[mapserver-commits] r10398 - sandbox/sdlime/common-expressions/mapserver

svn at osgeo.org svn at osgeo.org
Tue Jul 27 01:08:52 EDT 2010


Author: sdlime
Date: 2010-07-27 05:08:52 +0000 (Tue, 27 Jul 2010)
New Revision: 10398

Modified:
   sandbox/sdlime/common-expressions/mapserver/mapparser.c
   sandbox/sdlime/common-expressions/mapserver/mapparser.y
Log:
Fixed string concatination.

Modified: sandbox/sdlime/common-expressions/mapserver/mapparser.c
===================================================================
--- sandbox/sdlime/common-expressions/mapserver/mapparser.c	2010-07-27 04:25:11 UTC (rev 10397)
+++ sandbox/sdlime/common-expressions/mapserver/mapparser.c	2010-07-27 05:08:52 UTC (rev 10398)
@@ -391,8 +391,8 @@
      276,   284,   290,   296,   302,   308,   314,   320,   341,   362,
      368,   376,   383,   394,   405,   416,   427,   438,   449,   460,
      471,   481,   493,   494,   495,   496,   497,   498,   499,   506,
-     507,   508,   509,   519,   520,   521,   533,   534,   535,   538,
-     539
+     507,   508,   509,   519,   520,   521,   533,   534,   535,   541,
+     542
 };
 #endif
 
@@ -1277,7 +1277,7 @@
         yypresult.intval = MS_FALSE;
       break;
     case(MS_PARSE_RESULT_STRING):
-      yypresult.strval = (yyvsp[0].strval); /* strdup? */
+      yypresult.strval = (yyvsp[0].strval); // strdup($1);
       break;
     }
   }
@@ -1939,16 +1939,19 @@
 
   case 67:
 #line 534 "mapparser.y"
-    { (yyval.strval) = (yyvsp[-1].strval); free((yyvsp[-1].strval)); }
+    { (yyval.strval) = (yyvsp[-1].strval); }
     break;
 
   case 68:
 #line 535 "mapparser.y"
-    { snprintf((yyval.strval), sizeof((yyval.strval)), "%s%s", (yyvsp[-2].strval), (yyvsp[0].strval)); free((yyvsp[-2].strval)); free((yyvsp[0].strval)); }
+    { 
+      (yyval.strval) = (char *)malloc(strlen((yyvsp[-2].strval)) + strlen((yyvsp[0].strval)) + 1);
+      sprintf((yyval.strval), "%s%s", (yyvsp[-2].strval), (yyvsp[0].strval)); free((yyvsp[-2].strval)); free((yyvsp[0].strval)); 
+    }
     break;
 
   case 70:
-#line 539 "mapparser.y"
+#line 542 "mapparser.y"
     { (yyval.tmval) = (yyvsp[-1].tmval); }
     break;
 
@@ -1956,7 +1959,7 @@
     }
 
 /* Line 1037 of yacc.c.  */
-#line 1960 "mapparser.c"
+#line 1963 "mapparser.c"
 
   yyvsp -= yylen;
   yyssp -= yylen;
@@ -2184,7 +2187,7 @@
 }
 
 
-#line 542 "mapparser.y"
+#line 545 "mapparser.y"
 
 
 /*

Modified: sandbox/sdlime/common-expressions/mapserver/mapparser.y
===================================================================
--- sandbox/sdlime/common-expressions/mapserver/mapparser.y	2010-07-27 04:25:11 UTC (rev 10397)
+++ sandbox/sdlime/common-expressions/mapserver/mapparser.y	2010-07-27 05:08:52 UTC (rev 10398)
@@ -92,7 +92,7 @@
         yypresult.intval = MS_FALSE;
       break;
     case(MS_PARSE_RESULT_STRING):
-      yypresult.strval = $1; /* strdup? */
+      yypresult.strval = $1; // strdup($1);
       break;
     }
   }
@@ -531,8 +531,11 @@
 ;
 
 string_exp: STRING
-  | '(' string_exp ')' { $$ = $2; free($2); }
-  | string_exp '+' string_exp { snprintf($$, sizeof($$), "%s%s", $1, $3); free($1); free($3); }
+  | '(' string_exp ')' { $$ = $2; }
+  | string_exp '+' string_exp { 
+      $$ = (char *)malloc(strlen($1) + strlen($3) + 1);
+      sprintf($$, "%s%s", $1, $3); free($1); free($3); 
+    }
 ;
 
 time_exp: TIME



More information about the mapserver-commits mailing list