| 3648 | // so after this call the pointer is at the position of the null terminator. |
| 3649 | |
| 3650 | static TEXT* make_name( TEXT* const string, const gpre_sym* symbol) |
| 3651 | { |
| 3652 | |
| 3653 | if (symbol->sym_type == SYM_delimited_cursor) |
| 3654 | { |
| 3655 | // All This elaborate code is just to put double quotes around |
| 3656 | // the cursor names and to escape any embeded quotes. |
| 3657 | int i = 0; |
| 3658 | strcpy(string, "\"\\\""); |
| 3659 | const char* source = symbol->sym_string; |
| 3660 | for (i = static_cast<int>(strlen(string)); *source && i + 4 < MAX_CURSOR_SIZE; i++) |
| 3661 | { |
| 3662 | if (*source == '\"' || *source == '\'') |
| 3663 | { |
| 3664 | if (i + 7 >= MAX_CURSOR_SIZE) |
| 3665 | break; |
| 3666 | |
| 3667 | string[i++] = '\\'; |
| 3668 | string[i++] = *source; |
| 3669 | string[i++] = '\\'; |
| 3670 | } |
| 3671 | string[i] = *source++; |
| 3672 | } |
| 3673 | string[i] = 0; |
| 3674 | strcat(string, "\\\"\""); |
| 3675 | } |
| 3676 | else |
| 3677 | fb_utils::snprintf(string, MAX_CURSOR_SIZE, "\"%s\"", symbol->sym_string); |
| 3678 | |
| 3679 | return string; |
| 3680 | } |
| 3681 | |
| 3682 | |
| 3683 | //____________________________________________________________ |
no test coverage detected