mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-05-02 07:31:38 +02:00
Merge pull request #154 from redboltz/fix_issue_153
Fixed https://github.com/msgpack/msgpack-c/issues/153
This commit is contained in:
commit
dac8f6290d
@ -40,6 +40,7 @@
|
||||
|
||||
#endif // defined(_LIBCPP_VERSION) || (_MSC_VER >= 1700)
|
||||
|
||||
#if defined(MSGPACK_STD_TR1)
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
@ -153,4 +154,6 @@ inline void operator<< (object::with_zone& o, const MSGPACK_STD_TR1::unordered_m
|
||||
|
||||
#undef MSGPACK_STD_TR1
|
||||
|
||||
#endif // MSGPACK_STD_TR1
|
||||
|
||||
#endif // MSGPACK_TYPE_TR1_UNORDERED_MAP_HPP
|
||||
|
@ -40,6 +40,7 @@
|
||||
|
||||
#endif // defined(_LIBCPP_VERSION) || (_MSC_VER >= 1700)
|
||||
|
||||
#if defined(MSGPACK_STD_TR1)
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
@ -69,4 +70,6 @@ void operator<< (object::with_zone& o, const MSGPACK_STD_TR1::unordered_multimap
|
||||
|
||||
#undef MSGPACK_STD_TR1
|
||||
|
||||
#endif // MSGPACK_STD_TR1
|
||||
|
||||
#endif // MSGPACK_TYPE_TR1_UNORDERED_MAP_FWD_HPP
|
||||
|
@ -40,6 +40,8 @@
|
||||
|
||||
#endif // defined(_LIBCPP_VERSION) || (_MSC_VER >= 1700)
|
||||
|
||||
#if defined(MSGPACK_STD_TR1)
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
MSGPACK_API_VERSION_NAMESPACE(v1) {
|
||||
@ -145,4 +147,6 @@ inline void operator<< (object::with_zone& o, const MSGPACK_STD_TR1::unordered_m
|
||||
|
||||
#undef MSGPACK_STD_TR1
|
||||
|
||||
#endif // MSGPACK_STD_TR1
|
||||
|
||||
#endif // MSGPACK_TYPE_TR1_UNORDERED_SET_HPP
|
||||
|
@ -40,6 +40,8 @@
|
||||
|
||||
#endif // defined(_LIBCPP_VERSION) || (_MSC_VER >= 1700)
|
||||
|
||||
#if defined(MSGPACK_STD_TR1)
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
MSGPACK_API_VERSION_NAMESPACE(v1) {
|
||||
@ -68,4 +70,6 @@ void operator<< (object::with_zone& o, const MSGPACK_STD_TR1::unordered_multiset
|
||||
|
||||
#undef MSGPACK_STD_TR1
|
||||
|
||||
#endif // MSGPACK_STD_TR1
|
||||
|
||||
#endif // MSGPACK_TYPE_TR1_UNORDERED_SET_FWD_HPP
|
||||
|
@ -31,11 +31,11 @@ inline object const& operator>> (object const& o, std::vector<char>& v)
|
||||
switch (o.type) {
|
||||
case type::BIN:
|
||||
v.resize(o.via.bin.size);
|
||||
std::memcpy(v.data(), o.via.bin.ptr, o.via.bin.size);
|
||||
std::memcpy(&v.front(), o.via.bin.ptr, o.via.bin.size);
|
||||
break;
|
||||
case type::STR:
|
||||
v.resize(o.via.str.size);
|
||||
std::memcpy(v.data(), o.via.str.ptr, o.via.str.size);
|
||||
std::memcpy(&v.front(), o.via.str.ptr, o.via.str.size);
|
||||
break;
|
||||
default:
|
||||
throw type_error();
|
||||
@ -48,7 +48,7 @@ template <typename Stream>
|
||||
inline packer<Stream>& operator<< (packer<Stream>& o, const std::vector<char>& v)
|
||||
{
|
||||
o.pack_bin(v.size());
|
||||
o.pack_bin_body(v.data(), v.size());
|
||||
o.pack_bin_body(&v.front(), v.size());
|
||||
|
||||
return o;
|
||||
}
|
||||
@ -56,7 +56,7 @@ inline packer<Stream>& operator<< (packer<Stream>& o, const std::vector<char>& v
|
||||
inline void operator<< (object& o, const std::vector<char>& v)
|
||||
{
|
||||
o.type = type::BIN;
|
||||
o.via.bin.ptr = v.data();
|
||||
o.via.bin.ptr = &v.front();
|
||||
o.via.bin.size = static_cast<uint32_t>(v.size());
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ inline void operator<< (object::with_zone& o, const std::vector<char>& v)
|
||||
char* ptr = static_cast<char*>(o.zone.allocate_align(v.size()));
|
||||
o.via.bin.ptr = ptr;
|
||||
o.via.bin.size = static_cast<uint32_t>(v.size());
|
||||
std::memcpy(ptr, v.data(), v.size());
|
||||
std::memcpy(ptr, &v.front(), v.size());
|
||||
}
|
||||
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v1)
|
||||
|
@ -35,7 +35,9 @@
|
||||
#if __cplusplus < 201103
|
||||
|
||||
#if !defined(nullptr)
|
||||
#define nullptr (0)
|
||||
# if _MSC_VER < 1600
|
||||
# define nullptr (0)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
|
@ -28,6 +28,14 @@
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
// avoiding confliction std::max, std::min, and macro in windows.h
|
||||
#define NOMINMAX
|
||||
#endif // defined(_MSC_VER)
|
||||
|
||||
#ifdef _msgpack_atomic_counter_header
|
||||
#include _msgpack_atomic_counter_header
|
||||
#endif
|
||||
|
||||
|
||||
#define COUNTER_SIZE (sizeof(_msgpack_atomic_counter_t))
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
#define MSGPACK_PP_PROBE(x) x, 1
|
||||
|
||||
#if defined(__MSC_VER)
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
#define MSGPACK_PP_MSVC_VA_ARGS_WORKAROUND(define, args) define args
|
||||
#define MSGPACK_PP_CHECK(...) MSGPACK_PP_MSVC_VA_ARGS_WORKAROUND(MSGPACK_PP_CHECK_N, (__VA_ARGS__, 0))
|
||||
|
Loading…
x
Reference in New Issue
Block a user