[mapserver-commits] r8981 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Thu Apr 30 09:54:12 EDT 2009


Author: sdlime
Date: 2009-04-30 09:54:11 -0400 (Thu, 30 Apr 2009)
New Revision: 8981

Modified:
   trunk/mapserver/maptemplate.c
Log:
Cleaned up a few snprintf calls to use sizeof() instead of hard coding a static array's size.

Modified: trunk/mapserver/maptemplate.c
===================================================================
--- trunk/mapserver/maptemplate.c	2009-04-30 04:10:42 UTC (rev 8980)
+++ trunk/mapserver/maptemplate.c	2009-04-30 13:54:11 UTC (rev 8981)
@@ -1380,17 +1380,17 @@
     tagValue = strdup(format);
 
     if(precision != -1)
-      snprintf(numberFormat, 16, "%%.%dlf", precision);
+      snprintf(numberFormat, sizeof(numberFormat), "%%.%dlf", precision);
     else
-      snprintf(numberFormat, 16, "%%f");
+      snprintf(numberFormat, sizeof(numberFormat), "%%f");
 
-    snprintf(number, 64, numberFormat, tempExtent.minx);
+    snprintf(number, sizeof(number), numberFormat, tempExtent.minx);
     tagValue = msReplaceSubstring(tagValue, "$minx", number);
-    snprintf(number, 64, numberFormat, tempExtent.miny);
+    snprintf(number, sizeof(number), numberFormat, tempExtent.miny);
     tagValue = msReplaceSubstring(tagValue, "$miny", number);
-    snprintf(number, 64, numberFormat, tempExtent.maxx);
+    snprintf(number, sizeof(number), numberFormat, tempExtent.maxx);
     tagValue = msReplaceSubstring(tagValue, "$maxx", number);
-    snprintf(number, 64, numberFormat, tempExtent.maxy);
+    snprintf(number, sizeof(number), numberFormat, tempExtent.maxy);
     tagValue = msReplaceSubstring(tagValue, "$maxy", number);
 
      /* find the end of the tag */



More information about the mapserver-commits mailing list