GCC 7 added a new diagnostic, -Wimplicit-fallthrough, which is enabled
with -Wextra that warns about implicitly falling through a case
statement.
[ 4%] Building C object CMakeFiles/msgpackc-static.dir/src/unpack.c.o
/usr/lib/gcc-snapshot/bin/gcc -I/home/jamessan/src/msgpack-c/. -I/home/jamessan/src/msgpack-c/include -I/home/jamessan/src/msgpack-c/build/include -g -O2 -fdebug-prefix-map=/home/jamessan/src/msgpack-c=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -Wextra -Werror -g -O3 -o CMakeFiles/msgpackc-static.dir/src/unpack.c.o -c /home/jamessan/src/msgpack-c/src/unpack.c
In file included from /home/jamessan/src/msgpack-c/src/unpack.c:283:0:
/home/jamessan/src/msgpack-c/include/msgpack/unpack_template.h: In function 'template_execute':
/home/jamessan/src/msgpack-c/include/msgpack/unpack_template.h:238:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
++p;
^~~
/home/jamessan/src/msgpack-c/include/msgpack/unpack_template.h:240:13: note: here
default:
^~~~~~~
cc1: all warnings being treated as errors
Adding the comment makes it explicit that the fallthrough is
intentional, so gcc doesn't complain.
Changing the stream to `std::hex` mode should only affect the current character; otherwise printing some msgpack with a list like this: `[123, "string\\u0003", 123]` (123 decimal) ends up printing `[123, "string\\u0003", 7b]`, as `std::hex` is sticky.
This new function is an extension of the original msgpack_unpacker_next()
where it now adds third argument to store the number of parsed bytes for
the returned buffer upon a MSGPACK_UNPACK_SUCCESS case.
This is useful for cases where the caller needs to optimize memory usage
in the original buffer,s so upon success retrieval of the object, it can
later deprecate the already 'parsed' bytes.
For more details about the origins of this function please refer to the
following issue on github:
https://github.com/msgpack/msgpack-c/issues/514
Signed-off-by: Eduardo Silva <eduardo@treasure-data.com>
In the case the target type is char[] or const char[],
If the array is '\0' teminated, msgpack-c packs the characters before
'\0', otherwise packs all characters.
When converting, the array has the size that is greater than
msgpack::object STR's size, msgpack-c adds '\0' to just after converted
characters. Otherwise msgpack-c doesn't add '\0'.
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.