[Scipy-svn] r4048 - trunk/scipy/sparse/sparsetools

scipy-svn at scipy.org scipy-svn at scipy.org
Thu Mar 20 14:57:05 EDT 2008


Author: wnbell
Date: 2008-03-20 13:56:44 -0500 (Thu, 20 Mar 2008)
New Revision: 4048

Modified:
   trunk/scipy/sparse/sparsetools/bsr_wrap.cxx
   trunk/scipy/sparse/sparsetools/coo_wrap.cxx
   trunk/scipy/sparse/sparsetools/csc_wrap.cxx
   trunk/scipy/sparse/sparsetools/csr_wrap.cxx
   trunk/scipy/sparse/sparsetools/dia_wrap.cxx
   trunk/scipy/sparse/sparsetools/numpy.i
Log:
use const char * for string literals to keep GCC-4.2 happy


Modified: trunk/scipy/sparse/sparsetools/bsr_wrap.cxx
===================================================================
--- trunk/scipy/sparse/sparsetools/bsr_wrap.cxx	2008-03-20 17:44:00 UTC (rev 4047)
+++ trunk/scipy/sparse/sparsetools/bsr_wrap.cxx	2008-03-20 18:56:44 UTC (rev 4048)
@@ -2653,7 +2653,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"    ;
@@ -2672,8 +2672,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",
@@ -2704,16 +2704,16 @@
     ary = (PyArrayObject*) input;
   }
   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);
     ary = NULL;
   }
   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);

Modified: trunk/scipy/sparse/sparsetools/coo_wrap.cxx
===================================================================
--- trunk/scipy/sparse/sparsetools/coo_wrap.cxx	2008-03-20 17:44:00 UTC (rev 4047)
+++ trunk/scipy/sparse/sparsetools/coo_wrap.cxx	2008-03-20 18:56:44 UTC (rev 4048)
@@ -2653,7 +2653,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"    ;
@@ -2672,8 +2672,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",
@@ -2704,16 +2704,16 @@
     ary = (PyArrayObject*) input;
   }
   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);
     ary = NULL;
   }
   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);

Modified: trunk/scipy/sparse/sparsetools/csc_wrap.cxx
===================================================================
--- trunk/scipy/sparse/sparsetools/csc_wrap.cxx	2008-03-20 17:44:00 UTC (rev 4047)
+++ trunk/scipy/sparse/sparsetools/csc_wrap.cxx	2008-03-20 18:56:44 UTC (rev 4048)
@@ -2653,7 +2653,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"    ;
@@ -2672,8 +2672,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",
@@ -2704,16 +2704,16 @@
     ary = (PyArrayObject*) input;
   }
   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);
     ary = NULL;
   }
   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);

Modified: trunk/scipy/sparse/sparsetools/csr_wrap.cxx
===================================================================
--- trunk/scipy/sparse/sparsetools/csr_wrap.cxx	2008-03-20 17:44:00 UTC (rev 4047)
+++ trunk/scipy/sparse/sparsetools/csr_wrap.cxx	2008-03-20 18:56:44 UTC (rev 4048)
@@ -2667,7 +2667,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"    ;
@@ -2686,8 +2686,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",
@@ -2718,16 +2718,16 @@
     ary = (PyArrayObject*) input;
   }
   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);
     ary = NULL;
   }
   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);

Modified: trunk/scipy/sparse/sparsetools/dia_wrap.cxx
===================================================================
--- trunk/scipy/sparse/sparsetools/dia_wrap.cxx	2008-03-20 17:44:00 UTC (rev 4047)
+++ trunk/scipy/sparse/sparsetools/dia_wrap.cxx	2008-03-20 18:56:44 UTC (rev 4048)
@@ -2653,7 +2653,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"    ;
@@ -2672,8 +2672,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",
@@ -2704,16 +2704,16 @@
     ary = (PyArrayObject*) input;
   }
   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);
     ary = NULL;
   }
   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);

Modified: trunk/scipy/sparse/sparsetools/numpy.i
===================================================================
--- trunk/scipy/sparse/sparsetools/numpy.i	2008-03-20 17:44:00 UTC (rev 4047)
+++ trunk/scipy/sparse/sparsetools/numpy.i	2008-03-20 18:56:44 UTC (rev 4048)
@@ -59,7 +59,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"    ;
@@ -78,8 +78,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",
@@ -110,16 +110,16 @@
     ary = (PyArrayObject*) input;
   }
   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);
     ary = NULL;
   }
   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 Scipy-svn mailing list