[mapserver-commits] r11249 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Fri Mar 18 13:23:42 EDT 2011


Author: aboudreault
Date: 2011-03-18 10:23:42 -0700 (Fri, 18 Mar 2011)
New Revision: 11249

Modified:
   trunk/mapserver/mapfile.c
   trunk/mapserver/mapstring.c
Log:
Added string expression writting

Modified: trunk/mapserver/mapfile.c
===================================================================
--- trunk/mapserver/mapfile.c	2011-03-18 17:20:25 UTC (rev 11248)
+++ trunk/mapserver/mapfile.c	2011-03-18 17:23:42 UTC (rev 11249)
@@ -2174,10 +2174,17 @@
     fprintf(stream, "%s /%s/", name, exp->string);
     break;
   case(MS_STRING):
-    if (strchr(exp->string, '\"') != NULL)
-      fprintf(stream, "%s '%s'", name, exp->string);
-    else
-      fprintf(stream, "%s \"%s\"", name, exp->string);
+      if ( (strchr(exp->string, '\'') == NULL) && (strchr(exp->string, '\"') == NULL))
+          fprintf(stream, "%s \"%s\"", name, exp->string);
+      else if ( (strchr(exp->string, '\"') != NULL) && (strchr(exp->string, '\'') == NULL))
+          fprintf(stream, "%s \'%s\'", name, exp->string);
+      else if ( (strchr(exp->string, '\'') != NULL) && (strchr(exp->string, '\"') == NULL))
+          fprintf(stream, "%s \"%s\"", name, exp->string);
+      else {
+          string_tmp = msStringEscape(exp->string);
+          fprintf(stream, "%s \"%s\"", name, string_tmp);
+          free(string_tmp);
+      }   
     break;
   case(MS_EXPRESSION):
     fprintf(stream, "%s (%s)", name, exp->string);

Modified: trunk/mapserver/mapstring.c
===================================================================
--- trunk/mapserver/mapstring.c	2011-03-18 17:20:25 UTC (rev 11248)
+++ trunk/mapserver/mapstring.c	2011-03-18 17:23:42 UTC (rev 11249)
@@ -2126,7 +2126,7 @@
         return msStrdup("");
 
     string_tmp = (char*)msSmallMalloc((strlen(pszString)*2)+1);
-    for (string_ptr=pszString,i=0; *string_ptr!='\0'; ++string_ptr,++i) {
+    for (string_ptr=(char*)pszString,i=0; *string_ptr!='\0'; ++string_ptr,++i) {
         if ( (*string_ptr == '\"') || (*string_ptr == '\'') ) {
             string_tmp[i] = '\\';
             ++i;



More information about the mapserver-commits mailing list