From 57ffafaae1970a5666818d4a29c755abff13ddaf Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 30 May 2003 00:24:00 +0000 Subject: [PATCH] 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 --- wxPython/src/helpers.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wxPython/src/helpers.cpp b/wxPython/src/helpers.cpp index 13186d98fe..3cf9d3e290 100644 --- a/wxPython/src/helpers.cpp +++ b/wxPython/src/helpers.cpp @@ -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();