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