diff options
| author | Trent Mick <trentm@activestate.com> | 2000-08-12 20:58:11 +0000 |
|---|---|---|
| committer | Trent Mick <trentm@activestate.com> | 2000-08-12 20:58:11 +0000 |
| commit | fd4c46bf20eb785814ca99a269d94d165330cbcf (patch) | |
| tree | a66a0470d34b242787da00d3b0ec64b900de319b /Modules/arraymodule.c | |
| parent | 7fb489f4a6c742ef514f9e1240f2ae492a0e7062 (diff) | |
| download | cpython-fd4c46bf20eb785814ca99a269d94d165330cbcf.tar.gz | |
Use safer comparisons (only matters when sizeof(int) != sizeof(size_t)). fread
and fwrite return size_t, so it is safer to cast up to the largest type for the
comparison. I believe the cast is required at all to remove compiler warnings.
Diffstat (limited to 'Modules/arraymodule.c')
| -rw-r--r-- | Modules/arraymodule.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index ec1b08d405..6648c9c0b3 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -1039,8 +1039,8 @@ array_tofile(arrayobject *self, PyObject *args) return NULL; } if (self->ob_size > 0) { - if ((int)fwrite(self->ob_item, self->ob_descr->itemsize, - self->ob_size, fp) != self->ob_size) { + if (fwrite(self->ob_item, self->ob_descr->itemsize, + self->ob_size, fp) != (size_t)self->ob_size) { PyErr_SetFromErrno(PyExc_IOError); clearerr(fp); return NULL; |
