[Numpy-svn] r6521 - trunk/doc/swig

numpy-svn@scip... numpy-svn@scip...
Mon Mar 2 07:35:17 CST 2009


Author: cdavid
Date: 2009-03-02 07:35:13 -0600 (Mon, 02 Mar 2009)
New Revision: 6521

Modified:
   trunk/doc/swig/numpy.i
Log:
Update numpy.i to fix const char* return warnings issues with later versions of g++ (from Matthieu Brucher).

Modified: trunk/doc/swig/numpy.i
===================================================================
--- trunk/doc/swig/numpy.i	2009-03-01 17:07:06 UTC (rev 6520)
+++ trunk/doc/swig/numpy.i	2009-03-02 13:35:13 UTC (rev 6521)
@@ -97,7 +97,7 @@
 {
   /* Given a PyObject, return a string describing its type.
    */
-  char* pytype_string(PyObject* py_obj) {
+  const char* pytype_string(PyObject* py_obj) {
     if (py_obj == NULL          ) return "C NULL value";
     if (py_obj == Py_None       ) return "Python None" ;
     if (PyCallable_Check(py_obj)) return "callable"    ;
@@ -116,8 +116,8 @@
 
   /* Given a NumPy typecode, return a string describing the type.
    */
-  char* typecode_string(int typecode) {
-    static char* type_names[25] = {"bool", "byte", "unsigned byte",
+  const char* typecode_string(int typecode) {
+    static const char* type_names[25] = {"bool", "byte", "unsigned byte",
                                    "short", "unsigned short", "int",
                                    "unsigned int", "long", "unsigned long",
                                    "long long", "unsigned long long",
@@ -159,8 +159,8 @@
     }
     else if is_array(input)
     {
-      char* desired_type = typecode_string(typecode);
-      char* actual_type  = typecode_string(array_type(input));
+      const char* desired_type = typecode_string(typecode);
+      const char* actual_type  = typecode_string(array_type(input));
       PyErr_Format(PyExc_TypeError,
                    "Array of type '%s' required.  Array of type '%s' given",
                    desired_type, actual_type);
@@ -168,8 +168,8 @@
     }
     else
     {
-      char * desired_type = typecode_string(typecode);
-      char * actual_type  = pytype_string(input);
+      const char * desired_type = typecode_string(typecode);
+      const char * actual_type  = pytype_string(input);
       PyErr_Format(PyExc_TypeError,
                    "Array of type '%s' required.  A '%s' was given",
                    desired_type, actual_type);



More information about the Numpy-svn mailing list