copy a string while escaping '~' and '/' with ~0 and ~1 JSON pointer escape codes */
| 171 | |
| 172 | /* copy a string while escaping '~' and '/' with ~0 and ~1 JSON pointer escape codes */ |
| 173 | static void encode_string_as_pointer(unsigned char *destination, const unsigned char *source) |
| 174 | { |
| 175 | for (; source[0] != '\0'; (void)source++, destination++) |
| 176 | { |
| 177 | if (source[0] == '/') |
| 178 | { |
| 179 | destination[0] = '~'; |
| 180 | destination[1] = '1'; |
| 181 | destination++; |
| 182 | } |
| 183 | else if (source[0] == '~') |
| 184 | { |
| 185 | destination[0] = '~'; |
| 186 | destination[1] = '0'; |
| 187 | destination++; |
| 188 | } |
| 189 | else |
| 190 | { |
| 191 | destination[0] = source[0]; |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | destination[0] = '\0'; |
| 196 | } |
| 197 | |
| 198 | CJSON_PUBLIC(char *) cJSONUtils_FindPointerFromObjectTo(const cJSON * const object, const cJSON * const target) |
| 199 | { |
no outgoing calls
no test coverage detected
searching dependent graphs…