]> git.saurik.com Git - wxWidgets.git/commitdiff
Added wxPyInputStream dtor. Use PyLong_FromLongLong iff needed for wxFileOffset
authorRobin Dunn <robin@alldunn.com>
Fri, 19 Nov 2004 19:28:46 +0000 (19:28 +0000)
committerRobin Dunn <robin@alldunn.com>
Fri, 19 Nov 2004 19:28:46 +0000 (19:28 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30639 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/src/_streams.i
wxPython/src/helpers.cpp

index ed762b075e25fde0dce30f7d065cf690f937e289..225a0b901f6b335857fbc1a6e7733de333ab7b52 100644 (file)
@@ -79,7 +79,8 @@ public:
                 return NULL;
         }
     }
-
+    ~wxPyInputStream();
+    
     void close();
     void flush();
     bool eof();
index c10641926d0f3e387292d30975a5bacac2059c23..694c5f478010dd2689e994ecf95855b638bd1f5a 100644 (file)
@@ -1184,7 +1184,8 @@ bool wxPyInputStream::eof() {
 }
 
 wxPyInputStream::~wxPyInputStream() {
-    /* do nothing */
+    if (m_wxis)
+        delete m_wxis;
 }
 
 
@@ -1429,14 +1430,20 @@ size_t wxPyCBInputStream::OnSysWrite(const void *buffer, size_t bufsize) {
     return 0;
 }
 
+
 wxFileOffset wxPyCBInputStream::OnSysSeek(wxFileOffset off, wxSeekMode mode) {
     bool blocked = wxPyBeginBlockThreads();
-#if defined( __WINCE__) || defined(_LARGE_FILES) || wxHAS_HUGE_FILES
-    // wxFileOffset is a 64-bit value...
-    PyObject* arglist = Py_BuildValue("(Li)", off, mode);
-#else
-    PyObject* arglist = Py_BuildValue("(ii)", off, mode);
-#endif
+    PyObject* arglist = PyTuple_New(2);
+
+    if (sizeof(wxFileOffset) > sizeof(long))
+        // wxFileOffset is a 64-bit value...
+        PyTuple_SET_ITEM(arglist, 0, PyLong_FromLongLong(off));
+    else
+        PyTuple_SET_ITEM(arglist, 0, PyInt_FromLong(off));
+
+    PyTuple_SET_ITEM(arglist, 1, PyInt_FromLong(mode));
+
+    
     PyObject* result = PyEval_CallObject(m_seek, arglist);
     Py_DECREF(arglist);
     Py_XDECREF(result);
@@ -1452,11 +1459,9 @@ wxFileOffset wxPyCBInputStream::OnSysTell() const {
     Py_DECREF(arglist);
     wxFileOffset o = 0;
     if (result != NULL) {
-#if defined( __WINCE__) || defined(_LARGE_FILES) || wxHAS_HUGE_FILES
         if (PyLong_Check(result))
             o = PyLong_AsLongLong(result);
         else
-#endif
             o = PyInt_AsLong(result);
         Py_DECREF(result);
     };