[mapserver-commits] r10290 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Tue Jul 6 11:08:44 EDT 2010


Author: aboudreault
Date: 2010-07-06 15:08:44 +0000 (Tue, 06 Jul 2010)
New Revision: 10290

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

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2010-07-06 14:55:45 UTC (rev 10289)
+++ trunk/mapserver/HISTORY.TXT	2010-07-06 15:08:44 UTC (rev 10290)
@@ -14,6 +14,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Fixed Using STYLEITEM AUTO, loadExpression fails when the label text contains a double quote (#3481)
+
 - PHP/MapScript: Expose getGeomTransform/setGeomTransform instead of exposing the private vars for rfc48 (#2825) 
 
 - PHP/MapScript: Fixed updateFromString functions to resolve symbol names (#3273)

Modified: trunk/mapserver/mapogr.cpp
===================================================================
--- trunk/mapserver/mapogr.cpp	2010-07-06 14:55:45 UTC (rev 10289)
+++ trunk/mapserver/mapogr.cpp	2010-07-06 15:08:44 UTC (rev 10290)
@@ -2853,11 +2853,15 @@
 
               // Enclose the text string inside quotes to make sure it is seen
               // as a string by the parser inside loadExpression(). (bug185)
-              msLoadExpressionString(&(c->text), 
-                         (char*)CPLSPrintf("\"%s\"", 
-                                           OGR_ST_GetParamStr(hLabelStyle, 
-                                                              OGRSTLabelTextString, 
-                                                              &bIsNull)));
+              /* See bug 3481 about the isalpha hack */
+              const char *labelTextString = OGR_ST_GetParamStr(hLabelStyle, 
+                                                               OGRSTLabelTextString, 
+                                                               &bIsNull);
+              if (labelTextString && isalpha(labelTextString[0]))
+                  msLoadExpressionString(&(c->text), (char*)labelTextString);
+              else
+                  msLoadExpressionString(&(c->text), 
+                                  (char*)CPLSPrintf("\"%s\"", (char*)labelTextString));
 
               c->label.angle = OGR_ST_GetParamDbl(hLabelStyle, 
                                                   OGRSTLabelAngle, &bIsNull);
@@ -2988,10 +2992,15 @@
 
               // Enclose the text string inside quotes to make sure it is seen
               // as a string by the parser inside loadExpression(). (bug185)
-              msLoadExpressionString(&(c->text), 
-                         (char*)CPLSPrintf("\"%s\"", 
-                                           poLabelStyle->TextString(bIsNull)));
+              /* See bug 3481 about the isalpha hack */
+              const char *labelTextString = poLabelStyle->TextString(bIsNull);
 
+              if (labelTextString && isalpha(labelTextString[0]))
+                  msLoadExpressionString(&(c->text), (char*)labelTextString);
+              else
+                  msLoadExpressionString(&(c->text), 
+                                  (char*)CPLSPrintf("\"%s\"", (char*)labelTextString));
+
               c->label.angle = poLabelStyle->Angle(bIsNull);
 
               c->label.size = (int)poLabelStyle->Size(bIsNull);



More information about the mapserver-commits mailing list