copy a string while escaping '~' and '/' with ~0 and ~1 JSON pointer escape codes */
| 160 | |
| 161 | /* copy a string while escaping '~' and '/' with ~0 and ~1 JSON pointer escape codes */ |
| 162 | static void encode_string_as_pointer(unsigned char *destination, const unsigned char *source) |
| 163 | { |
| 164 | for (; source[0] != '\0'; (void)source++, destination++) |
| 165 | { |
| 166 | if (source[0] == '/') |
| 167 | { |
| 168 | destination[1] = '1'; |
| 169 | destination++; |
| 170 | } |
| 171 | else if (source[0] == '~') |
| 172 | { |
| 173 | destination[0] = '~'; |
| 174 | destination[1] = '1'; |
| 175 | destination++; |
| 176 | } |
| 177 | else |
| 178 | { |
| 179 | destination[0] = source[0]; |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | destination[0] = '\0'; |
| 184 | } |
| 185 | |
| 186 | CJSON_PUBLIC(char *) cJSONUtils_FindPointerFromObjectTo(const cJSON * const object, const cJSON * const target) |
| 187 | { |
no outgoing calls
no test coverage detected