Skip to content
Permalink
Browse files

Count SYMBOLSET blocks to match to their END

  • Loading branch information
alexbrault committed Dec 5, 2019
1 parent 6201f06 commit d60cd8c6fd5ca3488db77f1b27e68663c697f42d
Showing with 11 additions and 1 deletion.
  1. +11 −1 mapsymbol.c
@@ -558,6 +558,7 @@ int loadSymbolSet(symbolSetObj *symbolset, mapObj *map)
char szPath[MS_MAXPATHLEN], *pszSymbolPath=NULL;

int foundSymbolSetToken=MS_FALSE;
int symbolSetLevel=0;
int token;

if(!symbolset) {
@@ -598,12 +599,20 @@ int loadSymbolSet(symbolSetObj *symbolset, mapObj *map)

switch(token) {
case(END):
if (--symbolSetLevel < 0) {
msSetError(MS_IDENTERR, "END token found outside SYMBOLSET context. When nesting multiple SYMBOLSETs, make sure the SYMBOLSET/END pairs match.", "msLoadSymbolSet()");
status = -1;
}
break;
case(EOF):
status = 0;
break;
case(SYMBOL):
/* Allocate/init memory for new symbol if needed */
if (msGrowSymbolSet(symbolset) == NULL) {
if (symbolSetLevel == 0) {
msSetError(MS_IDENTERR, "SYMBOL token found outside SYMBOLSET context. When nesting multiple SYMBOLSETs, make sure the SYMBOLSET/END pairs match.", "msLoadSymbolSet()");
status = -1;
} else if (msGrowSymbolSet(symbolset) == NULL) {
status = -1;
} else if((loadSymbol((symbolset->symbol[symbolset->numsymbols]), pszSymbolPath) == -1))
status = -1;
@@ -612,6 +621,7 @@ int loadSymbolSet(symbolSetObj *symbolset, mapObj *map)
break;
case(SYMBOLSET):
foundSymbolSetToken = MS_TRUE;
symbolSetLevel++;
break;
default:
msSetError(MS_IDENTERR, "Parsing error near (%s):(line %d)", "loadSymbolSet()", msyystring_buffer, msyylineno);

0 comments on commit d60cd8c

Please sign in to comment.
You can’t perform that action at this time.