不可不知的JSON处理库(cJSON)

前端之家收集整理的这篇文章主要介绍了不可不知的JSON处理库(cJSON)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

ANSI C中的超轻量级JSON解析器

JSON(JavaScript对象表示法)是一种轻量级的数据交换格式。人类易于阅读和书写。机器很容易解析和生成。它基于JavaScript编程语言标准ECMA-262第三版(1999年12月)的子集 。JSON是一种完全独立于语言的文本格式,但是使用C语言家族(包括C,C ++,C#,Java,JavaScript,Perl,Python等)的程序员熟悉的约定。这些属性使JSON成为理想的数据交换语言。

cJSON旨在成为您可以完成工作的最简单的解析器。它是资源只有一个C的头文件和C文件,所以方便移植。它可以为你各种需要的json字符串处理,包括打包、解析、修改删除添加等。在这里将一探究竟。

在这里将着重叙述json的打包和解析,更多处理玩法,见文章末尾链接

开始cJSON

cJSON合并到您的项目

因为整个库只有一个C文件和一个头文件,所以您只需复制cJSON.h并复制cJSON.c到项目源并开始使用它。

cJSON用ANSI C(C89)编写,以便支持尽可能多的平台和编译器。

 

下载:

https://github.com/DaveGamble/cJSON/releases

 

Cjson结构体

/*@H_301_35@ The cJSON structure: @H_301_35@*/@H_301_35@
typedef @H_301_35@struct@H_301_35@ cJSON
{
    @H_301_35@struct@H_301_35@ cJSON *next;
    @H_301_35@prev;
    @H_301_35@child;
    @H_301_35@int@H_301_35@ type;
    @H_301_35@char@H_301_35@ *valuestring;
    @H_301_35@ valueint;
    @H_301_35@double@H_301_35@ valuedouble;
    @H_301_35@string@H_301_35@;
} cJSON;@H_301_35@

结构体项解析:

next 和prev :Cjson结构体作为一个双向连表的环,可以通过 next 和prev 指针进行连表遍历

child:可以是cJSON_Array、cJSON_Object类型数据

type:当前项的类型

valuestring:内容存储,当类型是cJSON_String和cJSON_Raw

valueint:内容存储,整型,可以是cJSON_False、cJSON_True数据

valuedouble:内容存储,浮点型,当类型是cJSON_Number

string:键名

数据类型

l  cJSON_Invalid表示一个不包含任何值的无效项目。如果将项目设置为全零字节,则将自动具有此类型。

l  cJSON_False表示一个false布尔值。您也可以使用来检查布尔值cJSON_IsBool

l  cJSON_True表示一个true布尔值。您也可以使用来检查布尔值cJSON_IsBool

l  cJSON_NULL表示一个null值

l  cJSON_Number 表示一个数字值。该值存储为double in valuedouble和in valueint。如果数字超出整数范围,INT_MAX或INT_MIN用于valueint

l  cJSON_String表示一个字符串值。它以零终止字符串的形式存储在中valuestring

l  cJSON_Array表示一个数组值。这是通过指向表示数组中值child的cJSON项目的链接列表来实现的。使用next和将元素链接在一起prev,其中第一个元素具有prev.next == NULL和最后一个元素next == NULL

l  cJSON_Object 表示一个对象值。对象的存储方式与数组相同,唯一的区别是对象中的项将其键存储在中string

l  cJSON_Raw表示以JSON字符存储的零终止形式的任何JSON valuestring。例如,可以使用它来避免一遍又一遍地打印相同的静态JSON以节省性能。解析时,cJSON永远不会创建此类型。另请注意,cJSON不会检查其是否为有效JSON。

类型

#define@H_301_35@ cJSON_Invalid (0)
#define@H_301_35@ cJSON_False  (1 << 0)
#define@H_301_35@ cJSON_True   (1 << 1)
#define@H_301_35@ cJSON_NULL   (1 << 2)
#define@H_301_35@ cJSON_Number (1 << 3)
#define@H_301_35@ cJSON_String (1 << 4)
#define@H_301_35@ cJSON_Array  (1 << 5)
#define@H_301_35@ cJSON_Object (1 << 6)
#define@H_301_35@ cJSON_Raw    (1 << 7) /* raw json */

类型判断

cJSON_IsInvalid(const@H_301_35@ cJSON * const@H_301_35@ item);
cJSON_IsFalse(@H_301_35@ item);
cJSON_IsTrue(@H_301_35@ item);
cJSON_IsBool(@H_301_35@ item);
cJSON_IsNull(@H_301_35@ item);
cJSON_IsNumber(@H_301_35@ item);
cJSON_IsString(@H_301_35@ item);
cJSON_IsArray(@H_301_35@ item);
cJSON_IsObject(@H_301_35@ item);
cJSON_IsRaw(@H_301_35@const@H_301_35@ item);

注意

创建cjson对象后,处理完需要进行内存释放:

如果是cjson里的对象,请使用cJSON_Delete()

如果不是对象:cJSON_free()或free()

 

零字符

cJSON不支持包含零字符'\0'或的字符串\u0000。对于当前的API,这是不可能的,因为字符串以零结尾。

 

字符编码

cJSON仅支持UTF-8编码的输入。但是在大多数情况下,它不会拒绝无效的UTF-8作为输入,而只是将其原样传播。只要输入不包含无效的UTF-8,输出将始终是有效的UTF-8。

 

C标准

cJSON用ANSI C(或C89,C90)编写。如果您的编译器或C库未遵循此标准,则不能保证正确的行为。

 

注意:ANSI C不是C ++,因此不应使用C ++编译器进行编译。您可以使用C编译器对其进行编译,然后将其与C ++代码链接。尽管可以使用C ++编译器进行编译,但是不能保证正确的行为。

 

浮点数字

double除IEEE754双精度浮点数外,cJSON不正式支持任何实现。它可能仍然可以与其他实现一起使用,但是这些实现的错误将被视为无效。

 

目前,cJSON支持的浮点文字的最大长度为63个字符。

 

数组和对象的深层嵌套

cJSON不支持嵌套太深的数组和对象,因为这会导致堆栈溢出。为了防止这种CJSON_NESTING_LIMIT情况,默认情况下,cJSON将深度限制为1000,但是可以在编译时进行更改。

格式化输出

按标准的格式输出json字符串,输出完后一定要记得释放内存

 代码

 1@H_301_35@ #include <stdio.h>
 2@H_301_35@ #include "@H_301_35@cJSON.h@H_301_35@"@H_301_35@
 3@H_301_35@ #include cJSON.c@H_301_35@ 4@H_301_35@ void@H_301_35@ main(){
@H_301_35@ 5@H_301_35@     //@H_301_35@待解析字符串 @H_301_35@
 6@H_301_35@     char@H_301_35@ *json_str={\"key1\":\"dongxiaodong\",\"key2\":1998,\"key3\":55778}@H_301_35@"@H_301_35@;
@H_301_35@ 7@H_301_35@     
 8@H_301_35@     输出原字符串@H_301_35@
 9@H_301_35@     printf(原字符串:%s\r\n@H_301_35@,json_str); 
@H_301_35@10@H_301_35@ 
11@H_301_35@     解析成json对象 @H_301_35@
12@H_301_35@     cJSON * json_obj = cJSON_Parse(json_str); 
@H_301_35@13@H_301_35@ 
14@H_301_35@     格式输出@H_301_35@
15@H_301_35@     char@H_301_35@ *json_print_str=NULL;
@H_301_35@16@H_301_35@     json_print_str=cJSON_Print(json_obj);
@H_301_35@17@H_301_35@     printf(\r\n输出内容:\r\n\r\n%s\r\n@H_301_35@301_35@18@H_301_35@     
19@H_301_35@     释放资源 @H_301_35@
20@H_301_35@     free@H_301_35@(json_print_str);
@H_301_35@21@H_301_35@     
22@H_301_35@     23@H_301_35@     cJSON_Delete(json_obj);
@H_301_35@24@H_301_35@ }

json打包

cJSON_CreateObject函数可创建一个根数据项,在此之后就可以添加各种数据类型的子节点了,使用完成后需要通过cJSON_Delete()释放内存。

创建一层级的json@H_301_35@

 代码

 5@H_301_35@     cJSON *root_obj = NULL;根,json对象 @H_301_35@
char@H_301_35@ *out_str = NULL; 输出结果 @H_301_35@
 7@H_301_35@     root_obj =cJSON_CreateObject();创建 
@H_301_35@ 8@H_301_35@      添加一个字符串,参数(根对象,键,值) @H_301_35@
 9@H_301_35@     cJSON_AddStringToObject(root_obj,key1@H_301_35@"@H_301_35@,1)">dongxiaodong@H_301_35@);
@H_301_35@10@H_301_35@     添加一个整型,参数(根对象,键,值) @H_301_35@
11@H_301_35@     cJSON_AddNumberToObject(root_obj,1)">key2@H_301_35@1998@H_301_35@12@H_301_35@     添加一个浮点型,参数(根对象,键,值) @H_301_35@
13@H_301_35@     cJSON_AddNumberToObject(root_obj,1)">key3@H_301_35@22.33@H_301_35@添加一个bool类型,参数(根对象,键,值) 
@H_301_35@bool值可以是0/1或false/true @H_301_35@
16@H_301_35@     cJSON_AddBoolToObject(root_obj,1)">key4@H_301_35@0@H_301_35@17@H_301_35@     将json对象打包成字符串 @H_301_35@
18@H_301_35@     out_str = cJSON_PrintUnformatted(root_obj);
@H_301_35@销毁json对象,释放内存 @H_301_35@
20@H_301_35@     cJSON_Delete(root_obj); 
@H_301_35@21@H_301_35@     输出值:{"key1":"dongxiaodong","key2":1998,"key3":22.33,"key4":false} @H_301_35@
22@H_301_35@     printf(%s@H_301_35@301_35@23@H_301_35@ }

类型创建函数还有:

cJSON_AddNullToObject(cJSON * const object,const char * const name);

cJSON_AddTrueToObject(cJSON * const object,const char * const name);

cJSON_AddFalseToObject(cJSON * const object,const char * const name);

cJSON_AddBoolToObject(cJSON * const object,const char * const name,const cJSON_bool boolean);

cJSON_AddNumberToObject(cJSON * const object,const double number);

cJSON_AddStringToObject(cJSON * const object,const char * const string);

cJSON_AddRawToObject(cJSON * const object,const char * const raw);

cJSON_AddObjectToObject(cJSON * const object,const char * const name);

cJSON_AddArrayToObject(cJSON * const object,const char * const name);

创建多层级的json@H_301_35@

 代码

 6@H_301_35@     cJSON *item_obj = NULL;二级json对象 @H_301_35@
 7@H_301_35@      8@H_301_35@     
 9@H_301_35@     root_obj =cJSON_CreateObject();10@H_301_35@      11@H_301_35@     cJSON_AddStringToObject(root_obj,1)">14@H_301_35@     
创建一个子json对象@H_301_35@
16@H_301_35@     item_obj= cJSON_AddObjectToObject(root_obj,1)">myson@H_301_35@); 
@H_301_35@向孩子对象中添加内容@H_301_35@
18@H_301_35@     cJSON_AddStringToObject(item_obj,1)">sonkey1@H_301_35@东小东@H_301_35@19@H_301_35@     cJSON_AddNumberToObject(item_obj,1)">sonkey2@H_301_35@2020@H_301_35@20@H_301_35@       
22@H_301_35@     out_str =23@H_301_35@     24@H_301_35@ 25@H_301_35@     301_35@
26@H_301_35@     printf(27@H_301_35@ }

创建多层json(数组形式)@H_301_35@

 

 代码

数组对象 @H_301_35@
创建一个子数组对象 @H_301_35@
16@H_301_35@     item_obj= cJSON_AddArrayToObject(root_obj,1)">向数组对象中添加内容@H_301_35@
18@H_301_35@     cJSON_AddItemToArray(item_obj,cJSON_CreateTrue()); 
@H_301_35@19@H_301_35@     cJSON_AddItemToArray(item_obj,cJSON_CreateNumber(22@H_301_35@));
@H_301_35@301_35@
27@H_301_35@ }

创建的对象还可以是下面这些

cJSON_CreateNull(void);

cJSON_CreateTrue(void);

cJSON_CreateFalse(void);

cJSON_CreateBool(cJSON_bool boolean);

cJSON_CreateNumber(double num);

cJSON_CreateString(const char *string);

cJSON_CreateRaw(const char *raw);

cJSON_CreateArray(void);

cJSON_CreateObject(void);

创建混合json@H_301_35@

 代码

 6@H_301_35@     cJSON *son_obj=NULL; 
@H_301_35@ 7@H_301_35@     cJSON *item_obj = NULL;输出结果 
@H_301_35@ 9@H_301_35@     
根对象 @H_301_35@
11@H_301_35@     root_obj =cJSON_CreateObject();13@H_301_35@     cJSON_AddStringToObject(root_obj,1)">15@H_301_35@     cJSON_AddNumberToObject(root_obj,1)">16@H_301_35@     
18@H_301_35@     item_obj= cJSON_AddArrayToObject(root_obj,1)">21@H_301_35@     cJSON_AddItemToArray(item_obj,1)">22@H_301_35@     
子对象 @H_301_35@
24@H_301_35@     son_obj =cJSON_CreateObject();26@H_301_35@     cJSON_AddStringToObject(son_obj,1)">son1@H_301_35@27@H_301_35@     28@H_301_35@     cJSON_AddNumberToObject(son_obj,1)">son2@H_301_35@29@H_301_35@ 301_35@30@H_301_35@     
31@H_301_35@     32@H_301_35@     out_str =33@H_301_35@     34@H_301_35@ 35@H_301_35@     301_35@
36@H_301_35@     printf(37@H_301_35@ }

json解析

解析一层级的json@H_301_35@

 

代码

301_35@ 8@H_301_35@     cJSON * json_obj =项存储 @H_301_35@
11@H_301_35@     cJSON *item=12@H_301_35@     
13@H_301_35@     14@H_301_35@     printf(15@H_301_35@     
16@H_301_35@     获取string类型 @H_301_35@
17@H_301_35@     item=cJSON_GetObjectItem(json_obj,1)">);  
@H_301_35@18@H_301_35@     printf(\r\nkey1:%s\r\n@H_301_35@valuestring);
@H_301_35@19@H_301_35@     cJSON_Delete(item);释放资源 
@H_301_35@20@H_301_35@      
获取数字 @H_301_35@
22@H_301_35@     item=cJSON_GetObjectItem(json_obj,1)">23@H_301_35@     printf(\r\nkey2:%d\r\n@H_301_35@valueint);
@H_301_35@24@H_301_35@     cJSON_Delete(item);25@H_301_35@     
26@H_301_35@     27@H_301_35@     item=cJSON_GetObjectItem(json_obj,1)">28@H_301_35@     printf(\r\nkey3:%f\r\n@H_301_35@valuedouble);
@H_301_35@29@H_301_35@     cJSON_Delete(item);获取bool @H_301_35@
32@H_301_35@     item=cJSON_GetObjectItem(json_obj,1)">33@H_301_35@     printf(\r\nkey4:%d\r\n@H_301_35@34@H_301_35@     cJSON_Delete(item);35@H_301_35@     
36@H_301_35@     是否资源 @H_301_35@
37@H_301_35@ 38@H_301_35@ }

解析多层级的json@H_301_35@

 

代码

301_35@内部项存储@H_301_35@
13@H_301_35@     cJSON * item_item=16@H_301_35@     printf(17@H_301_35@     
18@H_301_35@     19@H_301_35@     item=cJSON_GetObjectItem(json_obj,1)">20@H_301_35@     printf(21@H_301_35@     cJSON_Delete(item);22@H_301_35@      
24@H_301_35@     item=cJSON_GetObjectItem(json_obj,1)">25@H_301_35@     printf(26@H_301_35@     cJSON_Delete(item);27@H_301_35@     
28@H_301_35@     子串@H_301_35@
29@H_301_35@     item=cJSON_GetObjectItem(json_obj,1)">30@H_301_35@     item_item=cJSON_GetObjectItem(item,1)">31@H_301_35@     printf(\r\nmyson(sonkey1):%s\r\n@H_301_35@32@H_301_35@     cJSON_Delete(item_item);33@H_301_35@     
34@H_301_35@     item_item=cJSON_GetObjectItem(item,1)">35@H_301_35@     printf(\r\nmyson(sonkey2):%d\r\n@H_301_35@36@H_301_35@     cJSON_Delete(item_item);37@H_301_35@     
38@H_301_35@     cJSON_Delete(item);39@H_301_35@     
40@H_301_35@     41@H_301_35@ 42@H_301_35@ }

 解析多层json(数组形式)@H_301_35@

 

 

代码

301_35@获取子串 @H_301_35@
输出数组大小 @H_301_35@
32@H_301_35@     printf(\r\n数组大小:%d\r\n@H_301_35@301_35@34@H_301_35@     输出项1内容 @H_301_35@
35@H_301_35@     item_item=cJSON_GetArrayItem(item,1)">\r\nmyson(0):%d\r\n@H_301_35@37@H_301_35@     cJSON_Delete(item_item);@H_301_35@38@H_301_35@     
39@H_301_35@     输出项2内容 @H_301_35@
40@H_301_35@     item_item=cJSON_GetArrayItem(item,1)">1@H_301_35@41@H_301_35@     printf(\r\nmyson(1):%d\r\n@H_301_35@42@H_301_35@     cJSON_Delete(item_item);43@H_301_35@     
44@H_301_35@     cJSON_Delete(item);45@H_301_35@     
46@H_301_35@     47@H_301_35@ 48@H_301_35@ }

  解析混合json@H_301_35@

@H_301_35@

代码

301_35@44@H_301_35@     项3内容@H_301_35@
45@H_301_35@     item_item=cJSON_GetArrayItem(item,1)">2@H_301_35@46@H_301_35@     cJSON *item_item_son=47@H_301_35@     
48@H_301_35@     item_item_son =cJSON_GetObjectItem(item_item,1)">49@H_301_35@     printf(\r\nmyson(2)(son1):%s\r\n@H_301_35@50@H_301_35@     cJSON_Delete(item_item_son);51@H_301_35@     
52@H_301_35@     item_item_son =cJSON_GetObjectItem(item_item,1)">53@H_301_35@     printf(\r\nmyson(2)(son2):%d\r\n@H_301_35@54@H_301_35@     cJSON_Delete(item_item_son);释放资源@H_301_35@
55@H_301_35@     cJSON_Delete(item_item);释放资源   @H_301_35@
56@H_301_35@     
57@H_301_35@     cJSON_Delete(item);58@H_301_35@     
59@H_301_35@     60@H_301_35@ 61@H_301_35@ }

 附件:

cJSON.h

  1@H_301_35@ /*@H_301_35@
  2@H_301_35@   Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
@H_301_35@  3@H_301_35@ 
  4@H_301_35@   Permission is hereby granted,free of charge,to any person obtaining a copy
@H_301_35@  5@H_301_35@   of this software and associated documentation files (the "Software"),to deal
@H_301_35@  6@H_301_35@   in the Software without restriction,including without limitation the rights
@H_301_35@  7@H_301_35@   to use,copy,modify,merge,publish,distribute,sublicense,and/or sell
@H_301_35@  8@H_301_35@   copies of the Software,and to permit persons to whom the Software is
@H_301_35@  9@H_301_35@   furnished to do so,subject to the following conditions:
@H_301_35@ 10@H_301_35@ 
 11@H_301_35@   The above copyright notice and this permission notice shall be included in
@H_301_35@ 12@H_301_35@   all copies or substantial portions of the Software.
@H_301_35@ 13@H_301_35@ 
 14@H_301_35@   THE SOFTWARE IS PROVIDED "AS IS",WITHOUT WARRANTY OF ANY KIND,EXPRESS OR
@H_301_35@ 15@H_301_35@   IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,@H_301_35@ 16@H_301_35@   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@H_301_35@ 17@H_301_35@   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER
@H_301_35@ 18@H_301_35@   LIABILITY,WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE,ARISING FROM,1)"> 19@H_301_35@   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
@H_301_35@ 20@H_301_35@   THE SOFTWARE.
@H_301_35@ 21@H_301_35@ */@H_301_35@
 22@H_301_35@ 
 23@H_301_35@ #ifndef cJSON__h
@H_301_35@ 24@H_301_35@ #define@H_301_35@ cJSON__h
 25@H_301_35@ 
 26@H_301_35@ #ifdef __cplusplus
@H_301_35@ 27@H_301_35@ extern@H_301_35@ C@H_301_35@ 28@H_301_35@ {
@H_301_35@ 29@H_301_35@ #endif@H_301_35@
 30@H_301_35@ 
 31@H_301_35@ #if@H_301_35@ !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
 32@H_301_35@ #define@H_301_35@ __WINDOWS__
 33@H_301_35@  34@H_301_35@ 
 35@H_301_35@ #ifdef __WINDOWS__
@H_301_35@ 36@H_301_35@ 
 37@H_301_35@  When compiling for windows,we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention.  For windows you have 3 define options:
@H_301_35@ 38@H_301_35@ 
 39@H_301_35@ CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols
@H_301_35@ 40@H_301_35@ CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default)
@H_301_35@ 41@H_301_35@ CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol
@H_301_35@ 42@H_301_35@ 
 43@H_301_35@ For *nix builds that support visibility attribute,you can define similar behavior by
@H_301_35@ 44@H_301_35@ 
 45@H_301_35@ setting default visibility to hidden by adding
@H_301_35@ 46@H_301_35@ -fvisibility=hidden (for gcc)
@H_301_35@ 47@H_301_35@ or
@H_301_35@ 48@H_301_35@ -xldscope=hidden (for sun cc)
@H_301_35@ 49@H_301_35@ to CFLAGS
@H_301_35@ 50@H_301_35@ 
 51@H_301_35@ then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does
@H_301_35@ 52@H_301_35@ 
 53@H_301_35@  54@H_301_35@ 
 55@H_301_35@ #define@H_301_35@ CJSON_CDECL __cdecl
 56@H_301_35@ #define@H_301_35@ CJSON_STDCALL __stdcall
 57@H_301_35@ 
 58@H_301_35@  export symbols by default,this is necessary for copy pasting the C and header file @H_301_35@ 59@H_301_35@ #if@H_301_35@ !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS)
 60@H_301_35@ #define@H_301_35@ CJSON_EXPORT_SYMBOLS
 61@H_301_35@  62@H_301_35@ 
 63@H_301_35@ #if@H_301_35@ defined(CJSON_HIDE_SYMBOLS)
 64@H_301_35@ #define@H_301_35@ CJSON_PUBLIC(type)   type CJSON_STDCALL
 65@H_301_35@ #elif@H_301_35@ defined(CJSON_EXPORT_SYMBOLS)
 66@H_301_35@ #define@H_301_35@ CJSON_PUBLIC(type)   __declspec(dllexport) type CJSON_STDCALL
 67@H_301_35@ #elif@H_301_35@ defined(CJSON_IMPORT_SYMBOLS)
 68@H_301_35@ #define@H_301_35@ CJSON_PUBLIC(type)   __declspec(dllimport) type CJSON_STDCALL
 69@H_301_35@  70@H_301_35@ #else@H_301_35@ /* !__WINDOWS__ */
 71@H_301_35@ #define@H_301_35@ CJSON_CDECL
 72@H_301_35@ #define@H_301_35@ CJSON_STDCALL
 73@H_301_35@ 
 74@H_301_35@ #if@H_301_35@ (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
 75@H_301_35@ #define@H_301_35@ CJSON_PUBLIC(type)   __attribute__((visibility("default"))) type
 76@H_301_35@ #else@H_301_35@
 77@H_301_35@ #define@H_301_35@ CJSON_PUBLIC(type) type
 78@H_301_35@  79@H_301_35@  80@H_301_35@ 
 81@H_301_35@  project version @H_301_35@ 82@H_301_35@ #define@H_301_35@ CJSON_VERSION_MAJOR 1
 83@H_301_35@ #define@H_301_35@ CJSON_VERSION_MINOR 7
 84@H_301_35@ #define@H_301_35@ CJSON_VERSION_PATCH 13
 85@H_301_35@ 
 86@H_301_35@ #include <stddef.h>
 87@H_301_35@ 
 88@H_301_35@  cJSON Types: @H_301_35@ 89@H_301_35@  90@H_301_35@  91@H_301_35@  92@H_301_35@  93@H_301_35@  94@H_301_35@  95@H_301_35@  96@H_301_35@  97@H_301_35@ #define@H_301_35@ cJSON_Raw    (1 << 7) /* raw json */
 98@H_301_35@ 
 99@H_301_35@ #define@H_301_35@ cJSON_IsReference 256
100@H_301_35@ #define@H_301_35@ cJSON_StringIsConst 512
101@H_301_35@ 
102@H_301_35@ 103@H_301_35@ typedef  cJSON
@H_301_35@104@H_301_35@ 105@H_301_35@      next/prev allow you to walk array/object chains. Alternatively,use GetArraySize/GetArrayItem/GetObjectItem @H_301_35@106@H_301_35@     next;
@H_301_35@107@H_301_35@     prev;
@H_301_35@108@H_301_35@      An array or object item will have a child pointer pointing to a chain of the items in the array/object. @H_301_35@109@H_301_35@     child;
@H_301_35@110@H_301_35@ 
111@H_301_35@      The type of the item,as above. @H_301_35@112@H_301_35@      type;
@H_301_35@113@H_301_35@ 
114@H_301_35@      The item's string,if type==cJSON_String  and type == cJSON_Raw @H_301_35@115@H_301_35@     valuestring;
@H_301_35@116@H_301_35@      writing to valueint is DEPRECATED,use cJSON_SetNumberValue instead @H_301_35@117@H_301_35@      valueint;
@H_301_35@118@H_301_35@      The item's number,if type==cJSON_Number @H_301_35@119@H_301_35@      valuedouble;
@H_301_35@120@H_301_35@ 
121@H_301_35@      The item's name string,if this item is the child of,or is in the list of subitems of an object. @H_301_35@122@H_301_35@     123@H_301_35@ } cJSON;
@H_301_35@124@H_301_35@ 
125@H_301_35@ typedef  cJSON_Hooks
@H_301_35@126@H_301_35@ 127@H_301_35@        malloc/free are CDECL on Windows regardless of the default calling convention of the compiler,so ensure the hooks allow passing those functions directly. @H_301_35@128@H_301_35@       void@H_301_35@ *(CJSON_CDECL *malloc_fn)(size_t sz);
@H_301_35@129@H_301_35@       void@H_301_35@ (CJSON_CDECL *free_fn)(void@H_301_35@ *ptr);
@H_301_35@130@H_301_35@ } cJSON_Hooks;
@H_301_35@131@H_301_35@ 
132@H_301_35@ typedef  cJSON_bool;
@H_301_35@133@H_301_35@ 
134@H_301_35@  Limits how deeply nested arrays/objects can be before cJSON rejects to parse them.
@H_301_35@135@H_301_35@  * This is to prevent stack overflows. @H_301_35@136@H_301_35@ #ifndef CJSON_NESTING_LIMIT
@H_301_35@137@H_301_35@ #define@H_301_35@ CJSON_NESTING_LIMIT 1000
138@H_301_35@ 139@H_301_35@ 
140@H_301_35@  returns the version of cJSON as a string @H_301_35@141@H_301_35@ CJSON_PUBLIC(const@H_301_35@ char@H_301_35@*) cJSON_Version(142@H_301_35@ 
143@H_301_35@  Supply malloc,realloc and free functions to cJSON @H_301_35@144@H_301_35@ CJSON_PUBLIC(void@H_301_35@) cJSON_InitHooks(cJSON_Hooks* hooks);
@H_301_35@145@H_301_35@ 
146@H_301_35@  Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free,cJSON_Hooks.free_fn,or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated,where the caller has full responsibility of the buffer. @H_301_35@147@H_301_35@  Supply a block of JSON,and this returns a cJSON object you can interrogate. @H_301_35@148@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_Parse(value);
@H_301_35@149@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(value,size_t buffer_length);
@H_301_35@150@H_301_35@  ParseWithOpts allows you to require (and check) that the JSON is null terminated,and to retrieve the pointer to the final byte parsed. @H_301_35@151@H_301_35@  If you supply a ptr in return_parse_end and parsing fails,then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). @H_301_35@152@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(char@H_301_35@ *value,char@H_301_35@ **return_parse_end,cJSON_bool require_null_terminated);
@H_301_35@153@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(154@H_301_35@ 
155@H_301_35@  Render a cJSON entity to text for transfer/storage. @H_301_35@156@H_301_35@ CJSON_PUBLIC(char@H_301_35@ *) cJSON_Print(const@H_301_35@ cJSON *item);
@H_301_35@157@H_301_35@  Render a cJSON entity to text for transfer/storage without any formatting. @H_301_35@158@H_301_35@ CJSON_PUBLIC(char@H_301_35@ *) cJSON_PrintUnformatted(159@H_301_35@  Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted,=1 gives formatted @H_301_35@160@H_301_35@ CJSON_PUBLIC(char@H_301_35@ *) cJSON_PrintBuffered(const@H_301_35@ cJSON *item,1)"> prebuffer,cJSON_bool fmt);
@H_301_35@161@H_301_35@  Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. @H_301_35@162@H_301_35@  NOTE: cJSON is not always 100% accurate in estimating how much memory it will use,so to be safe allocate 5 bytes more than you actually need @H_301_35@163@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item,1)">char@H_301_35@ *buffer,1)">int@H_301_35@ length,1)"> cJSON_bool format);
@H_301_35@164@H_301_35@  Delete a cJSON entity and all subentities. @H_301_35@165@H_301_35@ CJSON_PUBLIC(void@H_301_35@) cJSON_Delete(cJSON *166@H_301_35@ 
167@H_301_35@  Returns the number of items in an array (or object). @H_301_35@168@H_301_35@ CJSON_PUBLIC(int@H_301_35@) cJSON_GetArraySize(array);
@H_301_35@169@H_301_35@  Retrieve item number "index" from array "array". Returns NULL if unsuccessful. @H_301_35@170@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const@H_301_35@ cJSON *array,1)"> index);
@H_301_35@171@H_301_35@  Get item "string" from object. Case insensitive. @H_301_35@172@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(object@H_301_35@,1)">char@H_301_35@ * 173@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(174@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(175@H_301_35@  For analysing Failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. @H_301_35@176@H_301_35@ CJSON_PUBLIC(char@H_301_35@ *) cJSON_GetErrorPtr(177@H_301_35@ 
178@H_301_35@  Check item type and return its value @H_301_35@179@H_301_35@ CJSON_PUBLIC(char@H_301_35@ *) cJSON_GetStringValue(cJSON *180@H_301_35@ CJSON_PUBLIC(double@H_301_35@) cJSON_GetNumberValue(cJSON *181@H_301_35@ 
182@H_301_35@  These functions check the type of an item @H_301_35@183@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid( item);
@H_301_35@184@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(185@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(186@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(187@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(188@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(189@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsString(190@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(191@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(192@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(193@H_301_35@ 
194@H_301_35@  These calls create a cJSON item of the appropriate type. @H_301_35@195@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateNull(196@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(197@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(198@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean);
@H_301_35@199@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateNumber( num);
@H_301_35@200@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateString(201@H_301_35@  raw json @H_301_35@202@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(raw);
@H_301_35@203@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateArray(204@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateObject(205@H_301_35@ 
206@H_301_35@  Create a string where valuestring references a string so
@H_301_35@207@H_301_35@  * it will not be freed by cJSON_Delete @H_301_35@208@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(209@H_301_35@  Create an object/array that only references it's elements so
@H_301_35@210@H_301_35@  * they will not be freed by cJSON_Delete @H_301_35@211@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(child);
@H_301_35@212@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(213@H_301_35@ 
214@H_301_35@  These utilities create an Array of count items.
@H_301_35@215@H_301_35@  * The parameter count cannot be greater than the number of elements in the number array,otherwise array access will be out of bounds.@H_301_35@216@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(int@H_301_35@ *numbers,1)"> count);
@H_301_35@217@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(float@H_301_35@ *numbers,1)">218@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(double@H_301_35@ *numbers,1)">219@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const@H_301_35@ *strings,1)">220@H_301_35@ 
221@H_301_35@  Append item to the specified array/object. @H_301_35@222@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array,cJSON *223@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *string@H_301_35@,1)">224@H_301_35@  Use this when string is definitely const (i.e. a literal,or as good as),and will definitely survive the cJSON object.
@H_301_35@225@H_301_35@  * WARNING: When this function was used,make sure to always check that (item->type & cJSON_StringIsConst) is zero before
@H_301_35@226@H_301_35@  * writing to `item->string` @H_301_35@227@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *228@H_301_35@  Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON,but don't want to corrupt your existing cJSON. @H_301_35@229@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array,1)">230@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *231@H_301_35@ 
232@H_301_35@  Remove/Detach items from Arrays/Objects. @H_301_35@233@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent,cJSON * 234@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array,1)"> which);
@H_301_35@235@H_301_35@ CJSON_PUBLIC(void@H_301_35@) cJSON_DeleteItemFromArray(cJSON *array,1)">236@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *237@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *238@H_301_35@ CJSON_PUBLIC(void@H_301_35@) cJSON_DeleteItemFromObject(cJSON *239@H_301_35@ CJSON_PUBLIC(void@H_301_35@) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *240@H_301_35@ 
241@H_301_35@  Update array items. @H_301_35@242@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(cJSON *array,1)">int@H_301_35@ which,cJSON *newitem);  Shifts pre-existing items to the right. @H_301_35@243@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const@H_301_35@ parent,1)">const@H_301_35@ item,1)"> replacement);
@H_301_35@244@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array,1)">newitem);
@H_301_35@245@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *246@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *247@H_301_35@ 
248@H_301_35@  Duplicate a cJSON item @H_301_35@249@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_Duplicate(item,cJSON_bool recurse);
@H_301_35@250@H_301_35@  Duplicate will create a new,identical cJSON item to the one you pass,in new memory that will
@H_301_35@251@H_301_35@  * need to be released. With recurse!=0,it will duplicate any children connected to the item.
@H_301_35@252@H_301_35@  * The item->next and ->prev pointers are always zero on return from Duplicate. @H_301_35@253@H_301_35@  Recursively compare two cJSON items for equality. If either a or b is NULL or invalid,they will be considered unequal.
@H_301_35@254@H_301_35@  * case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) @H_301_35@255@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const@H_301_35@ a,1)">const@H_301_35@ b,1)"> cJSON_bool case_sensitive);
@H_301_35@256@H_301_35@ 
257@H_301_35@  Minify a strings,remove blank characters(such as ' ','\t','\r','\n') from strings.
@H_301_35@258@H_301_35@  * The input pointer json cannot point to a read-only address area,such as a string constant,1)">259@H_301_35@  * but should point to a readable and writable adress area. @H_301_35@260@H_301_35@ CJSON_PUBLIC(void@H_301_35@) cJSON_Minify(json);
@H_301_35@261@H_301_35@ 
262@H_301_35@  Helper functions for creating and adding items to an object at the same time.
@H_301_35@263@H_301_35@  * They return the added item or NULL on failure. @H_301_35@264@H_301_35@ CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON *  name);
@H_301_35@265@H_301_35@ CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * 266@H_301_35@ CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * 267@H_301_35@ CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const@H_301_35@ name,1)"> cJSON_bool boolean);
@H_301_35@268@H_301_35@ CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON *  number);
@H_301_35@269@H_301_35@ CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * 270@H_301_35@ CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON *  raw);
@H_301_35@271@H_301_35@ CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * 272@H_301_35@ CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * 273@H_301_35@ 
274@H_301_35@  When assigning an integer value,it needs to be propagated to valuedouble too. @H_301_35@275@H_301_35@ #define@H_301_35@ cJSON_SetIntValue(object,number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number))
276@H_301_35@  helper for the cJSON_SetNumberValue macro @H_301_35@277@H_301_35@ CJSON_PUBLIC(double@H_301_35@) cJSON_SetNumberHelper(cJSON *278@H_301_35@ #define@H_301_35@ cJSON_SetNumberValue(object,number) ((object != NULL) ? cJSON_SetNumberHelper(object,(double)number) : (number))
279@H_301_35@  Change the valuestring of a cJSON_String object,only takes effect when type of object is cJSON_String @H_301_35@280@H_301_35@ CJSON_PUBLIC(char@H_301_35@*) cJSON_SetValuestring(cJSON *281@H_301_35@ 
282@H_301_35@  Macro for iterating over an array or object @H_301_35@283@H_301_35@ #define@H_301_35@ cJSON_ArrayForEach(element,array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
284@H_301_35@ 
285@H_301_35@  malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks @H_301_35@286@H_301_35@ CJSON_PUBLIC() cJSON_malloc(size_t size);
@H_301_35@287@H_301_35@ CJSON_PUBLIC(void@H_301_35@) cJSON_free(object@H_301_35@288@H_301_35@ 
289@H_301_35@ 290@H_301_35@ }
@H_301_35@291@H_301_35@ 292@H_301_35@ 
293@H_301_35@ #endif@H_301_35@
View Code@H_301_35@

cJSON.c

   1@H_301_35@    2@H_301_35@    3@H_301_35@ 
   4@H_301_35@    5@H_301_35@    6@H_301_35@    7@H_301_35@    8@H_301_35@    9@H_301_35@   10@H_301_35@ 
  11@H_301_35@   12@H_301_35@   13@H_301_35@ 
  14@H_301_35@   15@H_301_35@   16@H_301_35@   17@H_301_35@   18@H_301_35@   19@H_301_35@   20@H_301_35@   21@H_301_35@   22@H_301_35@ 
  23@H_301_35@  cJSON @H_301_35@  24@H_301_35@  JSON parser in C. @H_301_35@  25@H_301_35@ 
  26@H_301_35@  disable warnings about old C89 functions in MSVC @H_301_35@  27@H_301_35@ #if@H_301_35@ !defined(_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
  28@H_301_35@ #define@H_301_35@ _CRT_SECURE_NO_DEPRECATE
  29@H_301_35@   30@H_301_35@ 
  31@H_301_35@ #ifdef __GNUC__
@H_301_35@  32@H_301_35@ #pragma@H_301_35@ GCC visibility push(default)
  33@H_301_35@   34@H_301_35@ #if@H_301_35@ defined(_MSC_VER)
  35@H_301_35@ #pragma@H_301_35@ warning (push)
  36@H_301_35@  disable warning about single line comments in system headers @H_301_35@  37@H_301_35@ #pragma@H_301_35@ warning (disable : 4001)
  38@H_301_35@   39@H_301_35@ 
  40@H_301_35@ #include <string@H_301_35@.h>
  41@H_301_35@ #include <stdio.h>
  42@H_301_35@ #include <math.h>
  43@H_301_35@ #include <stdlib.h>
  44@H_301_35@ #include <limits.h>
  45@H_301_35@ #include <ctype.h>
  46@H_301_35@ #include <float@H_301_35@.h>
  47@H_301_35@ 
  48@H_301_35@ #ifdef ENABLE_LOCALES
@H_301_35@  49@H_301_35@ #include <locale.h>
  50@H_301_35@   51@H_301_35@ 
  52@H_301_35@   53@H_301_35@ #pragma@H_301_35@ warning (pop)
  54@H_301_35@   55@H_301_35@   56@H_301_35@ #pragma@H_301_35@ GCC visibility pop
  57@H_301_35@   58@H_301_35@ 
  59@H_301_35@ #include   60@H_301_35@ 
  61@H_301_35@  define our own boolean type @H_301_35@  62@H_301_35@ #ifdef true@H_301_35@
  63@H_301_35@ #undef@H_301_35@ true
  64@H_301_35@   65@H_301_35@ #define@H_301_35@ true ((cJSON_bool)1)
  66@H_301_35@ 
  67@H_301_35@ #ifdef false@H_301_35@
  68@H_301_35@ #undef@H_301_35@ false
  69@H_301_35@   70@H_301_35@ #define@H_301_35@ false ((cJSON_bool)0)
  71@H_301_35@ 
  72@H_301_35@  define isnan and isinf for ANSI C,if in C99 or above,isnan and isinf has been defined in math.h @H_301_35@  73@H_301_35@ #ifndef isinf
@H_301_35@  74@H_301_35@ #define@H_301_35@ isinf(d) (isnan((d - d)) && !isnan(d))
  75@H_301_35@   76@H_301_35@ #ifndef isnan
@H_301_35@  77@H_301_35@ #define@H_301_35@ isnan(d) (d != d)
  78@H_301_35@   79@H_301_35@ 
  80@H_301_35@ #ifndef NAN
@H_301_35@  81@H_301_35@ #define@H_301_35@ NAN 0.0/0.0
  82@H_301_35@   83@H_301_35@ 
  84@H_301_35@ typedef  {
@H_301_35@  85@H_301_35@     const@H_301_35@ unsigned json;
@H_301_35@  86@H_301_35@     size_t position;
@H_301_35@  87@H_301_35@ } error;
@H_301_35@  88@H_301_35@ static@H_301_35@ error global_error = { NULL,1)"> };
@H_301_35@  89@H_301_35@ 
  90@H_301_35@ CJSON_PUBLIC()
@H_301_35@  91@H_301_35@   92@H_301_35@     return@H_301_35@ (char@H_301_35@*) (global_error.json + global_error.position);
@H_301_35@  93@H_301_35@   94@H_301_35@ 
  95@H_301_35@ CJSON_PUBLIC(item) 
@H_301_35@  96@H_301_35@   97@H_301_35@     if@H_301_35@ (!cJSON_IsString(item)) 
@H_301_35@  98@H_301_35@     {
@H_301_35@  99@H_301_35@         return@H_301_35@ NULL;
@H_301_35@ 100@H_301_35@     }
@H_301_35@ 101@H_301_35@ 
 102@H_301_35@     return@H_301_35@ item-> 103@H_301_35@  104@H_301_35@ 
 105@H_301_35@ CJSON_PUBLIC( 106@H_301_35@  107@H_301_35@     cJSON_IsNumber(item)) 
@H_301_35@ 108@H_301_35@  109@H_301_35@          NAN;
@H_301_35@ 110@H_301_35@  111@H_301_35@ 
 112@H_301_35@     valuedouble;
@H_301_35@ 113@H_301_35@  114@H_301_35@ 
 115@H_301_35@  This is a safeguard to prevent copy-pasters from using incompatible C and header files @H_301_35@ 116@H_301_35@ #if@H_301_35@ (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 13)
 117@H_301_35@     #error@H_301_35@ cJSON.h and cJSON.c have different versions. Make sure that both have the same.
 118@H_301_35@  119@H_301_35@ 
 120@H_301_35@ CJSON_PUBLIC( 121@H_301_35@  122@H_301_35@     static@H_301_35@ char@H_301_35@ version[15@H_301_35@];
@H_301_35@ 123@H_301_35@     sprintf(version,1)">%i.%i.%i@H_301_35@301_35@ 124@H_301_35@ 
 125@H_301_35@      version;
@H_301_35@ 126@H_301_35@  127@H_301_35@ 
 128@H_301_35@  Case insensitive string comparison,doesn't consider two NULL pointers equal though @H_301_35@ 129@H_301_35@ int@H_301_35@ case_insensitive_strcmp(char@H_301_35@ *string1,1)">string2)
@H_301_35@ 130@H_301_35@  131@H_301_35@     if@H_301_35@ ((string1 == NULL) || (string2 == NULL))
@H_301_35@ 132@H_301_35@  133@H_301_35@         return@H_301_35@  134@H_301_35@  135@H_301_35@ 
 136@H_301_35@     if@H_301_35@ (string1 == string2)
@H_301_35@ 137@H_301_35@  138@H_301_35@          139@H_301_35@  140@H_301_35@ 
 141@H_301_35@     for@H_301_35@(; tolower(*string1) == tolower(*string2); (void@H_301_35@)string1++,string2++ 142@H_301_35@  143@H_301_35@         if@H_301_35@ (*string1 == '@H_301_35@\0@H_301_35@'@H_301_35@ 144@H_301_35@         {
@H_301_35@ 145@H_301_35@              146@H_301_35@         }
@H_301_35@ 147@H_301_35@  148@H_301_35@ 
 149@H_301_35@     return@H_301_35@ tolower(*string1) - tolower(*string2);
@H_301_35@ 150@H_301_35@  151@H_301_35@ 
 152@H_301_35@ typedef  internal_hooks
@H_301_35@ 153@H_301_35@  154@H_301_35@     allocate)(size_t size);
@H_301_35@ 155@H_301_35@     void@H_301_35@ (CJSON_CDECL *deallocate)(pointer);
@H_301_35@ 156@H_301_35@     void@H_301_35@ *(CJSON_CDECL *reallocate)(pointer,size_t size);
@H_301_35@ 157@H_301_35@ } internal_hooks;
@H_301_35@ 158@H_301_35@ 
 159@H_301_35@  160@H_301_35@  work around MSVC error C2322: '...' address of dllimport '...' is not static @H_301_35@ 161@H_301_35@  CJSON_CDECL internal_malloc(size_t size)
@H_301_35@ 162@H_301_35@  163@H_301_35@     return@H_301_35@ malloc@H_301_35@(size);
@H_301_35@ 164@H_301_35@  165@H_301_35@ void@H_301_35@ CJSON_CDECL internal_free(pointer)
@H_301_35@ 166@H_301_35@  167@H_301_35@     (pointer);
@H_301_35@ 168@H_301_35@  169@H_301_35@ void@H_301_35@ * CJSON_CDECL internal_realloc(301_35@ 170@H_301_35@  171@H_301_35@     realloc@H_301_35@(pointer,size);
@H_301_35@ 172@H_301_35@  173@H_301_35@  174@H_301_35@ #define@H_301_35@ internal_malloc malloc
 175@H_301_35@ #define@H_301_35@ internal_free free
 176@H_301_35@ #define@H_301_35@ internal_realloc realloc
 177@H_301_35@  178@H_301_35@ 
 179@H_301_35@  strlen of character literals resolved at compile time @H_301_35@ 180@H_301_35@ #define@H_301_35@ static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
 181@H_301_35@ 
 182@H_301_35@ static@H_301_35@ internal_hooks global_hooks = { internal_malloc,internal_free,internal_realloc };
@H_301_35@ 183@H_301_35@ 
 184@H_301_35@ static@H_301_35@ unsigned char@H_301_35@* cJSON_strdup(char@H_301_35@* const@H_301_35@ internal_hooks *  hooks)
@H_301_35@ 185@H_301_35@  186@H_301_35@     size_t length =  187@H_301_35@     unsigned char@H_301_35@ *copy = 188@H_301_35@ 
 189@H_301_35@     if@H_301_35@ (string@H_301_35@ == NULL)
@H_301_35@ 190@H_301_35@  191@H_301_35@          192@H_301_35@  193@H_301_35@ 
 194@H_301_35@     length = strlen((char@H_301_35@*)string@H_301_35@) + sizeof@H_301_35@(""@H_301_35@ 195@H_301_35@     copy = (unsigned char@H_301_35@*)hooks->allocate(length);
@H_301_35@ 196@H_301_35@     if@H_301_35@ (copy == 197@H_301_35@  198@H_301_35@          199@H_301_35@  200@H_301_35@     memcpy(copy,length);
@H_301_35@ 201@H_301_35@ 
 202@H_301_35@      copy;
@H_301_35@ 203@H_301_35@  204@H_301_35@ 
 205@H_301_35@ CJSON_PUBLIC( 206@H_301_35@  207@H_301_35@     if@H_301_35@ (hooks == 208@H_301_35@  209@H_301_35@          Reset hooks @H_301_35@ 210@H_301_35@         global_hooks.allocate =  211@H_301_35@         global_hooks.deallocate =  212@H_301_35@         global_hooks.reallocate =  213@H_301_35@          214@H_301_35@  215@H_301_35@ 
 216@H_301_35@     global_hooks.allocate =  217@H_301_35@     if@H_301_35@ (hooks->malloc_fn != 218@H_301_35@  219@H_301_35@         global_hooks.allocate = hooks->malloc_fn;
@H_301_35@ 220@H_301_35@  221@H_301_35@ 
 222@H_301_35@     global_hooks.deallocate =  223@H_301_35@     if@H_301_35@ (hooks->free_fn != 224@H_301_35@  225@H_301_35@         global_hooks.deallocate = hooks->free_fn;
@H_301_35@ 226@H_301_35@  227@H_301_35@ 
 228@H_301_35@      use realloc only if both free and malloc are used @H_301_35@ 229@H_301_35@     global_hooks.reallocate = 230@H_301_35@     if@H_301_35@ ((global_hooks.allocate == malloc@H_301_35@) && (global_hooks.deallocate == ))
@H_301_35@ 231@H_301_35@  232@H_301_35@         global_hooks.reallocate =  233@H_301_35@  234@H_301_35@  235@H_301_35@ 
 236@H_301_35@  Internal constructor. @H_301_35@ 237@H_301_35@ static@H_301_35@ cJSON *cJSON_New_Item( 238@H_301_35@  239@H_301_35@     cJSON* node = (cJSON*)hooks->allocate(sizeof@H_301_35@(cJSON));
@H_301_35@ 240@H_301_35@     if@H_301_35@ (node)
@H_301_35@ 241@H_301_35@  242@H_301_35@         memset(node,1)">'@H_301_35@,1)"> 243@H_301_35@  244@H_301_35@ 
 245@H_301_35@      node;
@H_301_35@ 246@H_301_35@  247@H_301_35@ 
 248@H_301_35@  Delete a cJSON structure. @H_301_35@ 249@H_301_35@ CJSON_PUBLIC(item)
@H_301_35@ 250@H_301_35@  251@H_301_35@     cJSON *next = 252@H_301_35@     while@H_301_35@ (item != 253@H_301_35@  254@H_301_35@         next = item-> 255@H_301_35@         if@H_301_35@ (!(item->type & cJSON_IsReference) && (item->child != 256@H_301_35@  257@H_301_35@             cJSON_Delete(item-> 258@H_301_35@  259@H_301_35@         if@H_301_35@ (!(item->type & cJSON_IsReference) && (item->valuestring != 260@H_301_35@  261@H_301_35@             global_hooks.deallocate(item-> 262@H_301_35@  263@H_301_35@         if@H_301_35@ (!(item->type & cJSON_StringIsConst) && (item->string@H_301_35@ != 264@H_301_35@  265@H_301_35@             global_hooks.deallocate(item-> 266@H_301_35@  267@H_301_35@         global_hooks.deallocate(item);
@H_301_35@ 268@H_301_35@         item = next;
@H_301_35@ 269@H_301_35@  270@H_301_35@  271@H_301_35@ 
 272@H_301_35@  get the decimal point character of the current locale @H_301_35@ 273@H_301_35@ char@H_301_35@ get_decimal_point( 274@H_301_35@  275@H_301_35@  276@H_301_35@     struct@H_301_35@ lconv *lconv = localeconv();
@H_301_35@ 277@H_301_35@     return@H_301_35@ (unsigned char@H_301_35@) lconv->decimal_point[ 278@H_301_35@  279@H_301_35@     .@H_301_35@ 280@H_301_35@  281@H_301_35@  282@H_301_35@ 
 283@H_301_35@ typedef struct@H_301_35@
 284@H_301_35@  285@H_301_35@     content;
@H_301_35@ 286@H_301_35@     size_t length;
@H_301_35@ 287@H_301_35@     size_t offset;
@H_301_35@ 288@H_301_35@     size_t depth;  How deeply nested (in arrays/objects) is the input at the current offset. @H_301_35@ 289@H_301_35@     internal_hooks hooks;
@H_301_35@ 290@H_301_35@ } parse_buffer;
@H_301_35@ 291@H_301_35@ 
 292@H_301_35@  check if the given size is left to read in a given parse buffer (starting with 1) @H_301_35@ 293@H_301_35@ #define@H_301_35@ can_read(buffer,size) ((buffer != NULL) && (((buffer)->offset + size) <= (buffer)->length))
 294@H_301_35@  check if the buffer can be accessed at the given index (starting with 0) @H_301_35@ 295@H_301_35@ #define@H_301_35@ can_access_at_index(buffer,index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
 296@H_301_35@ #define@H_301_35@ cannot_access_at_index(buffer,index) (!can_access_at_index(buffer,index))
 297@H_301_35@  get a pointer to the buffer at the position @H_301_35@ 298@H_301_35@ #define@H_301_35@ buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
 299@H_301_35@ 
 300@H_301_35@  Parse the input text to generate a number,and populate the result into item. @H_301_35@ 301@H_301_35@ static@H_301_35@ cJSON_bool parse_number(cJSON *  input_buffer)
@H_301_35@ 302@H_301_35@  303@H_301_35@     double@H_301_35@ number =  304@H_301_35@     unsigned char@H_301_35@ *after_end = 305@H_301_35@     unsigned char@H_301_35@ number_c_string[64@H_301_35@ 306@H_301_35@     unsigned char@H_301_35@ decimal_point = get_decimal_point();
@H_301_35@ 307@H_301_35@     size_t i =  308@H_301_35@ 
 309@H_301_35@     if@H_301_35@ ((input_buffer == NULL) || (input_buffer->content == 310@H_301_35@  311@H_301_35@         false@H_301_35@ 312@H_301_35@  313@H_301_35@ 
 314@H_301_35@      copy the number into a temporary buffer and replace '.' with the decimal point
@H_301_35@ 315@H_301_35@      * of the current locale (for strtod)
@H_301_35@ 316@H_301_35@      * This also takes care of '\0' not necessarily being available for marking the end of the input @H_301_35@ 317@H_301_35@     for@H_301_35@ (i = 0@H_301_35@; (i < (sizeof@H_301_35@(number_c_string) - 1@H_301_35@)) && can_access_at_index(input_buffer,i); i++ 318@H_301_35@  319@H_301_35@         switch@H_301_35@ (buffer_at_offset(input_buffer)[i])
@H_301_35@ 320@H_301_35@  321@H_301_35@             case@H_301_35@ 0@H_301_35@:
@H_301_35@ 322@H_301_35@             1@H_301_35@ 323@H_301_35@             2@H_301_35@ 324@H_301_35@             3@H_301_35@ 325@H_301_35@             4@H_301_35@ 326@H_301_35@             5@H_301_35@ 327@H_301_35@             6@H_301_35@ 328@H_301_35@             7@H_301_35@ 329@H_301_35@             8@H_301_35@ 330@H_301_35@             9@H_301_35@ 331@H_301_35@             +@H_301_35@ 332@H_301_35@             -@H_301_35@ 333@H_301_35@             e@H_301_35@ 334@H_301_35@             E@H_301_35@ 335@H_301_35@                 number_c_string[i] = buffer_at_offset(input_buffer)[i];
@H_301_35@ 336@H_301_35@                 break@H_301_35@ 337@H_301_35@ 
 338@H_301_35@              339@H_301_35@                 number_c_string[i] = decimal_point;
@H_301_35@ 340@H_301_35@                  341@H_301_35@ 
 342@H_301_35@             default@H_301_35@ 343@H_301_35@                 goto@H_301_35@ loop_end;
@H_301_35@ 344@H_301_35@  345@H_301_35@  346@H_301_35@ loop_end:
@H_301_35@ 347@H_301_35@     number_c_string[i] =  348@H_301_35@ 
 349@H_301_35@     number = strtod((char@H_301_35@*)number_c_string,(char@H_301_35@**)&after_end);
@H_301_35@ 350@H_301_35@     if@H_301_35@ (number_c_string == after_end)
@H_301_35@ 351@H_301_35@  352@H_301_35@         false@H_301_35@;  parse_error @H_301_35@ 353@H_301_35@  354@H_301_35@ 
 355@H_301_35@     item->valuedouble = number;
@H_301_35@ 356@H_301_35@ 
 357@H_301_35@      use saturation in case of overflow @H_301_35@ 358@H_301_35@     if@H_301_35@ (number >= INT_MAX)
@H_301_35@ 359@H_301_35@  360@H_301_35@         item->valueint = INT_MAX;
@H_301_35@ 361@H_301_35@  362@H_301_35@     else@H_301_35@ if@H_301_35@ (number <= ()INT_MIN)
@H_301_35@ 363@H_301_35@  364@H_301_35@         item->valueint = INT_MIN;
@H_301_35@ 365@H_301_35@  366@H_301_35@     else@H_301_35@
 367@H_301_35@  368@H_301_35@         item->valueint = ()number;
@H_301_35@ 369@H_301_35@  370@H_301_35@ 
 371@H_301_35@     item->type = cJSON_Number;
@H_301_35@ 372@H_301_35@ 
 373@H_301_35@     input_buffer->offset += (size_t)(after_end - number_c_string);
@H_301_35@ 374@H_301_35@     true@H_301_35@ 375@H_301_35@  376@H_301_35@ 
 377@H_301_35@  don't ask me,but the original cJSON_SetNumberValue returns an integer or double @H_301_35@ 378@H_301_35@ CJSON_PUBLIC( number)
@H_301_35@ 379@H_301_35@  380@H_301_35@      381@H_301_35@  382@H_301_35@         object@H_301_35@->valueint = 383@H_301_35@  384@H_301_35@      385@H_301_35@  386@H_301_35@          387@H_301_35@  388@H_301_35@      389@H_301_35@  390@H_301_35@         object@H_301_35@->valueint = ( 391@H_301_35@  392@H_301_35@ 
 393@H_301_35@     object@H_301_35@->valuedouble = 394@H_301_35@  395@H_301_35@ 
 396@H_301_35@ CJSON_PUBLIC(valuestring)
@H_301_35@ 397@H_301_35@  398@H_301_35@      399@H_301_35@      if object's type is not cJSON_String or is cJSON_IsReference,it should not set valuestring @H_301_35@ 400@H_301_35@     if@H_301_35@ (!(object@H_301_35@->type & cJSON_String) || (object@H_301_35@->type & cJSON_IsReference))
@H_301_35@ 401@H_301_35@  402@H_301_35@          403@H_301_35@  404@H_301_35@     if@H_301_35@ (strlen(valuestring) <= strlen(object@H_301_35@->valuestring))
@H_301_35@ 405@H_301_35@  406@H_301_35@         strcpy(valuestring,valuestring);
@H_301_35@ 407@H_301_35@          408@H_301_35@  409@H_301_35@     copy = (char@H_301_35@*) cJSON_strdup((char@H_301_35@*)valuestring,&global_hooks);
@H_301_35@ 410@H_301_35@      411@H_301_35@  412@H_301_35@          413@H_301_35@  414@H_301_35@     object@H_301_35@->valuestring != 415@H_301_35@  416@H_301_35@         cJSON_free( 417@H_301_35@  418@H_301_35@     object@H_301_35@->valuestring = 419@H_301_35@ 
 420@H_301_35@      421@H_301_35@  422@H_301_35@ 
 423@H_301_35@ typedef  424@H_301_35@  425@H_301_35@     unsigned buffer;
@H_301_35@ 426@H_301_35@  427@H_301_35@  428@H_301_35@     size_t depth;  current nesting depth (for formatted printing) @H_301_35@ 429@H_301_35@     cJSON_bool noalloc;
@H_301_35@ 430@H_301_35@     cJSON_bool format;  is this print a formatted print @H_301_35@ 431@H_301_35@  432@H_301_35@ } printbuffer;
@H_301_35@ 433@H_301_35@ 
 434@H_301_35@  realloc printbuffer if necessary to have at least "needed" bytes more @H_301_35@ 435@H_301_35@ char@H_301_35@* ensure(printbuffer *  p,size_t needed)
@H_301_35@ 436@H_301_35@  437@H_301_35@     unsigned char@H_301_35@ *newbuffer = 438@H_301_35@     size_t newsize =  439@H_301_35@ 
 440@H_301_35@     if@H_301_35@ ((p == NULL) || (p->buffer == 441@H_301_35@  442@H_301_35@          443@H_301_35@  444@H_301_35@ 
 445@H_301_35@     if@H_301_35@ ((p->length > 0@H_301_35@) && (p->offset >= p->length))
@H_301_35@ 446@H_301_35@  447@H_301_35@          make sure that offset is valid @H_301_35@ 448@H_301_35@          449@H_301_35@  450@H_301_35@ 
 451@H_301_35@     if@H_301_35@ (needed > 452@H_301_35@  453@H_301_35@          sizes bigger than INT_MAX are currently not supported @H_301_35@ 454@H_301_35@          455@H_301_35@  456@H_301_35@ 
 457@H_301_35@     needed += p->offset +  458@H_301_35@     if@H_301_35@ (needed <= p->length)
@H_301_35@ 459@H_301_35@  460@H_301_35@         return@H_301_35@ p->buffer + p->offset;
@H_301_35@ 461@H_301_35@  462@H_301_35@ 
 463@H_301_35@     if@H_301_35@ (p->noalloc) {
@H_301_35@ 464@H_301_35@          465@H_301_35@  466@H_301_35@ 
 467@H_301_35@      calculate new buffer size @H_301_35@ 468@H_301_35@     if@H_301_35@ (needed > (INT_MAX /  469@H_301_35@  470@H_301_35@          overflow of int,use INT_MAX if possible @H_301_35@ 471@H_301_35@         if@H_301_35@ (needed <= 472@H_301_35@  473@H_301_35@             newsize = 474@H_301_35@  475@H_301_35@          476@H_301_35@  477@H_301_35@              478@H_301_35@  479@H_301_35@  480@H_301_35@      481@H_301_35@  482@H_301_35@         newsize = needed *  483@H_301_35@  484@H_301_35@ 
 485@H_301_35@     if@H_301_35@ (p->hooks.reallocate != 486@H_301_35@  487@H_301_35@          reallocate with realloc if available @H_301_35@ 488@H_301_35@         newbuffer = (unsigned char@H_301_35@*)p->hooks.reallocate(p->buffer,newsize);
@H_301_35@ 489@H_301_35@         if@H_301_35@ (newbuffer == 490@H_301_35@  491@H_301_35@             p->hooks.deallocate(p->buffer);
@H_301_35@ 492@H_301_35@             p->length =  493@H_301_35@             p->buffer = 494@H_301_35@ 
 495@H_301_35@              496@H_301_35@  497@H_301_35@  498@H_301_35@      499@H_301_35@  500@H_301_35@          otherwise reallocate manually @H_301_35@ 501@H_301_35@         newbuffer = (unsigned char@H_301_35@*)p->hooks.allocate(newsize);
@H_301_35@ 502@H_301_35@         newbuffer)
@H_301_35@ 503@H_301_35@  504@H_301_35@             p->hooks.deallocate(p-> 505@H_301_35@             p->length =  506@H_301_35@             p->buffer = 507@H_301_35@ 
 508@H_301_35@              509@H_301_35@  510@H_301_35@          (newbuffer)
@H_301_35@ 511@H_301_35@  512@H_301_35@             memcpy(newbuffer,p->buffer,p->offset +  513@H_301_35@  514@H_301_35@         p->hooks.deallocate(p-> 515@H_301_35@  516@H_301_35@     p->length = newsize;
@H_301_35@ 517@H_301_35@     p->buffer = newbuffer;
@H_301_35@ 518@H_301_35@ 
 519@H_301_35@     return@H_301_35@ newbuffer + p-> 520@H_301_35@  521@H_301_35@ 
 522@H_301_35@  calculate the new length of the string in a printbuffer and update the offset @H_301_35@ 523@H_301_35@ void@H_301_35@ update_offset(printbuffer *  buffer)
@H_301_35@ 524@H_301_35@  525@H_301_35@     char@H_301_35@ *buffer_pointer = 526@H_301_35@     if@H_301_35@ ((buffer == NULL) || (buffer->buffer == 527@H_301_35@  528@H_301_35@          529@H_301_35@  530@H_301_35@     buffer_pointer = buffer->buffer + buffer-> 531@H_301_35@ 
 532@H_301_35@     buffer->offset += strlen((char@H_301_35@*)buffer_pointer);
@H_301_35@ 533@H_301_35@  534@H_301_35@ 
 535@H_301_35@  securely comparison of floating-point variables @H_301_35@ 536@H_301_35@ static@H_301_35@ cJSON_bool compare_double(double@H_301_35@ a,1)"> b)
@H_301_35@ 537@H_301_35@  538@H_301_35@     double@H_301_35@ maxVal = fabs(a) > fabs(b) ? fabs(a) : fabs(b);
@H_301_35@ 539@H_301_35@     return@H_301_35@ (fabs(a - b) <= maxVal * DBL_EPSILON);
@H_301_35@ 540@H_301_35@  541@H_301_35@ 
 542@H_301_35@  Render the number nicely from the given item into a string. @H_301_35@ 543@H_301_35@ static@H_301_35@ cJSON_bool print_number( output_buffer)
@H_301_35@ 544@H_301_35@  545@H_301_35@     unsigned char@H_301_35@ *output_pointer = 546@H_301_35@     double@H_301_35@ d = item-> 547@H_301_35@     int@H_301_35@ length =  548@H_301_35@     size_t i =  549@H_301_35@     unsigned char@H_301_35@ number_buffer[26@H_301_35@] = {0@H_301_35@};  temporary buffer to print the number into @H_301_35@ 550@H_301_35@     unsigned  551@H_301_35@     double@H_301_35@ test = 0.0@H_301_35@ 552@H_301_35@ 
 553@H_301_35@     if@H_301_35@ (output_buffer == 554@H_301_35@  555@H_301_35@          556@H_301_35@  557@H_301_35@ 
 558@H_301_35@      This checks for NaN and Infinity @H_301_35@ 559@H_301_35@     if@H_301_35@ (isnan(d) || isinf(d))
@H_301_35@ 560@H_301_35@  561@H_301_35@         length = sprintf((char@H_301_35@*)number_buffer,1)">null@H_301_35@ 562@H_301_35@  563@H_301_35@      564@H_301_35@  565@H_301_35@          Try 15 decimal places of precision to avoid nonsignificant nonzero digits @H_301_35@ 566@H_301_35@         length = sprintf((%1.15g@H_301_35@301_35@ 567@H_301_35@ 
 568@H_301_35@          Check whether the original double can be recovered @H_301_35@ 569@H_301_35@         if@H_301_35@ ((sscanf((%lg@H_301_35@1@H_301_35@) || !compare_double(()test,d))
@H_301_35@ 570@H_301_35@  571@H_301_35@              If not,print with 17 decimal places of precision @H_301_35@ 572@H_301_35@             length = sprintf((%1.17g@H_301_35@ 573@H_301_35@  574@H_301_35@  575@H_301_35@ 
 576@H_301_35@      sprintf Failed or buffer overrun occurred @H_301_35@ 577@H_301_35@     if@H_301_35@ ((length < 0@H_301_35@) || (length > (int@H_301_35@)(sizeof@H_301_35@(number_buffer) - )))
@H_301_35@ 578@H_301_35@  579@H_301_35@          580@H_301_35@  581@H_301_35@ 
 582@H_301_35@      reserve appropriate space in the output @H_301_35@ 583@H_301_35@     output_pointer = ensure(output_buffer,(size_t)length +  584@H_301_35@     if@H_301_35@ (output_pointer == 585@H_301_35@  586@H_301_35@          587@H_301_35@  588@H_301_35@ 
 589@H_301_35@      copy the printed number to the output and replace locale
@H_301_35@ 590@H_301_35@      * dependent decimal point with '.' @H_301_35@ 591@H_301_35@     0@H_301_35@; i < ((size_t)length); i++ 592@H_301_35@  593@H_301_35@         if@H_301_35@ (number_buffer[i] == decimal_point)
@H_301_35@ 594@H_301_35@  595@H_301_35@             output_pointer[i] =  596@H_301_35@             continue@H_301_35@ 597@H_301_35@  598@H_301_35@ 
 599@H_301_35@         output_pointer[i] = number_buffer[i];
@H_301_35@ 600@H_301_35@  601@H_301_35@     output_pointer[i] =  602@H_301_35@ 
 603@H_301_35@     output_buffer->offset += (size_t)length;
@H_301_35@ 604@H_301_35@ 
 605@H_301_35@      606@H_301_35@  607@H_301_35@ 
 608@H_301_35@  parse 4 digit hexadecimal number @H_301_35@ 609@H_301_35@ static@H_301_35@ unsigned parse_hex4( input)
@H_301_35@ 610@H_301_35@  611@H_301_35@     unsigned int@H_301_35@ h =  612@H_301_35@     size_t i =  613@H_301_35@ 
 614@H_301_35@     0@H_301_35@; i < 4@H_301_35@; i++ 615@H_301_35@  616@H_301_35@          parse digit @H_301_35@ 617@H_301_35@         if@H_301_35@ ((input[i] >= '@H_301_35@) && (input[i] <=  618@H_301_35@  619@H_301_35@             h += (unsigned int@H_301_35@) input[i] -  620@H_301_35@  621@H_301_35@         A@H_301_35@F@H_301_35@ 622@H_301_35@  623@H_301_35@             h += (unsigned int@H_301_35@) 10@H_301_35@ + input[i] -  624@H_301_35@  625@H_301_35@         a@H_301_35@f@H_301_35@ 626@H_301_35@  627@H_301_35@             h += (unsigned  628@H_301_35@  629@H_301_35@          invalid @H_301_35@ 630@H_301_35@  631@H_301_35@              632@H_301_35@  633@H_301_35@ 
 634@H_301_35@         if@H_301_35@ (i < 3@H_301_35@ 635@H_301_35@  636@H_301_35@              shift left to make place for the next nibble @H_301_35@ 637@H_301_35@             h = h << 4@H_301_35@ 638@H_301_35@  639@H_301_35@  640@H_301_35@ 
 641@H_301_35@      h;
@H_301_35@ 642@H_301_35@  643@H_301_35@ 
 644@H_301_35@  converts a UTF-16 literal to UTF-8
@H_301_35@ 645@H_301_35@  * A literal can be one or two sequences of the form \uXXXX @H_301_35@ 646@H_301_35@ char@H_301_35@ utf16_literal_to_utf8(const@H_301_35@ input_pointer,1)">const@H_301_35@ input_end,unsigned output_pointer)
@H_301_35@ 647@H_301_35@  648@H_301_35@     long@H_301_35@ unsigned int@H_301_35@ codepoint =  649@H_301_35@     unsigned int@H_301_35@ first_code =  650@H_301_35@     char@H_301_35@ *first_sequence = input_pointer;
@H_301_35@ 651@H_301_35@     unsigned char@H_301_35@ utf8_length =  652@H_301_35@     unsigned char@H_301_35@ utf8_position =  653@H_301_35@     unsigned char@H_301_35@ sequence_length =  654@H_301_35@     unsigned char@H_301_35@ first_byte_mark =  655@H_301_35@ 
 656@H_301_35@     if@H_301_35@ ((input_end - first_sequence) < 6@H_301_35@ 657@H_301_35@  658@H_301_35@          input ends unexpectedly @H_301_35@ 659@H_301_35@          fail;
@H_301_35@ 660@H_301_35@  661@H_301_35@ 
 662@H_301_35@      get the first utf16 sequence @H_301_35@ 663@H_301_35@     first_code = parse_hex4(first_sequence +  664@H_301_35@ 
 665@H_301_35@      check that the code is valid @H_301_35@ 666@H_301_35@     if@H_301_35@ (((first_code >= 0xDC00@H_301_35@) && (first_code <= 0xDFFF@H_301_35@ 667@H_301_35@  668@H_301_35@          669@H_301_35@  670@H_301_35@ 
 671@H_301_35@      UTF16 surrogate pair @H_301_35@ 672@H_301_35@     if@H_301_35@ ((first_code >= 0xD800@H_301_35@) && (first_code <= 0xDBFF@H_301_35@ 673@H_301_35@  674@H_301_35@         char@H_301_35@ *second_sequence = first_sequence +  675@H_301_35@         unsigned int@H_301_35@ second_code =  676@H_301_35@         sequence_length = 12@H_301_35@;  \uXXXX\uXXXX @H_301_35@ 677@H_301_35@ 
 678@H_301_35@         if@H_301_35@ ((input_end - second_sequence) <  679@H_301_35@  680@H_301_35@              681@H_301_35@              682@H_301_35@  683@H_301_35@ 
 684@H_301_35@         if@H_301_35@ ((second_sequence[0@H_301_35@] != \\@H_301_35@'@H_301_35@) || (second_sequence[1@H_301_35@] != u@H_301_35@ 685@H_301_35@  686@H_301_35@              missing second half of the surrogate pair @H_301_35@ 687@H_301_35@              688@H_301_35@  689@H_301_35@ 
 690@H_301_35@          get the second utf16 sequence @H_301_35@ 691@H_301_35@         second_code = parse_hex4(second_sequence +  692@H_301_35@          693@H_301_35@         if@H_301_35@ ((second_code < 0xDC00@H_301_35@) || (second_code >  694@H_301_35@  695@H_301_35@              invalid second half of the surrogate pair @H_301_35@ 696@H_301_35@              697@H_301_35@  698@H_301_35@ 
 699@H_301_35@ 
 700@H_301_35@          calculate the unicode codepoint from the surrogate pair @H_301_35@ 701@H_301_35@         codepoint = 0x10000@H_301_35@ + (((first_code & 0x3FF@H_301_35@) << 10@H_301_35@) | (second_code & 0x3FF@H_301_35@ 702@H_301_35@  703@H_301_35@      704@H_301_35@  705@H_301_35@         sequence_length = 6@H_301_35@;  \uXXXX @H_301_35@ 706@H_301_35@         codepoint = first_code;
@H_301_35@ 707@H_301_35@  708@H_301_35@ 
 709@H_301_35@      encode as UTF-8
@H_301_35@ 710@H_301_35@      * takes at maximum 4 bytes to encode:
@H_301_35@ 711@H_301_35@      * 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx @H_301_35@ 712@H_301_35@     if@H_301_35@ (codepoint < 0x80@H_301_35@ 713@H_301_35@  714@H_301_35@          normal ascii,encoding 0xxxxxxx @H_301_35@ 715@H_301_35@         utf8_length =  716@H_301_35@  717@H_301_35@     0x800@H_301_35@ 718@H_301_35@  719@H_301_35@          two bytes,encoding 110xxxxx 10xxxxxx @H_301_35@ 720@H_301_35@         utf8_length =  721@H_301_35@         first_byte_mark = 0xC0@H_301_35@;  11000000 @H_301_35@ 722@H_301_35@  723@H_301_35@     0x10000@H_301_35@ 724@H_301_35@  725@H_301_35@          three bytes,encoding 1110xxxx 10xxxxxx 10xxxxxx @H_301_35@ 726@H_301_35@         utf8_length =  727@H_301_35@         first_byte_mark = 0xE0@H_301_35@;  11100000 @H_301_35@ 728@H_301_35@  729@H_301_35@     if@H_301_35@ (codepoint <= 0x10FFFF@H_301_35@ 730@H_301_35@  731@H_301_35@          four bytes,encoding 1110xxxx 10xxxxxx 10xxxxxx 10xxxxxx @H_301_35@ 732@H_301_35@         utf8_length =  733@H_301_35@         first_byte_mark = 0xF0@H_301_35@;  11110000 @H_301_35@ 734@H_301_35@  735@H_301_35@      736@H_301_35@  737@H_301_35@          invalid unicode codepoint @H_301_35@ 738@H_301_35@          739@H_301_35@  740@H_301_35@ 
 741@H_301_35@      encode as utf8 @H_301_35@ 742@H_301_35@     for@H_301_35@ (utf8_position = (unsigned char@H_301_35@)(utf8_length - 1@H_301_35@); utf8_position > 0@H_301_35@; utf8_position-- 743@H_301_35@  744@H_301_35@          10xxxxxx @H_301_35@ 745@H_301_35@         (*output_pointer)[utf8_position] = (unsigned char@H_301_35@)((codepoint | 0x80@H_301_35@) & 0xBF@H_301_35@ 746@H_301_35@         codepoint >>=  747@H_301_35@  748@H_301_35@      encode first byte @H_301_35@ 749@H_301_35@     if@H_301_35@ (utf8_length >  750@H_301_35@  751@H_301_35@         (*output_pointer)[0@H_301_35@] = (unsigned char@H_301_35@)((codepoint | first_byte_mark) & 0xFF@H_301_35@ 752@H_301_35@  753@H_301_35@      754@H_301_35@  755@H_301_35@         (*output_pointer)[char@H_301_35@)(codepoint & 0x7F@H_301_35@ 756@H_301_35@  757@H_301_35@ 
 758@H_301_35@     *output_pointer += utf8_length;
@H_301_35@ 759@H_301_35@ 
 760@H_301_35@      sequence_length;
@H_301_35@ 761@H_301_35@ 
 762@H_301_35@ fail:
@H_301_35@ 763@H_301_35@      764@H_301_35@  765@H_301_35@ 
 766@H_301_35@  Parse the input text into an unescaped cinput,and populate item. @H_301_35@ 767@H_301_35@ static@H_301_35@ cJSON_bool parse_string(cJSON *  768@H_301_35@  769@H_301_35@     char@H_301_35@ *input_pointer = buffer_at_offset(input_buffer) +  770@H_301_35@     char@H_301_35@ *input_end = buffer_at_offset(input_buffer) +  771@H_301_35@     unsigned  772@H_301_35@     unsigned char@H_301_35@ *output = 773@H_301_35@ 
 774@H_301_35@      not a string @H_301_35@ 775@H_301_35@     if@H_301_35@ (buffer_at_offset(input_buffer)[\"@H_301_35@ 776@H_301_35@  777@H_301_35@          778@H_301_35@  779@H_301_35@ 
 780@H_301_35@  781@H_301_35@          calculate approximate size of the output (overestimate) @H_301_35@ 782@H_301_35@         size_t allocation_length =  783@H_301_35@         size_t skipped_bytes =  784@H_301_35@         while@H_301_35@ (((size_t)(input_end - input_buffer->content) < input_buffer->length) && (*input_end !=  785@H_301_35@  786@H_301_35@              is escape sequence @H_301_35@ 787@H_301_35@             if@H_301_35@ (input_end[0@H_301_35@] ==  788@H_301_35@             {
@H_301_35@ 789@H_301_35@                 if@H_301_35@ ((size_t)(input_end + 1@H_301_35@ - input_buffer->content) >= input_buffer-> 790@H_301_35@                 {
@H_301_35@ 791@H_301_35@                      prevent buffer overflow when last input character is a backslash @H_301_35@ 792@H_301_35@                      793@H_301_35@                 }
@H_301_35@ 794@H_301_35@                 skipped_bytes++ 795@H_301_35@                 input_end++ 796@H_301_35@             }
@H_301_35@ 797@H_301_35@             input_end++ 798@H_301_35@  799@H_301_35@         if@H_301_35@ (((size_t)(input_end - input_buffer->content) >= input_buffer->length) || (*input_end !=  800@H_301_35@  801@H_301_35@             goto@H_301_35@ fail;  string ended unexpectedly @H_301_35@ 802@H_301_35@  803@H_301_35@ 
 804@H_301_35@          This is at most how much we need for the output @H_301_35@ 805@H_301_35@         allocation_length = (size_t) (input_end - buffer_at_offset(input_buffer)) - skipped_bytes;
@H_301_35@ 806@H_301_35@         output = (unsigned char@H_301_35@*)input_buffer->hooks.allocate(allocation_length +  807@H_301_35@         if@H_301_35@ (output == 808@H_301_35@  809@H_301_35@              allocation failure @H_301_35@ 810@H_301_35@  811@H_301_35@  812@H_301_35@ 
 813@H_301_35@     output_pointer = output;
@H_301_35@ 814@H_301_35@      loop through the string literal @H_301_35@ 815@H_301_35@     while@H_301_35@ (input_pointer < input_end)
@H_301_35@ 816@H_301_35@  817@H_301_35@         if@H_301_35@ (*input_pointer !=  818@H_301_35@  819@H_301_35@             *output_pointer++ = *input_pointer++ 820@H_301_35@  821@H_301_35@          escape sequence @H_301_35@ 822@H_301_35@          823@H_301_35@  824@H_301_35@             unsigned  825@H_301_35@             if@H_301_35@ ((input_end - input_pointer) <  826@H_301_35@  827@H_301_35@                  828@H_301_35@  829@H_301_35@ 
 830@H_301_35@             switch@H_301_35@ (input_pointer[])
@H_301_35@ 831@H_301_35@  832@H_301_35@                 b@H_301_35@ 833@H_301_35@                     *output_pointer++ = \b@H_301_35@ 834@H_301_35@                      835@H_301_35@                  836@H_301_35@                     *output_pointer++ = \f@H_301_35@ 837@H_301_35@                      838@H_301_35@                 n@H_301_35@ 839@H_301_35@                     *output_pointer++ = \n@H_301_35@ 840@H_301_35@                      841@H_301_35@                 r@H_301_35@ 842@H_301_35@                     *output_pointer++ = \r@H_301_35@ 843@H_301_35@                      844@H_301_35@                 t@H_301_35@ 845@H_301_35@                     *output_pointer++ = \t@H_301_35@ 846@H_301_35@                      847@H_301_35@                  848@H_301_35@                  849@H_301_35@                 /@H_301_35@ 850@H_301_35@                     *output_pointer++ = input_pointer[ 851@H_301_35@                      852@H_301_35@ 
 853@H_301_35@                  UTF-16 literal @H_301_35@ 854@H_301_35@                  855@H_301_35@                     sequence_length = utf16_literal_to_utf8(input_pointer,input_end,1)">output_pointer);
@H_301_35@ 856@H_301_35@                     if@H_301_35@ (sequence_length ==  857@H_301_35@                     {
@H_301_35@ 858@H_301_35@                          Failed to convert UTF16-literal to UTF-8 @H_301_35@ 859@H_301_35@                          860@H_301_35@                     }
@H_301_35@ 861@H_301_35@                      862@H_301_35@ 
 863@H_301_35@                  864@H_301_35@                      865@H_301_35@  866@H_301_35@             input_pointer += 867@H_301_35@  868@H_301_35@  869@H_301_35@ 
 870@H_301_35@      zero terminate the output @H_301_35@ 871@H_301_35@     *output_pointer =  872@H_301_35@ 
 873@H_301_35@     item->type = cJSON_String;
@H_301_35@ 874@H_301_35@     item->valuestring = ()output;
@H_301_35@ 875@H_301_35@ 
 876@H_301_35@     input_buffer->offset = (size_t) (input_end - input_buffer->content);
@H_301_35@ 877@H_301_35@     input_buffer->offset++ 878@H_301_35@ 
 879@H_301_35@      880@H_301_35@ 
 881@H_301_35@  882@H_301_35@     if@H_301_35@ (output != 883@H_301_35@  884@H_301_35@         input_buffer->hooks.deallocate(output);
@H_301_35@ 885@H_301_35@  886@H_301_35@ 
 887@H_301_35@     if@H_301_35@ (input_pointer != 888@H_301_35@  889@H_301_35@         input_buffer->offset = (size_t)(input_pointer - input_buffer-> 890@H_301_35@  891@H_301_35@ 
 892@H_301_35@      893@H_301_35@  894@H_301_35@ 
 895@H_301_35@  Render the cstring provided to an escaped version that can be printed. @H_301_35@ 896@H_301_35@ static@H_301_35@ cJSON_bool print_string_ptr(const@H_301_35@ input,1)"> 897@H_301_35@  898@H_301_35@     char@H_301_35@ *input_pointer = 899@H_301_35@     unsigned  900@H_301_35@     unsigned  901@H_301_35@     size_t output_length =  902@H_301_35@      numbers of additional characters needed for escaping @H_301_35@ 903@H_301_35@     size_t escape_characters =  904@H_301_35@ 
 905@H_301_35@      906@H_301_35@  907@H_301_35@          908@H_301_35@  909@H_301_35@ 
 910@H_301_35@      empty string @H_301_35@ 911@H_301_35@     if@H_301_35@ (input == 912@H_301_35@  913@H_301_35@         output = ensure(output_buffer,1)">\"\"@H_301_35@ 914@H_301_35@          915@H_301_35@  916@H_301_35@              917@H_301_35@  918@H_301_35@         strcpy((char@H_301_35@*)output,1)"> 919@H_301_35@ 
 920@H_301_35@          921@H_301_35@  922@H_301_35@ 
 923@H_301_35@      set "flag" to 1 if something needs to be escaped @H_301_35@ 924@H_301_35@     for@H_301_35@ (input_pointer = input; *input_pointer; input_pointer++ 925@H_301_35@  926@H_301_35@         switch@H_301_35@ (*input_pointer)
@H_301_35@ 927@H_301_35@  928@H_301_35@              929@H_301_35@              930@H_301_35@              931@H_301_35@              932@H_301_35@              933@H_301_35@              934@H_301_35@              935@H_301_35@                  one character escape sequence @H_301_35@ 936@H_301_35@                 escape_characters++ 937@H_301_35@                  938@H_301_35@              939@H_301_35@                 if@H_301_35@ (*input_pointer < 32@H_301_35@ 940@H_301_35@  941@H_301_35@                      UTF-16 escape sequence uXXXX @H_301_35@ 942@H_301_35@                     escape_characters += 5@H_301_35@ 943@H_301_35@  944@H_301_35@                  945@H_301_35@  946@H_301_35@  947@H_301_35@     output_length = (size_t)(input_pointer - input) + escape_characters;
@H_301_35@ 948@H_301_35@ 
 949@H_301_35@     output = ensure(output_buffer,output_length +  950@H_301_35@      951@H_301_35@  952@H_301_35@          953@H_301_35@  954@H_301_35@ 
 955@H_301_35@      no characters have to be escaped @H_301_35@ 956@H_301_35@     if@H_301_35@ (escape_characters ==  957@H_301_35@  958@H_301_35@         output[0@H_301_35@] =  959@H_301_35@         memcpy(output + 301_35@ 960@H_301_35@         output[output_length + 1@H_301_35@] =  961@H_301_35@         output[output_length + 2@H_301_35@] =  962@H_301_35@ 
 963@H_301_35@          964@H_301_35@  965@H_301_35@ 
 966@H_301_35@     output[ 967@H_301_35@     output_pointer = output +  968@H_301_35@      copy the string @H_301_35@ 969@H_301_35@     for@H_301_35@ (input_pointer = input; *input_pointer != '@H_301_35@; (void@H_301_35@)input_pointer++,output_pointer++ 970@H_301_35@  971@H_301_35@         if@H_301_35@ ((*input_pointer > 31@H_301_35@) && (*input_pointer != '@H_301_35@) && (*input_pointer !=  972@H_301_35@  973@H_301_35@              normal character,copy @H_301_35@ 974@H_301_35@             *output_pointer = *input_pointer;
@H_301_35@ 975@H_301_35@  976@H_301_35@          977@H_301_35@  978@H_301_35@              character needs to be escaped @H_301_35@ 979@H_301_35@             *output_pointer++ =  980@H_301_35@              981@H_301_35@  982@H_301_35@                  983@H_301_35@                     *output_pointer =  984@H_301_35@                      985@H_301_35@                  986@H_301_35@                     *output_pointer =  987@H_301_35@                      988@H_301_35@                  989@H_301_35@                     *output_pointer =  990@H_301_35@                      991@H_301_35@                  992@H_301_35@                     *output_pointer =  993@H_301_35@                      994@H_301_35@                  995@H_301_35@                     *output_pointer =  996@H_301_35@                      997@H_301_35@                  998@H_301_35@                     *output_pointer =  999@H_301_35@                     1000@H_301_35@                 1001@H_301_35@                     *output_pointer = 1002@H_301_35@                     1003@H_301_35@                 1004@H_301_35@                      escape and print as unicode codepoint @H_301_35@1005@H_301_35@                     sprintf((char@H_301_35@*)output_pointer,1)">u%04x@H_301_35@input_pointer);
@H_301_35@1006@H_301_35@                     output_pointer += 1007@H_301_35@                     1008@H_301_35@ 1009@H_301_35@ 1010@H_301_35@ 1011@H_301_35@     output[output_length + 1012@H_301_35@     output[output_length + 1013@H_301_35@ 
1014@H_301_35@     1015@H_301_35@ 1016@H_301_35@ 
1017@H_301_35@  Invoke print_string_ptr (which is useful) on an item. @H_301_35@1018@H_301_35@ static@H_301_35@ cJSON_bool print_string( p)
@H_301_35@1019@H_301_35@ 1020@H_301_35@     return@H_301_35@ print_string_ptr((unsigned char@H_301_35@*)item->301_35@1021@H_301_35@ 1022@H_301_35@ 
1023@H_301_35@  Predeclare these prototypes. @H_301_35@1024@H_301_35@ static@H_301_35@ cJSON_bool parse_value(cJSON *  input_buffer);
@H_301_35@1025@H_301_35@ static@H_301_35@ cJSON_bool print_value( output_buffer);
@H_301_35@1026@H_301_35@ static@H_301_35@ cJSON_bool parse_array(cJSON * 1027@H_301_35@ static@H_301_35@ cJSON_bool print_array(1028@H_301_35@ static@H_301_35@ cJSON_bool parse_object(cJSON * 1029@H_301_35@ static@H_301_35@ cJSON_bool print_object(1030@H_301_35@ 
1031@H_301_35@  Utility to jump whitespace and cr/lf @H_301_35@1032@H_301_35@ static@H_301_35@ parse_buffer *buffer_skip_whitespace(parse_buffer * 1033@H_301_35@ 1034@H_301_35@     if@H_301_35@ ((buffer == NULL) || (buffer->content ==1035@H_301_35@ 1036@H_301_35@         1037@H_301_35@ 1038@H_301_35@ 
1039@H_301_35@     if@H_301_35@ (cannot_access_at_index(buffer,1)">1040@H_301_35@ 1041@H_301_35@          buffer;
@H_301_35@1042@H_301_35@ 1043@H_301_35@ 
1044@H_301_35@     while@H_301_35@ (can_access_at_index(buffer,1)">0@H_301_35@) && (buffer_at_offset(buffer)[0@H_301_35@] <= 1045@H_301_35@ 1046@H_301_35@        buffer->offset++1047@H_301_35@ 1048@H_301_35@ 
1049@H_301_35@     if@H_301_35@ (buffer->offset == buffer->1050@H_301_35@ 1051@H_301_35@         buffer->offset--1052@H_301_35@ 1053@H_301_35@ 
1054@H_301_35@     1055@H_301_35@ 1056@H_301_35@ 
1057@H_301_35@  skip the UTF-8 BOM (byte order mark) if it is at the beginning of a buffer @H_301_35@1058@H_301_35@ static@H_301_35@ parse_buffer *skip_utf8_bom(parse_buffer * 1059@H_301_35@ 1060@H_301_35@     if@H_301_35@ ((buffer == NULL) || (buffer->content == NULL) || (buffer->offset != 1061@H_301_35@ 1062@H_301_35@         1063@H_301_35@ 1064@H_301_35@ 
1065@H_301_35@     if@H_301_35@ (can_access_at_index(buffer,1)">4@H_301_35@) && (strncmp((char@H_301_35@*)buffer_at_offset(buffer),1)">\xEF\xBB\xBF@H_301_35@3@H_301_35@) == 1066@H_301_35@ 1067@H_301_35@         buffer->offset += 1068@H_301_35@ 1069@H_301_35@ 
1070@H_301_35@     1071@H_301_35@ 1072@H_301_35@ 
1073@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(301_35@1074@H_301_35@ 1075@H_301_35@     size_t buffer_length;
@H_301_35@1076@H_301_35@ 
1077@H_301_35@     if@H_301_35@ (NULL == value)
@H_301_35@1078@H_301_35@ 1079@H_301_35@         1080@H_301_35@ 1081@H_301_35@ 
1082@H_301_35@      Adding null character size due to require_null_terminated. @H_301_35@1083@H_301_35@     buffer_length = strlen(value) + 1084@H_301_35@ 
1085@H_301_35@      cJSON_ParseWithLengthOpts(value,buffer_length,return_parse_end,require_null_terminated);
@H_301_35@1086@H_301_35@ 1087@H_301_35@ 
1088@H_301_35@  Parse an object - create a new root,and populate. @H_301_35@1089@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(1090@H_301_35@ 1091@H_301_35@     parse_buffer buffer = { 0@H_301_35@,{  } };
@H_301_35@1092@H_301_35@     cJSON *item =1093@H_301_35@ 
1094@H_301_35@      reset error position @H_301_35@1095@H_301_35@     global_error.json =1096@H_301_35@     global_error.position = 1097@H_301_35@ 
1098@H_301_35@     if@H_301_35@ (value == NULL || 0@H_301_35@ == buffer_length)
@H_301_35@1099@H_301_35@ 1100@H_301_35@         1101@H_301_35@ 1102@H_301_35@ 
1103@H_301_35@     buffer.content = ()value;
@H_301_35@1104@H_301_35@     buffer.length = buffer_length; 
@H_301_35@1105@H_301_35@     buffer.offset = 1106@H_301_35@     buffer.hooks = global_hooks;
@H_301_35@1107@H_301_35@ 
1108@H_301_35@     item = cJSON_New_Item(&1109@H_301_35@     if@H_301_35@ (item == NULL)  memory fail @H_301_35@1110@H_301_35@ 1111@H_301_35@         1112@H_301_35@ 1113@H_301_35@ 
1114@H_301_35@     if@H_301_35@ (!parse_value(item,buffer_skip_whitespace(skip_utf8_bom(&buffer))))
@H_301_35@1115@H_301_35@ 1116@H_301_35@          parse failure. ep is set. @H_301_35@1117@H_301_35@         1118@H_301_35@ 1119@H_301_35@ 
1120@H_301_35@      if we require null-terminated JSON without appended garbage,skip and then check for a null terminator @H_301_35@1121@H_301_35@      (require_null_terminated)
@H_301_35@1122@H_301_35@ 1123@H_301_35@         buffer_skip_whitespace(&1124@H_301_35@         if@H_301_35@ ((buffer.offset >= buffer.length) || buffer_at_offset(&buffer)[1125@H_301_35@ 1126@H_301_35@             1127@H_301_35@ 1128@H_301_35@ 1129@H_301_35@      (return_parse_end)
@H_301_35@1130@H_301_35@ 1131@H_301_35@         *return_parse_end = (char@H_301_35@*)buffer_at_offset(&1132@H_301_35@ 1133@H_301_35@ 
1134@H_301_35@      item;
@H_301_35@1135@H_301_35@ 
1136@H_301_35@ 1137@H_301_35@     if@H_301_35@ (item !=1138@H_301_35@ 1139@H_301_35@         cJSON_Delete(item);
@H_301_35@1140@H_301_35@ 1141@H_301_35@ 
1142@H_301_35@     if@H_301_35@ (value !=1143@H_301_35@ 1144@H_301_35@         error local_error;
@H_301_35@1145@H_301_35@         local_error.json = (1146@H_301_35@         local_error.position = 1147@H_301_35@ 
1148@H_301_35@         if@H_301_35@ (buffer.offset < buffer.length)
@H_301_35@1149@H_301_35@ 1150@H_301_35@             local_error.position = buffer.offset;
@H_301_35@1151@H_301_35@ 1152@H_301_35@         if@H_301_35@ (buffer.length > 1153@H_301_35@ 1154@H_301_35@             local_error.position = buffer.length - 1155@H_301_35@ 1156@H_301_35@ 
1157@H_301_35@         if@H_301_35@ (return_parse_end !=1158@H_301_35@ 1159@H_301_35@             *return_parse_end = (char@H_301_35@*)local_error.json + local_error.position;
@H_301_35@1160@H_301_35@ 1161@H_301_35@ 
1162@H_301_35@         global_error = local_error;
@H_301_35@1163@H_301_35@ 1164@H_301_35@ 
1165@H_301_35@     1166@H_301_35@ 1167@H_301_35@ 
1168@H_301_35@  Default options for cJSON_Parse @H_301_35@1169@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_Parse(value)
@H_301_35@1170@H_301_35@ 1171@H_301_35@     return@H_301_35@ cJSON_ParseWithOpts(value,1)">1172@H_301_35@ 1173@H_301_35@ 
1174@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(301_35@1175@H_301_35@ 1176@H_301_35@     return@H_301_35@ cJSON_ParseWithLengthOpts(value,1)">1177@H_301_35@ 1178@H_301_35@ 
1179@H_301_35@ #define@H_301_35@ cjson_min(a,b) (((a) < (b)) ? (a) : (b))
1180@H_301_35@ 
1181@H_301_35@ char@H_301_35@ *print(1182@H_301_35@ 1183@H_301_35@     const@H_301_35@ size_t default_buffer_size = 256@H_301_35@1184@H_301_35@     printbuffer buffer[1185@H_301_35@     unsigned char@H_301_35@ *printed =1186@H_301_35@ 
1187@H_301_35@     memset(buffer,1)">(buffer));
@H_301_35@1188@H_301_35@ 
1189@H_301_35@      create buffer @H_301_35@1190@H_301_35@     buffer->buffer = (unsigned char@H_301_35@*) hooks->allocate(default_buffer_size);
@H_301_35@1191@H_301_35@     buffer->length = default_buffer_size;
@H_301_35@1192@H_301_35@     buffer->format = format;
@H_301_35@1193@H_301_35@     buffer->hooks = *hooks;
@H_301_35@1194@H_301_35@     if@H_301_35@ (buffer->buffer ==1195@H_301_35@ 1196@H_301_35@         1197@H_301_35@ 1198@H_301_35@ 
1199@H_301_35@      print the value @H_301_35@1200@H_301_35@     print_value(item,buffer))
@H_301_35@1201@H_301_35@ 1202@H_301_35@         1203@H_301_35@ 1204@H_301_35@     update_offset(buffer);
@H_301_35@1205@H_301_35@ 
1206@H_301_35@      check if reallocate is available @H_301_35@1207@H_301_35@     if@H_301_35@ (hooks->reallocate !=1208@H_301_35@ 1209@H_301_35@         printed = (unsigned char@H_301_35@*) hooks->reallocate(buffer->buffer,buffer->offset + 1210@H_301_35@         if@H_301_35@ (printed == NULL) {
@H_301_35@1211@H_301_35@             1212@H_301_35@ 1213@H_301_35@         buffer->buffer =1214@H_301_35@ 1215@H_301_35@      otherwise copy the JSON over to a new buffer @H_301_35@1216@H_301_35@ 1217@H_301_35@         printed = (unsigned char@H_301_35@*) hooks->allocate(buffer->offset + 1218@H_301_35@         1219@H_301_35@ 1220@H_301_35@             1221@H_301_35@ 1222@H_301_35@         memcpy(printed,buffer->buffer,cjson_min(buffer->length,1)">1223@H_301_35@         printed[buffer->offset] = '@H_301_35@;  just to be sure @H_301_35@1224@H_301_35@ 
1225@H_301_35@          free the buffer @H_301_35@1226@H_301_35@         hooks->deallocate(buffer->1227@H_301_35@ 1228@H_301_35@ 
1229@H_301_35@      printed;
@H_301_35@1230@H_301_35@ 
1231@H_301_35@ 1232@H_301_35@     if@H_301_35@ (buffer->buffer !=1233@H_301_35@ 1234@H_301_35@         hooks->deallocate(buffer->1235@H_301_35@ 1236@H_301_35@ 
1237@H_301_35@     if@H_301_35@ (printed !=1238@H_301_35@ 1239@H_301_35@         hooks->deallocate(printed);
@H_301_35@1240@H_301_35@ 1241@H_301_35@ 
1242@H_301_35@     1243@H_301_35@ 1244@H_301_35@ 
1245@H_301_35@  Render a cJSON item/entity/structure to text. @H_301_35@1246@H_301_35@ CJSON_PUBLIC(1247@H_301_35@ 1248@H_301_35@     char@H_301_35@*)print(item,1)">true@H_301_35@,1)">1249@H_301_35@ 1250@H_301_35@ 
1251@H_301_35@ CJSON_PUBLIC(1252@H_301_35@ 1253@H_301_35@     false@H_301_35@,1)">1254@H_301_35@ 1255@H_301_35@ 
1256@H_301_35@ CJSON_PUBLIC(301_35@1257@H_301_35@ 1258@H_301_35@     printbuffer p = { 1259@H_301_35@ 
1260@H_301_35@     if@H_301_35@ (prebuffer < 1261@H_301_35@ 1262@H_301_35@         1263@H_301_35@ 1264@H_301_35@ 
1265@H_301_35@     p.buffer = (unsigned )global_hooks.allocate((size_t)prebuffer);
@H_301_35@1266@H_301_35@     p.buffer)
@H_301_35@1267@H_301_35@ 1268@H_301_35@         1269@H_301_35@ 1270@H_301_35@ 
1271@H_301_35@     p.length = (size_t)prebuffer;
@H_301_35@1272@H_301_35@     p.offset = 1273@H_301_35@     p.noalloc = 1274@H_301_35@     p.format = fmt;
@H_301_35@1275@H_301_35@     p.hooks =1276@H_301_35@ 
1277@H_301_35@     if@H_301_35@ (!print_value(item,1)">p))
@H_301_35@1278@H_301_35@ 1279@H_301_35@         global_hooks.deallocate(p.buffer);
@H_301_35@1280@H_301_35@         1281@H_301_35@ 1282@H_301_35@ 
1283@H_301_35@     )p.buffer;
@H_301_35@1284@H_301_35@ 1285@H_301_35@ 
1286@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item,1)"> cJSON_bool format)
@H_301_35@1287@H_301_35@ 1288@H_301_35@     printbuffer p = { 1289@H_301_35@ 
1290@H_301_35@     0@H_301_35@) || (buffer ==1291@H_301_35@ 1292@H_301_35@         1293@H_301_35@ 1294@H_301_35@ 
1295@H_301_35@     p.buffer = (unsigned )buffer;
@H_301_35@1296@H_301_35@     p.length =1297@H_301_35@     p.offset = 1298@H_301_35@     p.noalloc = 1299@H_301_35@     p.format =1300@H_301_35@     p.hooks =1301@H_301_35@ 
1302@H_301_35@     return@H_301_35@ print_value(item,1)">p);
@H_301_35@1303@H_301_35@ 1304@H_301_35@ 
1305@H_301_35@  Parser core - when encountering text,process appropriately. @H_301_35@1306@H_301_35@ 1307@H_301_35@ 1308@H_301_35@     1309@H_301_35@ 1310@H_301_35@          no input @H_301_35@1311@H_301_35@ 1312@H_301_35@ 
1313@H_301_35@      parse the different types of values @H_301_35@1314@H_301_35@      null @H_301_35@1315@H_301_35@     if@H_301_35@ (can_read(input_buffer,1)">char@H_301_35@*)buffer_at_offset(input_buffer),1)">4@H_301_35@) == 1316@H_301_35@ 1317@H_301_35@         item->type = cJSON_NULL;
@H_301_35@1318@H_301_35@         input_buffer->offset += 1319@H_301_35@         1320@H_301_35@ 1321@H_301_35@      false @H_301_35@1322@H_301_35@     5@H_301_35@) && (strncmp((false@H_301_35@5@H_301_35@) == 1323@H_301_35@ 1324@H_301_35@         item->type = cJSON_False;
@H_301_35@1325@H_301_35@         input_buffer->offset += 1326@H_301_35@         1327@H_301_35@ 1328@H_301_35@      true @H_301_35@1329@H_301_35@     true@H_301_35@1330@H_301_35@ 1331@H_301_35@         item->type = cJSON_True;
@H_301_35@1332@H_301_35@         item->valueint = 1333@H_301_35@         input_buffer->offset += 1334@H_301_35@         1335@H_301_35@ 1336@H_301_35@      string @H_301_35@1337@H_301_35@     if@H_301_35@ (can_access_at_index(input_buffer,1)">0@H_301_35@) && (buffer_at_offset(input_buffer)[1338@H_301_35@ 1339@H_301_35@          parse_string(item,input_buffer);
@H_301_35@1340@H_301_35@ 1341@H_301_35@      number @H_301_35@1342@H_301_35@     0@H_301_35@) && ((buffer_at_offset(input_buffer)['@H_301_35@) || ((buffer_at_offset(input_buffer)[0@H_301_35@] >= '@H_301_35@) && (buffer_at_offset(input_buffer)[))))
@H_301_35@1343@H_301_35@ 1344@H_301_35@          parse_number(item,1)">1345@H_301_35@ 1346@H_301_35@      array @H_301_35@1347@H_301_35@     [@H_301_35@1348@H_301_35@ 1349@H_301_35@          parse_array(item,1)">1350@H_301_35@ 1351@H_301_35@      object @H_301_35@1352@H_301_35@     {@H_301_35@1353@H_301_35@ 1354@H_301_35@          parse_object(item,1)">1355@H_301_35@ 1356@H_301_35@ 
1357@H_301_35@     1358@H_301_35@ 1359@H_301_35@ 
1360@H_301_35@  Render a value to text. @H_301_35@1361@H_301_35@ 1362@H_301_35@ 1363@H_301_35@     unsigned 1364@H_301_35@ 
1365@H_301_35@     if@H_301_35@ ((item == NULL) || (output_buffer ==1366@H_301_35@ 1367@H_301_35@         1368@H_301_35@ 1369@H_301_35@ 
1370@H_301_35@     switch@H_301_35@ ((item->type) & 1371@H_301_35@ 1372@H_301_35@         case@H_301_35@ cJSON_NULL:
@H_301_35@1373@H_301_35@             output = ensure(output_buffer,1)">1374@H_301_35@             1375@H_301_35@ 1376@H_301_35@                 1377@H_301_35@ 1378@H_301_35@             strcpy((1379@H_301_35@             1380@H_301_35@ 
1381@H_301_35@          cJSON_False:
@H_301_35@1382@H_301_35@             output = ensure(output_buffer,1)">1383@H_301_35@             1384@H_301_35@ 1385@H_301_35@                 1386@H_301_35@ 1387@H_301_35@             strcpy((1388@H_301_35@             1389@H_301_35@ 
1390@H_301_35@          cJSON_True:
@H_301_35@1391@H_301_35@             output = ensure(output_buffer,1)">1392@H_301_35@             1393@H_301_35@ 1394@H_301_35@                 1395@H_301_35@ 1396@H_301_35@             strcpy((1397@H_301_35@             1398@H_301_35@ 
1399@H_301_35@          cJSON_Number:
@H_301_35@1400@H_301_35@              print_number(item,output_buffer);
@H_301_35@1401@H_301_35@ 
1402@H_301_35@          cJSON_Raw:
@H_301_35@1403@H_301_35@ 1404@H_301_35@             size_t raw_length = 1405@H_301_35@             if@H_301_35@ (item->valuestring ==1406@H_301_35@ 1407@H_301_35@                 1408@H_301_35@ 1409@H_301_35@ 
1410@H_301_35@             raw_length = strlen(item->valuestring) + 1411@H_301_35@             output = ensure(output_buffer,raw_length);
@H_301_35@1412@H_301_35@             1413@H_301_35@ 1414@H_301_35@                 1415@H_301_35@ 1416@H_301_35@             memcpy(output,1)">1417@H_301_35@             1418@H_301_35@ 1419@H_301_35@ 
1420@H_301_35@          cJSON_String:
@H_301_35@1421@H_301_35@              print_string(item,1)">1422@H_301_35@ 
1423@H_301_35@          cJSON_Array:
@H_301_35@1424@H_301_35@              print_array(item,1)">1425@H_301_35@ 
1426@H_301_35@          cJSON_Object:
@H_301_35@1427@H_301_35@              print_object(item,1)">1428@H_301_35@ 
1429@H_301_35@         1430@H_301_35@             1431@H_301_35@ 1432@H_301_35@ 1433@H_301_35@ 
1434@H_301_35@  Build an array from input text. @H_301_35@1435@H_301_35@ 1436@H_301_35@ 1437@H_301_35@     cJSON *head = NULL;  head of the linked list @H_301_35@1438@H_301_35@     cJSON *current_item =1439@H_301_35@ 
1440@H_301_35@     if@H_301_35@ (input_buffer->depth >= CJSON_NESTING_LIMIT)
@H_301_35@1441@H_301_35@ 1442@H_301_35@          to deeply nested @H_301_35@1443@H_301_35@ 1444@H_301_35@     input_buffer->depth++1445@H_301_35@ 
1446@H_301_35@     1447@H_301_35@ 1448@H_301_35@          not an array @H_301_35@1449@H_301_35@         1450@H_301_35@ 1451@H_301_35@ 
1452@H_301_35@     input_buffer->offset++1453@H_301_35@     buffer_skip_whitespace(input_buffer);
@H_301_35@1454@H_301_35@     ]@H_301_35@1455@H_301_35@ 1456@H_301_35@          empty array @H_301_35@1457@H_301_35@          success;
@H_301_35@1458@H_301_35@ 1459@H_301_35@ 
1460@H_301_35@      check if we skipped to the end of the buffer @H_301_35@1461@H_301_35@     if@H_301_35@ (cannot_access_at_index(input_buffer,1)">1462@H_301_35@ 1463@H_301_35@         input_buffer->offset--1464@H_301_35@         1465@H_301_35@ 1466@H_301_35@ 
1467@H_301_35@      step back to character in front of the first element @H_301_35@1468@H_301_35@     input_buffer->offset--1469@H_301_35@      loop through the comma separated array elements @H_301_35@1470@H_301_35@     do@H_301_35@
1471@H_301_35@ 1472@H_301_35@          allocate next item @H_301_35@1473@H_301_35@         cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks));
@H_301_35@1474@H_301_35@         if@H_301_35@ (new_item ==1475@H_301_35@ 1476@H_301_35@             1477@H_301_35@ 1478@H_301_35@ 
1479@H_301_35@          attach next item to list @H_301_35@1480@H_301_35@         if@H_301_35@ (head ==1481@H_301_35@ 1482@H_301_35@              start the linked list @H_301_35@1483@H_301_35@             current_item = head = new_item;
@H_301_35@1484@H_301_35@ 1485@H_301_35@         1486@H_301_35@ 1487@H_301_35@              add to the end and advance @H_301_35@1488@H_301_35@             current_item->next =1489@H_301_35@             new_item->prev = current_item;
@H_301_35@1490@H_301_35@             current_item =1491@H_301_35@ 1492@H_301_35@ 
1493@H_301_35@          parse next value @H_301_35@1494@H_301_35@         input_buffer->offset++1495@H_301_35@         buffer_skip_whitespace(input_buffer);
@H_301_35@1496@H_301_35@         parse_value(current_item,input_buffer))
@H_301_35@1497@H_301_35@ 1498@H_301_35@              Failed to parse value @H_301_35@1499@H_301_35@ 1500@H_301_35@ 1501@H_301_35@ 1502@H_301_35@     while@H_301_35@ (can_access_at_index(input_buffer,@H_301_35@1503@H_301_35@ 
1504@H_301_35@     0@H_301_35@) || buffer_at_offset(input_buffer)[1505@H_301_35@ 1506@H_301_35@          expected end of array @H_301_35@1507@H_301_35@ 1508@H_301_35@ 
1509@H_301_35@ success:
@H_301_35@1510@H_301_35@     input_buffer->depth--1511@H_301_35@ 
1512@H_301_35@     item->type = cJSON_Array;
@H_301_35@1513@H_301_35@     item->child = head;
@H_301_35@1514@H_301_35@ 
1515@H_301_35@     input_buffer->offset++1516@H_301_35@ 
1517@H_301_35@     1518@H_301_35@ 
1519@H_301_35@ 1520@H_301_35@     if@H_301_35@ (head !=1521@H_301_35@ 1522@H_301_35@         cJSON_Delete(head);
@H_301_35@1523@H_301_35@ 1524@H_301_35@ 
1525@H_301_35@     1526@H_301_35@ 1527@H_301_35@ 
1528@H_301_35@  Render an array to text @H_301_35@1529@H_301_35@ 1530@H_301_35@ 1531@H_301_35@     unsigned 1532@H_301_35@     size_t length = 1533@H_301_35@     cJSON *current_element = item->1534@H_301_35@ 
1535@H_301_35@     1536@H_301_35@ 1537@H_301_35@         1538@H_301_35@ 1539@H_301_35@ 
1540@H_301_35@      Compose the output array. @H_301_35@1541@H_301_35@      opening square bracket @H_301_35@1542@H_301_35@     output_pointer = ensure(output_buffer,1)">1543@H_301_35@     1544@H_301_35@ 1545@H_301_35@         1546@H_301_35@ 1547@H_301_35@ 
1548@H_301_35@     *output_pointer = 1549@H_301_35@     output_buffer->offset++1550@H_301_35@     output_buffer->depth++1551@H_301_35@ 
1552@H_301_35@     while@H_301_35@ (current_element !=1553@H_301_35@ 1554@H_301_35@         print_value(current_element,output_buffer))
@H_301_35@1555@H_301_35@ 1556@H_301_35@             1557@H_301_35@ 1558@H_301_35@         update_offset(output_buffer);
@H_301_35@1559@H_301_35@         if@H_301_35@ (current_element->next)
@H_301_35@1560@H_301_35@ 1561@H_301_35@             length = (size_t) (output_buffer->format ? 2@H_301_35@ : 1562@H_301_35@             output_pointer = ensure(output_buffer,length + 1563@H_301_35@             1564@H_301_35@ 1565@H_301_35@                 1566@H_301_35@ 1567@H_301_35@             *output_pointer++ = 1568@H_301_35@             if@H_301_35@(output_buffer->format)
@H_301_35@1569@H_301_35@ 1570@H_301_35@                 *output_pointer++ = '@H_301_35@ 1571@H_301_35@ 1572@H_301_35@             *output_pointer = 1573@H_301_35@             output_buffer->offset += length;
@H_301_35@1574@H_301_35@ 1575@H_301_35@         current_element = current_element->1576@H_301_35@ 1577@H_301_35@ 
1578@H_301_35@     output_pointer = ensure(output_buffer,1)">1579@H_301_35@     1580@H_301_35@ 1581@H_301_35@         1582@H_301_35@ 1583@H_301_35@     *output_pointer++ = 1584@H_301_35@     *output_pointer = 1585@H_301_35@     output_buffer->depth--1586@H_301_35@ 
1587@H_301_35@     1588@H_301_35@ 1589@H_301_35@ 
1590@H_301_35@  Build an object from the text. @H_301_35@1591@H_301_35@ 1592@H_301_35@ 1593@H_301_35@     cJSON *head = NULL;  linked list head @H_301_35@1594@H_301_35@     cJSON *current_item =1595@H_301_35@ 
1596@H_301_35@     1597@H_301_35@ 1598@H_301_35@         1599@H_301_35@ 1600@H_301_35@     input_buffer->depth++1601@H_301_35@ 
1602@H_301_35@     0@H_301_35@) || (buffer_at_offset(input_buffer)[1603@H_301_35@ 1604@H_301_35@          not an object @H_301_35@1605@H_301_35@ 1606@H_301_35@ 
1607@H_301_35@     input_buffer->offset++1608@H_301_35@ 1609@H_301_35@     }@H_301_35@1610@H_301_35@ 1611@H_301_35@         goto@H_301_35@ success;  empty object @H_301_35@1612@H_301_35@ 1613@H_301_35@ 
1614@H_301_35@     1615@H_301_35@     1616@H_301_35@ 1617@H_301_35@         input_buffer->offset--1618@H_301_35@         1619@H_301_35@ 1620@H_301_35@ 
1621@H_301_35@     1622@H_301_35@     input_buffer->offset--1623@H_301_35@     1624@H_301_35@     1625@H_301_35@ 1626@H_301_35@         1627@H_301_35@         cJSON *new_item = cJSON_New_Item(&(input_buffer->1628@H_301_35@         1629@H_301_35@ 1630@H_301_35@             1631@H_301_35@ 1632@H_301_35@ 
1633@H_301_35@         1634@H_301_35@         1635@H_301_35@ 1636@H_301_35@             1637@H_301_35@             current_item = head =1638@H_301_35@ 1639@H_301_35@         1640@H_301_35@ 1641@H_301_35@             1642@H_301_35@             current_item->next =1643@H_301_35@             new_item->prev =1644@H_301_35@             current_item =1645@H_301_35@ 1646@H_301_35@ 
1647@H_301_35@          parse the name of the child @H_301_35@1648@H_301_35@         input_buffer->offset++1649@H_301_35@ 1650@H_301_35@         parse_string(current_item,1)">1651@H_301_35@ 1652@H_301_35@              Failed to parse name @H_301_35@1653@H_301_35@ 1654@H_301_35@ 1655@H_301_35@ 
1656@H_301_35@          swap valuestring and string,because we parsed the name @H_301_35@1657@H_301_35@         current_item->string@H_301_35@ = current_item->1658@H_301_35@         current_item->valuestring =1659@H_301_35@ 
1660@H_301_35@         :@H_301_35@1661@H_301_35@ 1662@H_301_35@              invalid object @H_301_35@1663@H_301_35@ 1664@H_301_35@ 
1665@H_301_35@          parse the value @H_301_35@1666@H_301_35@         input_buffer->offset++1667@H_301_35@ 1668@H_301_35@         1669@H_301_35@ 1670@H_301_35@             1671@H_301_35@ 1672@H_301_35@ 1673@H_301_35@ 1674@H_301_35@     1675@H_301_35@ 
1676@H_301_35@     1677@H_301_35@ 1678@H_301_35@          expected end of object @H_301_35@1679@H_301_35@ 1680@H_301_35@ 
1681@H_301_35@ 1682@H_301_35@     input_buffer->depth--1683@H_301_35@ 
1684@H_301_35@     item->type = cJSON_Object;
@H_301_35@1685@H_301_35@     item->child =1686@H_301_35@ 
1687@H_301_35@     input_buffer->offset++1688@H_301_35@     1689@H_301_35@ 
1690@H_301_35@ 1691@H_301_35@     1692@H_301_35@ 1693@H_301_35@ 1694@H_301_35@ 1695@H_301_35@ 
1696@H_301_35@     1697@H_301_35@ 1698@H_301_35@ 
1699@H_301_35@  Render an object to text. @H_301_35@1700@H_301_35@ 1701@H_301_35@ 1702@H_301_35@     unsigned 1703@H_301_35@     size_t length = 1704@H_301_35@     cJSON *current_item = item->1705@H_301_35@ 
1706@H_301_35@     1707@H_301_35@ 1708@H_301_35@         1709@H_301_35@ 1710@H_301_35@ 
1711@H_301_35@      Compose the output: @H_301_35@1712@H_301_35@     length = (size_t) (output_buffer->format ? 1@H_301_35@);  fmt: {\n @H_301_35@1713@H_301_35@     output_pointer = ensure(output_buffer,1)">1714@H_301_35@     1715@H_301_35@ 1716@H_301_35@         1717@H_301_35@ 1718@H_301_35@ 
1719@H_301_35@     *output_pointer++ = 1720@H_301_35@     output_buffer->depth++1721@H_301_35@     if@H_301_35@ (output_buffer->1722@H_301_35@ 1723@H_301_35@         *output_pointer++ = 1724@H_301_35@ 1725@H_301_35@     output_buffer->offset +=1726@H_301_35@ 
1727@H_301_35@     while@H_301_35@ (current_item)
@H_301_35@1728@H_301_35@ 1729@H_301_35@         1730@H_301_35@ 1731@H_301_35@             size_t i;
@H_301_35@1732@H_301_35@             output_pointer = ensure(output_buffer,output_buffer->depth);
@H_301_35@1733@H_301_35@             1734@H_301_35@ 1735@H_301_35@                 1736@H_301_35@ 1737@H_301_35@             0@H_301_35@; i < output_buffer->depth; i++1738@H_301_35@ 1739@H_301_35@                 *output_pointer++ = 1740@H_301_35@ 1741@H_301_35@             output_buffer->offset += output_buffer->depth;
@H_301_35@1742@H_301_35@ 1743@H_301_35@ 
1744@H_301_35@          print key @H_301_35@1745@H_301_35@         if@H_301_35@ (!print_string_ptr((unsigned char@H_301_35@*)current_item->1746@H_301_35@ 1747@H_301_35@             1748@H_301_35@ 1749@H_301_35@ 1750@H_301_35@ 
1751@H_301_35@         length = (size_t) (output_buffer->format ? 1752@H_301_35@         output_pointer =1753@H_301_35@         1754@H_301_35@ 1755@H_301_35@             1756@H_301_35@ 1757@H_301_35@         *output_pointer++ = 1758@H_301_35@         1759@H_301_35@ 1760@H_301_35@             *output_pointer++ = 1761@H_301_35@ 1762@H_301_35@         output_buffer->offset +=1763@H_301_35@ 
1764@H_301_35@          print value @H_301_35@1765@H_301_35@         print_value(current_item,1)">1766@H_301_35@ 1767@H_301_35@             1768@H_301_35@ 1769@H_301_35@ 1770@H_301_35@ 
1771@H_301_35@          print comma if not last @H_301_35@1772@H_301_35@         length = ((size_t)(output_buffer->format ? 1@H_301_35@ : 0@H_301_35@) + (size_t)(current_item->next ? 1773@H_301_35@         output_pointer = ensure(output_buffer,1)">1774@H_301_35@         1775@H_301_35@ 1776@H_301_35@             1777@H_301_35@ 1778@H_301_35@         if@H_301_35@ (current_item->1779@H_301_35@ 1780@H_301_35@             *output_pointer++ = 1781@H_301_35@ 1782@H_301_35@ 
1783@H_301_35@         1784@H_301_35@ 1785@H_301_35@             *output_pointer++ = 1786@H_301_35@ 1787@H_301_35@         *output_pointer = 1788@H_301_35@         output_buffer->offset +=1789@H_301_35@ 
1790@H_301_35@         current_item = current_item->1791@H_301_35@ 1792@H_301_35@ 
1793@H_301_35@     output_pointer = ensure(output_buffer,output_buffer->format ? (output_buffer->depth + 1@H_301_35@) : 1794@H_301_35@     1795@H_301_35@ 1796@H_301_35@         1797@H_301_35@ 1798@H_301_35@     1799@H_301_35@ 1800@H_301_35@         size_t i;
@H_301_35@1801@H_301_35@         0@H_301_35@; i < (output_buffer->depth - 1@H_301_35@); i++1802@H_301_35@ 1803@H_301_35@             *output_pointer++ = 1804@H_301_35@ 1805@H_301_35@ 1806@H_301_35@     *output_pointer++ = 1807@H_301_35@     *output_pointer = 1808@H_301_35@     output_buffer->depth--1809@H_301_35@ 
1810@H_301_35@     1811@H_301_35@ 1812@H_301_35@ 
1813@H_301_35@  Get Array size/item / object item. @H_301_35@1814@H_301_35@ CJSON_PUBLIC(array)
@H_301_35@1815@H_301_35@ 1816@H_301_35@     cJSON *child =1817@H_301_35@     size_t size = 1818@H_301_35@ 
1819@H_301_35@     if@H_301_35@ (array ==1820@H_301_35@ 1821@H_301_35@         1822@H_301_35@ 1823@H_301_35@ 
1824@H_301_35@     child = array->1825@H_301_35@ 
1826@H_301_35@     while@H_301_35@(child !=1827@H_301_35@ 1828@H_301_35@         size++1829@H_301_35@         child = child->1830@H_301_35@ 1831@H_301_35@ 
1832@H_301_35@      FIXME: Can overflow here. Cannot be fixed without breaking the API @H_301_35@1833@H_301_35@ 
1834@H_301_35@     )size;
@H_301_35@1835@H_301_35@ 1836@H_301_35@ 
1837@H_301_35@ static@H_301_35@ cJSON* get_array_item(array,size_t index)
@H_301_35@1838@H_301_35@ 1839@H_301_35@     cJSON *current_child =1840@H_301_35@ 
1841@H_301_35@     1842@H_301_35@ 1843@H_301_35@         1844@H_301_35@ 1845@H_301_35@ 
1846@H_301_35@     current_child = array->1847@H_301_35@     while@H_301_35@ ((current_child != NULL) && (index > 1848@H_301_35@ 1849@H_301_35@         index--1850@H_301_35@         current_child = current_child->1851@H_301_35@ 1852@H_301_35@ 
1853@H_301_35@      current_child;
@H_301_35@1854@H_301_35@ 1855@H_301_35@ 
1856@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem( index)
@H_301_35@1857@H_301_35@ 1858@H_301_35@     if@H_301_35@ (index < 1859@H_301_35@ 1860@H_301_35@         1861@H_301_35@ 1862@H_301_35@ 
1863@H_301_35@      get_array_item(array,(size_t)index);
@H_301_35@1864@H_301_35@ 1865@H_301_35@ 
1866@H_301_35@ static@H_301_35@ cJSON *get_object_item( cJSON_bool case_sensitive)
@H_301_35@1867@H_301_35@ 1868@H_301_35@     cJSON *current_element =1869@H_301_35@ 
1870@H_301_35@     if@H_301_35@ ((object@H_301_35@ == NULL) || (name ==1871@H_301_35@ 1872@H_301_35@         1873@H_301_35@ 1874@H_301_35@ 
1875@H_301_35@     current_element = 1876@H_301_35@      (case_sensitive)
@H_301_35@1877@H_301_35@ 1878@H_301_35@         while@H_301_35@ ((current_element != NULL) && (current_element->string@H_301_35@ != NULL) && (strcmp(name,current_element->string@H_301_35@) != 1879@H_301_35@ 1880@H_301_35@             current_element = current_element->1881@H_301_35@ 1882@H_301_35@ 1883@H_301_35@     1884@H_301_35@ 1885@H_301_35@         while@H_301_35@ ((current_element != NULL) && (case_insensitive_strcmp((char@H_301_35@*)name,1)">char@H_301_35@*)(current_element->string@H_301_35@)) != 1886@H_301_35@ 1887@H_301_35@             current_element = current_element->1888@H_301_35@ 1889@H_301_35@ 1890@H_301_35@ 
1891@H_301_35@     if@H_301_35@ ((current_element == NULL) || (current_element-> NULL)) {
@H_301_35@1892@H_301_35@         1893@H_301_35@ 1894@H_301_35@ 
1895@H_301_35@      current_element;
@H_301_35@1896@H_301_35@ 1897@H_301_35@ 
1898@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(1899@H_301_35@ 1900@H_301_35@     return@H_301_35@ get_object_item(1901@H_301_35@ 1902@H_301_35@ 
1903@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(1904@H_301_35@ 1905@H_301_35@     1906@H_301_35@ 1907@H_301_35@ 
1908@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(1909@H_301_35@ 1910@H_301_35@     return@H_301_35@ cJSON_GetObjectItem(string@H_301_35@) ? 1911@H_301_35@ 1912@H_301_35@ 
1913@H_301_35@  Utility for array list handling. @H_301_35@1914@H_301_35@ void@H_301_35@ suffix_object(cJSON *prev,1)">1915@H_301_35@ 1916@H_301_35@     prev->next =1917@H_301_35@     item->prev = prev;
@H_301_35@1918@H_301_35@ 1919@H_301_35@ 
1920@H_301_35@  Utility for handling references. @H_301_35@1921@H_301_35@ static@H_301_35@ cJSON *create_reference(1922@H_301_35@ 1923@H_301_35@     cJSON *reference =1924@H_301_35@     if@H_301_35@ (item ==1925@H_301_35@ 1926@H_301_35@         1927@H_301_35@ 1928@H_301_35@ 
1929@H_301_35@     reference = cJSON_New_Item(hooks);
@H_301_35@1930@H_301_35@     if@H_301_35@ (reference ==1931@H_301_35@ 1932@H_301_35@         1933@H_301_35@ 1934@H_301_35@ 
1935@H_301_35@     memcpy(reference,item,1)">1936@H_301_35@     reference->string@H_301_35@ =1937@H_301_35@     reference->type |= cJSON_IsReference;
@H_301_35@1938@H_301_35@     reference->next = reference->prev =1939@H_301_35@      reference;
@H_301_35@1940@H_301_35@ 1941@H_301_35@ 
1942@H_301_35@ static@H_301_35@ cJSON_bool add_item_to_array(cJSON *array,1)">1943@H_301_35@ 1944@H_301_35@     cJSON *child =1945@H_301_35@ 
1946@H_301_35@     if@H_301_35@ ((item == NULL) || (array == NULL) || (array == item))
@H_301_35@1947@H_301_35@ 1948@H_301_35@         1949@H_301_35@ 1950@H_301_35@ 
1951@H_301_35@     child = array->1952@H_301_35@     1953@H_301_35@      * To find the last item in array quickly,we use prev in array
@H_301_35@1954@H_301_35@      1955@H_301_35@     if@H_301_35@ (child ==1956@H_301_35@ 1957@H_301_35@          list is empty,start new one @H_301_35@1958@H_301_35@         array->child =1959@H_301_35@         item->prev =1960@H_301_35@         item->next =1961@H_301_35@ 1962@H_301_35@     1963@H_301_35@ 1964@H_301_35@          append to the end @H_301_35@1965@H_301_35@         if@H_301_35@ (child->prev)
@H_301_35@1966@H_301_35@ 1967@H_301_35@             suffix_object(child->prev,item);
@H_301_35@1968@H_301_35@             array->child->prev =1969@H_301_35@ 1970@H_301_35@         1971@H_301_35@ 1972@H_301_35@             while@H_301_35@ (child->1973@H_301_35@ 1974@H_301_35@                 child = child->1975@H_301_35@ 1976@H_301_35@             suffix_object(child,1)">1977@H_301_35@             array->child->prev =1978@H_301_35@ 1979@H_301_35@ 1980@H_301_35@ 
1981@H_301_35@     1982@H_301_35@ 1983@H_301_35@ 
1984@H_301_35@  Add item to array/object. @H_301_35@1985@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array,1)">1986@H_301_35@ 1987@H_301_35@      add_item_to_array(array,1)">1988@H_301_35@ 1989@H_301_35@ 
1990@H_301_35@ #if@H_301_35@ defined(__clang__) || (defined(__GNUC__)  && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5))))
1991@H_301_35@     #pragma@H_301_35@ GCC diagnostic push
1992@H_301_35@ 1993@H_301_35@ 1994@H_301_35@ #pragma@H_301_35@ GCC diagnostic ignored "-Wcast-qual"
1995@H_301_35@ 1996@H_301_35@  helper function to cast away const @H_301_35@1997@H_301_35@ void@H_301_35@* cast_away_const(void@H_301_35@* 1998@H_301_35@ 1999@H_301_35@     void@H_301_35@*)2000@H_301_35@ 2001@H_301_35@ 2002@H_301_35@     #pragma@H_301_35@ GCC diagnostic pop
2003@H_301_35@ 2004@H_301_35@ 
2005@H_301_35@ 
2006@H_301_35@ static@H_301_35@ cJSON_bool add_item_to_object(cJSON * const@H_301_35@ hooks,1)"> cJSON_bool constant_key)
@H_301_35@2007@H_301_35@ 2008@H_301_35@     char@H_301_35@ *new_key =2009@H_301_35@     int@H_301_35@ new_type = cJSON_Invalid;
@H_301_35@2010@H_301_35@ 
2011@H_301_35@     object@H_301_35@ == NULL) || (string@H_301_35@ == NULL) || (item == NULL) || (object@H_301_35@ ==2012@H_301_35@ 2013@H_301_35@         2014@H_301_35@ 2015@H_301_35@ 
2016@H_301_35@      (constant_key)
@H_301_35@2017@H_301_35@ 2018@H_301_35@         new_key = (char@H_301_35@*)cast_away_const(2019@H_301_35@         new_type = item->type | cJSON_StringIsConst;
@H_301_35@2020@H_301_35@ 2021@H_301_35@     2022@H_301_35@ 2023@H_301_35@         new_key = (char@H_301_35@*)cJSON_strdup((301_35@2024@H_301_35@         if@H_301_35@ (new_key ==2025@H_301_35@ 2026@H_301_35@             2027@H_301_35@ 2028@H_301_35@ 
2029@H_301_35@         new_type = item->type & ~cJSON_StringIsConst;
@H_301_35@2030@H_301_35@ 2031@H_301_35@ 
2032@H_301_35@     2033@H_301_35@ 2034@H_301_35@         hooks->deallocate(item->2035@H_301_35@ 2036@H_301_35@ 
2037@H_301_35@     item-> new_key;
@H_301_35@2038@H_301_35@     item->type = new_type;
@H_301_35@2039@H_301_35@ 
2040@H_301_35@     return@H_301_35@ add_item_to_array(2041@H_301_35@ 2042@H_301_35@ 
2043@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *2044@H_301_35@ 2045@H_301_35@     return@H_301_35@ add_item_to_object(2046@H_301_35@ 2047@H_301_35@ 
2048@H_301_35@  Add an item to an object with constant string as key @H_301_35@2049@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *2050@H_301_35@ 2051@H_301_35@     2052@H_301_35@ 2053@H_301_35@ 
2054@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array,1)">2055@H_301_35@ 2056@H_301_35@     2057@H_301_35@ 2058@H_301_35@         2059@H_301_35@ 2060@H_301_35@ 
2061@H_301_35@     return@H_301_35@ add_item_to_array(array,create_reference(item,1)">global_hooks));
@H_301_35@2062@H_301_35@ 2063@H_301_35@ 
2064@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *2065@H_301_35@ 2066@H_301_35@     2067@H_301_35@ 2068@H_301_35@         2069@H_301_35@ 2070@H_301_35@ 
2071@H_301_35@     2072@H_301_35@ 2073@H_301_35@ 
2074@H_301_35@ CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON *  name)
@H_301_35@2075@H_301_35@ 2076@H_301_35@     cJSON *null@H_301_35@ = cJSON_CreateNull();
@H_301_35@2077@H_301_35@     if@H_301_35@ (add_item_to_object(null@H_301_35@,1)">2078@H_301_35@ 2079@H_301_35@         null@H_301_35@2080@H_301_35@ 2081@H_301_35@ 
2082@H_301_35@     cJSON_Delete(2083@H_301_35@     2084@H_301_35@ 2085@H_301_35@ 
2086@H_301_35@ CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * 2087@H_301_35@ 2088@H_301_35@     cJSON *true_item = cJSON_CreateTrue();
@H_301_35@2089@H_301_35@     2090@H_301_35@ 2091@H_301_35@          true_item;
@H_301_35@2092@H_301_35@ 2093@H_301_35@ 
2094@H_301_35@     cJSON_Delete(true_item);
@H_301_35@2095@H_301_35@     2096@H_301_35@ 2097@H_301_35@ 
2098@H_301_35@ CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * 2099@H_301_35@ 2100@H_301_35@     cJSON *false_item = cJSON_CreateFalse();
@H_301_35@2101@H_301_35@     2102@H_301_35@ 2103@H_301_35@          false_item;
@H_301_35@2104@H_301_35@ 2105@H_301_35@ 
2106@H_301_35@     cJSON_Delete(false_item);
@H_301_35@2107@H_301_35@     2108@H_301_35@ 2109@H_301_35@ 
2110@H_301_35@ CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON *  cJSON_bool boolean)
@H_301_35@2111@H_301_35@ 2112@H_301_35@     cJSON *bool_item = cJSON_CreateBool(boolean);
@H_301_35@2113@H_301_35@     2114@H_301_35@ 2115@H_301_35@          bool_item;
@H_301_35@2116@H_301_35@ 2117@H_301_35@ 
2118@H_301_35@     cJSON_Delete(bool_item);
@H_301_35@2119@H_301_35@     2120@H_301_35@ 2121@H_301_35@ 
2122@H_301_35@ CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * 2123@H_301_35@ 2124@H_301_35@     cJSON *number_item = cJSON_CreateNumber(number);
@H_301_35@2125@H_301_35@     2126@H_301_35@ 2127@H_301_35@          number_item;
@H_301_35@2128@H_301_35@ 2129@H_301_35@ 
2130@H_301_35@     cJSON_Delete(number_item);
@H_301_35@2131@H_301_35@     2132@H_301_35@ 2133@H_301_35@ 
2134@H_301_35@ CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * 2135@H_301_35@ 2136@H_301_35@     cJSON *string_item = cJSON_CreateString(2137@H_301_35@     2138@H_301_35@ 2139@H_301_35@          string_item;
@H_301_35@2140@H_301_35@ 2141@H_301_35@ 
2142@H_301_35@     cJSON_Delete(string_item);
@H_301_35@2143@H_301_35@     2144@H_301_35@ 2145@H_301_35@ 
2146@H_301_35@ CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON *  raw)
@H_301_35@2147@H_301_35@ 2148@H_301_35@     cJSON *raw_item = cJSON_CreateRaw(raw);
@H_301_35@2149@H_301_35@     2150@H_301_35@ 2151@H_301_35@          raw_item;
@H_301_35@2152@H_301_35@ 2153@H_301_35@ 
2154@H_301_35@     cJSON_Delete(raw_item);
@H_301_35@2155@H_301_35@     2156@H_301_35@ 2157@H_301_35@ 
2158@H_301_35@ CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * 2159@H_301_35@ 2160@H_301_35@     cJSON *object_item = cJSON_CreateObject();
@H_301_35@2161@H_301_35@     2162@H_301_35@ 2163@H_301_35@          object_item;
@H_301_35@2164@H_301_35@ 2165@H_301_35@ 
2166@H_301_35@     cJSON_Delete(object_item);
@H_301_35@2167@H_301_35@     2168@H_301_35@ 2169@H_301_35@ 
2170@H_301_35@ CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * 2171@H_301_35@ 2172@H_301_35@     cJSON *array = cJSON_CreateArray();
@H_301_35@2173@H_301_35@     2174@H_301_35@ 2175@H_301_35@          array;
@H_301_35@2176@H_301_35@ 2177@H_301_35@ 
2178@H_301_35@     cJSON_Delete(array);
@H_301_35@2179@H_301_35@     2180@H_301_35@ 2181@H_301_35@ 
2182@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent,1)"> item)
@H_301_35@2183@H_301_35@ 2184@H_301_35@     if@H_301_35@ ((parent == NULL) || (item ==2185@H_301_35@ 2186@H_301_35@         2187@H_301_35@ 2188@H_301_35@ 
2189@H_301_35@     if@H_301_35@ (item != parent->child)
@H_301_35@2190@H_301_35@ 2191@H_301_35@          not the first element @H_301_35@2192@H_301_35@         item->prev->next = item->2193@H_301_35@ 2194@H_301_35@     if@H_301_35@ (item->next !=2195@H_301_35@ 2196@H_301_35@          not the last element @H_301_35@2197@H_301_35@         item->next->prev = item->2198@H_301_35@ 2199@H_301_35@ 
2200@H_301_35@     if@H_301_35@ (item == parent->2201@H_301_35@ 2202@H_301_35@          first element @H_301_35@2203@H_301_35@         parent->child = item->2204@H_301_35@ 2205@H_301_35@      make sure the detached item doesn't point anywhere anymore @H_301_35@2206@H_301_35@     item->prev =2207@H_301_35@     item->next =2208@H_301_35@ 
2209@H_301_35@     2210@H_301_35@ 2211@H_301_35@ 
2212@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array,1)"> which)
@H_301_35@2213@H_301_35@ 2214@H_301_35@     if@H_301_35@ (which < 2215@H_301_35@ 2216@H_301_35@         2217@H_301_35@ 2218@H_301_35@ 
2219@H_301_35@      cJSON_DetachItemViaPointer(array,get_array_item(array,(size_t)which));
@H_301_35@2220@H_301_35@ 2221@H_301_35@ 
2222@H_301_35@ CJSON_PUBLIC(2223@H_301_35@ 2224@H_301_35@     cJSON_Delete(cJSON_DetachItemFromArray(array,which));
@H_301_35@2225@H_301_35@ 2226@H_301_35@ 
2227@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *2228@H_301_35@ 2229@H_301_35@     cJSON *to_detach = cJSON_GetObjectItem(2230@H_301_35@ 
2231@H_301_35@     return@H_301_35@ cJSON_DetachItemViaPointer(301_35@2232@H_301_35@ 2233@H_301_35@ 
2234@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *2235@H_301_35@ 2236@H_301_35@     cJSON *to_detach = cJSON_GetObjectItemCaseSensitive(2237@H_301_35@ 
2238@H_301_35@     2239@H_301_35@ 2240@H_301_35@ 
2241@H_301_35@ CJSON_PUBLIC(2242@H_301_35@ 2243@H_301_35@     cJSON_Delete(cJSON_DetachItemFromObject(2244@H_301_35@ 2245@H_301_35@ 
2246@H_301_35@ CJSON_PUBLIC(2247@H_301_35@ 2248@H_301_35@     cJSON_Delete(cJSON_DetachItemFromObjectCaseSensitive(2249@H_301_35@ 2250@H_301_35@ 
2251@H_301_35@  Replace array/object items with new ones. @H_301_35@2252@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(cJSON *array,1)">newitem)
@H_301_35@2253@H_301_35@ 2254@H_301_35@     cJSON *after_inserted =2255@H_301_35@ 
2256@H_301_35@     2257@H_301_35@ 2258@H_301_35@         2259@H_301_35@ 2260@H_301_35@ 
2261@H_301_35@     after_inserted =301_35@2262@H_301_35@     if@H_301_35@ (after_inserted ==2263@H_301_35@ 2264@H_301_35@         301_35@2265@H_301_35@ 2266@H_301_35@ 
2267@H_301_35@     newitem->next = after_inserted;
@H_301_35@2268@H_301_35@     newitem->prev = after_inserted->2269@H_301_35@     after_inserted->prev = newitem;
@H_301_35@2270@H_301_35@     if@H_301_35@ (after_inserted == array->2271@H_301_35@ 2272@H_301_35@         array->child =2273@H_301_35@ 2274@H_301_35@     2275@H_301_35@ 2276@H_301_35@         newitem->prev->next =2277@H_301_35@ 2278@H_301_35@     2279@H_301_35@ 2280@H_301_35@ 
2281@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON *  replacement)
@H_301_35@2282@H_301_35@ 2283@H_301_35@     if@H_301_35@ ((parent == NULL) || (replacement == NULL) || (item ==2284@H_301_35@ 2285@H_301_35@         2286@H_301_35@ 2287@H_301_35@ 
2288@H_301_35@     if@H_301_35@ (replacement ==2289@H_301_35@ 2290@H_301_35@         2291@H_301_35@ 2292@H_301_35@ 
2293@H_301_35@     replacement->next = item->2294@H_301_35@     replacement->prev = item->2295@H_301_35@ 
2296@H_301_35@     if@H_301_35@ (replacement->next !=2297@H_301_35@ 2298@H_301_35@         replacement->next->prev = replacement;
@H_301_35@2299@H_301_35@ 2300@H_301_35@     if@H_301_35@ (parent->child ==2301@H_301_35@ 2302@H_301_35@         parent->child =2303@H_301_35@ 2304@H_301_35@     2305@H_301_35@     {   2306@H_301_35@          * To find the last item in array quickly,we use prev in array.
@H_301_35@2307@H_301_35@          * We can't modify the last item's next pointer where this item was the parent's child
@H_301_35@2308@H_301_35@          2309@H_301_35@         if@H_301_35@ (replacement->prev !=2310@H_301_35@ 2311@H_301_35@             replacement->prev->next =2312@H_301_35@ 2313@H_301_35@ 2314@H_301_35@ 
2315@H_301_35@     item->next =2316@H_301_35@     item->prev =2317@H_301_35@     cJSON_Delete(item);
@H_301_35@2318@H_301_35@ 
2319@H_301_35@     2320@H_301_35@ 2321@H_301_35@ 
2322@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array,1)">2323@H_301_35@ 2324@H_301_35@     2325@H_301_35@ 2326@H_301_35@         2327@H_301_35@ 2328@H_301_35@ 
2329@H_301_35@      cJSON_ReplaceItemViaPointer(array,(size_t)which),1)">2330@H_301_35@ 2331@H_301_35@ 
2332@H_301_35@ static@H_301_35@ cJSON_bool replace_item_in_object(cJSON *replacement,cJSON_bool case_sensitive)
@H_301_35@2333@H_301_35@ 2334@H_301_35@     if@H_301_35@ ((replacement == NULL) || (2335@H_301_35@ 2336@H_301_35@         2337@H_301_35@ 2338@H_301_35@ 
2339@H_301_35@      replace the name in the replacement @H_301_35@2340@H_301_35@     if@H_301_35@ (!(replacement->type & cJSON_StringIsConst) && (replacement->2341@H_301_35@ 2342@H_301_35@         cJSON_free(replacement->2343@H_301_35@ 2344@H_301_35@     replacement->string@H_301_35@ = (2345@H_301_35@     replacement->type &= ~2346@H_301_35@ 
2347@H_301_35@     return@H_301_35@ cJSON_ReplaceItemViaPointer(301_35@2348@H_301_35@ 2349@H_301_35@ 
2350@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *2351@H_301_35@ 2352@H_301_35@     return@H_301_35@ replace_item_in_object(2353@H_301_35@ 2354@H_301_35@ 
2355@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *2356@H_301_35@ 2357@H_301_35@     2358@H_301_35@ 2359@H_301_35@ 
2360@H_301_35@  Create basic types: @H_301_35@2361@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateNull(2362@H_301_35@ 2363@H_301_35@     cJSON *item = cJSON_New_Item(&2364@H_301_35@     (item)
@H_301_35@2365@H_301_35@ 2366@H_301_35@         item->type =2367@H_301_35@ 2368@H_301_35@ 
2369@H_301_35@     2370@H_301_35@ 2371@H_301_35@ 
2372@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(2373@H_301_35@ 2374@H_301_35@     cJSON *item = cJSON_New_Item(&2375@H_301_35@     2376@H_301_35@ 2377@H_301_35@         item->type =2378@H_301_35@ 2379@H_301_35@ 
2380@H_301_35@     2381@H_301_35@ 2382@H_301_35@ 
2383@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(2384@H_301_35@ 2385@H_301_35@     cJSON *item = cJSON_New_Item(&2386@H_301_35@     2387@H_301_35@ 2388@H_301_35@         item->type =2389@H_301_35@ 2390@H_301_35@ 
2391@H_301_35@     2392@H_301_35@ 2393@H_301_35@ 
2394@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean)
@H_301_35@2395@H_301_35@ 2396@H_301_35@     cJSON *item = cJSON_New_Item(&2397@H_301_35@     2398@H_301_35@ 2399@H_301_35@         item->type = boolean ? cJSON_True : cJSON_False;
@H_301_35@2400@H_301_35@ 2401@H_301_35@ 
2402@H_301_35@     2403@H_301_35@ 2404@H_301_35@ 
2405@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateNumber( num)
@H_301_35@2406@H_301_35@ 2407@H_301_35@     cJSON *item = cJSON_New_Item(&2408@H_301_35@     2409@H_301_35@ 2410@H_301_35@         item->type =2411@H_301_35@         item->valuedouble = num;
@H_301_35@2412@H_301_35@ 
2413@H_301_35@         2414@H_301_35@         if@H_301_35@ (num >=2415@H_301_35@ 2416@H_301_35@             item->valueint =2417@H_301_35@ 2418@H_301_35@         if@H_301_35@ (num <= (2419@H_301_35@ 2420@H_301_35@             item->valueint =2421@H_301_35@ 2422@H_301_35@         2423@H_301_35@ 2424@H_301_35@             item->valueint = ()num;
@H_301_35@2425@H_301_35@ 2426@H_301_35@ 2427@H_301_35@ 
2428@H_301_35@     2429@H_301_35@ 2430@H_301_35@ 
2431@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateString(2432@H_301_35@ 2433@H_301_35@     cJSON *item = cJSON_New_Item(&2434@H_301_35@     2435@H_301_35@ 2436@H_301_35@         item->type =2437@H_301_35@         item->valuestring = (2438@H_301_35@         if@H_301_35@(!item->2439@H_301_35@ 2440@H_301_35@             cJSON_Delete(item);
@H_301_35@2441@H_301_35@             2442@H_301_35@ 2443@H_301_35@ 2444@H_301_35@ 
2445@H_301_35@     2446@H_301_35@ 2447@H_301_35@ 
2448@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(2449@H_301_35@ 2450@H_301_35@     cJSON *item = cJSON_New_Item(&2451@H_301_35@     2452@H_301_35@ 2453@H_301_35@         item->type = cJSON_String |2454@H_301_35@         item->valuestring = (2455@H_301_35@ 2456@H_301_35@ 
2457@H_301_35@     2458@H_301_35@ 2459@H_301_35@ 
2460@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(2461@H_301_35@ 2462@H_301_35@     cJSON *item = cJSON_New_Item(&2463@H_301_35@     2464@H_301_35@         item->type = cJSON_Object |2465@H_301_35@         item->child = (cJSON*)cast_away_const(child);
@H_301_35@2466@H_301_35@ 2467@H_301_35@ 
2468@H_301_35@     2469@H_301_35@ 2470@H_301_35@ 
2471@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(child) {
@H_301_35@2472@H_301_35@     cJSON *item = cJSON_New_Item(&2473@H_301_35@     2474@H_301_35@         item->type = cJSON_Array |2475@H_301_35@         item->child = (cJSON*2476@H_301_35@ 2477@H_301_35@ 
2478@H_301_35@     2479@H_301_35@ 2480@H_301_35@ 
2481@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(raw)
@H_301_35@2482@H_301_35@ 2483@H_301_35@     cJSON *item = cJSON_New_Item(&2484@H_301_35@     2485@H_301_35@ 2486@H_301_35@         item->type = cJSON_Raw;
@H_301_35@2487@H_301_35@         item->valuestring = (char@H_301_35@*)raw,1)">2488@H_301_35@         2489@H_301_35@ 2490@H_301_35@ 2491@H_301_35@             2492@H_301_35@ 2493@H_301_35@ 2494@H_301_35@ 
2495@H_301_35@     2496@H_301_35@ 2497@H_301_35@ 
2498@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateArray(2499@H_301_35@ 2500@H_301_35@     cJSON *item = cJSON_New_Item(&2501@H_301_35@     2502@H_301_35@ 2503@H_301_35@         item->type=cJSON_Array;
@H_301_35@2504@H_301_35@ 2505@H_301_35@ 
2506@H_301_35@     2507@H_301_35@ 2508@H_301_35@ 
2509@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateObject(2510@H_301_35@ 2511@H_301_35@     cJSON *item = cJSON_New_Item(&2512@H_301_35@      (item)
@H_301_35@2513@H_301_35@ 2514@H_301_35@         item->type =2515@H_301_35@ 2516@H_301_35@ 
2517@H_301_35@     2518@H_301_35@ 2519@H_301_35@ 
2520@H_301_35@  Create Arrays: @H_301_35@2521@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray( count)
@H_301_35@2522@H_301_35@ 2523@H_301_35@     size_t i = 2524@H_301_35@     cJSON *n =2525@H_301_35@     cJSON *p =2526@H_301_35@     cJSON *a =2527@H_301_35@ 
2528@H_301_35@     if@H_301_35@ ((count < 0@H_301_35@) || (numbers ==2529@H_301_35@ 2530@H_301_35@         2531@H_301_35@ 2532@H_301_35@ 
2533@H_301_35@     a =2534@H_301_35@     for@H_301_35@(i = 0@H_301_35@; a && (i < (size_t)count); i++2535@H_301_35@ 2536@H_301_35@         n = cJSON_CreateNumber(numbers[i]);
@H_301_35@2537@H_301_35@         n)
@H_301_35@2538@H_301_35@ 2539@H_301_35@             cJSON_Delete(a);
@H_301_35@2540@H_301_35@             2541@H_301_35@ 2542@H_301_35@         if@H_301_35@(!i)
@H_301_35@2543@H_301_35@ 2544@H_301_35@             a->child = n;
@H_301_35@2545@H_301_35@ 2546@H_301_35@         2547@H_301_35@ 2548@H_301_35@             suffix_object(p,n);
@H_301_35@2549@H_301_35@ 2550@H_301_35@         p =2551@H_301_35@ 2552@H_301_35@ 
2553@H_301_35@      a;
@H_301_35@2554@H_301_35@ 2555@H_301_35@ 
2556@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(2557@H_301_35@ 2558@H_301_35@     size_t i = 2559@H_301_35@     cJSON *n =2560@H_301_35@     cJSON *p =2561@H_301_35@     cJSON *a =2562@H_301_35@ 
2563@H_301_35@     2564@H_301_35@ 2565@H_301_35@         2566@H_301_35@ 2567@H_301_35@ 
2568@H_301_35@     a =2569@H_301_35@ 
2570@H_301_35@     2571@H_301_35@ 2572@H_301_35@         n = cJSON_CreateNumber(()numbers[i]);
@H_301_35@2573@H_301_35@         2574@H_301_35@ 2575@H_301_35@ 2576@H_301_35@             2577@H_301_35@ 2578@H_301_35@         2579@H_301_35@ 2580@H_301_35@             a->child =2581@H_301_35@ 2582@H_301_35@         2583@H_301_35@ 2584@H_301_35@ 2585@H_301_35@ 2586@H_301_35@         p =2587@H_301_35@ 2588@H_301_35@ 
2589@H_301_35@     2590@H_301_35@ 2591@H_301_35@ 
2592@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(2593@H_301_35@ 2594@H_301_35@     size_t i = 2595@H_301_35@     cJSON *n =2596@H_301_35@     cJSON *p =2597@H_301_35@     cJSON *a =2598@H_301_35@ 
2599@H_301_35@     2600@H_301_35@ 2601@H_301_35@         2602@H_301_35@ 2603@H_301_35@ 
2604@H_301_35@     a =2605@H_301_35@ 
2606@H_301_35@     0@H_301_35@;a && (i < (size_t)count); i++2607@H_301_35@ 2608@H_301_35@         n =2609@H_301_35@         2610@H_301_35@ 2611@H_301_35@ 2612@H_301_35@             2613@H_301_35@ 2614@H_301_35@         2615@H_301_35@ 2616@H_301_35@             a->child =2617@H_301_35@ 2618@H_301_35@         2619@H_301_35@ 2620@H_301_35@ 2621@H_301_35@ 2622@H_301_35@         p =2623@H_301_35@ 2624@H_301_35@ 
2625@H_301_35@     2626@H_301_35@ 2627@H_301_35@ 
2628@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(2629@H_301_35@ 2630@H_301_35@     size_t i = 2631@H_301_35@     cJSON *n =2632@H_301_35@     cJSON *p =2633@H_301_35@     cJSON *a =2634@H_301_35@ 
2635@H_301_35@     0@H_301_35@) || (strings ==2636@H_301_35@ 2637@H_301_35@         2638@H_301_35@ 2639@H_301_35@ 
2640@H_301_35@     a =2641@H_301_35@ 
2642@H_301_35@     2643@H_301_35@ 2644@H_301_35@         n = cJSON_CreateString(strings[i]);
@H_301_35@2645@H_301_35@         2646@H_301_35@ 2647@H_301_35@ 2648@H_301_35@             2649@H_301_35@ 2650@H_301_35@         2651@H_301_35@ 2652@H_301_35@             a->child =2653@H_301_35@ 2654@H_301_35@         2655@H_301_35@ 2656@H_301_35@ 2657@H_301_35@ 2658@H_301_35@         p =2659@H_301_35@ 2660@H_301_35@ 
2661@H_301_35@     2662@H_301_35@ 2663@H_301_35@ 
2664@H_301_35@  Duplication @H_301_35@2665@H_301_35@ CJSON_PUBLIC(cJSON *) cJSON_Duplicate(301_35@2666@H_301_35@ 2667@H_301_35@     cJSON *newitem =2668@H_301_35@     cJSON *child =2669@H_301_35@     cJSON *next =2670@H_301_35@     cJSON *newchild =2671@H_301_35@ 
2672@H_301_35@      Bail on bad ptr @H_301_35@2673@H_301_35@     2674@H_301_35@ 2675@H_301_35@         2676@H_301_35@ 2677@H_301_35@      Create new item @H_301_35@2678@H_301_35@     newitem = cJSON_New_Item(&2679@H_301_35@     2680@H_301_35@ 2681@H_301_35@         2682@H_301_35@ 2683@H_301_35@      Copy over all vars @H_301_35@2684@H_301_35@     newitem->type = item->type & (~cJSON_IsReference);
@H_301_35@2685@H_301_35@     newitem->valueint = item->valueint;
@H_301_35@2686@H_301_35@     newitem->valuedouble = item->2687@H_301_35@     if@H_301_35@ (item->2688@H_301_35@ 2689@H_301_35@         newitem->valuestring = (char@H_301_35@*)cJSON_strdup((unsigned char@H_301_35@*)item->valuestring,1)">2690@H_301_35@         if@H_301_35@ (!newitem->2691@H_301_35@ 2692@H_301_35@             2693@H_301_35@ 2694@H_301_35@ 2695@H_301_35@     2696@H_301_35@ 2697@H_301_35@         newitem->string@H_301_35@ = (item->type&cJSON_StringIsConst) ? item->string@H_301_35@ : (2698@H_301_35@         2699@H_301_35@ 2700@H_301_35@             2701@H_301_35@ 2702@H_301_35@ 2703@H_301_35@      If non-recursive,then we're done! @H_301_35@2704@H_301_35@     recurse)
@H_301_35@2705@H_301_35@ 2706@H_301_35@         2707@H_301_35@ 2708@H_301_35@      Walk the ->next chain for the child. @H_301_35@2709@H_301_35@     child = item->2710@H_301_35@     while@H_301_35@ (child !=2711@H_301_35@ 2712@H_301_35@         newchild = cJSON_Duplicate(child,1)">true@H_301_35@);  Duplicate (with recurse) each item in the ->next chain @H_301_35@2713@H_301_35@         newchild)
@H_301_35@2714@H_301_35@ 2715@H_301_35@             2716@H_301_35@ 2717@H_301_35@         if@H_301_35@ (next !=2718@H_301_35@ 2719@H_301_35@              If newitem->child already set,then crosswire ->prev and ->next and move on @H_301_35@2720@H_301_35@             next->next = newchild;
@H_301_35@2721@H_301_35@             newchild->prev =2722@H_301_35@             next =2723@H_301_35@ 2724@H_301_35@         2725@H_301_35@ 2726@H_301_35@              Set newitem->child and move to it @H_301_35@2727@H_301_35@             newitem->child =2728@H_301_35@             next =2729@H_301_35@ 2730@H_301_35@         child = child->2731@H_301_35@ 2732@H_301_35@ 
2733@H_301_35@     2734@H_301_35@ 
2735@H_301_35@ 2736@H_301_35@     if@H_301_35@ (newitem !=2737@H_301_35@ 2738@H_301_35@         cJSON_Delete(newitem);
@H_301_35@2739@H_301_35@ 2740@H_301_35@ 
2741@H_301_35@     2742@H_301_35@ 2743@H_301_35@ 
2744@H_301_35@ void@H_301_35@ skip_oneline_comment(input)
@H_301_35@2745@H_301_35@ 2746@H_301_35@     *input += static_strlen(//@H_301_35@2747@H_301_35@ 
2748@H_301_35@     for@H_301_35@ (; (*input)['@H_301_35@; ++(*input))
@H_301_35@2749@H_301_35@ 2750@H_301_35@         if@H_301_35@ ((*input)[) {
@H_301_35@2751@H_301_35@             *input += static_strlen(2752@H_301_35@             2753@H_301_35@ 2754@H_301_35@ 2755@H_301_35@ 2756@H_301_35@ 
2757@H_301_35@ void@H_301_35@ skip_multiline_comment(2758@H_301_35@ 2759@H_301_35@     *input += static_strlen(/*@H_301_35@2760@H_301_35@ 
2761@H_301_35@     2762@H_301_35@ 2763@H_301_35@         if@H_301_35@ (((*input)[*@H_301_35@'@H_301_35@) && ((*input)[1@H_301_35@] == 2764@H_301_35@ 2765@H_301_35@             *input += static_strlen(*/@H_301_35@2766@H_301_35@             2767@H_301_35@ 2768@H_301_35@ 2769@H_301_35@ 2770@H_301_35@ 
2771@H_301_35@ void@H_301_35@ minify_string(char@H_301_35@ **input,1)">output) {
@H_301_35@2772@H_301_35@     (*output)[0@H_301_35@] = (*input)[2773@H_301_35@     *input += static_strlen(2774@H_301_35@     *output += static_strlen(2775@H_301_35@ 
2776@H_301_35@ 
2777@H_301_35@     void@H_301_35@)++(*input),++(*output)) {
@H_301_35@2778@H_301_35@         (*output)[2779@H_301_35@ 
2780@H_301_35@         2781@H_301_35@             (*output)[2782@H_301_35@             *input += static_strlen(2783@H_301_35@             *output += static_strlen(2784@H_301_35@             2785@H_301_35@         } )) {
@H_301_35@2786@H_301_35@             (*output)[1@H_301_35@] = (*input)[2787@H_301_35@             *input += static_strlen(2788@H_301_35@             *output += static_strlen(2789@H_301_35@ 2790@H_301_35@ 2791@H_301_35@ 2792@H_301_35@ 
2793@H_301_35@ CJSON_PUBLIC(json)
@H_301_35@2794@H_301_35@ 2795@H_301_35@     char@H_301_35@ *into = json;
@H_301_35@2796@H_301_35@ 
2797@H_301_35@     if@H_301_35@ (json ==2798@H_301_35@ 2799@H_301_35@         2800@H_301_35@ 2801@H_301_35@ 
2802@H_301_35@     while@H_301_35@ (json[2803@H_301_35@ 2804@H_301_35@         switch@H_301_35@ (json[2805@H_301_35@ 2806@H_301_35@             2807@H_301_35@             2808@H_301_35@             2809@H_301_35@             2810@H_301_35@                 json++2811@H_301_35@                 2812@H_301_35@ 
2813@H_301_35@             2814@H_301_35@                 if@H_301_35@ (json[2815@H_301_35@ 2816@H_301_35@                     skip_oneline_comment(&2817@H_301_35@ 2818@H_301_35@                 2819@H_301_35@ 2820@H_301_35@                     skip_multiline_comment(&2821@H_301_35@                 } else@H_301_35@2822@H_301_35@                     json++2823@H_301_35@ 2824@H_301_35@                 2825@H_301_35@ 
2826@H_301_35@             2827@H_301_35@                 minify_string(&json,1)">into);
@H_301_35@2828@H_301_35@                 2829@H_301_35@ 
2830@H_301_35@             2831@H_301_35@                 into[0@H_301_35@] = json[2832@H_301_35@                 json++2833@H_301_35@                 into++2834@H_301_35@ 2835@H_301_35@ 2836@H_301_35@ 
2837@H_301_35@      and null-terminate. @H_301_35@2838@H_301_35@     *into = 2839@H_301_35@ 2840@H_301_35@ 
2841@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(2842@H_301_35@ 2843@H_301_35@     2844@H_301_35@ 2845@H_301_35@         2846@H_301_35@ 2847@H_301_35@ 
2848@H_301_35@     return@H_301_35@ (item->type & 0xFF@H_301_35@) ==2849@H_301_35@ 2850@H_301_35@ 
2851@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(2852@H_301_35@ 2853@H_301_35@     2854@H_301_35@ 2855@H_301_35@         2856@H_301_35@ 2857@H_301_35@ 
2858@H_301_35@     2859@H_301_35@ 2860@H_301_35@ 
2861@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(2862@H_301_35@ 2863@H_301_35@     2864@H_301_35@ 2865@H_301_35@         2866@H_301_35@ 2867@H_301_35@ 
2868@H_301_35@     0xff@H_301_35@) ==2869@H_301_35@ 2870@H_301_35@ 
2871@H_301_35@ 
2872@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(2873@H_301_35@ 2874@H_301_35@     2875@H_301_35@ 2876@H_301_35@         2877@H_301_35@ 2878@H_301_35@ 
2879@H_301_35@     return@H_301_35@ (item->type & (cJSON_True | cJSON_False)) != 2880@H_301_35@ 2881@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(2882@H_301_35@ 2883@H_301_35@     2884@H_301_35@ 2885@H_301_35@         2886@H_301_35@ 2887@H_301_35@ 
2888@H_301_35@     2889@H_301_35@ 2890@H_301_35@ 
2891@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(2892@H_301_35@ 2893@H_301_35@     2894@H_301_35@ 2895@H_301_35@         2896@H_301_35@ 2897@H_301_35@ 
2898@H_301_35@     2899@H_301_35@ 2900@H_301_35@ 
2901@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsString(2902@H_301_35@ 2903@H_301_35@     2904@H_301_35@ 2905@H_301_35@         2906@H_301_35@ 2907@H_301_35@ 
2908@H_301_35@     2909@H_301_35@ 2910@H_301_35@ 
2911@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(2912@H_301_35@ 2913@H_301_35@     2914@H_301_35@ 2915@H_301_35@         2916@H_301_35@ 2917@H_301_35@ 
2918@H_301_35@     2919@H_301_35@ 2920@H_301_35@ 
2921@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(2922@H_301_35@ 2923@H_301_35@     2924@H_301_35@ 2925@H_301_35@         2926@H_301_35@ 2927@H_301_35@ 
2928@H_301_35@     2929@H_301_35@ 2930@H_301_35@ 
2931@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(2932@H_301_35@ 2933@H_301_35@     2934@H_301_35@ 2935@H_301_35@         2936@H_301_35@ 2937@H_301_35@ 
2938@H_301_35@     2939@H_301_35@ 2940@H_301_35@ 
2941@H_301_35@ CJSON_PUBLIC(cJSON_bool) cJSON_Compare(2942@H_301_35@ 2943@H_301_35@     if@H_301_35@ ((a == NULL) || (b == NULL) || ((a->type & 0xFF@H_301_35@) != (b->type & 0xFF@H_301_35@)) || cJSON_IsInvalid(a))
@H_301_35@2944@H_301_35@ 2945@H_301_35@         2946@H_301_35@ 2947@H_301_35@ 
2948@H_301_35@      check if type is valid @H_301_35@2949@H_301_35@     switch@H_301_35@ (a->type & 2950@H_301_35@ 2951@H_301_35@         2952@H_301_35@         2953@H_301_35@         2954@H_301_35@         2955@H_301_35@         2956@H_301_35@         2957@H_301_35@         2958@H_301_35@         2959@H_301_35@             2960@H_301_35@ 
2961@H_301_35@         2962@H_301_35@             2963@H_301_35@ 2964@H_301_35@ 
2965@H_301_35@      identical objects are equal @H_301_35@2966@H_301_35@     if@H_301_35@ (a ==2967@H_301_35@ 2968@H_301_35@         2969@H_301_35@ 2970@H_301_35@ 
2971@H_301_35@     2972@H_301_35@ 2973@H_301_35@          in these cases and equal type is enough @H_301_35@2974@H_301_35@         2975@H_301_35@         2976@H_301_35@         2977@H_301_35@             2978@H_301_35@ 
2979@H_301_35@         2980@H_301_35@             if@H_301_35@ (compare_double(a->valuedouble,b->valuedouble))
@H_301_35@2981@H_301_35@ 2982@H_301_35@                 2983@H_301_35@ 2984@H_301_35@             2985@H_301_35@ 
2986@H_301_35@         2987@H_301_35@         2988@H_301_35@             if@H_301_35@ ((a->valuestring == NULL) || (b->valuestring ==2989@H_301_35@ 2990@H_301_35@                 2991@H_301_35@ 2992@H_301_35@             if@H_301_35@ (strcmp(a->valuestring,b->valuestring) == 2993@H_301_35@ 2994@H_301_35@                 2995@H_301_35@ 2996@H_301_35@ 
2997@H_301_35@             2998@H_301_35@ 
2999@H_301_35@         3000@H_301_35@ 3001@H_301_35@             cJSON *a_element = a->3002@H_301_35@             cJSON *b_element = b->3003@H_301_35@ 
3004@H_301_35@             for@H_301_35@ (; (a_element != NULL) && (b_element != NULL);)
@H_301_35@3005@H_301_35@ 3006@H_301_35@                 cJSON_Compare(a_element,b_element,case_sensitive))
@H_301_35@3007@H_301_35@ 3008@H_301_35@                     3009@H_301_35@ 3010@H_301_35@ 
3011@H_301_35@                 a_element = a_element->3012@H_301_35@                 b_element = b_element->3013@H_301_35@ 3014@H_301_35@ 
3015@H_301_35@              one of the arrays is longer than the other @H_301_35@3016@H_301_35@             if@H_301_35@ (a_element != b_element) {
@H_301_35@3017@H_301_35@                 3018@H_301_35@ 3019@H_301_35@ 
3020@H_301_35@             3021@H_301_35@ 3022@H_301_35@ 
3023@H_301_35@         3024@H_301_35@ 3025@H_301_35@             cJSON *a_element =3026@H_301_35@             cJSON *b_element =3027@H_301_35@             cJSON_ArrayForEach(a_element,a)
@H_301_35@3028@H_301_35@ 3029@H_301_35@                  TODO This has O(n^2) runtime,which is horrible! @H_301_35@3030@H_301_35@                 b_element = get_object_item(b,a_element->301_35@3031@H_301_35@                 if@H_301_35@ (b_element ==3032@H_301_35@ 3033@H_301_35@                     3034@H_301_35@ 3035@H_301_35@ 
3036@H_301_35@                 3037@H_301_35@ 3038@H_301_35@                     3039@H_301_35@ 3040@H_301_35@ 3041@H_301_35@ 
3042@H_301_35@              doing this twice,once on a and b to prevent true comparison if a subset of b
@H_301_35@3043@H_301_35@              * TODO: Do this the proper way,this is just a fix for now @H_301_35@3044@H_301_35@             cJSON_ArrayForEach(b_element,b)
@H_301_35@3045@H_301_35@ 3046@H_301_35@                 a_element = get_object_item(a,b_element->3047@H_301_35@                 if@H_301_35@ (a_element ==3048@H_301_35@ 3049@H_301_35@                     3050@H_301_35@ 3051@H_301_35@ 
3052@H_301_35@                 cJSON_Compare(b_element,a_element,1)">3053@H_301_35@ 3054@H_301_35@                     3055@H_301_35@ 3056@H_301_35@ 3057@H_301_35@ 
3058@H_301_35@             3059@H_301_35@ 3060@H_301_35@ 
3061@H_301_35@         3062@H_301_35@             3063@H_301_35@ 3064@H_301_35@ 3065@H_301_35@ 
3066@H_301_35@ CJSON_PUBLIC() cJSON_malloc(size_t size)
@H_301_35@3067@H_301_35@ 3068@H_301_35@      global_hooks.allocate(size);
@H_301_35@3069@H_301_35@ 3070@H_301_35@ 
3071@H_301_35@ CJSON_PUBLIC(3072@H_301_35@ 3073@H_301_35@     global_hooks.deallocate(3074@H_301_35@ }
View Code@H_301_35@

 


 参考:

https://blog.csdn.net/shizhe0123/article/details/94742514

https://blog.csdn.net/fengxinlinux/article/details/53121287

https://www.cnblogs.com/skullboyer/p/8152157.html

猜你在找的C&C++相关文章