1
0
mirror of https://github.com/DaveGamble/cJSON synced 2024-12-24 15:42:07 +00:00

Fixing all W4-level warnings.

This commit is contained in:
Pawel Winogrodzki 2017-03-29 13:03:38 -07:00 committed by Max Bruckner
parent 6702037b68
commit 238ceec175

15
cJSON.c
View File

@ -23,7 +23,10 @@
/* cJSON */
/* JSON parser in C. */
#ifdef __GNUC__
#pragma GCC visibility push(default)
#endif
#include <string.h>
#include <stdio.h>
#include <math.h>
@ -32,7 +35,10 @@
#include <limits.h>
#include <ctype.h>
#include <locale.h>
#ifdef __GNUC__
#pragma GCC visibility pop
#endif
#include "cJSON.h"
@ -956,7 +962,7 @@ static parse_buffer *buffer_skip_whitespace(parse_buffer * const buffer)
/* Parse an object - create a new root, and populate. */
CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated)
{
parse_buffer buffer;
parse_buffer buffer = { 0 };
cJSON *item = NULL;
/* reset error position */
@ -1040,7 +1046,9 @@ CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value)
return cJSON_ParseWithOpts(value, 0, 0);
}
#ifndef min
#define min(a, b) ((a < b) ? a : b)
#endif
static unsigned char *print(const cJSON * const item, cJSON_bool format, const internal_hooks * const hooks)
{
@ -1687,7 +1695,7 @@ CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON *object, const char *strin
return c;
}
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string)
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * object, const char * string)
{
cJSON *current_element = NULL;
@ -1771,7 +1779,10 @@ CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSO
#if defined (__clang__) || ((__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5))))
#pragma GCC diagnostic push
#endif
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wcast-qual"
#endif
/* Add an item to an object with constant string as key */
CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item)
{