[Numpy-svn] r6290 - branches/fix_float_format/numpy/core/src

numpy-svn@scip... numpy-svn@scip...
Thu Jan 1 03:29:50 CST 2009


Author: cdavid
Date: 2009-01-01 03:28:16 -0600 (Thu, 01 Jan 2009)
New Revision: 6290

Modified:
   branches/fix_float_format/numpy/core/src/npy_format.c
Log:
Do not use strncpy but strcpy: we know the string sizes, and strncpy sucks anyway.

Modified: branches/fix_float_format/numpy/core/src/npy_format.c
===================================================================
--- branches/fix_float_format/numpy/core/src/npy_format.c	2009-01-01 09:26:43 UTC (rev 6289)
+++ branches/fix_float_format/numpy/core/src/npy_format.c	2009-01-01 09:28:16 UTC (rev 6290)
@@ -260,20 +260,20 @@
             if (buf_size < 4) {                                         \
                 return NULL;                                            \
             }                                                           \
-            strncpy(buffer, "nan", 4);                                  \
+            strcpy(buffer, "nan");                                      \
 	}                                                               \
         else {                                                          \
             if (signbit(val)) {                                         \
                 if (buf_size < 5) {                                     \
                     return NULL;                                        \
                 }                                                       \
-                strncpy(buffer, "-inf", 5);                             \
+                strcpy(buffer, "-inf");                                 \
             }                                                           \
             else {                                                      \
                 if (buf_size < 4) {                                     \
                     return NULL;                                        \
                 }                                                       \
-                strncpy(buffer, "inf", 4);                              \
+                strcpy(buffer, "inf");                                  \
             }                                                           \
 	}                                                               \
 	return buffer;                                                  \



More information about the Numpy-svn mailing list