diff --git a/test/buffer.cpp b/test/buffer.cpp index e05f2ce3..773a2a77 100644 --- a/test/buffer.cpp +++ b/test/buffer.cpp @@ -92,7 +92,12 @@ TEST(buffer, zbuffer_c) TEST(buffer, fbuffer) { +#if defined(_MSC_VER) + FILE* file; + tmpfile_s(&file); +#else // defined(_MSC_VER) FILE* file = tmpfile(); +#endif // defined(_MSC_VER) EXPECT_TRUE( file != NULL ); msgpack::fbuffer fbuf(file); @@ -116,7 +121,13 @@ TEST(buffer, fbuffer) TEST(buffer, fbuffer_c) { +#if defined(_MSC_VER) + FILE* file; + tmpfile_s(&file); +#else // defined(_MSC_VER) FILE* file = tmpfile(); +#endif // defined(_MSC_VER) + void* fbuf = (void*)file; EXPECT_TRUE( file != NULL ); diff --git a/test/cases.cpp b/test/cases.cpp index 45aace0b..bb9ad092 100644 --- a/test/cases.cpp +++ b/test/cases.cpp @@ -11,7 +11,7 @@ static void feed_file(msgpack::unpacker& pac, const char* path) if(fin.bad()) { throw std::runtime_error("read failed"); } - pac.buffer_consumed(fin.gcount()); + pac.buffer_consumed(static_cast(fin.gcount())); if(fin.fail()) { break; } @@ -35,4 +35,3 @@ TEST(cases, format) EXPECT_FALSE( pac_compact.next(&result) ); } - diff --git a/test/msgpack_basic.cpp b/test/msgpack_basic.cpp index 770af6d5..ad8dc0a5 100644 --- a/test/msgpack_basic.cpp +++ b/test/msgpack_basic.cpp @@ -585,7 +585,7 @@ TEST(MSGPACK_STL, simple_buffer_non_const_cstring) val1 += 'a' + rand() % 26; msgpack::sbuffer sbuf; char* s = new char[val1.size() + 1]; - std::strcpy(s, val1.c_str()); + std::memcpy(s, val1.c_str(), val1.size() + 1); msgpack::pack(sbuf, s); delete [] s; msgpack::unpacked ret; diff --git a/test/raw.cpp b/test/raw.cpp index 8c961fe4..36252d49 100644 --- a/test/raw.cpp +++ b/test/raw.cpp @@ -92,8 +92,8 @@ TEST(MSGPACK_RAW_REF, pack_unpack_16_h) msgpack::pack(ss, rr1); std::string packed_str = ss.str(); EXPECT_EQ(packed_str[0], static_cast(0xc5u)); - EXPECT_EQ(packed_str[1], static_cast(0xff)); - EXPECT_EQ(packed_str[2], static_cast(0xff)); + EXPECT_EQ(packed_str[1], static_cast(0xffu)); + EXPECT_EQ(packed_str[2], static_cast(0xffu)); EXPECT_EQ(packed_str[3], 'A'); msgpack::unpacked upd; diff --git a/test/streaming.cpp b/test/streaming.cpp index b9d2199e..54d56a51 100644 --- a/test/streaming.cpp +++ b/test/streaming.cpp @@ -156,7 +156,7 @@ public: while(true) { pac.reserve_buffer(32*1024); - size_t len = input.readsome(pac.buffer(), pac.buffer_capacity()); + size_t len = static_cast(input.readsome(pac.buffer(), pac.buffer_capacity())); if(len == 0) { return; @@ -226,7 +226,7 @@ TEST(streaming, basic_compat) while(count < 3) { pac.reserve_buffer(32*1024); - size_t len = input.readsome(pac.buffer(), pac.buffer_capacity()); + size_t len = static_cast(input.readsome(pac.buffer(), pac.buffer_capacity())); pac.buffer_consumed(len); while(pac.execute()) { @@ -262,7 +262,7 @@ public: while(true) { pac.reserve_buffer(32*1024); - size_t len = input.readsome(pac.buffer(), pac.buffer_capacity()); + size_t len = static_cast(input.readsome(pac.buffer(), pac.buffer_capacity())); if(len == 0) { return;