[Numpy-svn] r6372 - trunk/numpy/core/src

numpy-svn@scip... numpy-svn@scip...
Tue Feb 17 23:07:08 CST 2009


Author: cdavid
Date: 2009-02-17 23:06:57 -0600 (Tue, 17 Feb 2009)
New Revision: 6372

Modified:
   trunk/numpy/core/src/numpyos.c
Log:
Fix some const issues in NumPyOs_ascii_strtod.

Modified: trunk/numpy/core/src/numpyos.c
===================================================================
--- trunk/numpy/core/src/numpyos.c	2009-02-17 21:19:10 UTC (rev 6371)
+++ trunk/numpy/core/src/numpyos.c	2009-02-18 05:06:57 UTC (rev 6372)
@@ -416,7 +416,8 @@
     size_t decimal_point_len = strlen(decimal_point);
 
     char buffer[FLOAT_FORMATBUFLEN+1];
-    char *p;
+    const char *p;
+    char *q;
     size_t n;
     double result;
 
@@ -444,14 +445,14 @@
             while (NumPyOS_ascii_isalnum(*p) || *p == '_') ++p;
             if (*p == ')') ++p;
         }
-        if (endptr != NULL) *endptr = p;
+        if (endptr != NULL) *endptr = (char*)p;
         return NumPyOS_NAN;
     }
     else if (NumPyOS_ascii_strncasecmp(p, "inf", 3) == 0) {
         p += 3;
         if (NumPyOS_ascii_strncasecmp(p, "inity", 5) == 0)
             p += 5;
-        if (endptr != NULL) *endptr = p;
+        if (endptr != NULL) *endptr = (char*)p;
         return result*NumPyOS_PINF;
     }
     /* End of ##1 */
@@ -464,7 +465,7 @@
      * where <DP> is the decimal point under the foreign locale.
      */
     if (decimal_point[0] != '.' || decimal_point[1] != 0) {
-        p = (char *)s;
+        p = s;
         if (*p == '+' || *p == '-')
             ++p;
         while (*p >= '0' && *p <= '9')
@@ -475,9 +476,9 @@
                 n = FLOAT_FORMATBUFLEN;
             memcpy(buffer, s, n);
             buffer[n] = '\0';
-            result = PyOS_ascii_strtod(buffer, &p);
+            result = PyOS_ascii_strtod(buffer, &q);
             if (endptr != NULL) {
-                *endptr = s + (p - buffer);
+                *endptr = (char*)(s + (q - buffer));
             }
             return result;
         }



More information about the Numpy-svn mailing list