New upstream version 1.7.7
Yanhao Mo
5 years ago
|
0 |
1.7.7
|
|
1 |
=====
|
|
2 |
Fixes:
|
|
3 |
------
|
|
4 |
* Fix a memory leak when realloc fails (see #267), thanks @AlfieDeng for reporting
|
|
5 |
* Fix a typo in the header file (see #266), thanks @zhaozhixu
|
|
6 |
|
|
7 |
1.7.6
|
|
8 |
=====
|
|
9 |
Fixes:
|
|
10 |
------
|
|
11 |
* Add `SONAME` to the ELF files built by the Makefile (see #252), thanks @YanhaoMo for reporting
|
|
12 |
* Add include guards and `extern "C"` to `cJSON_Utils.h` (see #256), thanks @daschfg for reporting
|
|
13 |
|
|
14 |
Other changes:
|
|
15 |
--------------
|
|
16 |
* Mark the Makefile as deprecated in the README.
|
|
17 |
|
0 | 18 |
1.7.5
|
1 | 19 |
=====
|
2 | 20 |
Fixes:
|
6 | 6 |
|
7 | 7 |
set(PROJECT_VERSION_MAJOR 1)
|
8 | 8 |
set(PROJECT_VERSION_MINOR 7)
|
9 | |
set(PROJECT_VERSION_PATCH 5)
|
|
9 |
set(PROJECT_VERSION_PATCH 7)
|
10 | 10 |
set(CJSON_VERSION_SO 1)
|
11 | 11 |
set(CJSON_UTILS_VERSION_SO 1)
|
12 | 12 |
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
40 | 40 |
* [Stephan Gatzka](https://github.com/gatzka)
|
41 | 41 |
* [Weston Schmidt](https://github.com/schmidtw)
|
42 | 42 |
* [yangfl](https://github.com/yangfl)
|
|
43 |
* [Zhao Zhixu](https://github.com/zhaozhixu)
|
43 | 44 |
|
44 | 45 |
And probably more people on [SourceForge](https://sourceforge.net/p/cjson/bugs/search/?q=status%3Aclosed-rejected+or+status%3Aclosed-out-of-date+or+status%3Awont-fix+or+status%3Aclosed-fixed+or+status%3Aclosed&page=0)
|
45 | 46 |
|
7 | 7 |
|
8 | 8 |
LDLIBS = -lm
|
9 | 9 |
|
10 | |
LIBVERSION = 1.7.5
|
|
10 |
LIBVERSION = 1.7.7
|
11 | 11 |
CJSON_SOVERSION = 1
|
12 | 12 |
UTILS_SOVERSION = 1
|
|
13 |
|
|
14 |
CJSON_SO_LDFLAG=-Wl,-soname=$(CJSON_LIBNAME).so.$(CJSON_SOVERSION)
|
|
15 |
UTILS_SO_LDFLAG=-Wl,-soname=$(UTILS_LIBNAME).so.$(UTILS_SOVERSION)
|
13 | 16 |
|
14 | 17 |
PREFIX ?= /usr/local
|
15 | 18 |
INCLUDE_PATH ?= include/cjson
|
|
22 | 25 |
|
23 | 26 |
# validate gcc version for use fstack-protector-strong
|
24 | 27 |
MIN_GCC_VERSION = "4.9"
|
25 | |
GCC_VERSION := "`gcc -dumpversion`"
|
|
28 |
GCC_VERSION := "`$(CC) -dumpversion`"
|
26 | 29 |
IS_GCC_ABOVE_MIN_VERSION := $(shell expr "$(GCC_VERSION)" ">=" "$(MIN_GCC_VERSION)")
|
27 | 30 |
ifeq "$(IS_GCC_ABOVE_MIN_VERSION)" "1"
|
28 | 31 |
CFLAGS += -fstack-protector-strong
|
|
41 | 44 |
## create dynamic (shared) library on Darwin (base OS for MacOSX and IOS)
|
42 | 45 |
ifeq (Darwin, $(uname))
|
43 | 46 |
SHARED = dylib
|
|
47 |
CJSON_SO_LDFLAG = ""
|
|
48 |
UTILS_SO_LDFLAG = ""
|
44 | 49 |
endif
|
45 | 50 |
|
46 | 51 |
#cJSON library names
|
|
89 | 94 |
#shared libraries .so.1.0.0
|
90 | 95 |
#cJSON
|
91 | 96 |
$(CJSON_SHARED_VERSION): $(CJSON_OBJ)
|
92 | |
$(CC) -shared -o $@ $< $(LDFLAGS)
|
|
97 |
$(CC) -shared -o $@ $< $(CJSON_SO_LDFLAG) $(LDFLAGS)
|
93 | 98 |
#cJSON_Utils
|
94 | 99 |
$(UTILS_SHARED_VERSION): $(UTILS_OBJ)
|
95 | |
$(CC) -shared -o $@ $< $(LDFLAGS)
|
|
100 |
$(CC) -shared -o $@ $< $(UTILS_SO_LDFLAG) $(LDFLAGS)
|
96 | 101 |
|
97 | 102 |
#objects
|
98 | 103 |
#cJSON
|
126 | 126 |
On Windows CMake is usually used to create a Visual Studio solution file by running it inside the Developer Command Prompt for Visual Studio, for exact steps follow the official documentation from CMake and Microsoft and use the online search engine of your choice. The descriptions of the the options above still generally apply, although not all of them work on Windows.
|
127 | 127 |
|
128 | 128 |
#### Makefile
|
|
129 |
**NOTE:** This Method is deprecated. Use CMake if at all possible. Makefile support is limited to fixing bugs.
|
|
130 |
|
129 | 131 |
If you don't have CMake available, but still have GNU make. You can use the makefile to build cJSON:
|
130 | 132 |
|
131 | |
Run this command in the directory with the source code and it will automatically compile static and shared libraries and a little test program.
|
|
133 |
Run this command in the directory with the source code and it will automatically compile static and shared libraries and a little test program (not the full test suite).
|
132 | 134 |
|
133 | 135 |
```
|
134 | 136 |
make all
|
40 | 40 |
#include <stdio.h>
|
41 | 41 |
#include <math.h>
|
42 | 42 |
#include <stdlib.h>
|
43 | |
#include <float.h>
|
44 | 43 |
#include <limits.h>
|
45 | 44 |
#include <ctype.h>
|
46 | 45 |
|
|
81 | 80 |
}
|
82 | 81 |
|
83 | 82 |
/* This is a safeguard to prevent copy-pasters from using incompatible C and header files */
|
84 | |
#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 5)
|
|
83 |
#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 7)
|
85 | 84 |
#error cJSON.h and cJSON.c have different versions. Make sure that both have the same.
|
86 | 85 |
#endif
|
87 | 86 |
|
|
1113 | 1112 |
if (hooks->reallocate != NULL)
|
1114 | 1113 |
{
|
1115 | 1114 |
printed = (unsigned char*) hooks->reallocate(buffer->buffer, buffer->offset + 1);
|
1116 | |
buffer->buffer = NULL;
|
1117 | 1115 |
if (printed == NULL) {
|
1118 | 1116 |
goto fail;
|
1119 | 1117 |
}
|
|
1118 |
buffer->buffer = NULL;
|
1120 | 1119 |
}
|
1121 | 1120 |
else /* otherwise copy the JSON over to a new buffer */
|
1122 | 1121 |
{
|
30 | 30 |
/* project version */
|
31 | 31 |
#define CJSON_VERSION_MAJOR 1
|
32 | 32 |
#define CJSON_VERSION_MINOR 7
|
33 | |
#define CJSON_VERSION_PATCH 5
|
|
33 |
#define CJSON_VERSION_PATCH 7
|
34 | 34 |
|
35 | 35 |
#include <stddef.h>
|
36 | 36 |
|
|
155 | 155 |
|
156 | 156 |
/* Returns the number of items in an array (or object). */
|
157 | 157 |
CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array);
|
158 | |
/* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */
|
|
158 |
/* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */
|
159 | 159 |
CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index);
|
160 | 160 |
/* Get item "string" from object. Case insensitive. */
|
161 | 161 |
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string);
|
18 | 18 |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 | 19 |
THE SOFTWARE.
|
20 | 20 |
*/
|
|
21 |
|
|
22 |
#ifndef cJSON_Utils__h
|
|
23 |
#define cJSON_Utils__h
|
|
24 |
|
|
25 |
#ifdef __cplusplus
|
|
26 |
extern "C"
|
|
27 |
{
|
|
28 |
#endif
|
21 | 29 |
|
22 | 30 |
#include "cJSON.h"
|
23 | 31 |
|
|
71 | 79 |
/* Sorts the members of the object into alphabetical order. */
|
72 | 80 |
CJSON_PUBLIC(void) cJSONUtils_SortObject(cJSON * const object);
|
73 | 81 |
CJSON_PUBLIC(void) cJSONUtils_SortObjectCaseSensitive(cJSON * const object);
|
|
82 |
|
|
83 |
#ifdef __cplusplus
|
|
84 |
}
|
|
85 |
#endif
|
|
86 |
|
|
87 |
#endif
|