mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-14 06:55:50 +02:00
Fixed warnings on MSVC.
This commit is contained in:
@@ -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 );
|
||||
|
@@ -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<size_t>(fin.gcount()));
|
||||
if(fin.fail()) {
|
||||
break;
|
||||
}
|
||||
@@ -35,4 +35,3 @@ TEST(cases, format)
|
||||
|
||||
EXPECT_FALSE( pac_compact.next(&result) );
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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<char>(0xc5u));
|
||||
EXPECT_EQ(packed_str[1], static_cast<char>(0xff));
|
||||
EXPECT_EQ(packed_str[2], static_cast<char>(0xff));
|
||||
EXPECT_EQ(packed_str[1], static_cast<char>(0xffu));
|
||||
EXPECT_EQ(packed_str[2], static_cast<char>(0xffu));
|
||||
EXPECT_EQ(packed_str[3], 'A');
|
||||
|
||||
msgpack::unpacked upd;
|
||||
|
@@ -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<size_t>(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<size_t>(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<size_t>(input.readsome(pac.buffer(), pac.buffer_capacity()));
|
||||
|
||||
if(len == 0) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user