1
0
mirror of https://github.com/DaveGamble/cJSON synced 2024-12-26 00:22:04 +00:00

reformatting: firstByteMark

This commit is contained in:
Max Bruckner 2016-09-28 01:32:09 +07:00
parent e10f2bf08d
commit 2e2dc873b2

13
cJSON.c
View File

@ -430,8 +430,19 @@ static unsigned parse_hex4(const char *str)
return h; return h;
} }
/* first bytes of UTF8 encoding for a given length in bytes */
static const unsigned char firstByteMark[7] =
{
0x00, /* should never happen */
0x00, /* 0xxxxxxx */
0xC0, /* 110xxxxx */
0xE0, /* 1110xxxx */
0xF0, /* 11110xxx */
0xF8,
0xFC
};
/* Parse the input text into an unescaped cstring, and populate item. */ /* Parse the input text into an unescaped cstring, and populate item. */
static const unsigned char firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
static const char *parse_string(cJSON *item,const char *str,const char **ep) static const char *parse_string(cJSON *item,const char *str,const char **ep)
{ {
const char *ptr=str+1,*end_ptr=str+1;char *ptr2;char *out;int len=0;unsigned uc,uc2; const char *ptr=str+1,*end_ptr=str+1;char *ptr2;char *out;int len=0;unsigned uc,uc2;