From b95a4c56b05fb3200780c1cacc3b1659a2832f8e Mon Sep 17 00:00:00 2001 From: Alanscut Date: Mon, 22 Jun 2020 11:23:24 +0800 Subject: [PATCH] fix #376 --- cJSON.c | 4 ++-- cJSON.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cJSON.c b/cJSON.c index 23270c4..3cdc8fa 100644 --- a/cJSON.c +++ b/cJSON.c @@ -92,7 +92,7 @@ CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void) return (const char*) (global_error.json + global_error.position); } -CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item) +CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item) { if (!cJSON_IsString(item)) { @@ -102,7 +102,7 @@ CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item) return item->valuestring; } -CJSON_PUBLIC(double) cJSON_GetNumberValue(cJSON *item) +CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item) { if (!cJSON_IsNumber(item)) { diff --git a/cJSON.h b/cJSON.h index 0c6c8e0..b5ceb29 100644 --- a/cJSON.h +++ b/cJSON.h @@ -176,8 +176,8 @@ CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *st CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void); /* Check item type and return its value */ -CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item); -CJSON_PUBLIC(double) cJSON_GetNumberValue(cJSON *item); +CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item); +CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item); /* These functions check the type of an item */ CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item);