[mapserver-commits] r11808 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Mon Jun 13 11:21:42 EDT 2011


Author: aboudreault
Date: 2011-06-13 08:21:42 -0700 (Mon, 13 Jun 2011)
New Revision: 11808

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapfile.c
   trunk/mapserver/mapogr.cpp
Log:
Fixed Using STYLEITEM AUTO, loadExpression fails when the label text contains a space or begins with a double quote (#3481)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2011-06-13 10:13:45 UTC (rev 11807)
+++ trunk/mapserver/HISTORY.TXT	2011-06-13 15:21:42 UTC (rev 11808)
@@ -15,6 +15,9 @@
 Current Version (SVN trunk, 6.1-dev, future 6.2): 
 ------------------------------------------------- 
 
+- Fixed Using STYLEITEM AUTO, loadExpression fails when the label text
+  contains a space or begins with a double quote (#3481)
+
 - Fix for the cluster processing if the shape bounds doesn't overlap 
   with the given extent (#3913)
 

Modified: trunk/mapserver/mapfile.c
===================================================================
--- trunk/mapserver/mapfile.c	2011-06-13 10:13:45 UTC (rev 11807)
+++ trunk/mapserver/mapfile.c	2011-06-13 15:21:42 UTC (rev 11808)
@@ -2118,10 +2118,7 @@
   } else {
     msResetErrorList(); /* failure above is not really an error since we'll consider anything not matching (like an unquoted number) as a STRING) */
     exp->type = MS_STRING;
-    if((strlen(value) - strlen(msyystring_buffer)) == 2)
-      exp->string = msStrdup(msyystring_buffer); /* value was quoted */
-    else
-      exp->string = msStrdup(value); /* use the whole value */
+    exp->string = msStrdup(msyystring_buffer);
   }
 
   return(0); 

Modified: trunk/mapserver/mapogr.cpp
===================================================================
--- trunk/mapserver/mapogr.cpp	2011-06-13 10:13:45 UTC (rev 11807)
+++ trunk/mapserver/mapogr.cpp	2011-06-13 15:21:42 UTC (rev 11808)
@@ -2913,11 +2913,10 @@
           const char *labelTextString = OGR_ST_GetParamStr(hLabelStyle, 
                                                            OGRSTLabelTextString, 
                                                            &bIsNull);
-          if (labelTextString && isalnum(labelTextString[0]))
-              msLoadExpressionString(&(c->text), (char*)labelTextString);
-          else
-              msLoadExpressionString(&(c->text), 
-                              (char*)CPLSPrintf("\"%s\"", (char*)labelTextString));
+          char *escapedTextString = msStringEscape((char*)labelTextString);
+          msLoadExpressionString(&(c->text),
+                                 (char*)CPLSPrintf("\"%s\"", escapedTextString));
+          free(escapedTextString);
 
           c->label.angle = OGR_ST_GetParamDbl(hLabelStyle, 
                                               OGRSTLabelAngle, &bIsNull);
@@ -3042,11 +3041,10 @@
           /* See bug 3481 about the isalnum hack */
           const char *labelTextString = poLabelStyle->TextString(bIsNull);
 
-          if (labelTextString && isalnum(labelTextString[0]))
-              msLoadExpressionString(&(c->text), (char*)labelTextString);
-          else
-              msLoadExpressionString(&(c->text), 
-                              (char*)CPLSPrintf("\"%s\"", (char*)labelTextString));
+          char *escapedTextString = msStringEscape((char*)labelTextString);
+          msLoadExpressionString(&(c->text),
+                                 (char*)CPLSPrintf("\"%s\"", escapedTextString));
+          free(escapedTextString);
 
           c->label.angle = poLabelStyle->Angle(bIsNull);
 



More information about the mapserver-commits mailing list