MCPcopy Create free account
hub / github.com/ByConity/ByConity / skip_utf8_bom

Function skip_utf8_bom

contrib/cJSON/cJSON.cpp:1000–1013  ·  view source on GitHub ↗

skip the UTF-8 BOM (byte order mark) if it is at the beginning of a buffer */

Source from the content-addressed store, hash-verified

998
999/* skip the UTF-8 BOM (byte order mark) if it is at the beginning of a buffer */
1000static parse_buffer *skip_utf8_bom(parse_buffer * const buffer)
1001{
1002 if ((buffer == NULL) || (buffer->content == NULL) || (buffer->offset != 0))
1003 {
1004 return NULL;
1005 }
1006
1007 if (can_access_at_index(buffer, 4) && (strncmp((const char*)buffer_at_offset(buffer), "\xEF\xBB\xBF", 3) == 0))
1008 {
1009 buffer->offset += 3;
1010 }
1011
1012 return buffer;
1013}
1014
1015/* Parse an object - create a new root, and populate. */
1016CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated)

Callers 1

cJSON_ParseWithOptsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected