** msOWSMakeAllLayersUnique() */
| 585 | ** msOWSMakeAllLayersUnique() |
| 586 | */ |
| 587 | int 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() |
no test coverage detected