From 33cf7663405cd45cf5e5eeab36fde1a9cbf2528a Mon Sep 17 00:00:00 2001 From: Tim Warren Date: Thu, 28 May 2015 16:15:10 -0400 Subject: [PATCH] Patch Json library to compile with -std=c++11 and gcc --- include/json/json.h | 3 ++- include/jsoncpp.cpp | 12 ++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/include/json/json.h b/include/json/json.h index edea69b..b1184db 100644 --- a/include/json/json.h +++ b/include/json/json.h @@ -69,7 +69,8 @@ license you like. // ////////////////////////////////////////////////////////////////////// - +// Tell C++11 where to find std::unique_ptr +#include #ifndef JSON_AMALGATED_H_INCLUDED diff --git a/include/jsoncpp.cpp b/include/jsoncpp.cpp index a6b47fb..38a4863 100644 --- a/include/jsoncpp.cpp +++ b/include/jsoncpp.cpp @@ -219,11 +219,9 @@ static int stackDepth_g = 0; // see readValue() namespace Json { -#if __cplusplus >= 201103L -typedef std::unique_ptr CharReaderPtr; -#else + typedef std::auto_ptr CharReaderPtr; -#endif + // Implementation of class Features // //////////////////////////////// @@ -3965,6 +3963,8 @@ Value& Path::make(Value& root) const { #if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below #define snprintf _snprintf +#elif defined(WIN32) +#define snprintf _snprintf #elif __cplusplus >= 201103L #define snprintf std::snprintf #endif @@ -3976,11 +3976,7 @@ Value& Path::make(Value& root) const { namespace Json { -#if __cplusplus >= 201103L -typedef std::unique_ptr StreamWriterPtr; -#else typedef std::auto_ptr StreamWriterPtr; -#endif static bool containsControlCharacter(const char* str) { while (*str) {