Added wxPyInputStream dtor. Use PyLong_FromLongLong iff needed for wxFileOffset
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30639 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		@@ -79,7 +79,8 @@ public:
 | 
				
			|||||||
                return NULL;
 | 
					                return NULL;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    ~wxPyInputStream();
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    void close();
 | 
					    void close();
 | 
				
			||||||
    void flush();
 | 
					    void flush();
 | 
				
			||||||
    bool eof();
 | 
					    bool eof();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1184,7 +1184,8 @@ bool wxPyInputStream::eof() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxPyInputStream::~wxPyInputStream() {
 | 
					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;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxFileOffset wxPyCBInputStream::OnSysSeek(wxFileOffset off, wxSeekMode mode) {
 | 
					wxFileOffset wxPyCBInputStream::OnSysSeek(wxFileOffset off, wxSeekMode mode) {
 | 
				
			||||||
    bool blocked = wxPyBeginBlockThreads();
 | 
					    bool blocked = wxPyBeginBlockThreads();
 | 
				
			||||||
#if defined( __WINCE__) || defined(_LARGE_FILES) || wxHAS_HUGE_FILES
 | 
					    PyObject* arglist = PyTuple_New(2);
 | 
				
			||||||
    // wxFileOffset is a 64-bit value...
 | 
					
 | 
				
			||||||
    PyObject* arglist = Py_BuildValue("(Li)", off, mode);
 | 
					    if (sizeof(wxFileOffset) > sizeof(long))
 | 
				
			||||||
#else
 | 
					        // wxFileOffset is a 64-bit value...
 | 
				
			||||||
    PyObject* arglist = Py_BuildValue("(ii)", off, mode);
 | 
					        PyTuple_SET_ITEM(arglist, 0, PyLong_FromLongLong(off));
 | 
				
			||||||
#endif
 | 
					    else
 | 
				
			||||||
 | 
					        PyTuple_SET_ITEM(arglist, 0, PyInt_FromLong(off));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    PyTuple_SET_ITEM(arglist, 1, PyInt_FromLong(mode));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    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);
 | 
				
			||||||
@@ -1452,11 +1459,9 @@ wxFileOffset wxPyCBInputStream::OnSysTell() const {
 | 
				
			|||||||
    Py_DECREF(arglist);
 | 
					    Py_DECREF(arglist);
 | 
				
			||||||
    wxFileOffset o = 0;
 | 
					    wxFileOffset o = 0;
 | 
				
			||||||
    if (result != NULL) {
 | 
					    if (result != NULL) {
 | 
				
			||||||
#if defined( __WINCE__) || defined(_LARGE_FILES) || wxHAS_HUGE_FILES
 | 
					 | 
				
			||||||
        if (PyLong_Check(result))
 | 
					        if (PyLong_Check(result))
 | 
				
			||||||
            o = PyLong_AsLongLong(result);
 | 
					            o = PyLong_AsLongLong(result);
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
            o = PyInt_AsLong(result);
 | 
					            o = PyInt_AsLong(result);
 | 
				
			||||||
        Py_DECREF(result);
 | 
					        Py_DECREF(result);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user