Support MSVC cli.

MSVC CLI defined their own nullptr and provides for __nullptr for standard C++11.
https://msdn.microsoft.com/en-us/library/4ex65770.aspx
msgpack-c introduce MSGPACK_NULLPTR for internal use, it is defined as __nullptr only if compiled on C++ CLI otherwise defined as nullptr.
This commit is contained in:
Takatoshi Kondo
2016-06-08 09:41:18 +09:00
parent ca5ef097ac
commit 0f66e144ab
44 changed files with 186 additions and 176 deletions

View File

@@ -133,10 +133,10 @@ TEST(reference, unpack_int_sized_ref)
msgpack::pack(sbuf, 1);
bool referenced;
s_p = nullptr;
s_p = MSGPACK_NULLPTR;
msgpack::object_handle oh = msgpack::unpack(sbuf.data(), sbuf.size(), referenced, never_called, &sbuf);
EXPECT_FALSE(referenced);
EXPECT_EQ(nullptr, s_p);
EXPECT_EQ(MSGPACK_NULLPTR, s_p);
}
TEST(reference, unpack_string_sized_ref_4)
@@ -145,7 +145,7 @@ TEST(reference, unpack_string_sized_ref_4)
msgpack::pack(sbuf, std::string("1234"));
bool referenced;
s_p = nullptr;
s_p = MSGPACK_NULLPTR;
// the last argument sbuf is any pointer as a user data.
// That is stored to s_p in sized_reference
msgpack::object_handle oh = msgpack::unpack(sbuf.data(), sbuf.size(), referenced, sized_reference, &sbuf);
@@ -160,7 +160,7 @@ TEST(reference, unpack_string_sized_ref_5)
msgpack::pack(sbuf, std::string("12345"));
bool referenced;
s_p = nullptr;
s_p = MSGPACK_NULLPTR;
msgpack::object_handle oh = msgpack::unpack(sbuf.data(), sbuf.size(), referenced, sized_reference, &sbuf);
EXPECT_TRUE(referenced);
EXPECT_EQ(&sbuf, s_p);
@@ -176,7 +176,7 @@ TEST(reference, unpack_bin_sized_ref_5)
packer.pack_bin_body(c, sizeof(c));
bool referenced;
s_p = nullptr;
s_p = MSGPACK_NULLPTR;
msgpack::object_handle oh = msgpack::unpack(sbuf.data(), sbuf.size(), referenced, sized_reference, &sbuf);
EXPECT_FALSE(referenced);
EXPECT_EQ(&sbuf, s_p);
@@ -191,7 +191,7 @@ TEST(reference, unpack_bin_sized_ref_6)
packer.pack_bin_body(c, sizeof(c));
bool referenced;
s_p = nullptr;
s_p = MSGPACK_NULLPTR;
msgpack::object_handle oh = msgpack::unpack(sbuf.data(), sbuf.size(), referenced, sized_reference, &sbuf);
EXPECT_TRUE(referenced);
EXPECT_EQ(&sbuf, s_p);
@@ -207,7 +207,7 @@ TEST(reference, unpack_ext_sized_ref_6)
packer.pack_ext_body(buf, sizeof(buf));
bool referenced;
s_p = nullptr;
s_p = MSGPACK_NULLPTR;
msgpack::object_handle oh = msgpack::unpack(sbuf.data(), sbuf.size(), referenced, sized_reference, &sbuf);
EXPECT_FALSE(referenced);
EXPECT_EQ(&sbuf, s_p);
@@ -223,7 +223,7 @@ TEST(reference, unpack_ext_sized_ref_7)
packer.pack_ext_body(buf, sizeof(buf));
bool referenced;
s_p = nullptr;
s_p = MSGPACK_NULLPTR;
msgpack::object_handle oh = msgpack::unpack(sbuf.data(), sbuf.size(), referenced, sized_reference, &sbuf);
EXPECT_TRUE(referenced);
EXPECT_EQ(&sbuf, s_p);