As per discussion in - https://github.com/open-source-parsers/jsoncpp/issues/404
Null should not be pass to memcmp, it may show undesired behaviour, so avoid doing that using assertion.
Also, changed one direct "assert" to JSON_ASSERT - it will be decided if exceptions are used or not.
See https://github.com/open-source-parsers/jsoncpp/issues/411#issuecomment-180974558
I was unable to produce a warning in Clang, so I am not certain. But based on a [SO answer](http://stackoverflow.com/questions/25480059/gcc-conversion-warning-when-assigning-to-a-bitfield), I think I've fixed the following:
```
/tmp/jsoncpp/src/lib_json/json_value.cpp: In copy constructor 'Json::Value::CZString::CZString(const Json::Value::CZString&)':
/tmp/jsoncpp/src/lib_json/json_value.cpp:235:18: error: conversion to 'unsigned char:2' from 'unsigned int' may alter its value [-Werror=conversion]
storage_.policy_ = (other.cstr_
~~~~~~~~~~~~
? (static_cast<DuplicationPolicy>(other.storage_.policy_) == noDuplication
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
? noDuplication : duplicate)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: static_cast<DuplicationPolicy>(other.storage_.policy_));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
- if building as a submodule of another repository, installation of pkg-config files can fail because they may not be in the top-level binary directory
- changing ${CMAKE_BINARY_DIR} to ${CMAKE_CURRENT_BINARY_DIR} allow CMake to find the files for installation
'-pedantic' issues all warnings demanded by strict ISO C/C++; rejecting
extensions that do not follow ISO C/C++. Without this option, certain GNU
extensions and traditional C/C++ features are supported as well.
With this option enabled building jsoncpp fails with the musl toolchain on
x86 because of an incompatible posix_memalign declaration [1]. Without
'-pedantic' there is no error anymore and jsoncpp builds fine.
Add an option JSONCPP_WITH_STRICT_ISO to disable compilation with '-pedantic'
with GCC. If jsoncpp is build with the JSONCPP_WITH_WARNING_AS_ERROR option
'-pedantic-errors' is used instead.
[1] https://gcc.gnu.org/ml/gcc-patches/2015-05/msg01425.html
* Add move constructor to Value::CZString
* Add unit test for Value move constructor
* Allow includer to specify in advance the value for
JSON_HAS_RVALUE_REFERENCES
In value.h, ValueConstIterator can convert to ValueIterator, I think that is a bug. the correct way is ValueIterator can convert to ValueConstIterator.
Based on a patches to CMake by:
Ådne Hovda <ahovda@openit.com>:
commit 7b1cdb00279908cacabada92f8a53e4986465423
jsoncpp: Provide 'isfinite' implementation on older AIX and HP-UX
Newer AIX and HP-UX platforms provide 'isfinite' as a <math.h> macro.
Older versions do not, so add the definition if it is not provided.
Michael Scott <michael.scott@gbgplc.com>:
commit 9217b678b305d7df7471ba476a81bf28961fdfa3
jsoncpp: Provide 'isfinite' impl on more HP-UX versions (#15576)
Some versions of HP-UX do not define 'isfinite' or 'finite' in math.h
for Itanium when preprocessing with C++, so we have to add the
definition ourselves instead to map to the internal version.
Joerg Sonnenberger <joerg@bec.de>:
commit 75644dafe54c21902f14cfe58cb8338b553b69d8
jsoncpp: Fix compilation as C99 on Solaris
In C99 mode, Solaris variants may already define isfinite, so check for
the existence first.