Kaydet (Commit) a2a6477b authored tarafından Victor Stinner's avatar Victor Stinner

Fix io.FileIO.readall() on Windows 64 bits

Use Py_off_t type (64 bits) instead of off_t (32 bits).
üst 2c5d3cbf
...@@ -552,12 +552,12 @@ fileio_readinto(fileio *self, PyObject *args) ...@@ -552,12 +552,12 @@ fileio_readinto(fileio *self, PyObject *args)
static size_t static size_t
new_buffersize(fileio *self, size_t currentsize new_buffersize(fileio *self, size_t currentsize
#ifdef HAVE_FSTAT #ifdef HAVE_FSTAT
, off_t pos, off_t end , Py_off_t pos, Py_off_t end
#endif #endif
) )
{ {
#ifdef HAVE_FSTAT #ifdef HAVE_FSTAT
if (end != (off_t)-1) { if (end != (Py_off_t)-1) {
/* Files claiming a size smaller than SMALLCHUNK may /* Files claiming a size smaller than SMALLCHUNK may
actually be streaming pseudo-files. In this case, we actually be streaming pseudo-files. In this case, we
apply the more aggressive algorithm below. apply the more aggressive algorithm below.
...@@ -584,7 +584,7 @@ fileio_readall(fileio *self) ...@@ -584,7 +584,7 @@ fileio_readall(fileio *self)
{ {
#ifdef HAVE_FSTAT #ifdef HAVE_FSTAT
struct stat st; struct stat st;
off_t pos, end; Py_off_t pos, end;
#endif #endif
PyObject *result; PyObject *result;
Py_ssize_t total = 0; Py_ssize_t total = 0;
...@@ -609,7 +609,7 @@ fileio_readall(fileio *self) ...@@ -609,7 +609,7 @@ fileio_readall(fileio *self)
if (fstat(self->fd, &st) == 0) if (fstat(self->fd, &st) == 0)
end = st.st_size; end = st.st_size;
else else
end = (off_t)-1; end = (Py_off_t)-1;
#endif #endif
while (1) { while (1) {
#ifdef HAVE_FSTAT #ifdef HAVE_FSTAT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment