Use Python Longs when off_t can be 64-bit

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20765 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-05-30 00:24:00 +00:00
parent 3fd659e9e4
commit 57ffafaae1

View File

@@ -1165,7 +1165,12 @@ size_t wxPyCBInputStream::OnSysWrite(const void *buffer, size_t bufsize) {
off_t wxPyCBInputStream::OnSysSeek(off_t off, wxSeekMode mode) {
wxPyBeginBlockThreads();
#ifdef _LARGE_FILES
// off_t is a 64-bit value...
PyObject* arglist = Py_BuildValue("(Li)", off, mode);
#else
PyObject* arglist = Py_BuildValue("(ii)", off, mode);
#endif
PyObject* result = PyEval_CallObject(m_seek, arglist);
Py_DECREF(arglist);
Py_XDECREF(result);
@@ -1173,6 +1178,7 @@ off_t wxPyCBInputStream::OnSysSeek(off_t off, wxSeekMode mode) {
return OnSysTell();
}
off_t wxPyCBInputStream::OnSysTell() const {
wxPyBeginBlockThreads();
PyObject* arglist = Py_BuildValue("()");
@@ -1180,7 +1186,13 @@ off_t wxPyCBInputStream::OnSysTell() const {
Py_DECREF(arglist);
off_t o = 0;
if (result != NULL) {
#ifdef _LARGE_FILES
if (PyLong_Check(result))
o = PyLong_AsLongLong(result);
else
#else
o = PyInt_AsLong(result);
#endif
Py_DECREF(result);
};
wxPyEndBlockThreads();