[mapserver-commits] r8973 - branches/branch-5-4/mapserver
svn at osgeo.org
svn at osgeo.org
Tue Apr 28 17:00:31 EDT 2009
Author: sdlime
Date: 2009-04-28 17:00:31 -0400 (Tue, 28 Apr 2009)
New Revision: 8973
Modified:
branches/branch-5-4/mapserver/maptemplate.c
Log:
Fixed tag argument initialization error in processItemTag. (#2990)
Modified: branches/branch-5-4/mapserver/maptemplate.c
===================================================================
--- branches/branch-5-4/mapserver/maptemplate.c 2009-04-28 14:45:36 UTC (rev 8972)
+++ branches/branch-5-4/mapserver/maptemplate.c 2009-04-28 21:00:31 UTC (rev 8973)
@@ -512,18 +512,18 @@
papszArgs = msStringTokenize(pszArgs, " ", &nArgs, MS_TRUE);
/* msReturnTemplateQuerycheck all argument if they have values */
- for (i=0; i<nArgs; i++) {
- if(strchr(papszArgs[i], '='))
- {
- papszVarVal = msStringTokenize(papszArgs[i], "=", &nDummy, MS_FALSE);
- msInsertHashTable(*ppoHashTable, papszVarVal[0],
- papszVarVal[1]);
+ for (i=0; i<nArgs; i++) {
+ if(strlen(papszArgs[i]) == 0) continue;
+
+ if(strchr(papszArgs[i], '=')) {
+ papszVarVal = msStringTokenize(papszArgs[i], "=", &nDummy, MS_FALSE);
+ msInsertHashTable(*ppoHashTable, papszVarVal[0], papszVarVal[1]);
free(papszVarVal[0]);
free(papszVarVal[1]);
free(papszVarVal);
+ } else { /* no value specified. set it to 1 */
+ msInsertHashTable(*ppoHashTable, papszArgs[i], "1");
}
- else /* no value specified. set it to 1 */
- msInsertHashTable(*ppoHashTable, papszArgs[i], "1");
free(papszArgs[i]);
}
@@ -1110,18 +1110,15 @@
int tagOffset, tagLength;
char *encodedTagValue=NULL, *tagValue=NULL;
- char *argValue;
+ char *argValue=NULL;
- char *name=NULL;
- char *pattern=NULL;
- int precision=-1; /* don't change */
- char *format="$value";
- char *nullFormat="";
- int uc=MS_FALSE, lc=MS_FALSE, commify=MS_FALSE;
+ /* tag arguments, initialized below since we may be processing a number of tags in this function call */
+ char *name=NULL, *pattern=NULL;
+ char *format=NULL, *nullFormat=NULL;
+ int precision;
+ int uc, lc, commify;
+ int escape;
- /* int substr=MS_FALSE, substrStart, substrLength; */
- int escape=ESCAPE_HTML;
-
if(!*line) {
msSetError(MS_WEBERR, "Invalid line pointer.", "processItemTag()");
return(MS_FAILURE);
@@ -1132,6 +1129,14 @@
if(!tagStart) return(MS_SUCCESS); /* OK, just return; */
while (tagStart) {
+ /* initialize the tag arguments */
+ format = "$value";
+ nullFormat = "";
+ precision=-1;
+ name = pattern = NULL;
+ uc = lc = commify = MS_FALSE;
+ escape=ESCAPE_HTML;
+
tagOffset = tagStart - *line;
/* check for any tag arguments */
More information about the mapserver-commits
mailing list