mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-17 11:05:05 +02:00
Fixed processing of empty data in fbuffer class.
This commit is contained in:
@@ -31,6 +31,7 @@ public:
|
|||||||
{
|
{
|
||||||
MSGPACK_ASSERT(buf || len == 0);
|
MSGPACK_ASSERT(buf || len == 0);
|
||||||
if (!buf) return;
|
if (!buf) return;
|
||||||
|
if (len == 0) return;
|
||||||
if (1 != fwrite(buf, len, 1, m_file)) {
|
if (1 != fwrite(buf, len, 1, m_file)) {
|
||||||
throw std::runtime_error("fwrite() failed");
|
throw std::runtime_error("fwrite() failed");
|
||||||
}
|
}
|
||||||
|
@@ -90,6 +90,7 @@ BOOST_AUTO_TEST_CASE(fbuffer)
|
|||||||
fbuf.write("a", 1);
|
fbuf.write("a", 1);
|
||||||
fbuf.write("a", 1);
|
fbuf.write("a", 1);
|
||||||
fbuf.write("a", 1);
|
fbuf.write("a", 1);
|
||||||
|
fbuf.write("", 0);
|
||||||
|
|
||||||
fflush(file);
|
fflush(file);
|
||||||
rewind(file);
|
rewind(file);
|
||||||
|
Reference in New Issue
Block a user