Releases: DaveGamble/cJSON
Releases · DaveGamble/cJSON
1.3.0
This release includes a lot of rework in the parser and includes the Cunity unit testing framework, as well as some fixes. I increased the minor version number because there were quite a lot of internal changes.
Features:
- New type for cJSON structs:
cJSON_Invalid
(#108)
Fixes:
- runtime checks for a lot of potential integer overflows
- fix incorrect return in cJSON_PrintBuffered (cf9d57d)
- fix several potential issues found by Coverity
- fix potentially undefined behavior when assigning big numbers to
valueint
(41e2837)- Numbers exceeding
INT_MAX
or lower thanINT_MIN
will be explicitly assigned tovalueint
asINT_MAX
andINT_MIN
respectively (saturation on overflow). - fix the
cJSON_SetNumberValue
macro (87f7727), this slightly changes the behavior, see commit message
- Numbers exceeding
Introduce unit tests
Started writing unit tests with the Cunity testing framework. Currently this covers the parser functions.
Also:
- Support for running the tests with Valgrind
- Support for compiling the tests with AddressSanitizer and UndefinedBehaviorSanitizer.
travis.yml
file for running unit tests on travis. (not enabled for the repository yet though #102)
Simplifications
After having unit tests for the parser function in place, I started refactoring the parser functions (as well as others) and making them easier to read and maintain.
- Use
strtod
from the standard library for parsing numbers (0747669) - Use goto-fail in several parser functions (#100)
- Rewrite/restructure all of the parsing functions to be easier to understand and have less code paths doing the same as another. (#109)
- Simplify the buffer allocation strategy to always doubling the needed amount (9f6fa94)
- Combined
cJSON_AddItemToObject
andcJSON_AddItemToObjectCS
to one function (cf862d0)
Other changes
- Prevent the usage of incompatible C and header versions via preprocessor directive (123bb1a)
- Let CMake automatically detect compiler flags
- Add new compiler flags (
-Wundef
,-Wswitch-default
,-Wconversion
,-fstack-protector-strong
) (#98) - Change internal sizes from
int
tosize_t
(ecd5678) - Change internal strings from
char*
tounsigned char*
(28b9ba4) - Add
const
in more places
1.2.1
1.2.0
Features:
Fixes:
1.1.0
- Add a function
cJSON_PrintPreallocated
to print to a preallocated buffer, thanks @ChisholmKyle (#72) - More compiler warnings when using Clang or GCC, thanks @gatzka (#75, #78)
- fixed a memory leak in
cJSON_Duplicate
, thanks @alperakcan (#81) - fix the
ENABLE_CUSTOM_COMPILER_FLAGS
cmake option
1.0.2
1.0.1
First release 1.0.0
This is the first official versioned release of cJSON. It provides an API version for the shared library and improved Makefile and CMake build files.