Static Value-Flow Analysis
|
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <ctype.h>
#include <float.h>
#include "Util/cJSON.h"
Go to the source code of this file.
Classes | |
struct | error |
struct | internal_hooks |
struct | parse_buffer |
struct | printbuffer |
Macros | |
#define | true ((cJSON_bool)1) |
#define | false ((cJSON_bool)0) |
#define | isinf(d) (isnan((d - d)) && !isnan(d)) |
#define | isnan(d) (d != d) |
#define | NAN 0.0/0.0 |
#define | internal_malloc malloc |
#define | internal_free free |
#define | internal_realloc realloc |
#define | static_strlen(string_literal) (sizeof(string_literal) - sizeof("")) |
#define | can_read(buffer, size) ((buffer != NULL) && (((buffer)->offset + size) <= (buffer)->length)) |
#define | can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length)) |
#define | cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index)) |
#define | buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset) |
#define | cjson_min(a, b) (((a) < (b)) ? (a) : (b)) |
Typedefs | |
typedef struct internal_hooks | internal_hooks |
Functions | |
CJSON_PUBLIC (const char *) cJSON_GetErrorPtr(void) | |
CJSON_PUBLIC (char *) cJSON_GetStringValue(const cJSON *const item) | |
CJSON_PUBLIC (double) cJSON_GetNumberValue(const cJSON *const item) | |
static int | case_insensitive_strcmp (const unsigned char *string1, const unsigned char *string2) |
static unsigned char * | cJSON_strdup (const unsigned char *string, const internal_hooks *const hooks) |
CJSON_PUBLIC (void) cJSON_InitHooks(cJSON_Hooks *hooks) | |
static cJSON * | cJSON_New_Item (const internal_hooks *const hooks) |
static unsigned char | get_decimal_point (void) |
static cJSON_bool | parse_number (cJSON *const item, parse_buffer *const input_buffer) |
if (!(object->type &cJSON_String)||(object->type &cJSON_IsReference)) | |
if (strlen(valuestring)<=strlen(object->valuestring)) | |
if (copy==NULL) | |
if (object->valuestring !=NULL) | |
static unsigned char * | ensure (printbuffer *const p, size_t needed) |
static void | update_offset (printbuffer *const buffer) |
static cJSON_bool | compare_double (double a, double b) |
static cJSON_bool | print_number (const cJSON *const item, printbuffer *const output_buffer) |
static unsigned | parse_hex4 (const unsigned char *const input) |
static unsigned char | utf16_literal_to_utf8 (const unsigned char *const input_pointer, const unsigned char *const input_end, unsigned char **output_pointer) |
static cJSON_bool | parse_string (cJSON *const item, parse_buffer *const input_buffer) |
static cJSON_bool | print_string_ptr (const unsigned char *const input, printbuffer *const output_buffer) |
static cJSON_bool | print_string (const cJSON *const item, printbuffer *const p) |
static cJSON_bool | parse_value (cJSON *const item, parse_buffer *const input_buffer) |
static cJSON_bool | print_value (const cJSON *const item, printbuffer *const output_buffer) |
static cJSON_bool | parse_array (cJSON *const item, parse_buffer *const input_buffer) |
static cJSON_bool | print_array (const cJSON *const item, printbuffer *const output_buffer) |
static cJSON_bool | parse_object (cJSON *const item, parse_buffer *const input_buffer) |
static cJSON_bool | print_object (const cJSON *const item, printbuffer *const output_buffer) |
static parse_buffer * | buffer_skip_whitespace (parse_buffer *const buffer) |
static parse_buffer * | skip_utf8_bom (parse_buffer *const buffer) |
CJSON_PUBLIC (cJSON *) cJSON_ParseWithOpts(const char *value | |
if (NULL==value) | |
return | cJSON_ParseWithLengthOpts (value, buffer_length, return_parse_end, require_null_terminated) |
if (value==NULL||0==buffer_length) | |
if (item==NULL) | |
if (!parse_value(item, buffer_skip_whitespace(skip_utf8_bom(&buffer)))) | |
if (require_null_terminated) | |
if (return_parse_end) | |
if (value !=NULL) | |
static unsigned char * | print (const cJSON *const item, cJSON_bool format, const internal_hooks *const hooks) |
if (prebuffer< 0) | |
if (!p.buffer) | |
if (!print_value(item, &p)) | |
return (char *) p.buffer | |
CJSON_PUBLIC (cJSON_bool) cJSON_PrintPreallocated(cJSON *item | |
if ((length< 0)||(buffer==NULL)) | |
return | print_value (item, &p) |
static cJSON * | get_array_item (const cJSON *array, size_t index) |
static cJSON * | get_object_item (const cJSON *const object, const char *const name, const cJSON_bool case_sensitive) |
static void | suffix_object (cJSON *prev, cJSON *item) |
static cJSON * | create_reference (const cJSON *item, const internal_hooks *const hooks) |
static cJSON_bool | add_item_to_array (cJSON *array, cJSON *item) |
static void * | cast_away_const (const void *string) |
static cJSON_bool | add_item_to_object (cJSON *const object, const char *const string, cJSON *const item, const internal_hooks *const hooks, const cJSON_bool constant_key) |
if (add_item_to_object(object, name, null, &global_hooks, false)) | |
cJSON_Delete (null) | |
if (add_item_to_object(object, name, true_item, &global_hooks, false)) | |
cJSON_Delete (true_item) | |
if (add_item_to_object(object, name, false_item, &global_hooks, false)) | |
cJSON_Delete (false_item) | |
if (add_item_to_object(object, name, bool_item, &global_hooks, false)) | |
cJSON_Delete (bool_item) | |
if (add_item_to_object(object, name, number_item, &global_hooks, false)) | |
cJSON_Delete (number_item) | |
if (add_item_to_object(object, name, string_item, &global_hooks, false)) | |
cJSON_Delete (string_item) | |
if (add_item_to_object(object, name, raw_item, &global_hooks, false)) | |
cJSON_Delete (raw_item) | |
if (add_item_to_object(object, name, object_item, &global_hooks, false)) | |
cJSON_Delete (object_item) | |
if (add_item_to_object(object, name, array, &global_hooks, false)) | |
cJSON_Delete (array) | |
return | cJSON_DetachItemViaPointer (object, to_detach) |
if (after_inserted==NULL) | |
if (replacement->next !=NULL) | |
if (parent->child==item) | |
cJSON_Delete (item) | |
static cJSON_bool | replace_item_in_object (cJSON *object, const char *string, cJSON *replacement, cJSON_bool case_sensitive) |
if ((count< 0)||(numbers==NULL)) | |
for (i=0;a &&(i<(size_t) count);i++) | |
if (a &&a->child) | |
if ((count< 0)||(strings==NULL)) | |
if (!item) | |
if (item->valuestring) | |
while (child !=NULL) | |
if (newitem &&newitem->child) | |
static void | skip_oneline_comment (char **input) |
static void | skip_multiline_comment (char **input) |
static void | minify_string (char **input, char **output) |
#define cannot_access_at_index | ( | buffer, | |
index | |||
) | (!can_access_at_index(buffer, index)) |
#define false ((cJSON_bool)0) |
#define static_strlen | ( | string_literal | ) | (sizeof(string_literal) - sizeof("")) |
return true ((cJSON_bool)1) |
typedef struct internal_hooks internal_hooks |
|
static |
Definition at line 1962 of file cJSON.cpp.
|
static |
Definition at line 2017 of file cJSON.cpp.
|
static |
|
static |
Definition at line 134 of file cJSON.cpp.
|
static |
cJSON_Delete | ( | array | ) |
cJSON_Delete | ( | bool_item | ) |
cJSON_Delete | ( | false_item | ) |
cJSON_Delete | ( | item | ) |
cJSON_Delete | ( | null | ) |
cJSON_Delete | ( | number_item | ) |
cJSON_Delete | ( | object_item | ) |
cJSON_Delete | ( | raw_item | ) |
cJSON_Delete | ( | string_item | ) |
cJSON_Delete | ( | true_item | ) |
return cJSON_DetachItemViaPointer | ( | object | , |
to_detach | |||
) |
|
static |
return cJSON_ParseWithLengthOpts | ( | value | , |
buffer_length | , | ||
return_parse_end | , | ||
require_null_terminated | |||
) |
CJSON_PUBLIC | ( | cJSON * | ) | const |
CJSON_PUBLIC | ( | cJSON_bool | ) |
CJSON_PUBLIC | ( | void | ) |
Definition at line 210 of file cJSON.cpp.
|
static |
|
static |
|
static |
Definition at line 1941 of file cJSON.cpp.
|
static |
Definition at line 440 of file cJSON.cpp.
|
static |
|
static |
Definition at line 1885 of file cJSON.cpp.
if | ( | ! | object->type &cJSON_String)||(object->type &cJSON_IsReference | ) |
if | ( | ! | parse_valueitem, buffer_skip_whitespace(skip_utf8_bom(&buffer)) | ) |
if | ( | ! | print_valueitem, &p | ) |
if | ( | add_item_to_object(object, name, array, &global_hooks, false) | ) |
if | ( | add_item_to_object(object, name, bool_item, &global_hooks, false) | ) |
if | ( | add_item_to_object(object, name, false_item, &global_hooks, false) | ) |
if | ( | add_item_to_object(object, name, null, &global_hooks, false) | ) |
if | ( | add_item_to_object(object, name, number_item, &global_hooks, false) | ) |
if | ( | add_item_to_object(object, name, object_item, &global_hooks, false) | ) |
if | ( | add_item_to_object(object, name, raw_item, &global_hooks, false) | ) |
if | ( | add_item_to_object(object, name, string_item, &global_hooks, false) | ) |
if | ( | add_item_to_object(object, name, true_item, &global_hooks, false) | ) |
if | ( | after_inserted | = = NULL | ) |
if | ( | item-> | valuestring | ) |
if | ( | object->valuestring ! | = NULL | ) |
if | ( | parent-> | child = = item | ) |
if | ( | replacement->next ! | = NULL | ) |
if | ( | require_null_terminated | ) |
Definition at line 1129 of file cJSON.cpp.
if | ( | return_parse_end | ) |
if | ( | strlen(valuestring)<=strlen(object->valuestring) | ) |
if | ( | value ! | = NULL | ) |
Definition at line 1150 of file cJSON.cpp.
if | ( | value | = = NULL || 0 == buffer_length | ) |
|
static |
Definition at line 2831 of file cJSON.cpp.
|
static |
Definition at line 1444 of file cJSON.cpp.
|
static |
Definition at line 617 of file cJSON.cpp.
|
static |
Definition at line 306 of file cJSON.cpp.
|
static |
Definition at line 1605 of file cJSON.cpp.
|
static |
Definition at line 775 of file cJSON.cpp.
|
static |
Definition at line 1315 of file cJSON.cpp.
|
static |
Definition at line 1189 of file cJSON.cpp.
|
static |
Definition at line 1543 of file cJSON.cpp.
|
static |
Definition at line 547 of file cJSON.cpp.
|
static |
Definition at line 1719 of file cJSON.cpp.
|
static |
|
static |
Definition at line 904 of file cJSON.cpp.
|
static |
Definition at line 1370 of file cJSON.cpp.
|
static |
Definition at line 2358 of file cJSON.cpp.
return | ( | char * | ) |
|
static |
|
static |
|
static |
Definition at line 1066 of file cJSON.cpp.
|
static |
|
static |
Definition at line 654 of file cJSON.cpp.
Definition at line 2765 of file cJSON.cpp.
after_inserted = get_array_item(array, (size_t)which) |
const char* const const cJSON_bool boolean |
return copy = (char*) cJSON_strdup((const unsigned char*)valuestring, &global_hooks) |
int cJSON_bool fmt |
Definition at line 1265 of file cJSON.cpp.
|
static |
p hooks = global_hooks |
int index |
global_error json = NULL |
p length = buffer_length |
const char* const name |
return newitem |
const char* const const double number |
global_error position = 0 |
item prev = after_inserted->prev |
const char* const const char* const raw |
size_t const char cJSON_bool require_null_terminated |
const char* string |
newitem type = item->type & (~cJSON_IsReference) |