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:
@@ -1165,7 +1165,12 @@ size_t wxPyCBInputStream::OnSysWrite(const void *buffer, size_t bufsize) {
|
|||||||
|
|
||||||
off_t wxPyCBInputStream::OnSysSeek(off_t off, wxSeekMode mode) {
|
off_t wxPyCBInputStream::OnSysSeek(off_t off, wxSeekMode mode) {
|
||||||
wxPyBeginBlockThreads();
|
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);
|
PyObject* arglist = Py_BuildValue("(ii)", off, mode);
|
||||||
|
#endif
|
||||||
PyObject* result = PyEval_CallObject(m_seek, arglist);
|
PyObject* result = PyEval_CallObject(m_seek, arglist);
|
||||||
Py_DECREF(arglist);
|
Py_DECREF(arglist);
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
@@ -1173,6 +1178,7 @@ off_t wxPyCBInputStream::OnSysSeek(off_t off, wxSeekMode mode) {
|
|||||||
return OnSysTell();
|
return OnSysTell();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
off_t wxPyCBInputStream::OnSysTell() const {
|
off_t wxPyCBInputStream::OnSysTell() const {
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
PyObject* arglist = Py_BuildValue("()");
|
PyObject* arglist = Py_BuildValue("()");
|
||||||
@@ -1180,7 +1186,13 @@ off_t wxPyCBInputStream::OnSysTell() const {
|
|||||||
Py_DECREF(arglist);
|
Py_DECREF(arglist);
|
||||||
off_t o = 0;
|
off_t o = 0;
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
|
#ifdef _LARGE_FILES
|
||||||
|
if (PyLong_Check(result))
|
||||||
|
o = PyLong_AsLongLong(result);
|
||||||
|
else
|
||||||
|
#else
|
||||||
o = PyInt_AsLong(result);
|
o = PyInt_AsLong(result);
|
||||||
|
#endif
|
||||||
Py_DECREF(result);
|
Py_DECREF(result);
|
||||||
};
|
};
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
|
Reference in New Issue
Block a user