From 2e2dc873b2e77984713ccab6e049b58f36801e55 Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Wed, 28 Sep 2016 01:32:09 +0700 Subject: [PATCH] reformatting: firstByteMark --- cJSON.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cJSON.c b/cJSON.c index 706ac76..6f4a76a 100644 --- a/cJSON.c +++ b/cJSON.c @@ -430,8 +430,19 @@ static unsigned parse_hex4(const char *str) 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. */ -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) { const char *ptr=str+1,*end_ptr=str+1;char *ptr2;char *out;int len=0;unsigned uc,uc2;