Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cgi label changing issues #4621

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ if(WITH_FLEX_BISON)
find_package(BISON)
find_package(FLEX)

BISON_TARGET(MapfileParser mapparser.y ${CMAKE_CURRENT_BUILD_DIR}/mapparser.c)
FLEX_TARGET(MapfileScanner maplexer.l ${CMAKE_CURRENT_BUILD_DIR}/maplexer.c COMPILE_FLAGS "--nounistd -Pmsyy -i")
BISON_TARGET(MapfileParser mapparser.y ${PROJECT_SOURCE_DIR}/mapparser.c)
FLEX_TARGET(MapfileScanner maplexer.l ${PROJECT_SOURCE_DIR}/maplexer.c COMPILE_FLAGS "--nounistd -Pmsyy -i")
ADD_FLEX_BISON_DEPENDENCY(MapfileScanner MapfileParser)
endif(WITH_FLEX_BISON)

Expand Down
38 changes: 25 additions & 13 deletions mapfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2069,13 +2069,17 @@ static int loadLabel(labelObj *label)
} /* next token */
}

int msUpdateLabelFromString(labelObj *label, char *string)
int msUpdateLabelFromString(labelObj *label, char *string, int url_string)
{
if(!label || !string) return MS_FAILURE;

msAcquireLock( TLOCK_PARSER );

if(url_string)
msyystate = MS_TOKENIZE_URL_STRING;
else
msyystate = MS_TOKENIZE_STRING;

msyystate = MS_TOKENIZE_STRING;
msyystring = string;
msyylex(); /* sets things up, but doesn't process any tokens */

Expand Down Expand Up @@ -6603,17 +6607,25 @@ int msUpdateMapFromURL(mapObj *map, char *variable, char *string)
if(msLookupHashTable(&(GET_LAYER(map, i)->class[j]->validation), "immutable"))
return(MS_SUCCESS); /* fail silently */

if(msyylex() == STYLE) {
if(getInteger(&k) == -1) return MS_FAILURE;

if(k>=GET_LAYER(map, i)->class[j]->numstyles || k<0) {
msSetError(MS_MISCERR, "Style to be modified not valid.", "msUpdateMapFromURL()");
return MS_FAILURE;
}

if(msUpdateStyleFromString((GET_LAYER(map, i))->class[j]->styles[k], string, MS_TRUE) != MS_SUCCESS) return MS_FAILURE;
} else {
if(msUpdateClassFromString((GET_LAYER(map, i))->class[j], string, MS_TRUE) != MS_SUCCESS) return MS_FAILURE;
switch(msyylex()) {
case STYLE:
if(getInteger(&k) == -1) return MS_FAILURE;
if(k>=GET_LAYER(map, i)->class[j]->numstyles || k<0) {
msSetError(MS_MISCERR, "Style to be modified not valid.", "msUpdateMapFromURL()");
return MS_FAILURE;
}
if(msUpdateStyleFromString((GET_LAYER(map, i))->class[j]->styles[k], string, MS_TRUE) != MS_SUCCESS) return MS_FAILURE;
break;
case LABEL:
if(getInteger(&k) == -1) return MS_FAILURE;
if(k>=GET_LAYER(map, i)->class[j]->numlabels || k<0) {
msSetError(MS_MISCERR, "Label to be modified not valid.", "msUpdateMapFromURL()");
return MS_FAILURE;
}
if(msUpdateLabelFromString((GET_LAYER(map, i))->class[j]->labels[k], string, MS_TRUE) != MS_SUCCESS) return MS_FAILURE;
break;
default:
if(msUpdateClassFromString((GET_LAYER(map, i))->class[j], string, MS_TRUE) != MS_SUCCESS) return MS_FAILURE;
}
} else {
if(msUpdateLayerFromString((GET_LAYER(map, i)), string, MS_TRUE) != MS_SUCCESS) return MS_FAILURE;
Expand Down
Loading