From 7f48ddc85e2fff9150e968bcd570c543a6da6aa3 Mon Sep 17 00:00:00 2001 From: Takatoshi Kondo Date: Thu, 15 Jan 2015 01:19:01 +0900 Subject: [PATCH] Fixed #190. Supressed warnings on MSVC. --- CMakeLists.txt | 4 +- erb/cpp03_zone.hpp.erb | 8 +- include/msgpack/detail/cpp03_zone.hpp | 8 +- include/msgpack/pack.hpp | 126 +++++++++++++------------- test/CMakeLists.txt | 4 +- test/limit.cpp | 24 ++--- test/object_with_zone.cpp | 4 +- test/pack_unpack_c.cpp | 10 +- test/streaming_c.cpp | 4 +- test/zone.cpp | 2 +- 10 files changed, 97 insertions(+), 97 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 58661a53..5755f368 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -215,9 +215,9 @@ IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" ST ENDIF () IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") IF (CMAKE_CXX_FLAGS MATCHES "/W[0-4]") - STRING(REGEX REPLACE "/W[0-4]" "/W3 /wd4290 /wd4309" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + STRING(REGEX REPLACE "/W[0-4]" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") ELSE () - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /wd4290 /wd4309") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3") ENDIF () ENDIF () diff --git a/erb/cpp03_zone.hpp.erb b/erb/cpp03_zone.hpp.erb index f8f96cf1..2027e64a 100644 --- a/erb/cpp03_zone.hpp.erb +++ b/erb/cpp03_zone.hpp.erb @@ -161,21 +161,21 @@ public: void clear(); void swap(zone& o); - static void* operator new(std::size_t size) throw(std::bad_alloc) + static void* operator new(std::size_t size) { void* p = ::malloc(size); if (!p) throw std::bad_alloc(); return p; } - static void operator delete(void *p) throw() + static void operator delete(void *p) /* throw() */ { ::free(p); } - static void* operator new(std::size_t size, void* place) throw() + static void* operator new(std::size_t size, void* place) /* throw() */ { return ::operator new(size, place); } - static void operator delete(void* p, void* place) throw() + static void operator delete(void* p, void* place) /* throw() */ { ::operator delete(p, place); } diff --git a/include/msgpack/detail/cpp03_zone.hpp b/include/msgpack/detail/cpp03_zone.hpp index 880544c1..effbc80d 100644 --- a/include/msgpack/detail/cpp03_zone.hpp +++ b/include/msgpack/detail/cpp03_zone.hpp @@ -161,21 +161,21 @@ public: void clear(); void swap(zone& o); - static void* operator new(std::size_t size) throw(std::bad_alloc) + static void* operator new(std::size_t size) { void* p = ::malloc(size); if (!p) throw std::bad_alloc(); return p; } - static void operator delete(void *p) throw() + static void operator delete(void *p) /* throw() */ { ::free(p); } - static void* operator new(std::size_t size, void* place) throw() + static void* operator new(std::size_t size, void* place) /* throw() */ { return ::operator new(size, place); } - static void operator delete(void* p, void* place) throw() + static void operator delete(void* p, void* place) /* throw() */ { ::operator delete(p, place); } diff --git a/include/msgpack/pack.hpp b/include/msgpack/pack.hpp index fec1b0ad..9360d229 100644 --- a/include/msgpack/pack.hpp +++ b/include/msgpack/pack.hpp @@ -221,7 +221,7 @@ inline packer& packer::pack_int64(int64_t d) template inline packer& packer::pack_fix_uint8(uint8_t d) { - char buf[2] = {static_cast(0xcc), take8_8(d)}; + char buf[2] = {static_cast(0xccu), take8_8(d)}; append_buffer(buf, 2); return *this; } @@ -230,7 +230,7 @@ template inline packer& packer::pack_fix_uint16(uint16_t d) { char buf[3]; - buf[0] = static_cast(0xcd); _msgpack_store16(&buf[1], d); + buf[0] = static_cast(0xcdu); _msgpack_store16(&buf[1], d); append_buffer(buf, 3); return *this; } @@ -239,7 +239,7 @@ template inline packer& packer::pack_fix_uint32(uint32_t d) { char buf[5]; - buf[0] = static_cast(0xce); _msgpack_store32(&buf[1], d); + buf[0] = static_cast(0xceu); _msgpack_store32(&buf[1], d); append_buffer(buf, 5); return *this; } @@ -248,7 +248,7 @@ template inline packer& packer::pack_fix_uint64(uint64_t d) { char buf[9]; - buf[0] = static_cast(0xcf); _msgpack_store64(&buf[1], d); + buf[0] = static_cast(0xcfu); _msgpack_store64(&buf[1], d); append_buffer(buf, 9); return *this; } @@ -256,7 +256,7 @@ inline packer& packer::pack_fix_uint64(uint64_t d) template inline packer& packer::pack_fix_int8(int8_t d) { - char buf[2] = {static_cast(0xd0), take8_8(d)}; + char buf[2] = {static_cast(0xd0u), take8_8(d)}; append_buffer(buf, 2); return *this; } @@ -265,7 +265,7 @@ template inline packer& packer::pack_fix_int16(int16_t d) { char buf[3]; - buf[0] = static_cast(0xd1); _msgpack_store16(&buf[1], d); + buf[0] = static_cast(0xd1u); _msgpack_store16(&buf[1], d); append_buffer(buf, 3); return *this; } @@ -274,7 +274,7 @@ template inline packer& packer::pack_fix_int32(int32_t d) { char buf[5]; - buf[0] = static_cast(0xd2); _msgpack_store32(&buf[1], d); + buf[0] = static_cast(0xd2u); _msgpack_store32(&buf[1], d); append_buffer(buf, 5); return *this; } @@ -283,7 +283,7 @@ template inline packer& packer::pack_fix_int64(int64_t d) { char buf[9]; - buf[0] = static_cast(0xd3); _msgpack_store64(&buf[1], d); + buf[0] = static_cast(0xd3u); _msgpack_store64(&buf[1], d); append_buffer(buf, 9); return *this; } @@ -590,7 +590,7 @@ inline packer& packer::pack_float(float d) union { float f; uint32_t i; } mem; mem.f = d; char buf[5]; - buf[0] = static_cast(0xca); _msgpack_store32(&buf[1], mem.i); + buf[0] = static_cast(0xcau); _msgpack_store32(&buf[1], mem.i); append_buffer(buf, 5); return *this; } @@ -601,7 +601,7 @@ inline packer& packer::pack_double(double d) union { double f; uint64_t i; } mem; mem.f = d; char buf[9]; - buf[0] = static_cast(0xcb); + buf[0] = static_cast(0xcbu); #if defined(__arm__) && !(__ARM_EABI__) // arm-oabi // https://github.com/msgpack/msgpack-perl/pull/1 mem.i = (mem.i & 0xFFFFFFFFUL) << 32UL | (mem.i >> 32UL); @@ -615,7 +615,7 @@ inline packer& packer::pack_double(double d) template inline packer& packer::pack_nil() { - const char d = static_cast(0xc0); + const char d = static_cast(0xc0u); append_buffer(&d, 1); return *this; } @@ -623,7 +623,7 @@ inline packer& packer::pack_nil() template inline packer& packer::pack_true() { - const char d = static_cast(0xc3); + const char d = static_cast(0xc3u); append_buffer(&d, 1); return *this; } @@ -631,7 +631,7 @@ inline packer& packer::pack_true() template inline packer& packer::pack_false() { - const char d = static_cast(0xc2); + const char d = static_cast(0xc2u); append_buffer(&d, 1); return *this; } @@ -641,15 +641,15 @@ template inline packer& packer::pack_array(size_t n) { if(n < 16) { - char d = static_cast(0x90 | n); + char d = static_cast(0x90u | n); append_buffer(&d, 1); } else if(n < 65536) { char buf[3]; - buf[0] = static_cast(0xdc); _msgpack_store16(&buf[1], static_cast(n)); + buf[0] = static_cast(0xdcu); _msgpack_store16(&buf[1], static_cast(n)); append_buffer(buf, 3); } else { char buf[5]; - buf[0] = static_cast(0xdd); _msgpack_store32(&buf[1], static_cast(n)); + buf[0] = static_cast(0xddu); _msgpack_store32(&buf[1], static_cast(n)); append_buffer(buf, 5); } return *this; @@ -659,16 +659,16 @@ template inline packer& packer::pack_map(size_t n) { if(n < 16) { - unsigned char d = 0x80 | n; + unsigned char d = 0x80u | n; char buf = take8_8(d); append_buffer(&buf, 1); } else if(n < 65536) { char buf[3]; - buf[0] = static_cast(0xde); _msgpack_store16(&buf[1], static_cast(n)); + buf[0] = static_cast(0xdeu); _msgpack_store16(&buf[1], static_cast(n)); append_buffer(buf, 3); } else { char buf[5]; - buf[0] = static_cast(0xdf); _msgpack_store32(&buf[1], static_cast(n)); + buf[0] = static_cast(0xdfu); _msgpack_store32(&buf[1], static_cast(n)); append_buffer(buf, 5); } return *this; @@ -678,20 +678,20 @@ template inline packer& packer::pack_str(size_t l) { if(l < 32) { - unsigned char d = 0xa0 | static_cast(l); + unsigned char d = 0xa0u | static_cast(l); char buf = take8_8(d); append_buffer(&buf, 1); } else if(l < 256) { char buf[2]; - buf[0] = static_cast(0xd9); buf[1] = static_cast(l); + buf[0] = static_cast(0xd9u); buf[1] = static_cast(l); append_buffer(buf, 2); } else if(l < 65536) { char buf[3]; - buf[0] = static_cast(0xda); _msgpack_store16(&buf[1], static_cast(l)); + buf[0] = static_cast(0xdau); _msgpack_store16(&buf[1], static_cast(l)); append_buffer(buf, 3); } else { char buf[5]; - buf[0] = static_cast(0xdb); _msgpack_store32(&buf[1], static_cast(l)); + buf[0] = static_cast(0xdbu); _msgpack_store32(&buf[1], static_cast(l)); append_buffer(buf, 5); } return *this; @@ -709,15 +709,15 @@ inline packer& packer::pack_bin(size_t l) { if(l < 256) { char buf[2]; - buf[0] = static_cast(0xc4); buf[1] = static_cast(l); + buf[0] = static_cast(0xc4u); buf[1] = static_cast(l); append_buffer(buf, 2); } else if(l < 65536) { char buf[3]; - buf[0] = static_cast(0xc5); _msgpack_store16(&buf[1], static_cast(l)); + buf[0] = static_cast(0xc5u); _msgpack_store16(&buf[1], static_cast(l)); append_buffer(buf, 3); } else { char buf[5]; - buf[0] = static_cast(0xc6); _msgpack_store32(&buf[1], static_cast(l)); + buf[0] = static_cast(0xc6u); _msgpack_store32(&buf[1], static_cast(l)); append_buffer(buf, 5); } return *this; @@ -736,50 +736,50 @@ inline packer& packer::pack_ext(size_t l, int8_t type) switch(l) { case 1: { char buf[2]; - buf[0] = static_cast(0xd4); + buf[0] = static_cast(0xd4u); buf[1] = static_cast(type); append_buffer(buf, 2); } break; case 2: { char buf[2]; - buf[0] = static_cast(0xd5); + buf[0] = static_cast(0xd5u); buf[1] = static_cast(type); append_buffer(buf, 2); } break; case 4: { char buf[2]; - buf[0] = static_cast(0xd6); + buf[0] = static_cast(0xd6u); buf[1] = static_cast(type); append_buffer(buf, 2); } break; case 8: { char buf[2]; - buf[0] = static_cast(0xd7); + buf[0] = static_cast(0xd7u); buf[1] = static_cast(type); append_buffer(buf, 2); } break; case 16: { char buf[2]; - buf[0] = static_cast(0xd8); + buf[0] = static_cast(0xd8u); buf[1] = static_cast(type); append_buffer(buf, 2); } break; default: if(l < 256) { char buf[3]; - buf[0] = static_cast(0xc7); + buf[0] = static_cast(0xc7u); buf[1] = static_cast(l); buf[2] = static_cast(type); append_buffer(buf, 3); } else if(l < 65536) { char buf[4]; - buf[0] = static_cast(0xc8); + buf[0] = static_cast(0xc8u); _msgpack_store16(&buf[1], static_cast(l)); buf[3] = static_cast(type); append_buffer(buf, 4); } else { char buf[6]; - buf[0] = static_cast(0xc9); + buf[0] = static_cast(0xc9u); _msgpack_store32(&buf[1], static_cast(l)); buf[5] = static_cast(type); append_buffer(buf, 6); @@ -806,7 +806,7 @@ inline void packer::pack_imp_uint8(T d) append_buffer(&buf, 1); } else { /* unsigned 8 */ - char buf[2] = {static_cast(0xcc), take8_8(d)}; + char buf[2] = {static_cast(0xccu), take8_8(d)}; append_buffer(buf, 2); } } @@ -821,12 +821,12 @@ inline void packer::pack_imp_uint16(T d) append_buffer(&buf, 1); } else if(d < (1<<8)) { /* unsigned 8 */ - char buf[2] = {static_cast(0xcc), take8_16(d)}; + char buf[2] = {static_cast(0xccu), take8_16(d)}; append_buffer(buf, 2); } else { /* unsigned 16 */ char buf[3]; - buf[0] = static_cast(0xcd); _msgpack_store16(&buf[1], static_cast(d)); + buf[0] = static_cast(0xcdu); _msgpack_store16(&buf[1], static_cast(d)); append_buffer(buf, 3); } } @@ -842,19 +842,19 @@ inline void packer::pack_imp_uint32(T d) append_buffer(&buf, 1); } else { /* unsigned 8 */ - char buf[2] = {static_cast(0xcc), take8_32(d)}; + char buf[2] = {static_cast(0xccu), take8_32(d)}; append_buffer(buf, 2); } } else { if(d < (1<<16)) { /* unsigned 16 */ char buf[3]; - buf[0] = static_cast(0xcd); _msgpack_store16(&buf[1], static_cast(d)); + buf[0] = static_cast(0xcdu); _msgpack_store16(&buf[1], static_cast(d)); append_buffer(buf, 3); } else { /* unsigned 32 */ char buf[5]; - buf[0] = static_cast(0xce); _msgpack_store32(&buf[1], static_cast(d)); + buf[0] = static_cast(0xceu); _msgpack_store32(&buf[1], static_cast(d)); append_buffer(buf, 5); } } @@ -871,24 +871,24 @@ inline void packer::pack_imp_uint64(T d) append_buffer(&buf, 1); } else { /* unsigned 8 */ - char buf[2] = {static_cast(0xcc), take8_64(d)}; + char buf[2] = {static_cast(0xccu), take8_64(d)}; append_buffer(buf, 2); } } else { if(d < (1ULL<<16)) { /* unsigned 16 */ char buf[3]; - buf[0] = static_cast(0xcd); _msgpack_store16(&buf[1], static_cast(d)); + buf[0] = static_cast(0xcdu); _msgpack_store16(&buf[1], static_cast(d)); append_buffer(buf, 3); } else if(d < (1ULL<<32)) { /* unsigned 32 */ char buf[5]; - buf[0] = static_cast(0xce); _msgpack_store32(&buf[1], static_cast(d)); + buf[0] = static_cast(0xceu); _msgpack_store32(&buf[1], static_cast(d)); append_buffer(buf, 5); } else { /* unsigned 64 */ char buf[9]; - buf[0] = static_cast(0xcf); _msgpack_store64(&buf[1], d); + buf[0] = static_cast(0xcfu); _msgpack_store64(&buf[1], d); append_buffer(buf, 9); } } @@ -900,7 +900,7 @@ inline void packer::pack_imp_int8(T d) { if(d < -(1<<5)) { /* signed 8 */ - char buf[2] = {static_cast(0xd0), take8_8(d)}; + char buf[2] = {static_cast(0xd0u), take8_8(d)}; append_buffer(buf, 2); } else { /* fixnum */ @@ -917,11 +917,11 @@ inline void packer::pack_imp_int16(T d) if(d < -(1<<7)) { /* signed 16 */ char buf[3]; - buf[0] = static_cast(0xd1); _msgpack_store16(&buf[1], static_cast(d)); + buf[0] = static_cast(0xd1u); _msgpack_store16(&buf[1], static_cast(d)); append_buffer(buf, 3); } else { /* signed 8 */ - char buf[2] = {static_cast(0xd0), take8_16(d)}; + char buf[2] = {static_cast(0xd0u), take8_16(d)}; append_buffer(buf, 2); } } else if(d < (1<<7)) { @@ -931,12 +931,12 @@ inline void packer::pack_imp_int16(T d) } else { if(d < (1<<8)) { /* unsigned 8 */ - char buf[2] = {static_cast(0xcc), take8_16(d)}; + char buf[2] = {static_cast(0xccu), take8_16(d)}; append_buffer(buf, 2); } else { /* unsigned 16 */ char buf[3]; - buf[0] = static_cast(0xcd); _msgpack_store16(&buf[1], static_cast(d)); + buf[0] = static_cast(0xcdu); _msgpack_store16(&buf[1], static_cast(d)); append_buffer(buf, 3); } } @@ -950,16 +950,16 @@ inline void packer::pack_imp_int32(T d) if(d < -(1<<15)) { /* signed 32 */ char buf[5]; - buf[0] = static_cast(0xd2); _msgpack_store32(&buf[1], static_cast(d)); + buf[0] = static_cast(0xd2u); _msgpack_store32(&buf[1], static_cast(d)); append_buffer(buf, 5); } else if(d < -(1<<7)) { /* signed 16 */ char buf[3]; - buf[0] = static_cast(0xd1); _msgpack_store16(&buf[1], static_cast(d)); + buf[0] = static_cast(0xd1u); _msgpack_store16(&buf[1], static_cast(d)); append_buffer(buf, 3); } else { /* signed 8 */ - char buf[2] = { static_cast(0xd0), take8_32(d)}; + char buf[2] = { static_cast(0xd0u), take8_32(d)}; append_buffer(buf, 2); } } else if(d < (1<<7)) { @@ -969,17 +969,17 @@ inline void packer::pack_imp_int32(T d) } else { if(d < (1<<8)) { /* unsigned 8 */ - char buf[2] = { static_cast(0xcc), take8_32(d)}; + char buf[2] = { static_cast(0xccu), take8_32(d)}; append_buffer(buf, 2); } else if(d < (1<<16)) { /* unsigned 16 */ char buf[3]; - buf[0] = static_cast(0xcd); _msgpack_store16(&buf[1], static_cast(d)); + buf[0] = static_cast(0xcdu); _msgpack_store16(&buf[1], static_cast(d)); append_buffer(buf, 3); } else { /* unsigned 32 */ char buf[5]; - buf[0] = static_cast(0xce); _msgpack_store32(&buf[1], static_cast(d)); + buf[0] = static_cast(0xceu); _msgpack_store32(&buf[1], static_cast(d)); append_buffer(buf, 5); } } @@ -994,23 +994,23 @@ inline void packer::pack_imp_int64(T d) if(d < -(1LL<<31)) { /* signed 64 */ char buf[9]; - buf[0] = static_cast(0xd3); _msgpack_store64(&buf[1], d); + buf[0] = static_cast(0xd3u); _msgpack_store64(&buf[1], d); append_buffer(buf, 9); } else { /* signed 32 */ char buf[5]; - buf[0] = static_cast(0xd2); _msgpack_store32(&buf[1], static_cast(d)); + buf[0] = static_cast(0xd2u); _msgpack_store32(&buf[1], static_cast(d)); append_buffer(buf, 5); } } else { if(d < -(1<<7)) { /* signed 16 */ char buf[3]; - buf[0] = static_cast(0xd1); _msgpack_store16(&buf[1], static_cast(d)); + buf[0] = static_cast(0xd1u); _msgpack_store16(&buf[1], static_cast(d)); append_buffer(buf, 3); } else { /* signed 8 */ - char buf[2] = {static_cast(0xd0), take8_64(d)}; + char buf[2] = {static_cast(0xd0u), take8_64(d)}; append_buffer(buf, 2); } } @@ -1022,24 +1022,24 @@ inline void packer::pack_imp_int64(T d) if(d < (1LL<<16)) { if(d < (1<<8)) { /* unsigned 8 */ - char buf[2] = {static_cast(0xcc), take8_64(d)}; + char buf[2] = {static_cast(0xccu), take8_64(d)}; append_buffer(buf, 2); } else { /* unsigned 16 */ char buf[3]; - buf[0] = static_cast(0xcd); _msgpack_store16(&buf[1], static_cast(d)); + buf[0] = static_cast(0xcdu); _msgpack_store16(&buf[1], static_cast(d)); append_buffer(buf, 3); } } else { if(d < (1LL<<32)) { /* unsigned 32 */ char buf[5]; - buf[0] = static_cast(0xce); _msgpack_store32(&buf[1], static_cast(d)); + buf[0] = static_cast(0xceu); _msgpack_store32(&buf[1], static_cast(d)); append_buffer(buf, 5); } else { /* unsigned 64 */ char buf[9]; - buf[0] = static_cast(0xcf); _msgpack_store64(&buf[1], d); + buf[0] = static_cast(0xcfu); _msgpack_store64(&buf[1], d); append_buffer(buf, 9); } } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3642ef1b..d59bf1d4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -56,9 +56,9 @@ FOREACH (source_file ${check_PROGRAMS}) ENDIF () IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") IF (CMAKE_CXX_FLAGS MATCHES "/W[0-4]") - STRING(REGEX REPLACE "/W[0-4]" "/W3 /wd4290 /wd4309" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + STRING(REGEX REPLACE "/W[0-4]" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") ELSE () - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /wd4290 /wd4309") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3") ENDIF () ENDIF () ENDFOREACH () diff --git a/test/limit.cpp b/test/limit.cpp index 2a5f1a61..e8483f1a 100644 --- a/test/limit.cpp +++ b/test/limit.cpp @@ -218,12 +218,12 @@ TEST(limit, unpack_ext_over_32_bit) { if (sizeof(std::size_t) == 4) { char const buf [] = { - static_cast(0xc9), - static_cast(0xff), - static_cast(0xff), - static_cast(0xff), - static_cast(0xff), - static_cast(0x01), + static_cast(0xc9u), + static_cast(0xffu), + static_cast(0xffu), + static_cast(0xffu), + static_cast(0xffu), + static_cast(0x01u), }; try { msgpack::unpacked unp; @@ -244,12 +244,12 @@ TEST(limit, unpack_ext_no_over_64_bit) { if (sizeof(std::size_t) == 8) { char const buf [] = { - static_cast(0xc9), - static_cast(0xff), - static_cast(0xff), - static_cast(0xff), - static_cast(0xff), - static_cast(0x01), + static_cast(0xc9u), + static_cast(0xffu), + static_cast(0xffu), + static_cast(0xffu), + static_cast(0xffu), + static_cast(0x01u), }; try { msgpack::unpacked unp; diff --git a/test/object_with_zone.cpp b/test/object_with_zone.cpp index 2869c74e..dafe6274 100644 --- a/test/object_with_zone.cpp +++ b/test/object_with_zone.cpp @@ -139,11 +139,11 @@ TEST(object_with_zone, unsigned_long_long) // float TEST(object_with_zone, float) { - float v = 1.23; + float v = 1.23f; msgpack::zone z; msgpack::object obj(v, z); EXPECT_TRUE(fabs(obj.as() - v) <= kEPS); - v = 4.56; + v = 4.56f; EXPECT_TRUE(fabs(obj.as() - static_cast(1.23)) <= kEPS); } diff --git a/test/pack_unpack_c.cpp b/test/pack_unpack_c.cpp index 60e0e00e..4c8b8547 100644 --- a/test/pack_unpack_c.cpp +++ b/test/pack_unpack_c.cpp @@ -40,29 +40,29 @@ TEST(unpack, sequence) msgpack_packer_free(pk); - bool success; + msgpack_unpack_return success; size_t offset = 0; msgpack_unpacked msg; msgpack_unpacked_init(&msg); success = msgpack_unpack_next(&msg, sbuf->data, sbuf->size, &offset); - EXPECT_TRUE(success); + EXPECT_EQ(MSGPACK_UNPACK_SUCCESS, success); EXPECT_EQ(MSGPACK_OBJECT_POSITIVE_INTEGER, msg.data.type); EXPECT_EQ(1, msg.data.via.u64); success = msgpack_unpack_next(&msg, sbuf->data, sbuf->size, &offset); - EXPECT_TRUE(success); + EXPECT_EQ(MSGPACK_UNPACK_SUCCESS, success); EXPECT_EQ(MSGPACK_OBJECT_POSITIVE_INTEGER, msg.data.type); EXPECT_EQ(2, msg.data.via.u64); success = msgpack_unpack_next(&msg, sbuf->data, sbuf->size, &offset); - EXPECT_TRUE(success); + EXPECT_EQ(MSGPACK_UNPACK_SUCCESS, success); EXPECT_EQ(MSGPACK_OBJECT_POSITIVE_INTEGER, msg.data.type); EXPECT_EQ(3, msg.data.via.u64); success = msgpack_unpack_next(&msg, sbuf->data, sbuf->size, &offset); - EXPECT_FALSE(success); + EXPECT_EQ(MSGPACK_UNPACK_CONTINUE, success); msgpack_sbuffer_free(sbuf); msgpack_unpacked_destroy(&msg); diff --git a/test/streaming_c.cpp b/test/streaming_c.cpp index 34fbfa98..5652ba2e 100644 --- a/test/streaming_c.cpp +++ b/test/streaming_c.cpp @@ -23,7 +23,7 @@ TEST(streaming, basic) EXPECT_EQ(0, msgpack_pack_bin(pk, 8)); EXPECT_EQ(0, msgpack_pack_bin_body(pk, "bin_data", 8)); EXPECT_EQ(0, msgpack_pack_map(pk, 1)); - EXPECT_EQ(0, msgpack_pack_float(pk, 0.4)); + EXPECT_EQ(0, msgpack_pack_float(pk, 0.4f)); EXPECT_EQ(0, msgpack_pack_double(pk, 0.8)); int max_count = 6; @@ -98,7 +98,7 @@ TEST(streaming, basic) EXPECT_EQ(1, obj.via.map.size); e = obj.via.map.ptr[0].key; EXPECT_EQ(MSGPACK_OBJECT_DOUBLE, e.type); - ASSERT_FLOAT_EQ(0.4, (float)e.via.dec); + ASSERT_FLOAT_EQ(0.4f, (float)e.via.dec); e = obj.via.map.ptr[0].val; EXPECT_EQ(MSGPACK_OBJECT_DOUBLE, e.type); ASSERT_DOUBLE_EQ(0.8, e.via.dec); diff --git a/test/zone.cpp b/test/zone.cpp index 6e69828c..9a1b2015 100644 --- a/test/zone.cpp +++ b/test/zone.cpp @@ -20,7 +20,7 @@ TEST(zone, allocate_align_custom) char* start = (char*)z.allocate_align(1, align); EXPECT_EQ(reinterpret_cast(start) % align, 0); for (std::size_t s = 1; s < align; ++s) { - (char*)z.allocate_no_align(s); + z.allocate_no_align(s); char* buf_a = (char*)z.allocate_align(1, align); EXPECT_EQ(0, reinterpret_cast(buf_a) % align); }