mirror of
https://github.com/python/cpython.git
synced 2025-11-11 22:55:08 +00:00
bug [ 1274069 ] bz2module.c compiler warning
This commit is contained in:
parent
99363b6a19
commit
a8bcecc872
1 changed files with 12 additions and 5 deletions
|
|
@ -110,8 +110,8 @@ typedef struct {
|
||||||
|
|
||||||
BZFILE *fp;
|
BZFILE *fp;
|
||||||
int mode;
|
int mode;
|
||||||
long pos;
|
Py_off_t pos;
|
||||||
long size;
|
Py_off_t size;
|
||||||
#ifdef WITH_THREAD
|
#ifdef WITH_THREAD
|
||||||
PyThread_type_lock lock;
|
PyThread_type_lock lock;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -982,7 +982,7 @@ BZ2File_seek(BZ2FileObject *self, PyObject *args)
|
||||||
char *buffer = small_buffer;
|
char *buffer = small_buffer;
|
||||||
size_t buffersize = SMALLCHUNK;
|
size_t buffersize = SMALLCHUNK;
|
||||||
int bytesread = 0;
|
int bytesread = 0;
|
||||||
int readsize;
|
size_t readsize;
|
||||||
int chunksize;
|
int chunksize;
|
||||||
int bzerror;
|
int bzerror;
|
||||||
int rewind = 0;
|
int rewind = 0;
|
||||||
|
|
@ -1089,10 +1089,13 @@ BZ2File_seek(BZ2FileObject *self, PyObject *args)
|
||||||
/* Before getting here, offset must be set to the number of bytes
|
/* Before getting here, offset must be set to the number of bytes
|
||||||
* to walk forward. */
|
* to walk forward. */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if ((size_t)offset-bytesread > buffersize)
|
if (offset-bytesread > buffersize)
|
||||||
readsize = buffersize;
|
readsize = buffersize;
|
||||||
else
|
else
|
||||||
readsize = offset-bytesread;
|
/* offset might be wider that readsize, but the result
|
||||||
|
* of the subtraction is bound by buffersize (see the
|
||||||
|
* condition above). buffersize is 8192. */
|
||||||
|
readsize = (size_t)(offset-bytesread);
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
chunksize = Util_UnivNewlineRead(&bzerror, self->fp,
|
chunksize = Util_UnivNewlineRead(&bzerror, self->fp,
|
||||||
buffer, readsize, self);
|
buffer, readsize, self);
|
||||||
|
|
@ -1137,7 +1140,11 @@ BZ2File_tell(BZ2FileObject *self, PyObject *args)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(HAVE_LARGEFILE_SUPPORT)
|
||||||
ret = PyInt_FromLong(self->pos);
|
ret = PyInt_FromLong(self->pos);
|
||||||
|
#else
|
||||||
|
ret = PyLong_FromLongLong(self->pos);
|
||||||
|
#endif
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue