MCPcopy Index your code
hub / github.com/MapServer/MapServer / msOWSMakeAllLayersUnique

Function msOWSMakeAllLayersUnique

mapows.c:587–615  ·  view source on GitHub ↗

** msOWSMakeAllLayersUnique() */

Source from the content-addressed store, hash-verified

585** msOWSMakeAllLayersUnique()
586*/
587int msOWSMakeAllLayersUnique(mapObj *map)
588{
589 int i, j;
590
591 /* Make sure all layers in the map file have valid and unique names */
592 for(i=0; i<map->numlayers; i++)
593 {
594 int count=1;
595 for(j=i+1; j<map->numlayers; j++)
596 {
597 if (GET_LAYER(map, i)->name == NULL || GET_LAYER(map, j)->name == NULL)
598 {
599 continue;
600 }
601 if (strcasecmp(GET_LAYER(map, i)->name, GET_LAYER(map, j)->name) == 0 &&
602 msRenameLayer((GET_LAYER(map, j)), ++count) != MS_SUCCESS)
603 {
604 return MS_FAILURE;
605 }
606 }
607
608 /* Don't forget to rename the first layer if duplicates were found */
609 if (count > 1 && msRenameLayer((GET_LAYER(map, i)), 1) != MS_SUCCESS)
610 {
611 return MS_FAILURE;
612 }
613 }
614 return MS_SUCCESS;
615}
616
617/*
618** msOWSNegotiateVersion()

Callers 2

msWMSDispatchFunction · 0.85
msWFSDispatchFunction · 0.85

Calls 2

strcasecmpFunction · 0.85
msRenameLayerFunction · 0.85

Tested by

no test coverage detected