Newer
Older
Import / projects / LGN-IP3870 / qtpyui / pythonqt / pythonqt.diff
diff -du src/PythonQt.cpp ../../PythonQt.cpp
--- src/PythonQt.cpp	2007-05-02 10:25:16.000000000 +0800
+++ ../../PythonQt.cpp	2007-12-20 02:12:17.000000000 +0800
@@ -217,7 +217,7 @@
     if (!info) {
       info = new PythonQtClassInfo(m);
       _knownQtClasses.insert(m->className(), info);
-      PyModule_AddObject(_pythonQtModule, m->className(), (PyObject*)createNewPythonQtMetaObjectWrapper(info));
+      PyModule_AddObject(_pythonQtModule, (char *)m->className(), (PyObject*)createNewPythonQtMetaObjectWrapper(info));
     }
     m = m->superClass();
   }
@@ -323,7 +323,7 @@
       if (!info) {
         info = new PythonQtClassInfo(wrapper?wrapper->metaObject():&QObject::staticQtMetaObject, name);
         _knownQtWrapperClasses.insert(name, info);
-        PyModule_AddObject(_pythonQtModule, name, (PyObject*)createNewPythonQtMetaObjectWrapper(info));
+        PyModule_AddObject(_pythonQtModule, (char *)(const char *) name, (PyObject*)createNewPythonQtMetaObjectWrapper(info));
       } else {
         if (wrapper && (info->metaObject() != wrapper->metaObject())) {
           info->setMetaObject(wrapper->metaObject());
@@ -922,7 +922,7 @@
   PythonQtClassInfo* info = new PythonQtClassInfo(wrapper->metaObject(), typeName);
   _knownVariantWrappers.insert(type, qMakePair(info, wrapper));
   addDecorators(wrapper, false, true);
-  PyModule_AddObject(_pythonQtModule, typeName, (PyObject*)createNewPythonQtMetaObjectWrapper(info));
+  PyModule_AddObject(_pythonQtModule, (char *)typeName, (PyObject*)createNewPythonQtMetaObjectWrapper(info));
 }
 
 PyObject* PythonQt::helpCalled(PythonQtClassInfo* info)
diff -du src/PythonQtConversion.cpp ../../PythonQtConversion.cpp
--- src/PythonQtConversion.cpp	2007-05-02 10:25:16.000000000 +0800
+++ ../../PythonQtConversion.cpp	2007-12-20 00:47:05.000000000 +0800
@@ -51,6 +51,15 @@
 PythonQtValueStorage<QVariant, 32> PythonQtConv::global_variantStorage;
 
 
+/*
+   Correction to python library headers that create many
+   warnings in C++ about type punned variables
+*/
+#undef Py_False
+#undef Py_True
+#define Py_False ((PyObject *)(void*)&_Py_ZeroStruct)
+#define Py_True  ((PyObject *)(void*)&_Py_TrueStruct)
+
 PyObject* PythonQtConv::GetPyBool(bool val)
 {
   PyObject* r = val?Py_True:Py_False;
@@ -562,7 +571,7 @@
     d = PyInt_AS_LONG(val);
   } else if (!strict) {
     if (val->ob_type == &PyFloat_Type) {
-      d = floor(PyFloat_AS_DOUBLE(val));
+      d = (int)floor(PyFloat_AS_DOUBLE(val));
     } else if (val->ob_type == &PyLong_Type) {
       // handle error on overflow!
       d = PyLong_AsLong(val);
@@ -588,7 +597,7 @@
     d = PyLong_AsLongLong(val);
   } else if (!strict) {
     if (val->ob_type == &PyFloat_Type) {
-      d = floor(PyFloat_AS_DOUBLE(val));
+      d = (qint64)floor(PyFloat_AS_DOUBLE(val));
     } else if (val == Py_False) {
       d = 0;
     } else if (val == Py_True) {
@@ -611,7 +620,7 @@
     d = PyLong_AsLongLong(val);
   } else if (!strict) {
     if (val->ob_type == &PyFloat_Type) {
-      d = floor(PyFloat_AS_DOUBLE(val));
+      d = (quint64)floor(PyFloat_AS_DOUBLE(val));
     } else if (val == Py_False) {
       d = 0;
     } else if (val == Py_True) {
diff -du src/PythonQtCppWrapperFactory.h ../../PythonQtCppWrapperFactory.h
--- src/PythonQtCppWrapperFactory.h	2006-11-23 14:27:36.000000000 +0800
+++ ../../PythonQtCppWrapperFactory.h	2007-12-13 04:00:30.000000000 +0800
@@ -58,4 +58,4 @@
 
 };
 
-#endif
\ No newline at end of file
+#endif
diff -du src/PythonQtImportFileInterface.h ../../PythonQtImportFileInterface.h
--- src/PythonQtImportFileInterface.h	2006-11-23 14:27:36.000000000 +0800
+++ ../../PythonQtImportFileInterface.h	2007-12-19 23:27:51.000000000 +0800
@@ -50,6 +50,8 @@
 class PythonQtImportFileInterface {
 
 public:
+  virtual ~PythonQtImportFileInterface() { }
+
   //! read the given file as byte array, without doing any linefeed translations
   virtual QByteArray readFileAsBytes(const QString& filename) = 0;
 
@@ -65,4 +67,4 @@
 
 };
 
-#endif
\ No newline at end of file
+#endif
diff -du src/PythonQtImporter.cpp ../../PythonQtImporter.cpp
--- src/PythonQtImporter.cpp	2007-04-18 16:31:42.000000000 +0800
+++ ../../PythonQtImporter.cpp	2007-12-19 23:47:07.000000000 +0800
@@ -112,7 +113,7 @@
 /* PythonQtImporter.__init__
   Just store the path argument
 */
-int PythonQtImporter_init(PythonQtImporter *self, PyObject *args, PyObject *kwds)
+int PythonQtImporter_init(PythonQtImporter *self, PyObject *args, PyObject *)
 {
   self->_path = NULL;
 
@@ -233,7 +234,7 @@
   Py_DECREF(code);
   if (Py_VerboseFlag)
     PySys_WriteStderr("import %s # loaded from %s\n",
-          fullname, modpath);
+          fullname, (const char *)modpath.toLatin1());
   return mod;
 error:
   Py_DECREF(code);
@@ -243,7 +244,7 @@
 
 
 PyObject *
-PythonQtImporter_get_data(PyObject *obj, PyObject *args)
+PythonQtImporter_get_data(PyObject *, PyObject *)
 {
   // EXTRA, NOT YET IMPLEMENTED
   return NULL;
@@ -263,7 +264,7 @@
 }
 
 PyObject *
-PythonQtImporter_get_source(PyObject *obj, PyObject *args)
+PythonQtImporter_get_source(PyObject * /*obj*/, PyObject * /*args*/)
 {
   // EXTRA, NOT YET IMPLEMENTED
 /*
@@ -353,7 +354,7 @@
    doc_get_code},
   {"get_source", PythonQtImporter_get_source, METH_VARARGS,
    doc_get_source},
-  {NULL,    NULL} /* sentinel */
+  {NULL,    NULL, 0, 0} /* sentinel */
 };
 
 
@@ -406,6 +407,7 @@
   PyType_GenericAlloc,      /* tp_alloc */
   PyType_GenericNew,      /* tp_new */
   PyObject_Del,     /* tp_free */
+  0,0,0,0,0,0,0
 };
 
 
@@ -579,7 +582,7 @@
 /* Return the code object for the module named by 'fullname' from the
    Zip archive as a new reference. */
 PyObject *
-PythonQtImport::getCodeFromData(const QString& path, int isbytecode,int ispackage, time_t mtime)
+PythonQtImport::getCodeFromData(const QString& path, int isbytecode,int /*ispackage*/, time_t mtime)
 {
   bool hasImporter = PythonQt::importInterface()!=NULL;
 
@@ -761,7 +764,7 @@
 
   Py_INCREF(&PythonQtImporter_Type);
   if (PyModule_AddObject(mod, "PythonQtImporter",
-             (PyObject *)&PythonQtImporter_Type) < 0)
+             (PyObject *)(void*)&PythonQtImporter_Type) < 0)
     return;
 
   // set our importer into the path_hooks to handle all path on sys.path
diff -du src/PythonQtMetaObjectWrapper.cpp ../../PythonQtMetaObjectWrapper.cpp
--- src/PythonQtMetaObjectWrapper.cpp	2007-04-18 11:12:12.000000000 +0800
+++ ../../PythonQtMetaObjectWrapper.cpp	2007-12-19 23:46:30.000000000 +0800
@@ -52,7 +52,7 @@
   self->ob_type->tp_free((PyObject*)self);
 }
 
-static PyObject* PythonQtMetaObjectWrapper_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+static PyObject* PythonQtMetaObjectWrapper_new(PyTypeObject *type, PyObject * /*args*/, PyObject * /*kwds*/)
 {
   PythonQtMetaObjectWrapper *self;
 
@@ -63,7 +63,7 @@
   return (PyObject *)self;
 }
 
-static int PythonQtMetaObjectWrapper_init(PythonQtMetaObjectWrapper *self, PyObject *args, PyObject *kwds)
+static int PythonQtMetaObjectWrapper_init(PythonQtMetaObjectWrapper */*self*/, PyObject */*args*/, PyObject */*kwds*/)
 {
   return 0;
 }
@@ -123,7 +123,7 @@
     {"help", (PyCFunction)PythonQtMetaObjectWrapper_help, METH_NOARGS,
     "Shows the help of available methods for this class"
     },
-    {NULL}  /* Sentinel */
+    {NULL, 0, 0, 0}  /* Sentinel */
 };
 
 
@@ -234,6 +234,7 @@
     (initproc)PythonQtMetaObjectWrapper_init,      /* tp_init */
     0,                         /* tp_alloc */
     PythonQtMetaObjectWrapper_new,                 /* tp_new */
+    0,0,0,0,0,0,0,0
 };
 
 //-------------------------------------------------------
diff -du src/PythonQtMetaObjectWrapper.h ../../PythonQtMetaObjectWrapper.h
--- src/PythonQtMetaObjectWrapper.h	2007-04-13 09:06:14.000000000 +0800
+++ ../../PythonQtMetaObjectWrapper.h	2007-12-19 23:27:04.000000000 +0800
@@ -70,7 +70,8 @@
 // an abstact class for handling construction of objects
 class PythonQtConstructorHandler {
 public:
+  virtual ~PythonQtConstructorHandler() { } 
   virtual QObject* create(const QMetaObject* meta, PyObject *args, PyObject *kw, QString& error) = 0;
 };
 
-#endif
\ No newline at end of file
+#endif
diff -du src/PythonQtObjectPtr.h ../../PythonQtObjectPtr.h
--- src/PythonQtObjectPtr.h	2007-05-02 10:25:16.000000000 +0800
+++ ../../PythonQtObjectPtr.h	2007-12-13 03:58:56.000000000 +0800
@@ -152,4 +152,4 @@
 // register it to the meta type system
 Q_DECLARE_METATYPE(PythonQtObjectPtr)
 
-#endif
\ No newline at end of file
+#endif
diff -du src/PythonQtSlot.cpp ../../PythonQtSlot.cpp
--- src/PythonQtSlot.cpp	2007-04-13 15:32:46.000000000 +0800
+++ ../../PythonQtSlot.cpp	2007-12-19 23:45:34.000000000 +0800
@@ -167,7 +167,7 @@
   }
 }
 
-PyObject *PythonQtSlotFunction_CallImpl(QObject* objectToCall, PythonQtSlotInfo* info, PyObject *args, PyObject *kw, bool isVariantCall, void* firstArg)
+PyObject *PythonQtSlotFunction_CallImpl(QObject* objectToCall, PythonQtSlotInfo* info, PyObject *args, PyObject * /*kw*/, bool isVariantCall, void* firstArg)
 {
   int argc = PyTuple_Size(args);
   
@@ -233,7 +233,7 @@
   op = pythonqtslot_free_list;
   if (op != NULL) {
     pythonqtslot_free_list = (PythonQtSlotFunctionObject *)(op->m_self);
-    PyObject_INIT(op, &PythonQtSlotFunction_Type);
+    op = PyObject_INIT(op, &PythonQtSlotFunction_Type);
   }
   else {
     op = PyObject_GC_New(PythonQtSlotFunctionObject, &PythonQtSlotFunction_Type);
@@ -282,14 +282,14 @@
 }
 
 static PyObject *
-meth_get__doc__(PythonQtSlotFunctionObject *m, void *closure)
+meth_get__doc__(PythonQtSlotFunctionObject * /*m*/, void * /*closure*/)
 {
   Py_INCREF(Py_None);
   return Py_None;
 }
 
 static PyObject *
-meth_get__name__(PythonQtSlotFunctionObject *m, void *closure)
+meth_get__name__(PythonQtSlotFunctionObject *m, void * /*closure*/)
 {
   return PyString_FromString(m->m_ml->metaMethod()->signature());
 }
@@ -312,7 +312,7 @@
 }
 
 static PyObject *
-meth_get__self__(PythonQtSlotFunctionObject *m, void *closure)
+meth_get__self__(PythonQtSlotFunctionObject *m, void * /*closure*/)
 {
   PyObject *self;
   if (PyEval_GetRestricted()) {
@@ -328,17 +328,17 @@
 }
 
 static PyGetSetDef meth_getsets [] = {
-  {"__doc__",  (getter)meth_get__doc__,  NULL, NULL},
-  {"__name__", (getter)meth_get__name__, NULL, NULL},
-  {"__self__", (getter)meth_get__self__, NULL, NULL},
-  {0}
+  {"__doc__",  (getter)meth_get__doc__,  NULL, NULL, 0},
+  {"__name__", (getter)meth_get__name__, NULL, NULL, 0},
+  {"__self__", (getter)meth_get__self__, NULL, NULL, 0},
+  {0, 0, 0, 0, 0}
 };
 
 #define OFF(x) offsetof(PythonQtSlotFunctionObject, x)
 
 static PyMemberDef meth_members[] = {
-  {"__module__",    T_OBJECT,     OFF(m_module), WRITE_RESTRICTED},
-  {NULL}
+  {"__module__",    T_OBJECT,     OFF(m_module), WRITE_RESTRICTED, 0},
+  {NULL, 0, 0, 0, 0}
 };
 
 static PyObject *
@@ -418,6 +418,8 @@
     meth_getsets,       /* tp_getset */
     0,          /* tp_base */
     0,          /* tp_dict */
+    0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0
 };
 
 /* Clear out the free list */
diff -du src/PythonQtStdOut.cpp ../../PythonQtStdOut.cpp
--- src/PythonQtStdOut.cpp	2006-11-23 14:27:36.000000000 +0800
+++ ../../PythonQtStdOut.cpp	2007-12-19 23:42:21.000000000 +0800
@@ -41,7 +41,7 @@
 
 #include "PythonQtStdOut.h"
 
-static PyObject *PythonQtStdOutRedirect_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+static PyObject *PythonQtStdOutRedirect_new(PyTypeObject *type, PyObject * /*args*/, PyObject * /*kwds*/)
 {
   PythonQtStdOutRedirect *self;
   self = (PythonQtStdOutRedirect *)type->tp_alloc(type, 0);
@@ -69,7 +69,7 @@
   {"write", (PyCFunction)PythonQtStdOutRedirect_write, METH_VARARGS,
     "redirect the writing to a callback"
   },
-  {NULL}  /* Sentinel */
+  {NULL, 0, 0, 0}  /* Sentinel */
 };
 
 PyTypeObject PythonQtStdOutRedirectType = {
@@ -112,4 +112,5 @@
     0,                         /* tp_init */
     0,                         /* tp_alloc */
     PythonQtStdOutRedirect_new,                 /* tp_new */
+    0,0,0,0,0,0,0,0
 };
diff -du src/PythonQtVariantWrapper.cpp ../../PythonQtVariantWrapper.cpp
--- src/PythonQtVariantWrapper.cpp	2007-04-18 11:12:12.000000000 +0800
+++ ../../PythonQtVariantWrapper.cpp	2007-12-19 23:40:46.000000000 +0800
@@ -58,7 +58,7 @@
   self->ob_type->tp_free((PyObject*)self);
 }
 
-static PyObject* PythonQtVariantWrapper_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+static PyObject* PythonQtVariantWrapper_new(PyTypeObject *type, PyObject * /*args*/, PyObject * /*kwds*/)
 {
   PythonQtVariantWrapper *self;
   
@@ -70,7 +70,7 @@
   return (PyObject *)self;
 }
 
-static int PythonQtVariantWrapper_init(PythonQtVariantWrapper *self, PyObject *args, PyObject *kwds)
+static int PythonQtVariantWrapper_init(PythonQtVariantWrapper * /*self*/, PyObject * /*args*/, PyObject * /*kwds*/)
 {
   return 0;
 }
@@ -93,7 +93,7 @@
     {"help", (PyCFunction)PythonQtVariantWrapper_help, METH_NOARGS,
     "Shows the help of available methods for this class"
     },
-    {NULL}  /* Sentinel */
+    {NULL, 0, 0, 0}  /* Sentinel */
 };
 
 
@@ -250,6 +250,7 @@
     (initproc)PythonQtVariantWrapper_init,      /* tp_init */
     0,                         /* tp_alloc */
     PythonQtVariantWrapper_new,                 /* tp_new */
+    0,0,0,0,0,0,0,0
 };
 
 //-------------------------------------------------------
diff -du src/PythonQtVariants.h ../../PythonQtVariants.h
--- src/PythonQtVariants.h	2007-04-12 14:24:24.000000000 +0800
+++ ../../PythonQtVariants.h	2007-12-18 01:19:34.000000000 +0800
@@ -46,7 +46,7 @@
 #include "structmember.h"
 
 
-#include "wrapper/PythonQtWrappedVariants.h"
+#include "PythonQtWrappedVariants.h"
 
 #endif
 
diff -du src/PythonQtWrapper.cpp ../../PythonQtWrapper.cpp
--- src/PythonQtWrapper.cpp	2007-04-18 11:12:12.000000000 +0800
+++ ../../PythonQtWrapper.cpp	2007-12-20 02:15:12.000000000 +0800
@@ -81,7 +81,7 @@
   self->ob_type->tp_free((PyObject*)self);
 }
 
-static PyObject* PythonQtWrapper_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+static PyObject* PythonQtWrapper_new(PyTypeObject *type, PyObject * /*args*/, PyObject * /*kwds*/)
 {
   PythonQtWrapper *self;
   
@@ -95,7 +95,7 @@
   return (PyObject *)self;
 }
 
-static int PythonQtWrapper_init(PythonQtWrapper *self, PyObject *args, PyObject *kwds)
+static int PythonQtWrapper_init(PythonQtWrapper * /*self*/, PyObject * /*args*/, PyObject * /*kwds*/)
 {
   return 0;
 }
@@ -118,7 +118,7 @@
     {"help", (PyCFunction)PythonQtWrapper_help, METH_NOARGS,
     "Shows the help of available methods for this class"
     },
-    {NULL}  /* Sentinel */
+    {NULL, 0, 0, 0}  /* Sentinel */
 };
 
 
@@ -154,6 +154,8 @@
   case PythonQtMemberInfo::EnumValue:
     return PyInt_FromLong(member._enumValue);
     break;
+  case PythonQtMemberInfo::Invalid:
+    break;
   }
   
   // look for the interal methods (className(), help())
@@ -250,12 +252,12 @@
   PythonQtWrapper* wt = (PythonQtWrapper*)obj;
   if (wt->_wrappedPtr) {
     if (wt->_obj) {
-      return PyString_FromFormat("%s (C++ Object 0x%x wrapped by %s 0x%x))", wt->_info->className(), wt->_wrappedPtr, wt->_obj->metaObject()->className(), wt->_obj);
+      return PyString_FromFormat("%s (C++ Object 0x%x wrapped by %s 0x%x))", wt->_info->className(), (unsigned)wt->_wrappedPtr, wt->_obj->metaObject()->className(), (unsigned)wt->_obj);
     } else {
-      return PyString_FromFormat("%s (C++ Object 0x%x unwrapped)", wt->_info->className(), wt->_wrappedPtr);
+      return PyString_FromFormat("%s (C++ Object 0x%x unwrapped)", wt->_info->className(), (unsigned)wt->_wrappedPtr);
     }
   } else {
-    return PyString_FromFormat("%s (QObject 0x%x)", wt->_info->className(), wt->_obj, wt->_wrappedPtr);
+    return PyString_FromFormat("%s (C++ Object 0x%x wrapped 0x%x))", wt->_info->className(), (unsigned)wt->_obj, (unsigned)wt->_wrappedPtr);
   }
 }
 
@@ -328,6 +330,7 @@
     0,      /* nb_true_divide */
     0,      /* nb_inplace_floor_divide */
     0,      /* nb_inplace_true_divide */
+    // 0   /* on Linux and MacOSX the number of fields is different */
 };
 
 PyTypeObject PythonQtWrapper_Type = {
@@ -370,6 +373,7 @@
     (initproc)PythonQtWrapper_init,      /* tp_init */
     0,                         /* tp_alloc */
     PythonQtWrapper_new,                 /* tp_new */
+    0,0,0,0,0,0,0,0
 };
 
 //-------------------------------------------------------
diff -du src/PythonQtWrapper.h ../../PythonQtWrapper.h
--- src/PythonQtWrapper.h	2007-04-23 09:14:20.000000000 +0800
+++ ../../PythonQtWrapper.h	2007-12-13 03:58:42.000000000 +0800
@@ -75,4 +75,4 @@
 } PythonQtWrapper;
 
 
-#endif
\ No newline at end of file
+#endif