[mapserver-commits] r12801 - sandbox/sdlime/rfc-77
svn at osgeo.org
svn at osgeo.org
Fri Nov 25 13:10:23 EST 2011
Author: sdlime
Date: 2011-11-25 10:10:22 -0800 (Fri, 25 Nov 2011)
New Revision: 12801
Modified:
sandbox/sdlime/rfc-77/mapfile.c
Log:
Fix inline feature read/write to account for multiple text values in a shape (although we only support one for now).
Modified: sandbox/sdlime/rfc-77/mapfile.c
===================================================================
--- sandbox/sdlime/rfc-77/mapfile.c 2011-11-23 18:43:35 UTC (rev 12800)
+++ sandbox/sdlime/rfc-77/mapfile.c 2011-11-25 18:10:22 UTC (rev 12801)
@@ -891,7 +891,14 @@
break;
}
case(TEXT):
- if(getString(&shape->text) == MS_FAILURE) return(MS_FAILURE);
+ if(shape->text && shape->numtext > 0)
+ free(shape->text[0]); /* avoid memory leak (could consider allowing multiple TEXT values for inline features) */
+ else {
+ shape->text = (char **) msSmallMalloc(sizeof(char *));
+ shape->numtext = 1;
+ }
+
+ if(getString(&shape->text[0]) == MS_FAILURE) return(MS_FAILURE);
break;
case(WKT):
{
@@ -945,7 +952,10 @@
fprintf(stream, "\"\n");
}
- writeString(stream, indent, "TEXT", NULL, feature->text);
+ if(feature->text) {
+ for (i=0; i<feature->numtext; i++)
+ writeString(stream, indent, "TEXT", NULL, feature->text[i]);
+ }
writeBlockEnd(stream, indent, "FEATURE");
}
More information about the mapserver-commits
mailing list