mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-13 22:50:19 +02:00
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:
@@ -12,7 +12,7 @@ TEST(limit, unpack_array_no_over)
|
||||
msgpack::pack(ss, v);
|
||||
try {
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), nullptr, nullptr,
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(3, 0, 0, 0, 0));
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
@@ -34,7 +34,7 @@ TEST(limit, unpack_array_over)
|
||||
msgpack::pack(ss, v);
|
||||
try {
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), nullptr, nullptr,
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(2, 0, 0, 0, 0));
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
@@ -56,7 +56,7 @@ TEST(limit, unpack_map_no_over)
|
||||
msgpack::pack(ss, m);
|
||||
try {
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), nullptr, nullptr,
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(0, 3, 0, 0, 0));
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
@@ -78,7 +78,7 @@ TEST(limit, unpack_map_over)
|
||||
msgpack::pack(ss, m);
|
||||
try {
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), nullptr, nullptr,
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(0, 2, 0, 0, 0));
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
@@ -97,7 +97,7 @@ TEST(limit, unpack_str_no_over)
|
||||
msgpack::pack(ss, s);
|
||||
try {
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), nullptr, nullptr,
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(0, 0, 3, 0, 0));
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
@@ -116,7 +116,7 @@ TEST(limit, unpack_str_over)
|
||||
msgpack::pack(ss, s);
|
||||
try {
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), nullptr, nullptr,
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(0, 0, 2, 0, 0));
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
@@ -138,7 +138,7 @@ TEST(limit, unpack_bin_no_over)
|
||||
msgpack::pack(ss, v);
|
||||
try {
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), nullptr, nullptr,
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(0, 0, 0, 3, 0));
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
@@ -160,7 +160,7 @@ TEST(limit, unpack_bin_over)
|
||||
msgpack::pack(ss, v);
|
||||
try {
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), nullptr, nullptr,
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(0, 0, 0, 2, 0));
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
@@ -181,7 +181,7 @@ TEST(limit, unpack_ext_no_over)
|
||||
packer.pack_ext_body(buf, sizeof(buf));
|
||||
try {
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), nullptr, nullptr,
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(0, 0, 0, 0, 3+1));
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
@@ -202,7 +202,7 @@ TEST(limit, unpack_ext_over)
|
||||
packer.pack_ext_body(buf, sizeof(buf));
|
||||
try {
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), nullptr, nullptr,
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(0, 0, 0, 0, 2+1));
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
@@ -227,7 +227,7 @@ TEST(limit, unpack_ext_over_32_bit)
|
||||
};
|
||||
try {
|
||||
msgpack::object_handle unp;
|
||||
msgpack::unpack(unp, buf, sizeof(buf), nullptr, nullptr,
|
||||
msgpack::unpack(unp, buf, sizeof(buf), MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(0, 0, 0, 0, 0xffffffff));
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
@@ -253,7 +253,7 @@ TEST(limit, unpack_ext_no_over_64_bit)
|
||||
};
|
||||
try {
|
||||
msgpack::object_handle unp;
|
||||
msgpack::unpack(unp, buf, sizeof(buf), nullptr, nullptr,
|
||||
msgpack::unpack(unp, buf, sizeof(buf), MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(0, 0, 0, 0, 0xffffffff));
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
@@ -279,7 +279,7 @@ TEST(limit, unpack_depth_no_over)
|
||||
msgpack::pack(ss, outer);
|
||||
try {
|
||||
msgpack::object_handle unp;
|
||||
msgpack::unpack(unp, ss.str().c_str(), ss.str().size(), nullptr, nullptr,
|
||||
msgpack::unpack(unp, ss.str().c_str(), ss.str().size(), MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(1, 0, 0, 0, 0, 2));
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
@@ -301,7 +301,7 @@ TEST(limit, unpack_depth_over)
|
||||
msgpack::pack(ss, outer);
|
||||
try {
|
||||
msgpack::object_handle unp;
|
||||
msgpack::unpack(unp, ss.str().c_str(), ss.str().size(), nullptr, nullptr,
|
||||
msgpack::unpack(unp, ss.str().c_str(), ss.str().size(), MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(1, 0, 0, 0, 0, 1));
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
@@ -327,7 +327,7 @@ TEST(limit, unpack_array_over_cpp11_no_off_no_ref)
|
||||
msgpack::pack(ss, v);
|
||||
try {
|
||||
msgpack::object_handle unp =
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), nullptr, nullptr,
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(2, 0, 0, 0, 0));
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
@@ -350,7 +350,7 @@ TEST(limit, unpack_array_over_cpp11_no_off_ref)
|
||||
try {
|
||||
bool ref;
|
||||
msgpack::object_handle unp =
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), ref, nullptr, nullptr,
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), ref, MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(2, 0, 0, 0, 0));
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
@@ -373,7 +373,7 @@ TEST(limit, unpack_array_over_cpp11_off_no_ref)
|
||||
try {
|
||||
std::size_t off = 0;
|
||||
msgpack::object_handle unp =
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), off, nullptr, nullptr,
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), off, MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(2, 0, 0, 0, 0));
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
@@ -397,7 +397,7 @@ TEST(limit, unpack_array_over_cpp11_off_ref)
|
||||
bool ref;
|
||||
std::size_t off = 0;
|
||||
msgpack::object_handle unp =
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), off, ref, nullptr, nullptr,
|
||||
msgpack::unpack(ss.str().c_str(), ss.str().size(), off, ref, MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(2, 0, 0, 0, 0));
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
@@ -421,7 +421,7 @@ TEST(limit, unpack_array_over_no_off_no_ref)
|
||||
msgpack::pack(ss, v);
|
||||
try {
|
||||
msgpack::object_handle unp;
|
||||
msgpack::unpack(unp, ss.str().c_str(), ss.str().size(), nullptr, nullptr,
|
||||
msgpack::unpack(unp, ss.str().c_str(), ss.str().size(), MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(2, 0, 0, 0, 0));
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
@@ -444,7 +444,7 @@ TEST(limit, unpack_array_over_no_off_ref)
|
||||
try {
|
||||
bool ref;
|
||||
msgpack::object_handle unp;
|
||||
msgpack::unpack(unp, ss.str().c_str(), ss.str().size(), ref, nullptr, nullptr,
|
||||
msgpack::unpack(unp, ss.str().c_str(), ss.str().size(), ref, MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(2, 0, 0, 0, 0));
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
@@ -467,7 +467,7 @@ TEST(limit, unpack_array_over_off_no_ref)
|
||||
try {
|
||||
std::size_t off = 0;
|
||||
msgpack::object_handle unp;
|
||||
msgpack::unpack(unp, ss.str().c_str(), ss.str().size(), off, nullptr, nullptr,
|
||||
msgpack::unpack(unp, ss.str().c_str(), ss.str().size(), off, MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(2, 0, 0, 0, 0));
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
@@ -491,7 +491,7 @@ TEST(limit, unpack_array_over_off_ref)
|
||||
bool ref;
|
||||
std::size_t off = 0;
|
||||
msgpack::object_handle unp;
|
||||
msgpack::unpack(unp, ss.str().c_str(), ss.str().size(), off, ref, nullptr, nullptr,
|
||||
msgpack::unpack(unp, ss.str().c_str(), ss.str().size(), off, ref, MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(2, 0, 0, 0, 0));
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
@@ -518,7 +518,7 @@ TEST(limit, unpack_array_over_off_ref_pointer)
|
||||
bool ref;
|
||||
std::size_t off = 0;
|
||||
msgpack::object_handle unp;
|
||||
msgpack::unpack(&unp, ss.str().c_str(), ss.str().size(), &off, &ref, nullptr, nullptr,
|
||||
msgpack::unpack(&unp, ss.str().c_str(), ss.str().size(), &off, &ref, MSGPACK_NULLPTR, MSGPACK_NULLPTR,
|
||||
msgpack::unpack_limit(2, 0, 0, 0, 0));
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
@@ -541,7 +541,7 @@ TEST(limit, unpacker_array_over)
|
||||
v.push_back(3);
|
||||
msgpack::pack(ss, v);
|
||||
try {
|
||||
msgpack::unpacker u(nullptr, nullptr, MSGPACK_UNPACKER_INIT_BUFFER_SIZE,
|
||||
msgpack::unpacker u(MSGPACK_NULLPTR, MSGPACK_NULLPTR, MSGPACK_UNPACKER_INIT_BUFFER_SIZE,
|
||||
msgpack::unpack_limit(2, 0, 0, 0, 0));
|
||||
u.reserve_buffer(ss.str().size());
|
||||
memcpy(u.buffer(), ss.str().c_str(), ss.str().size());
|
||||
@@ -560,7 +560,7 @@ TEST(limit, unpacker_array_over)
|
||||
|
||||
TEST(limit, unpacker_reserve)
|
||||
{
|
||||
msgpack::unpacker u(nullptr, nullptr, MSGPACK_UNPACKER_INIT_BUFFER_SIZE,
|
||||
msgpack::unpacker u(MSGPACK_NULLPTR, MSGPACK_NULLPTR, MSGPACK_UNPACKER_INIT_BUFFER_SIZE,
|
||||
msgpack::unpack_limit());
|
||||
std::size_t original_capacity = u.buffer_capacity();
|
||||
u.reserve_buffer(original_capacity + 1u);
|
||||
@@ -569,7 +569,7 @@ TEST(limit, unpacker_reserve)
|
||||
|
||||
TEST(limit, unpacker_reserve_more_than_twice)
|
||||
{
|
||||
msgpack::unpacker u(nullptr, nullptr, MSGPACK_UNPACKER_INIT_BUFFER_SIZE,
|
||||
msgpack::unpacker u(MSGPACK_NULLPTR, MSGPACK_NULLPTR, MSGPACK_UNPACKER_INIT_BUFFER_SIZE,
|
||||
msgpack::unpack_limit());
|
||||
std::size_t original_capacity = u.buffer_capacity();
|
||||
u.reserve_buffer(original_capacity * 3);
|
||||
|
Reference in New Issue
Block a user