mirror of
https://github.com/DaveGamble/cJSON.git
synced 2026-06-12 00:04:40 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 981f59b163 | |||
| e4eadb9a81 | |||
| ff0681e4fd | |||
| a2309a509d | |||
| c49ffbfba8 | |||
| e7533aa6f0 |
+1
-1
@@ -7,7 +7,7 @@ project(cJSON C)
|
||||
|
||||
set(PROJECT_VERSION_MAJOR 1)
|
||||
set(PROJECT_VERSION_MINOR 2)
|
||||
set(PROJECT_VERSION_PATCH 0)
|
||||
set(PROJECT_VERSION_PATCH 1)
|
||||
set(CJSON_VERSION_SO 1)
|
||||
set(CJSON_UTILS_VERSION_SO 1)
|
||||
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
||||
|
||||
@@ -10,7 +10,7 @@ UTILS_TEST_SRC = cJSON.c cJSON_Utils.c test_utils.c
|
||||
|
||||
LDLIBS = -lm
|
||||
|
||||
LIBVERSION = 1.2.0
|
||||
LIBVERSION = 1.2.1
|
||||
CJSON_SOVERSION = 1
|
||||
UTILS_SOVERSION = 1
|
||||
|
||||
|
||||
@@ -58,6 +58,14 @@ const char *cJSON_GetErrorPtr(void)
|
||||
return global_ep;
|
||||
}
|
||||
|
||||
extern const char* cJSON_Version(void)
|
||||
{
|
||||
static char version[15];
|
||||
sprintf(version, "%i.%i.%i", CJSON_VERSION_MAJOR, CJSON_VERSION_MINOR, CJSON_VERSION_PATCH);
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
/* case insensitive strcmp */
|
||||
static int cJSON_strcasecmp(const char *s1, const char *s2)
|
||||
{
|
||||
|
||||
@@ -28,6 +28,14 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* project version */
|
||||
#define CJSON_VERSION_MAJOR 1
|
||||
#define CJSON_VERSION_MINOR 2
|
||||
#define CJSON_VERSION_PATCH 1
|
||||
|
||||
/* returns the version of cJSON as a string */
|
||||
extern const char* cJSON_Version(void);
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* cJSON Types: */
|
||||
|
||||
+17
-5
@@ -208,6 +208,11 @@ cJSON *cJSONUtils_GetPointer(cJSON *object, const char *pointer)
|
||||
static void cJSONUtils_InplaceDecodePointerString(char *string)
|
||||
{
|
||||
char *s2 = string;
|
||||
|
||||
if (string == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (; *string; s2++, string++)
|
||||
{
|
||||
*s2 = (*string != '~')
|
||||
@@ -229,12 +234,19 @@ static cJSON *cJSONUtils_PatchDetach(cJSON *object, const char *path)
|
||||
|
||||
/* copy path and split it in parent and child */
|
||||
parentptr = cJSONUtils_strdup(path);
|
||||
childptr = strrchr(parentptr, '/'); /* last '/' */
|
||||
if (childptr)
|
||||
{
|
||||
/* split strings */
|
||||
*childptr++ = '\0';
|
||||
if (parentptr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
childptr = strrchr(parentptr, '/'); /* last '/' */
|
||||
if (childptr == NULL)
|
||||
{
|
||||
free(parentptr);
|
||||
return NULL;
|
||||
}
|
||||
/* split strings */
|
||||
*childptr++ = '\0';
|
||||
|
||||
parent = cJSONUtils_GetPointer(object, parentptr);
|
||||
cJSONUtils_InplaceDecodePointerString(childptr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user