skip the UTF-8 BOM (byte order mark) if it is at the beginning of a buffer */
| 1058 | |
| 1059 | /* skip the UTF-8 BOM (byte order mark) if it is at the beginning of a buffer */ |
| 1060 | static parse_buffer *skip_utf8_bom(parse_buffer * const buffer) |
| 1061 | { |
| 1062 | if ((buffer == NULL) || (buffer->content == NULL) || (buffer->offset != 0)) |
| 1063 | { |
| 1064 | return NULL; |
| 1065 | } |
| 1066 | |
| 1067 | if (can_access_at_index(buffer, 4) && (strncmp((const char*)buffer_at_offset(buffer), "\xEF\xBB\xBF", 3) == 0)) |
| 1068 | { |
| 1069 | buffer->offset += 3; |
| 1070 | } |
| 1071 | |
| 1072 | return buffer; |
| 1073 | } |
| 1074 | |
| 1075 | CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated) |
| 1076 | { |
no outgoing calls
no test coverage detected