Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
version: 1.1.0.{build}
before_build:

environment:
matrix:
- cpp11: -DMSGPACK_CXX11=OFF
boost: -DMSGPACK_BOOST=ON
msvc: '"Visual Studio 10 2010"'
- cpp11: -DMSGPACK_CXX11=OFF
boost: -DMSGPACK_BOOST=ON
msvc: '"Visual Studio 11 2012"'
- cpp11: -DMSGPACK_CXX11=OFF
boost: -DMSGPACK_BOOST=ON
msvc: '"Visual Studio 12 2013"'
- cpp11: -DMSGPACK_CXX11=ON
boost: -DMSGPACK_BOOST=ON
msvc: '"Visual Studio 14 2015"'
- cpp11: -DMSGPACK_CXX11=OFF
boost: -DMSGPACK_BOOST=ON
msvc: '"Visual Studio 14 2015"'
- cpp11: -DMSGPACK_CXX11=ON
boost: -DMSGPACK_BOOST=OFF
msvc: '"Visual Studio 14 2015"'
- cpp11: -DMSGPACK_CXX11=OFF
boost: -DMSGPACK_BOOST=OFF
msvc: '"Visual Studio 14 2015"'
build_script:
- appveyor DownloadFile http://googletest.googlecode.com/files/gtest-1.7.0.zip -FileName gtest-1.7.0.zip
- 7z x gtest-1.7.0.zip > NUL
- cd gtest-1.7.0
- md build
- cd build
- cmake -DBUILD_SHARED_LIBS=ON ..
- cmake -G %msvc% -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_FLAGS=/D_VARIADIC_MAX=10 ..
- cmake --build . --config Release
- cd ..
- cd ..
Expand All @@ -15,26 +39,14 @@ before_build:
- cd zlib-1.2.8
- md build
- cd build
- cmake ..
- cmake -G %msvc% ..
- cmake --build . --config Release
- copy zconf.h ..
- cd ..
- cd ..

environment:
matrix:
- cpp11: -DMSGPACK_CXX11=ON
boost: -DMSGPACK_BOOST=ON
- cpp11: -DMSGPACK_CXX11=OFF
boost: -DMSGPACK_BOOST=ON
- cpp11: -DMSGPACK_CXX11=ON
boost: -DMSGPACK_BOOST=OFF
- cpp11: -DMSGPACK_CXX11=OFF
boost: -DMSGPACK_BOOST=OFF
build_script:
- md build
- cd build
- cmake %cpp11% %boost% -DMSGPACK_BOOST_DIR=C:\Libraries\\boost_1_58_0 -DGTEST_LIBRARY=%APPVEYOR_BUILD_FOLDER%\gtest-1.7.0\build\Release\gtest.lib -DGTEST_MAIN_LIBRARY=%APPVEYOR_BUILD_FOLDER%\gtest-1.7.0\build\Release\gtest_main.lib -DGTEST_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%\gtest-1.7.0\include -DZLIB_LIBRARY=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.8\build\Release\zlib.lib -DZLIB_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.8 ..
- cmake -G %msvc% %cpp11% %boost% -DMSGPACK_BOOST_DIR=C:\Libraries\\boost_1_60_0 -DGTEST_LIBRARY=%APPVEYOR_BUILD_FOLDER%\gtest-1.7.0\build\Release\gtest.lib -DGTEST_MAIN_LIBRARY=%APPVEYOR_BUILD_FOLDER%\gtest-1.7.0\build\Release\gtest_main.lib -DGTEST_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%\gtest-1.7.0\include -DZLIB_LIBRARY=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.8\build\Release\zlib.lib -DZLIB_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.8 -DCMAKE_CXX_FLAGS='"/D_VARIADIC_MAX=10 /EHsc"' ..
- cmake --build . --config Release

test_script:
Expand Down
2 changes: 2 additions & 0 deletions erb/v1/cpp03_define_map.hpp.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include "msgpack/adaptor/adaptor_base.hpp"
#include "msgpack/object_fwd.hpp"

#include <map>

namespace msgpack {
/// @cond
MSGPACK_API_VERSION_NAMESPACE(v1) {
Expand Down
5 changes: 3 additions & 2 deletions example/c/lib_buffer_unpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ size_t receiver_recv(receiver *r, char* buf, size_t try_size) {
size_t receiver_to_unpacker(receiver* r, size_t request_size,
msgpack_unpacker *unpacker)
{
size_t recv_len;
// make sure there's enough room, or expand the unpacker accordingly
if (msgpack_unpacker_buffer_capacity(unpacker) < request_size) {
msgpack_unpacker_reserve_buffer(unpacker, request_size);
assert(msgpack_unpacker_buffer_capacity(unpacker) >= request_size);
}
size_t recv_len = receiver_recv(r, msgpack_unpacker_buffer(unpacker),
request_size);
recv_len = receiver_recv(r, msgpack_unpacker_buffer(unpacker),
request_size);
msgpack_unpacker_buffer_consumed(unpacker, recv_len);
return recv_len;
}
Expand Down
1 change: 1 addition & 0 deletions include/msgpack/v1/adaptor/adaptor_base_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include "msgpack/versioning.hpp"
#include "msgpack/object_fwd.hpp"
#include "msgpack/pack.hpp"

namespace msgpack {

Expand Down
41 changes: 26 additions & 15 deletions include/msgpack/v1/adaptor/boost/msgpack_variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ struct basic_variant :
basic_variant() {}
template <typename T>
basic_variant(T const& t):base(t) {}

#if defined(_MSC_VER) && _MSC_VER < 1700
// The following redundant functions are required to avoid MSVC
// See https://svn.boost.org/trac/boost/ticket/592
basic_variant(basic_variant const& other):base(static_cast<base const&>(other)) {}
basic_variant& operator=(basic_variant const& other) {
*static_cast<base*>(this) = static_cast<base const&>(other);
return *this;
}
#endif // defined(_MSC_VER) && _MSC_VER < 1700

basic_variant(char const* p):base(std::string(p)) {}
basic_variant(char v) {
int_init(v);
Expand All @@ -104,51 +115,51 @@ struct basic_variant :
basic_variant(unsigned long long v):base(uint64_t(v)) {}

bool is_nil() const {
return boost::get<msgpack::type::nil_t>(this);
return boost::get<msgpack::type::nil_t>(this) != nullptr;
}
bool is_bool() const {
return boost::get<bool>(this);
return boost::get<bool>(this) != nullptr;
}
bool is_int64_t() const {
return boost::get<int64_t>(this);
return boost::get<int64_t>(this) != nullptr;
}
bool is_uint64_t() const {
return boost::get<uint64_t>(this);
return boost::get<uint64_t>(this) != nullptr;
}
bool is_double() const {
return boost::get<double>(this);
return boost::get<double>(this) != nullptr;
}
bool is_string() const {
return boost::get<std::string>(this);
return boost::get<std::string>(this) != nullptr;
}
#if (BOOST_VERSION / 100000) >= 1 && ((BOOST_VERSION / 100) % 1000) >= 53
bool is_boost_string_ref() const {
return boost::get<boost::string_ref>(this);
return boost::get<boost::string_ref>(this) != nullptr;
}
#endif // (BOOST_VERSION / 100000) >= 1 && ((BOOST_VERSION / 100) % 1000) >= 53
bool is_vector_char() const {
return boost::get<std::vector<char> >(this);
return boost::get<std::vector<char> >(this) != nullptr;
}
bool is_vector_char() {
return boost::get<std::vector<char> >(this);
return boost::get<std::vector<char> >(this) != nullptr;
}
bool is_raw_ref() const {
return boost::get<raw_ref>(this);
return boost::get<raw_ref>(this) != nullptr;
}
bool is_ext() const {
return boost::get<ext>(this);
return boost::get<ext>(this) != nullptr;
}
bool is_ext_ref() const {
return boost::get<ext_ref>(this);
return boost::get<ext_ref>(this) != nullptr;
}
bool is_vector() const {
return boost::get<std::vector<basic_variant<STR, BIN, EXT> > >(this);
return boost::get<std::vector<basic_variant<STR, BIN, EXT> > >(this) != nullptr;
}
bool is_map() const {
return boost::get<std::map<basic_variant<STR, BIN, EXT>, basic_variant<STR, BIN, EXT> > >(this);
return boost::get<std::map<basic_variant<STR, BIN, EXT>, basic_variant<STR, BIN, EXT> > >(this) != nullptr;
}
bool is_multimap() const {
return boost::get<std::multimap<basic_variant<STR, BIN, EXT>, basic_variant<STR, BIN, EXT> > >(this);
return boost::get<std::multimap<basic_variant<STR, BIN, EXT>, basic_variant<STR, BIN, EXT> > >(this) != nullptr;
}

bool as_bool() const {
Expand Down
2 changes: 2 additions & 0 deletions include/msgpack/v1/adaptor/detail/cpp03_define_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include "msgpack/adaptor/adaptor_base.hpp"
#include "msgpack/object_fwd.hpp"

#include <map>

namespace msgpack {
/// @cond
MSGPACK_API_VERSION_NAMESPACE(v1) {
Expand Down
2 changes: 2 additions & 0 deletions include/msgpack/v1/adaptor/int.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#define MSGPACK_V1_TYPE_INT_HPP

#include "msgpack/v1/adaptor/int_decl.hpp"
#include "msgpack/object.hpp"

#include <limits>

namespace msgpack {
Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ LIST (APPEND check_PROGRAMS
convert.cpp
fixint.cpp
fixint_c.cpp
inc_adaptor_define.cpp
json.cpp
limit.cpp
msgpack_basic.cpp
Expand Down
2 changes: 2 additions & 0 deletions test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ check_PROGRAMS = \
convert \
fixint \
fixint_c \
inc_adaptor_define \
json \
limit \
msgpack_basic \
Expand Down Expand Up @@ -54,6 +55,7 @@ cases_SOURCES = cases.cpp
convert_SOURCES = convert.cpp
fixint_SOURCES = fixint.cpp
fixint_c_SOURCES = fixint_c.cpp
inc_adaptor_define_SOURCES = inc_adaptor_define.cpp
json_SOURCES = json.cpp
limit_SOURCES = limit.cpp
msgpack_basic_SOURCES = msgpack_basic.cpp
Expand Down
3 changes: 3 additions & 0 deletions test/inc_adaptor_define.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <msgpack/adaptor/define.hpp>

int main() {}
8 changes: 8 additions & 0 deletions test/msgpack_basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ TEST(MSGPACK, simple_buffer_int64)
GEN_TEST(int64_t);
}

#if !defined(_MSC_VER) || _MSC_VER >=1800

TEST(MSGPACK, simple_buffer_float)
{
vector<float> v;
Expand Down Expand Up @@ -185,6 +187,8 @@ TEST(MSGPACK, simple_buffer_float)
}
}

#endif // !defined(_MSC_VER) || _MSC_VER >=1800

namespace {
template<typename F, typename I>
struct TypePair {
Expand Down Expand Up @@ -232,6 +236,8 @@ INSTANTIATE_TYPED_TEST_CASE_P(IntegerToFloatingPointTestInstance,
IntegerToFloatingPointTest,
IntegerToFloatingPointTestTypes);

#if !defined(_MSC_VER) || _MSC_VER >=1800

TEST(MSGPACK, simple_buffer_double)
{
vector<double> v;
Expand Down Expand Up @@ -278,6 +284,8 @@ TEST(MSGPACK, simple_buffer_double)
}
}

#endif // !defined(_MSC_VER) || _MSC_VER >=1800

TEST(MSGPACK, simple_buffer_nil)
{
msgpack::sbuffer sbuf;
Expand Down
4 changes: 4 additions & 0 deletions test/msgpack_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ TEST(MSGPACKC, simple_buffer_int64)
GEN_TEST_SIGNED(int64_t, int64);
}

#if !defined(_MSC_VER) || _MSC_VER >=1800

TEST(MSGPACKC, simple_buffer_float)
{
vector<float> v;
Expand Down Expand Up @@ -315,6 +317,8 @@ TEST(MSGPACKC, simple_buffer_double)
}
}

#endif // !defined(_MSC_VER) || _MSC_VER >=1800

TEST(MSGPACKC, simple_buffer_nil)
{
msgpack_sbuffer sbuf;
Expand Down