qfile_t._from_fp was broken

This commit is contained in:
elias.bachaalany 2010-02-15 11:58:44 +00:00
parent 06e8cad773
commit 8b7625f145

View File

@ -21,7 +21,7 @@ private:
return false; return false;
own = false; own = false;
fn.sprnt("<FILE * %p>", fp); fn.sprnt("<FILE * %p>", fp);
fp = fp; this->fp = fp;
return true; return true;
} }
inline void _from_cobject(PyObject *pycobject) inline void _from_cobject(PyObject *pycobject)
@ -198,9 +198,9 @@ public:
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
int write(PyObject *py_buf) int write(PyObject *py_buf)
{ {
size_t sz = PyString_GET_SIZE(py_buf); if (!PyString_Check(py_buf))
void *buf = (void *)PyString_AS_STRING(py_buf); return 0;
return qfwrite(fp, buf, sz); return qfwrite(fp, (void *)PyString_AS_STRING(py_buf), PyString_GET_SIZE(py_buf));
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------