From d6e666f5735df7cfd905c29326b859c55de26017 Mon Sep 17 00:00:00 2001 From: Sergiy80 Date: Sat, 3 Dec 2016 22:29:14 +0200 Subject: [PATCH] Add pragma pack directive Related to https://github.com/open-source-parsers/jsoncpp/issues/458 --- include/json/allocator.h | 4 ++++ include/json/features.h | 4 ++++ include/json/reader.h | 4 ++++ include/json/value.h | 3 +++ include/json/writer.h | 4 ++++ 5 files changed, 19 insertions(+) diff --git a/include/json/allocator.h b/include/json/allocator.h index 9d8b9fc..2492758 100644 --- a/include/json/allocator.h +++ b/include/json/allocator.h @@ -9,6 +9,8 @@ #include #include +#pragma pack(push, 8) + namespace Json { template class SecureAllocator { @@ -91,4 +93,6 @@ bool operator!=(const SecureAllocator&, const SecureAllocator&) { } //namespace Json +#pragma pack(pop) + #endif // CPPTL_JSON_ALLOCATOR_H_INCLUDED diff --git a/include/json/features.h b/include/json/features.h index 1bb7bb6..de45248 100644 --- a/include/json/features.h +++ b/include/json/features.h @@ -10,6 +10,8 @@ #include "forwards.h" #endif // if !defined(JSON_IS_AMALGAMATION) +#pragma pack(push, 8) + namespace Json { /** \brief Configuration passed to reader and writer. @@ -54,4 +56,6 @@ public: } // namespace Json +#pragma pack(pop) + #endif // CPPTL_JSON_FEATURES_H_INCLUDED diff --git a/include/json/reader.h b/include/json/reader.h index caf8727..6ab5bdb 100644 --- a/include/json/reader.h +++ b/include/json/reader.h @@ -23,6 +23,8 @@ #pragma warning(disable : 4251) #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma pack(push, 8) + namespace Json { /** \brief Unserialize a JSON document into a @@ -397,6 +399,8 @@ JSON_API JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM&, Value&); } // namespace Json +#pragma pack(pop) + #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #pragma warning(pop) #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) diff --git a/include/json/value.h b/include/json/value.h index f2eb3f3..c39f423 100644 --- a/include/json/value.h +++ b/include/json/value.h @@ -42,6 +42,8 @@ #pragma warning(disable : 4251) #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma pack(push, 8) + /** \brief JSON (JavaScript Object Notation). */ namespace Json { @@ -859,6 +861,7 @@ template<> inline void swap(Json::Value& a, Json::Value& b) { a.swap(b); } } +#pragma pack(pop) #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #pragma warning(pop) diff --git a/include/json/writer.h b/include/json/writer.h index 2c1e65b..d0944ee 100644 --- a/include/json/writer.h +++ b/include/json/writer.h @@ -20,6 +20,8 @@ #pragma warning(disable : 4251) #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma pack(push, 8) + namespace Json { class Value; @@ -324,6 +326,8 @@ JSON_API JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM&, const Value& root); } // namespace Json +#pragma pack(pop) + #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #pragma warning(pop) #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)