* Add a default new symbol. If the symbol name exists * return the id of the symbol. */
| 662 | * return the id of the symbol. |
| 663 | */ |
| 664 | int msAddNewSymbol(mapObj *map, char *name) |
| 665 | { |
| 666 | int i = 0; |
| 667 | |
| 668 | if (!map || !name) |
| 669 | return -1; |
| 670 | |
| 671 | i = msGetSymbolIndex(&map->symbolset, name, MS_TRUE); |
| 672 | if (i >= 0) |
| 673 | return i; |
| 674 | |
| 675 | /* Allocate memory for new symbol if needed */ |
| 676 | if (msGrowSymbolSet(&(map->symbolset)) == NULL) |
| 677 | return -1; |
| 678 | |
| 679 | i = map->symbolset.numsymbols; |
| 680 | map->symbolset.symbol[i]->name = msStrdup(name); |
| 681 | |
| 682 | map->symbolset.numsymbols++; |
| 683 | |
| 684 | return i; |
| 685 | } |
| 686 | |
| 687 | /* msAppendSymbol and msRemoveSymbol are part of the work to resolve |
| 688 | * MapServer bug 579. |
no test coverage detected