Codebase list cjson / 8558751
New upstream version 1.7.7 Yanhao Mo 5 years ago
8 changed file(s) with 50 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
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
018 1.7.5
119 =====
220 Fixes:
66
77 set(PROJECT_VERSION_MAJOR 1)
88 set(PROJECT_VERSION_MINOR 7)
9 set(PROJECT_VERSION_PATCH 5)
9 set(PROJECT_VERSION_PATCH 7)
1010 set(CJSON_VERSION_SO 1)
1111 set(CJSON_UTILS_VERSION_SO 1)
1212 set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
4040 * [Stephan Gatzka](https://github.com/gatzka)
4141 * [Weston Schmidt](https://github.com/schmidtw)
4242 * [yangfl](https://github.com/yangfl)
43 * [Zhao Zhixu](https://github.com/zhaozhixu)
4344
4445 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)
4546
77
88 LDLIBS = -lm
99
10 LIBVERSION = 1.7.5
10 LIBVERSION = 1.7.7
1111 CJSON_SOVERSION = 1
1212 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)
1316
1417 PREFIX ?= /usr/local
1518 INCLUDE_PATH ?= include/cjson
2225
2326 # validate gcc version for use fstack-protector-strong
2427 MIN_GCC_VERSION = "4.9"
25 GCC_VERSION := "`gcc -dumpversion`"
28 GCC_VERSION := "`$(CC) -dumpversion`"
2629 IS_GCC_ABOVE_MIN_VERSION := $(shell expr "$(GCC_VERSION)" ">=" "$(MIN_GCC_VERSION)")
2730 ifeq "$(IS_GCC_ABOVE_MIN_VERSION)" "1"
2831 CFLAGS += -fstack-protector-strong
4144 ## create dynamic (shared) library on Darwin (base OS for MacOSX and IOS)
4245 ifeq (Darwin, $(uname))
4346 SHARED = dylib
47 CJSON_SO_LDFLAG = ""
48 UTILS_SO_LDFLAG = ""
4449 endif
4550
4651 #cJSON library names
8994 #shared libraries .so.1.0.0
9095 #cJSON
9196 $(CJSON_SHARED_VERSION): $(CJSON_OBJ)
92 $(CC) -shared -o $@ $< $(LDFLAGS)
97 $(CC) -shared -o $@ $< $(CJSON_SO_LDFLAG) $(LDFLAGS)
9398 #cJSON_Utils
9499 $(UTILS_SHARED_VERSION): $(UTILS_OBJ)
95 $(CC) -shared -o $@ $< $(LDFLAGS)
100 $(CC) -shared -o $@ $< $(UTILS_SO_LDFLAG) $(LDFLAGS)
96101
97102 #objects
98103 #cJSON
126126 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.
127127
128128 #### Makefile
129 **NOTE:** This Method is deprecated. Use CMake if at all possible. Makefile support is limited to fixing bugs.
130
129131 If you don't have CMake available, but still have GNU make. You can use the makefile to build cJSON:
130132
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).
132134
133135 ```
134136 make all
4040 #include <stdio.h>
4141 #include <math.h>
4242 #include <stdlib.h>
43 #include <float.h>
4443 #include <limits.h>
4544 #include <ctype.h>
4645
8180 }
8281
8382 /* 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)
8584 #error cJSON.h and cJSON.c have different versions. Make sure that both have the same.
8685 #endif
8786
11131112 if (hooks->reallocate != NULL)
11141113 {
11151114 printed = (unsigned char*) hooks->reallocate(buffer->buffer, buffer->offset + 1);
1116 buffer->buffer = NULL;
11171115 if (printed == NULL) {
11181116 goto fail;
11191117 }
1118 buffer->buffer = NULL;
11201119 }
11211120 else /* otherwise copy the JSON over to a new buffer */
11221121 {
3030 /* project version */
3131 #define CJSON_VERSION_MAJOR 1
3232 #define CJSON_VERSION_MINOR 7
33 #define CJSON_VERSION_PATCH 5
33 #define CJSON_VERSION_PATCH 7
3434
3535 #include <stddef.h>
3636
155155
156156 /* Returns the number of items in an array (or object). */
157157 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. */
159159 CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index);
160160 /* Get item "string" from object. Case insensitive. */
161161 CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string);
1818 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1919 THE SOFTWARE.
2020 */
21
22 #ifndef cJSON_Utils__h
23 #define cJSON_Utils__h
24
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #endif
2129
2230 #include "cJSON.h"
2331
7179 /* Sorts the members of the object into alphabetical order. */
7280 CJSON_PUBLIC(void) cJSONUtils_SortObject(cJSON * const object);
7381 CJSON_PUBLIC(void) cJSONUtils_SortObjectCaseSensitive(cJSON * const object);
82
83 #ifdef __cplusplus
84 }
85 #endif
86
87 #endif