mirror of
https://github.com/python/cpython.git
synced 2025-10-22 14:42:22 +00:00
- added (long) casts to a couple of Py_BuildValue calls,
just for the sake of it. note that this only covers the unlikely case that size_t is smaller than a long; it's probably more likely that there are platforms out there where size_t is *larger* than a long, and mmapmodule cannot really deal with that today.
This commit is contained in:
parent
e25cfd8662
commit
5cccf50931
1 changed files with 7 additions and 7 deletions
|
@ -260,10 +260,10 @@ mmap_size_method(mmap_object *self,
|
||||||
#ifdef MS_WIN32
|
#ifdef MS_WIN32
|
||||||
if (self->file_handle != (INT_PTR) -1) {
|
if (self->file_handle != (INT_PTR) -1) {
|
||||||
return (Py_BuildValue (
|
return (Py_BuildValue (
|
||||||
"l",
|
"l", (long)
|
||||||
GetFileSize ((HANDLE)self->file_handle, NULL)));
|
GetFileSize ((HANDLE)self->file_handle, NULL)));
|
||||||
} else {
|
} else {
|
||||||
return (Py_BuildValue ("l", self->size) );
|
return (Py_BuildValue ("l", (long) self->size) );
|
||||||
}
|
}
|
||||||
#endif /* MS_WIN32 */
|
#endif /* MS_WIN32 */
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ mmap_size_method(mmap_object *self,
|
||||||
PyErr_SetFromErrno(mmap_module_error);
|
PyErr_SetFromErrno(mmap_module_error);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return (Py_BuildValue ("l", buf.st_size) );
|
return (Py_BuildValue ("l", (long) buf.st_size) );
|
||||||
}
|
}
|
||||||
#endif /* UNIX */
|
#endif /* UNIX */
|
||||||
}
|
}
|
||||||
|
@ -371,7 +371,7 @@ mmap_tell_method(mmap_object *self, PyObject *args)
|
||||||
CHECK_VALID(NULL);
|
CHECK_VALID(NULL);
|
||||||
if (!PyArg_ParseTuple(args, ":tell"))
|
if (!PyArg_ParseTuple(args, ":tell"))
|
||||||
return NULL;
|
return NULL;
|
||||||
return (Py_BuildValue ("l", self->pos) );
|
return (Py_BuildValue ("l", (long) self->pos) );
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -388,8 +388,8 @@ mmap_flush_method(mmap_object *self, PyObject *args)
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
#ifdef MS_WIN32
|
#ifdef MS_WIN32
|
||||||
return (Py_BuildValue (
|
return (Py_BuildValue("l", (long)
|
||||||
"l", FlushViewOfFile (self->data+offset, size)));
|
FlushViewOfFile(self->data+offset, size)));
|
||||||
#endif /* MS_WIN32 */
|
#endif /* MS_WIN32 */
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
/* XXX semantics of return value? */
|
/* XXX semantics of return value? */
|
||||||
|
@ -400,7 +400,7 @@ mmap_flush_method(mmap_object *self, PyObject *args)
|
||||||
PyErr_SetFromErrno(mmap_module_error);
|
PyErr_SetFromErrno(mmap_module_error);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return Py_BuildValue ("l", 0);
|
return Py_BuildValue ("l", (long) 0);
|
||||||
#endif /* UNIX */
|
#endif /* UNIX */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue