diff options
| -rw-r--r-- | CMakeLists.txt | 17 | ||||
| -rw-r--r-- | json/json-forwards.h | 12 | ||||
| -rw-r--r-- | json/json.h | 20 | ||||
| -rw-r--r-- | json/jsoncpp.cpp | 12 |
4 files changed, 51 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 912eeea6..a8dd693b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,16 +17,13 @@ if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8) endif() endif() -file(GLOB BN_API_SOURCES CONFIGURE_DEPENDS *.cpp *.h json/json.h json/json-forwards.h) -if(NOT DEMO) - list(APPEND BN_API_SOURCES json/jsoncpp.cpp) - if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - set_source_files_properties(json/jsoncpp.cpp PROPERTIES COMPILE_FLAGS /w) - elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set_source_files_properties(json/jsoncpp.cpp PROPERTIES COMPILE_FLAGS -Wno-everything) - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set_source_files_properties(json/jsoncpp.cpp PROPERTIES COMPILE_FLAGS -w) - endif() +file(GLOB BN_API_SOURCES CONFIGURE_DEPENDS *.cpp *.h json/*.cpp json/*.h) +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set_source_files_properties(json/jsoncpp.cpp PROPERTIES COMPILE_FLAGS /w) +elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set_source_files_properties(json/jsoncpp.cpp PROPERTIES COMPILE_FLAGS -Wno-everything) +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set_source_files_properties(json/jsoncpp.cpp PROPERTIES COMPILE_FLAGS -w) endif() if(NOT BN_INTERNAL_BUILD) diff --git a/json/json-forwards.h b/json/json-forwards.h index 4dad2056..159df166 100644 --- a/json/json-forwards.h +++ b/json/json-forwards.h @@ -79,6 +79,14 @@ license you like. /// to prevent private header inclusion. #define JSON_IS_AMALGAMATION +#ifdef BINARYNINJACORE_LIBRARY +#define JSONCPP_INLINE_NS_BEGIN inline namespace Core { +#define JSONCPP_INLINE_NS_END } +#else +#define JSONCPP_INLINE_NS_BEGIN +#define JSONCPP_INLINE_NS_END +#endif + // ////////////////////////////////////////////////////////////////////// // Beginning of content of file: include/json/config.h // ////////////////////////////////////////////////////////////////////// @@ -243,6 +251,7 @@ license you like. #endif // if !defined(JSON_IS_AMALGAMATION) namespace Json { +JSONCPP_INLINE_NS_BEGIN typedef int Int; typedef unsigned int UInt; #if defined(JSON_NO_INT64) @@ -280,6 +289,7 @@ typedef UInt64 LargestUInt; #define JSONCPP_ISTRINGSTREAM std::istringstream #define JSONCPP_ISTREAM std::istream #endif // if JSONCPP_USING_SECURE_MEMORY +JSONCPP_INLINE_NS_END } // end namespace Json #endif // JSON_CONFIG_H_INCLUDED @@ -310,6 +320,7 @@ typedef UInt64 LargestUInt; #endif // if !defined(JSON_IS_AMALGAMATION) namespace Json { +JSONCPP_INLINE_NS_BEGIN // writer.h class FastWriter; @@ -331,6 +342,7 @@ class ValueIteratorBase; class ValueIterator; class ValueConstIterator; +JSONCPP_INLINE_NS_END } // namespace Json #endif // JSON_FORWARDS_H_INCLUDED diff --git a/json/json.h b/json/json.h index 8208038b..d7db7cf9 100644 --- a/json/json.h +++ b/json/json.h @@ -78,6 +78,14 @@ license you like. /// to prevent private header inclusion. #define JSON_IS_AMALGAMATION +#ifdef BINARYNINJACORE_LIBRARY +#define JSONCPP_INLINE_NS_BEGIN inline namespace Core { +#define JSONCPP_INLINE_NS_END } +#else +#define JSONCPP_INLINE_NS_BEGIN +#define JSONCPP_INLINE_NS_END +#endif + // ////////////////////////////////////////////////////////////////////// // Beginning of content of file: include/json/version.h // ////////////////////////////////////////////////////////////////////// @@ -278,6 +286,7 @@ license you like. #endif // if !defined(JSON_IS_AMALGAMATION) namespace Json { +JSONCPP_INLINE_NS_BEGIN typedef int Int; typedef unsigned int UInt; #if defined(JSON_NO_INT64) @@ -315,6 +324,7 @@ typedef UInt64 LargestUInt; #define JSONCPP_ISTRINGSTREAM std::istringstream #define JSONCPP_ISTREAM std::istream #endif // if JSONCPP_USING_SECURE_MEMORY +JSONCPP_INLINE_NS_END } // end namespace Json #endif // JSON_CONFIG_H_INCLUDED @@ -345,6 +355,7 @@ typedef UInt64 LargestUInt; #endif // if !defined(JSON_IS_AMALGAMATION) namespace Json { +JSONCPP_INLINE_NS_BEGIN // writer.h class FastWriter; @@ -366,6 +377,7 @@ class ValueIteratorBase; class ValueIterator; class ValueConstIterator; +JSONCPP_INLINE_NS_END } // namespace Json #endif // JSON_FORWARDS_H_INCLUDED @@ -398,6 +410,7 @@ class ValueConstIterator; #pragma pack(push, 8) namespace Json { +JSONCPP_INLINE_NS_BEGIN /** \brief Configuration passed to reader and writer. * This configuration object can be used to force the Reader or Writer @@ -439,6 +452,7 @@ public: bool allowNumericKeys_; }; +JSONCPP_INLINE_NS_END } // namespace Json #pragma pack(pop) @@ -515,6 +529,7 @@ public: /** \brief JSON (JavaScript Object Notation). */ namespace Json { +JSONCPP_INLINE_NS_BEGIN /** Base class for all exceptions we throw. * @@ -1364,6 +1379,7 @@ public: inline void swap(Value& a, Value& b) { a.swap(b); } +JSONCPP_INLINE_NS_END } // namespace Json #pragma pack(pop) @@ -1415,6 +1431,7 @@ inline void swap(Value& a, Value& b) { a.swap(b); } #pragma pack(push, 8) namespace Json { +JSONCPP_INLINE_NS_BEGIN /** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a *Value. @@ -1798,6 +1815,7 @@ bool JSON_API parseFromStream(CharReader::Factory const&, */ JSON_API JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM&, Value&); +JSONCPP_INLINE_NS_END } // namespace Json #pragma pack(pop) @@ -1846,6 +1864,7 @@ JSON_API JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM&, Value&); #pragma pack(push, 8) namespace Json { +JSONCPP_INLINE_NS_BEGIN class Value; @@ -2180,6 +2199,7 @@ JSONCPP_STRING JSON_API valueToQuotedString(const char* value); /// \see Json::operator>>() JSON_API JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM&, const Value& root); +JSONCPP_INLINE_NS_END } // namespace Json #pragma pack(pop) diff --git a/json/jsoncpp.cpp b/json/jsoncpp.cpp index f6661c6a..52efd8be 100644 --- a/json/jsoncpp.cpp +++ b/json/jsoncpp.cpp @@ -114,6 +114,7 @@ license you like. */ namespace Json { +JSONCPP_INLINE_NS_BEGIN static inline char getDecimalPoint() { #ifdef JSONCPP_NO_LOCALE_SUPPORT return '\0'; @@ -217,6 +218,7 @@ template <typename Iter> Iter fixZerosInTheEnd(Iter begin, Iter end) { return end; } +JSONCPP_INLINE_NS_END } // namespace Json #endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED @@ -291,6 +293,7 @@ static size_t const stackLimit_g = JSONCPP_DEPRECATED_STACK_LIMIT; // see readValue() namespace Json { +JSONCPP_INLINE_NS_BEGIN #if __cplusplus >= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520) typedef std::unique_ptr<CharReader> CharReaderPtr; @@ -2265,6 +2268,7 @@ JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM& sin, Value& root) { return sin; } +JSONCPP_INLINE_NS_END } // namespace Json // ////////////////////////////////////////////////////////////////////// @@ -2288,6 +2292,7 @@ JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM& sin, Value& root) { // included by json_value.cpp namespace Json { +JSONCPP_INLINE_NS_BEGIN // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// @@ -2446,6 +2451,7 @@ ValueIterator& ValueIterator::operator=(const SelfType& other) { return *this; } +JSONCPP_INLINE_NS_END } // namespace Json // ////////////////////////////////////////////////////////////////////// @@ -2490,6 +2496,7 @@ ValueIterator& ValueIterator::operator=(const SelfType& other) { #define JSON_ASSERT_UNREACHABLE assert(false) namespace Json { +JSONCPP_INLINE_NS_BEGIN // This is a walkaround to avoid the static initialization of Value::null. // kNull must be word-aligned to avoid crashing on ARM. We use an alignment of @@ -2637,6 +2644,7 @@ static inline void releasePrefixedStringValue(char* value) { free(value); } static inline void releaseStringValue(char* value, unsigned) { free(value); } #endif // JSONCPP_USING_SECURE_MEMORY +JSONCPP_INLINE_NS_END } // namespace Json // ////////////////////////////////////////////////////////////////// @@ -2652,6 +2660,7 @@ static inline void releaseStringValue(char* value, unsigned) { free(value); } #endif // if !defined(JSON_IS_AMALGAMATION) namespace Json { +JSONCPP_INLINE_NS_BEGIN // BN: subclass Exception::Exception(JSONCPP_STRING const& msg) : JSONCPP_EXCEPTION(msg.c_str()) {} @@ -4157,6 +4166,7 @@ Value& Path::make(Value& root) const { return *node; } +JSONCPP_INLINE_NS_END } // namespace Json // ////////////////////////////////////////////////////////////////////// @@ -4257,6 +4267,7 @@ Value& Path::make(Value& root) const { #endif namespace Json { +JSONCPP_INLINE_NS_BEGIN #if __cplusplus >= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520) typedef std::unique_ptr<StreamWriter> StreamWriterPtr; @@ -5434,6 +5445,7 @@ JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM& sout, Value const& root) { return sout; } +JSONCPP_INLINE_NS_END } // namespace Json // ////////////////////////////////////////////////////////////////////// |
