Compare commits

...

122 Commits

Author SHA1 Message Date
Takatoshi Kondo
b6803a5fec Merge pull request #723 from redboltz/update_readme
Updated readme.
2018-08-21 22:30:54 +09:00
Takatoshi Kondo
210d3ce390 Updated readme. 2018-08-21 07:13:38 +09:00
Takatoshi Kondo
a350e0714e Merge pull request #716 from redboltz/update_310
Updated the version to 3.1.0
2018-08-21 06:43:27 +09:00
Takatoshi Kondo
72757feae4 Updated the version to 3.1.0 2018-08-20 21:58:54 +09:00
Takatoshi Kondo
fe2346efa1 Merge pull request #721 from dennisklein/master
Export an interface target for the C++ header-only library
2018-08-17 07:41:31 +09:00
Takatoshi Kondo
43ae287be3 Merge pull request #722 from redboltz/fix_build_shared_libs
Fixed BUILD_SHARED_LIBS meaning.
2018-08-17 07:40:53 +09:00
Takatoshi Kondo
b804e12dec Fixed BUILD_SHARED_LIBS meaning.
There are three switches to build static/shared libraries.

Here is the logic.

If BUILD_SHARED_LIBS is defined
   If BUILD_SHARED_LIBS is ON
      build only shared-library
   Else
      build only static-library
   Endif
Else
   If MSGPACK_ENABLE_SHARED is ON (default)
      build shared-library
   Endif
   If MSGPACK_ENABLE_STATIC is ON (default)
      build static-library
   Endif
Endif

Here is common settings:

If you want to build both static/shared libraries, don't set switches.
If you want to build only shared-library, set BUILD_SHARED_LIBS=ON.
If you want to build only static-library, set BUILD_SHARED_LIBS=OFF.
2018-08-15 16:39:21 +09:00
Dennis Klein
99c221ad01 Export an interface target for the C++ header-only library 2018-08-13 20:54:29 +02:00
Takatoshi Kondo
3a615bcf44 Merge pull request #720 from redboltz/fix_711
Removed warnings.
2018-08-12 22:54:28 +09:00
Takatoshi Kondo
87863c1696 Removed warnings. 2018-08-12 20:59:00 +09:00
Takatoshi Kondo
45defd565a Merge pull request #719 from redboltz/add_byte
Add byte
2018-08-12 20:48:19 +09:00
Takatoshi Kondo
f1726cef0d Updated travis-ci environment. 2018-08-12 18:31:44 +09:00
Takatoshi Kondo
8a788f3a48 Added C++17 std::byte support.
`std::byte` is mapped to
https://github.com/msgpack/msgpack/blob/master/spec.md#int-format-family.

`std::vector<std::byte>` and `std::byte[]` are mapped to https://github.com/msgpack/msgpack/blob/master/spec.md#bin-format-family.
2018-08-12 16:23:39 +09:00
Takatoshi Kondo
7710868556 Merge pull request #718 from seratch/fix-typo
Fix misspelled words in comments
2018-08-11 17:23:35 +09:00
Kazuhiro Sera
0b53833856 Fix misspelled words in comments, detected by github.com/client9/misspell 2018-08-11 11:28:40 +09:00
Takatoshi Kondo
43c643bab6 Merge pull request #717 from redboltz/fix_lack_of_so_version
Added so version if shared object only build.
2018-08-11 09:41:31 +09:00
Takatoshi Kondo
ac64fcace8 Added so version if shared object only build.
Fixed MSGPACK_INSTALLTARGETS list manipulation.
2018-08-10 19:39:43 +09:00
Takatoshi Kondo
84ba0c7b4b Merge pull request #704 from owent-contrib/master
Fix MSGPACK_DEPRECATED for MSVC 1914 with /Zc:__cplusplus
2018-08-09 17:48:26 +09:00
Takatoshi Kondo
f79606d9ff Merge pull request #713 from redboltz/fix_703
Fixed #703.
2018-08-08 21:50:37 +09:00
Takatoshi Kondo
3aaadb9b12 Fixed #703.
Added no build static-library option.
2018-08-08 20:14:48 +09:00
Takatoshi Kondo
8a3a11f123 Merge pull request #710 from redboltz/fix_709
Fixed #709.
2018-07-29 09:22:26 +09:00
Takatoshi Kondo
32f1f0edf2 Fixed #709.
Renamed parameter name on macros. It minimizes conflict with
MSGPACK_DEFINE* user defined arguments.
2018-07-29 07:45:57 +09:00
Takatoshi Kondo
5bd75905cb Merge pull request #707 from redboltz/ts_c
Added timestamp minimal support for C.
2018-07-22 22:06:58 +09:00
Takatoshi Kondo
eebdc007a9 Added timestamp minimal support for C. 2018-07-22 20:38:36 +09:00
Takatoshi Kondo
3aae588a6a Merge pull request #706 from redboltz/fix_638_3
Implemented #638.
2018-07-22 18:23:35 +09:00
Takatoshi Kondo
cb2dcb19b9 Implemented #638.
Added Time Stamp support.
2018-07-22 16:25:23 +09:00
Takatoshi Kondo
c58a565366 Merge pull request #705 from redboltz/fix_697
Fixed #697.
2018-07-22 10:27:39 +09:00
Takatoshi Kondo
93b944eec4 Fixed #697.
Removed out of range array dereference.
2018-07-21 20:42:40 +09:00
owent
7340f1e9c8 Fix MSGPACK_DEPRECATED for MSVC 1914 with /Zc:__cplusplus, @see https://docs.microsoft.com/cpp/build/reference/zc-cplusplus 2018-07-17 21:25:20 +08:00
Takatoshi Kondo
0a65c443a2 Merge pull request #694 from oleksak/patch-1
Update object.hpp
2018-05-28 07:28:36 +09:00
Oleksandr Kravchenko
bae6a8db57 Update object.hpp
a little bug fix
2018-05-26 19:59:01 +03:00
Takatoshi Kondo
ddb320197a Merge pull request #689 from derwolfe/san-2
Sanitizer build for fuzzers
2018-05-21 19:25:30 +09:00
Chris Wolfe
dc51f6493b add/modify cmake and travis to get the regression tests built with sanitizers 2018-05-19 10:59:59 -05:00
Chris Wolfe
c027909acc add a test file for regression tests, cmakelist.txt to get it build correctly 2018-05-19 10:58:45 -05:00
Chris Wolfe
2bd56533fa add regression test cases 2018-05-19 10:57:50 -05:00
Takatoshi Kondo
c07452a7a2 Merge pull request #687 from jamessan/doxygen-paths
Strip the build path from generated documentation
2018-05-13 20:55:58 +09:00
James McCoy
8701aeec30 Strip the build path from generated documentation
Since FULL_PATH_NAMES = YES, Doxygen includes the full build path to the
file in the documentation.  This is most prevalent in the <title>
attribute for a file.

Setting STRIP_FROM_PATH = ${CMAKE_CURRENT_SOURCE_DIR}/include means that
only the relevant portion of the path (that which the user would need to
use) is included.

--- a/msgpack_8h.html	2018-05-12 14:03:34.098715879 -0400
+++ b/msgpack_8h.html	2018-05-12 14:04:17.386349607 -0400
@@ -5,7 +5,7 @@
 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
 <meta name="generator" content="Doxygen 1.8.13"/>
 <meta name="viewport" content="width=device-width, initial-scale=1"/>
-<title>MessagePack for C: /home/jamessan/src/debian.org/pkg-vim/msgpack-c/include/msgpack.h File Reference</title>
+<title>MessagePack for C: msgpack.h File Reference</title>
 <link href="tabs.css" rel="stylesheet" type="text/css"/>
 <script type="text/javascript" src="jquery.js"></script>
 <script type="text/javascript" src="dynsections.js"></script>
2018-05-12 14:04:48 -04:00
Takatoshi Kondo
2c4f2b890e Merge pull request #686 from redboltz/fix_685
Fixed #685.
2018-05-12 16:15:22 +09:00
Takatoshi Kondo
f1acd78e54 Fixed #685.
Added fuzz directory to release tar ball.
2018-05-12 14:48:31 +09:00
Takatoshi Kondo
49d22b7d28 Merge pull request #683 from redboltz/fix_658
Fixed #658.
2018-05-10 22:50:54 +09:00
Takatoshi Kondo
96133c8dd9 Fixed #658.
Added include file checking.
2018-05-10 19:02:24 +09:00
Takatoshi Kondo
bd18a36dae Merge pull request #681 from redboltz/update_doc_to_v3.0.0
Update the document for the version 3.0.0.
2018-05-09 21:40:30 +09:00
Takatoshi Kondo
3fe630769e Update the document for the version 3.0.0. 2018-05-09 16:16:50 +09:00
Takatoshi Kondo
2f80758889 Merge pull request #677 from komainu8/add_dll_export
Add dll export for msvc
2018-04-30 18:15:59 +09:00
Takatoshi Kondo
9f3efe9e54 Merge pull request #678 from derwolfe/lower-test-limit-oom
Lower limits for the fuzzer inputs
2018-04-30 09:25:24 +09:00
Chris Wolfe
6e44edf290 lower the input limits, I might need to push a config change to oss-fuzz as well to lower the max input size 2018-04-29 10:49:56 -05:00
Yasuhiro Horimoto
d28cbf32b9 Add dll export for msvc 2018-04-27 18:24:17 +09:00
Takatoshi Kondo
48d226e97c Merge pull request #676 from redboltz/remove_object_pack_recursion
Removed recursion from msgpack::object packing and stringize.
2018-04-27 06:33:51 +09:00
Takatoshi Kondo
64698e8e8c Removed other recursions from msgpack::object.
Fixed start_map_item and start_array_item calling point.
Supported visitor aborting.
2018-04-27 00:54:55 +09:00
Takatoshi Kondo
e0d098641c Merge pull request #674 from derwolfe/fix-fuzzer
Fix the fuzzer by setting limits for depth and ext.
2018-04-26 21:49:04 +09:00
Takatoshi Kondo
06f4b05487 Removed #if 0 codes. 2018-04-26 20:18:20 +09:00
Takatoshi Kondo
122fce5aee Merge pull request #675 from derwolfe/add-fuzz-corpus
move the seed corpus in repo
2018-04-26 20:08:58 +09:00
Takatoshi Kondo
e3f5281903 Removed recursion from msgpack::object packing and stringize.
Changed json expected strings.

Before this commit, json output has redundant white space.
The commit remove it. Semantically no difference.
2018-04-26 19:36:48 +09:00
Chris Wolfe
88e94e3776 move the seed corpus in repo 2018-04-25 15:47:53 -05:00
Chris Wolfe
95275ff16e Fix the fuzzer by setting limits for depth and ext.
This is a short lived bug in the fuzzer implementation in which the
limits were not set correctly.

Credit to OSS-Fuzz
2018-04-25 08:00:47 -05:00
Takatoshi Kondo
4cb938ed18 Merge pull request #673 from redboltz/fix_671
Fixed #671.
2018-04-25 12:52:12 +09:00
Takatoshi Kondo
5f3e62461e Merge pull request #672 from derwolfe/add-fuzzer-and-test
Add the fuzzer from oss-fuzz and a test that exercises it
2018-04-25 11:08:42 +09:00
Takatoshi Kondo
ec239933db Fixed #671.
Added STR type check to define_map.
2018-04-25 10:43:26 +09:00
Chris Wolfe
de59b393c7 conform to project norms and naming conventions 2018-04-24 20:04:54 -05:00
Chris Wolfe
b02371efe5 no reason to have this declaration 2018-04-24 18:09:15 -05:00
Chris Wolfe
f34289fdfd remove newline that I accidentally added 2018-04-24 17:17:49 -05:00
Chris Wolfe
584478a4f1 fuzzers are cpp11 only at the moment 2018-04-24 15:22:20 -05:00
Chris Wolfe
700ec688f7 add the fuzzer from oss-fuzz and a test that exercises it 2018-04-24 15:05:09 -05:00
Takatoshi Kondo
a133c1d393 Merge pull request #670 from redboltz/fix_variadic_template
Added missing variadic template parameters.
2018-04-12 08:03:02 +09:00
Takatoshi Kondo
6ba9a58648 Added missing variadic template parameters. 2018-04-12 06:36:32 +09:00
Takatoshi Kondo
bb92d326c8 Merge pull request #668 from redboltz/fix_missing_install_files
Fixed #667.
2018-04-11 11:26:12 +09:00
Takatoshi Kondo
1e13dadf1f Added install file comparison script. 2018-04-11 09:49:47 +09:00
Takatoshi Kondo
7b271c2af2 Fixed #667. 2018-04-11 08:52:16 +09:00
Takatoshi Kondo
c3f4e52bdb Merge pull request #666 from redboltz/fix_663_and_update_to_v3
Fix 663 and update to v3
2018-04-09 06:20:42 +09:00
Takatoshi Kondo
458b4c0363 Removed redundant version namespace qualification. 2018-04-08 23:24:17 +09:00
Takatoshi Kondo
f8dc0f0d04 Fixed #663. 2018-04-08 22:29:36 +09:00
Takatoshi Kondo
347658cdc1 Updated the version to 3.0.0.
See https://github.com/msgpack/msgpack-c/pull/639#issuecomment-353786498
So I updated the version to 3.0.0.
In the version 2.x, it keeps the original behavior.
2018-04-08 22:27:45 +09:00
Takatoshi Kondo
427a6e7313 Revert "Fixed #637."
This reverts commit 5ece2ef2c7.
2018-04-06 07:38:58 +09:00
Takatoshi Kondo
7f76a3caf0 Merge pull request #661 from Leo3738/master
Small grammatical changes made to README.md
2018-04-04 22:55:39 +09:00
Takatoshi Kondo
40539727e6 Merge branch 'kraj-master' 2018-04-04 22:52:56 +09:00
Takatoshi Kondo
30e56d0a45 Merge branch 'master' of https://github.com/kraj/msgpack-c into kraj-master 2018-04-04 21:11:56 +09:00
Takatoshi Kondo
8eef2a245b Merge branch 'cableramki-master' 2018-04-04 18:23:00 +09:00
Takatoshi Kondo
2bcfe2fdb0 Merge branch 'master' of https://github.com/cableramki/msgpack-c into cableramki-master 2018-04-04 15:55:35 +09:00
Takatoshi Kondo
2b49e62b3c Merge branch 'utkarsh009-master' 2018-04-04 15:54:09 +09:00
Takatoshi Kondo
bf70a36a1d Merge branch 'master' of https://github.com/utkarsh009/msgpack-c into utkarsh009-master 2018-04-04 14:04:00 +09:00
Takatoshi Kondo
eb92058cf4 Merge branch 'Elv13-master' 2018-04-04 14:00:48 +09:00
Takatoshi Kondo
423eaf25fb Removed -O3 -g -Werror options from CmakeLists.txt.
Added -g -Werror options to .travis.yml.
2018-04-04 13:07:21 +09:00
Takatoshi Kondo
280abe852c Merge pull request #662 from redboltz/update_boost_on_travis
Update boost on travis
2018-04-04 12:18:00 +09:00
Takatoshi Kondo
c91307aaa1 Merge branch 'master' of https://github.com/Elv13/msgpack-c into Elv13-master 2018-04-04 12:13:56 +09:00
Takatoshi Kondo
88ffd08087 Supported boost 1.66.0 or later on the examples. 2018-04-04 07:44:49 +09:00
Takatoshi Kondo
bd337129c6 Updated the boost version to 1.66.0 on travis-ci. 2018-04-04 07:20:08 +09:00
Ramki A
1f5cb86366 Update unpack_decl.hpp 2018-04-02 17:58:04 -07:00
Ramki A
0d39c577d8 Update unpack.hpp 2018-04-02 17:57:52 -07:00
Ramki A
7e66dc28f0 Update unpack_decl.hpp 2018-04-02 17:57:25 -07:00
Ramki A
bec47a59f0 Update unpack.hpp 2018-04-02 17:56:57 -07:00
Leo3738
064f854ddf Small grammatical changes made to README.md 2018-04-02 15:08:52 -07:00
Khem Raj
a05d92ae85 Fix -Werror=class-memaccess
Casting to void* make gcc happy since its upset about
object types and rightly so

Fixes

'void* memcpy(void*, const void*, size_t)' copying an object of non-trivial type 'struct msgpack::v2::object' from an array of 'const msgpack_object' {aka 'const struct msgpack_object'} [-Werror=class-memaccess]

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2018-04-01 19:55:38 -07:00
Ananthakrishnan
1fdfde5d5f Fixed #elif syntax. 2018-03-30 15:30:49 -07:00
Ananthakrishnan
b1620f1f6a Fixed Travis Mac OS build. 2018-03-30 15:14:59 -07:00
Ramki Ananthakrishnan
f789635ddc Fixed Coverity error due to missing header. 2018-03-29 15:09:19 -07:00
Utkarsh Anand
f65c26e280 Include <sys/uio.h> in NetBSD too.
This was needed for neovim
2018-03-28 20:18:05 +05:30
Emmanuel Lepage Vallée
579212996f build: Do not set -g, -O3 and -Werror CFLAGS
Hello, here are a few changes to the default CFLAGS

## Why Werror

With each new compiler version, your code "break" and fail to compile. It is true that it's a sometime a "bug" in the code and need visibility to get fixed. However, Werror should *always* be a local CFLAGS and not a project one, see Google for endless people arguing back and forth and removing Werror is now the prevalent winner of that argument. In the latest GCC, it fails to compile because the fwrite result in unchecked. Even if you fix this in new releases, you cannot fix the past and all existing releases used in stable products suddenly fail to compile, wasting everybody time.

## Why -g

This should be decided by the one who compiles the code. Some people want small and pre-stripped binaries and appending this to the CFLAGS breaks the standard way of achieving this. Prepend it if you wish, but please do not append it.

## Why -O3

On many systems with limited cache or higher memory latency, `O3` is slower than `O2`, so IMHO it should not be hardcoded. In my case I used `Os` and it's faster. The `O` value should be left to the system, not hardcoded.
2017-12-12 01:26:22 -05:00
Takatoshi Kondo
208595b262 Merge pull request #639 from redboltz/fix_637
Fixed #637.
2017-11-28 08:05:43 +09:00
Takatoshi Kondo
83a4b89818 Merge pull request #645 from redboltz/fix_644
Fixed #644.
2017-11-14 19:04:03 +09:00
Takatoshi Kondo
d46f220737 Removed unused code. 2017-11-12 12:31:17 +09:00
Takatoshi Kondo
b4db293181 Fixed #644.
Added `as()` checking to MSGPACK_DEFINE family.
2017-11-11 15:44:31 +09:00
Takatoshi Kondo
d1eac600e9 Merge pull request #643 from redboltz/fix_642
Fixed #642.
2017-11-10 12:15:05 +09:00
Takatoshi Kondo
7e758ca053 Fixed #642.
Fixed documentation.
2017-11-09 10:40:43 +09:00
Takatoshi Kondo
db6d4f2003 Merge pull request #641 from redboltz/fix_640
Fixed #640.
2017-11-04 15:43:02 +09:00
Takatoshi Kondo
1ba46a30ce Fixed #640.
Replaced comma with semi colon.
Unified cording style.
2017-11-04 12:55:22 +09:00
Takatoshi Kondo
5ece2ef2c7 Fixed #637.
<<< Breaking change >>>
In the functions unpack() and parse(),
Old behavior: If any parse error is happend, offset is NOT updated.
New behavior: If any parse error is happend, offset is updated to the
position the error happened.

It helps MessagePack format error analysis.

If you want to old behavior, copy the original value of offset and then call unpack()
and/or parse().
2017-10-22 18:22:41 +09:00
Takatoshi Kondo
9513734040 Merge pull request #635 from sztomi/sztomi/objhandle_ops
Added * and -> operators to object_handle
2017-10-14 10:54:28 +09:00
sztomi
d452625ed1 Added * and -> operators to object_handle 2017-10-09 20:23:25 +02:00
Takatoshi Kondo
b02c6beb4d Merge pull request #634 from redboltz/fix_trusty
Fix trusty
2017-10-09 18:39:39 +09:00
Takatoshi Kondo
06c2896def Added symbolic link. 2017-10-09 15:20:29 +09:00
Takatoshi Kondo
724db8ed89 Added zlib1g-dev for 32bit build. 2017-10-09 14:29:47 +09:00
Takatoshi Kondo
fa48078a52 Merge pull request #631 from redboltz/fix_travis
Set `precise` explicitly to fix 32bit zlib missing problem.
2017-10-01 23:38:21 +09:00
Takatoshi Kondo
d8ad85fa8c Set precise explicitly to fix 32bit zlib missing problem. 2017-10-01 21:25:06 +09:00
Takatoshi Kondo
cc3b895449 Merge pull request #630 from samdoshi/patch-1
Don't sudo with brew in QUICKSTART-C.md
2017-10-01 17:45:36 +09:00
Sam Doshi
384242e5eb Don't sudo with brew in QUICKSTART-C.md 2017-10-01 08:29:46 +01:00
Takatoshi Kondo
7a98138f27 Merge pull request #625 from redboltz/update_to_215
Updated the version to 2.1.5.
2017-08-05 00:02:07 +09:00
Takatoshi Kondo
cd4e0bda57 Updated the version to 2.1.5.
Version 2.1.4 will be removed.
See https://github.com/msgpack/msgpack-c/issues/623
2017-08-04 23:07:27 +09:00
Takatoshi Kondo
1ad2db0c42 Merge pull request #624 from mkaes/master
Add defines for QNX build
2017-08-04 22:37:44 +09:00
Michael Kaes
96a76a7a5c Add defines for QNX build 2017-08-04 14:41:37 +02:00
Takatoshi Kondo
bc964bd847 Merge pull request #622 from redboltz/add_version_updater
Added version updating script.
2017-08-04 08:14:43 +09:00
Takatoshi Kondo
12604b5c8e Added version updating script. 2017-08-04 08:13:48 +09:00
Takatoshi Kondo
7c67109396 Updated README. 2017-08-04 07:18:17 +09:00
174 changed files with 6632 additions and 700 deletions

View File

@@ -1,5 +1,6 @@
language: cpp
sudo: false
dist: trusty
install:
- export BASE=`pwd`
@@ -9,8 +10,9 @@ install:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then ./cmake-3.7.1-Linux-x86_64.sh --prefix=${BASE}/usr --skip-license; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export PATH="${BASE}/usr/bin:$PATH"; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export LD_LIBRARY_PATH="${BASE}/usr/lib:$LD_LIBRARY_PATH"; fi
- if [ "$CXX" = "g++" ]; then export CXX="g++-6" CC="gcc-6"; fi
- if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then export CXX="clang++-3.9" CC="clang-3.9"; fi
- if [ "$CXX" == "g++" ]; then export CXX="g++-7" CC="gcc-7"; fi
- if [ "$CXX" == "clang++" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then export CXX="clang++-5.0" CC="clang-5.0"; fi
- if [ "$CXX" == "g++" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then cd /usr/include/c++/$(g++ -v 2>&1 | grep version | awk '{print $3}')/bits; ln -s ../ext/atomicity.h .; cd ${BASE}/usr; fi
#gtest
- wget https://github.com/google/googletest/archive/release-1.7.0.zip -O googletest-release-1.7.0.zip
- unzip -q googletest-release-1.7.0.zip
@@ -24,22 +26,24 @@ install:
- mkdir -p ${BASE}/usr/lib
- mv *.a ${BASE}/usr/lib
- cd ..
# valgrind
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then wget http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2 && tar xjf valgrind-3.12.0.tar.bz2 && cd valgrind-3.12.0 && ./configure --prefix=${BASE}/usr > /dev/null && make -j3 > /dev/null && make install > /dev/null && cd ..; fi
# boost
- if [ "$BOOST" == "ON" ]; then wget http://sourceforge.net/projects/boost/files/boost/1.63.0/boost_1_63_0.zip && unzip -q boost_1_63_0.zip && cd boost_1_63_0 && ./bootstrap.sh && ./b2 -j3 --prefix=${BASE}/usr --with-chrono --with-context --with-system --with-timer address-model=${ARCH} install > /dev/null && cd ..; fi
# valgrind
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$MSGPACK_FUZZ_REGRESSION" != "ON" ]; then wget http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2 && tar xjf valgrind-3.12.0.tar.bz2 && cd valgrind-3.12.0 && ./configure --prefix=${BASE}/usr > /dev/null && make -j3 > /dev/null && make install > /dev/null && cd ..; fi
# boost
- if [ "$BOOST" == "ON" ] && [ "MSGPACK_FUZZ_REGRESSION" != "ON" ]; then wget http://sourceforge.net/projects/boost/files/boost/1.67.0/boost_1_67_0.zip && unzip -q boost_1_67_0.zip && cd boost_1_67_0 && ./bootstrap.sh && ./b2 -j3 --prefix=${BASE}/usr --with-chrono --with-context --with-system --with-timer address-model=${ARCH} install > /dev/null && cd ..; fi
- if [ "$MSGPACK_FUZZ_REGRESSION" == "ON" ]; then wget http://sourceforge.net/projects/boost/files/boost/1.67.0/boost_1_67_0.zip && unzip -q boost_1_67_0.zip && cd boost_1_67_0 && ./bootstrap.sh --with-toolset=clang && ./b2 clean && ./b2 -j$(nproc) --prefix=${BASE}/usr --with-system --with-filesystem address-model=${ARCH} install > /dev/null && cd ..; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ln -s /usr/include/x86_64-linux-gnu/zconf.h /usr/include; fi
matrix:
include:
- os: osx
compiler: clang
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="64" BOOST="ON" SHARED="ON" CHAR_SIGN="unsigned" API_VERSION="1"
env: ACTION="ci/build_cmake.sh" CXX17="ON" ARCH="64" BOOST="ON" SHARED="ON" CHAR_SIGN="unsigned" API_VERSION="1"
- os: osx
compiler: clang
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="64" BOOST="ON" SHARED="ON" CHAR_SIGN="signed" API_VERSION="2"
env: ACTION="ci/build_cmake.sh" CXX17="ON" ARCH="64" BOOST="ON" SHARED="ON" CHAR_SIGN="signed" API_VERSION="3"
- os: osx
compiler: clang
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="64" SHARED="ON" CHAR_SIGN="signed" API_VERSION="2"
env: ACTION="ci/build_cmake.sh" CXX17="ON" ARCH="64" SHARED="ON" CHAR_SIGN="signed" API_VERSION="2"
- os: osx
compiler: clang
env: ACTION="ci/build_cmake.sh" ARCH="64" SHARED="ON" CHAR_SIGN="unsigned" API_VERSION="2"
@@ -50,15 +54,14 @@ matrix:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
- llvm-toolchain-precise
- llvm-toolchain-trusty-5.0
packages:
- g++-multilib
- gcc-multilib
- gcc-5-multilib
- g++-5-multilib
- gcc-7-multilib
- g++-7-multilib
- bzip2
- clang-3.9
- clang-5.0
- libc6-dbg
- os: linux
compiler: clang
@@ -67,61 +70,60 @@ matrix:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
- llvm-toolchain-precise
- llvm-toolchain-trusty-5.0
packages:
- g++-multilib
- gcc-multilib
- gcc-5-multilib
- g++-5-multilib
- gcc-7-multilib
- g++-7-multilib
- lib32stdc++6-6-dbg
- lib32gcc1
- libc6-i386
- lib32z1-dev
- zlib1g-dev
- bzip2
- clang-3.9
- clang-5.0
- libc6-dbg
- os: linux
compiler: clang
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="64" BOOST="ON" SHARED="ON" CHAR_SIGN="signed" API_VERSION="2" X3_PARSE="ON"
env: ACTION="ci/build_cmake.sh" CXX17="ON" ARCH="64" BOOST="ON" SHARED="ON" CHAR_SIGN="signed" API_VERSION="3" X3_PARSE="ON"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
- llvm-toolchain-precise
- llvm-toolchain-trusty-5.0
packages:
- g++-multilib
- gcc-multilib
- gcc-5-multilib
- g++-5-multilib
- gcc-7-multilib
- g++-7-multilib
- bzip2
- clang-3.9
- clang-5.0
- libc6-dbg
- os: linux
compiler: clang
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="32" SHARED="OFF" CHAR_SIGN="unsigned" API_VERSION="2"
env: ACTION="ci/build_cmake.sh" CXX17="ON" ARCH="32" SHARED="OFF" CHAR_SIGN="unsigned" API_VERSION="2"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
- llvm-toolchain-precise
- llvm-toolchain-trusty-5.0
packages:
- g++-multilib
- gcc-multilib
- gcc-5-multilib
- g++-5-multilib
- gcc-7-multilib
- g++-7-multilib
- lib32stdc++6-6-dbg
- lib32gcc1
- libc6-i386
- lib32z1-dev
- zlib1g-dev
- bzip2
- clang-3.9
- clang-5.0
- libc6-dbg
- os: linux
compiler: gcc
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="64" SHARED="ON" CHAR_SIGN="signed" API_VERSION="2"
env: ACTION="ci/build_cmake.sh" CXX17="ON" ARCH="64" SHARED="ON" CHAR_SIGN="signed" API_VERSION="2"
addons:
apt:
sources:
@@ -129,13 +131,13 @@ matrix:
packages:
- g++-multilib
- gcc-multilib
- gcc-6-multilib
- g++-6-multilib
- gcc-7-multilib
- g++-7-multilib
- bzip2
- libc6-dbg
- os: linux
compiler: gcc
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="32" BOOST="ON" SHARED="ON" CHAR_SIGN="unsigned" API_VERSION="2" X3_PARSE="ON"
env: ACTION="ci/build_cmake.sh" CXX17="ON" ARCH="32" BOOST="ON" SHARED="ON" CHAR_SIGN="unsigned" API_VERSION="3" X3_PARSE="ON"
addons:
apt:
sources:
@@ -143,12 +145,13 @@ matrix:
packages:
- g++-multilib
- gcc-multilib
- gcc-6-multilib
- g++-6-multilib
- gcc-7-multilib
- g++-7-multilib
- lib32stdc++6-6-dbg
- lib32gcc1
- libc6-i386
- lib32z1-dev
- zlib1g-dev
- bzip2
- libc6-dbg
- os: linux
@@ -161,8 +164,8 @@ matrix:
packages:
- g++-multilib
- gcc-multilib
- gcc-6-multilib
- g++-6-multilib
- gcc-7-multilib
- g++-7-multilib
- bzip2
- libc6-dbg
- os: linux
@@ -175,12 +178,13 @@ matrix:
packages:
- g++-multilib
- gcc-multilib
- gcc-6-multilib
- g++-6-multilib
- gcc-7-multilib
- g++-7-multilib
- lib32stdc++6-6-dbg
- lib32gcc1
- libc6-i386
- lib32z1-dev
- zlib1g-dev
- bzip2
- libc6-dbg
- os: linux
@@ -193,14 +197,43 @@ matrix:
packages:
- g++-multilib
- gcc-multilib
- gcc-6-multilib
- g++-6-multilib
- gcc-7-multilib
- g++-7-multilib
- lib32stdc++6-6-dbg
- lib32gcc1
- libc6-i386
- lib32z1-dev
- zlib1g-dev
- bzip2
- libc6-dbg
- os: linux
compiler: clang
env: ACTION="ci/build_regression.sh" ARCH="64" SAN="UBSAN" MSGPACK_FUZZ_REGRESSION="ON"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-5.0
packages:
- bzip2
- clang-5.0
script:
- CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" CMAKE_LIBRARY_PATH="${BASE}" GTEST_ROOT="${BASE}/gtest" BOOST_ROOT="${BASE}/boost" CTEST_OUTPUT_ON_FAILURE=1 MSGPACK_SAN="${SAN}" ci/build_regression.sh
- os: linux
compiler: clang
env: ACTION="ci/build_regression.sh" ARCH="64" SAN="ASAN" MSGPACK_FUZZ_REGRESSION="ON"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-5.0
packages:
- bzip2
- clang-5.0
script:
- CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" CMAKE_LIBRARY_PATH="${BASE}" GTEST_ROOT="${BASE}/gtest" BOOST_ROOT="${BASE}/boost" CTEST_OUTPUT_ON_FAILURE=1 MSGPACK_SAN="${SAN}" ci/build_regression.sh
script:
- CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" CMAKE_LIBRARY_PATH="${BASE}/usr/lib:${BASE}/build" GTEST_ROOT="${BASE}/usr" BOOST_ROOT="${BASE}/usr" ${ACTION}
- CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" CMAKE_LIBRARY_PATH="${BASE}/usr/lib:${BASE}/build" GTEST_ROOT="${BASE}/usr" BOOST_ROOT="${BASE}/usr" CFLAGS="-Werror -g" CXXFLAGS="-Werror -g" ${ACTION}
- cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2

View File

@@ -1,4 +1,44 @@
# 2017-08-03 version 2.1.4
# 2018-08-10 version 3.1.0
* Improve documents (#687, #718)
* Add fuzzer support (#689)
* Fix msgpack::object union member access bug (#694)
* Improve cross platform configuration (#704)
* Fix out of range dereference bug of EXT (#705)
* Add timestamp support. std::chrono::system_clock::time_point is mapped to TIMESTAMP (#706)
* Add minimal timestamp support for C. The type `msgpack_timestamp` and the function `msgpack_object_to_timestamp()` are introduced (#707)
* Improve MSGPACK_DEFINE family name confliction probability (#710)
* Add no static-library build option (BUILD_SHARED_LIBS=ON) (#713, #717, #722)
* Add header only cmake target (#721)
* Add `std::byte` adaptor (#719)
* Remove some warnings (#720)
# 2018-05-12 version 3.0.1
* Add fuzz directory to release tar ball (#686)
* Add include file checking for X-Code (#683)
# 2018-05-09 version 3.0.0
## << breaking changes >>
* Change offset parameter updating rule. If parse error happens, offset is updated to the error position. (#639, #666)
## << other updates >>
* Improve cross platform configuration (#655, #677)
* Improve build system (#647)
* Improve user class adaptor (#645, #673)
* Improve msgpack::object visitation logic (#676)
* Remove some warnings (#641, 659)
* Add `->` and `*` operators to object_handle (#635)
* Improve CI environment (#631, #634, #643, #657, #662, #668)
* Improve documents (#630, #661)
* Refactoring (#670)
* Add OSS-Fuzz support (#672, #674, #675, #678)
# 2017-08-04 version 2.1.5
* Improve cross platform configuration (#624)
* Add boost asio examples (including zlib) (#610)
* Remove some warnings (#611)
* Fix unpack visitor to treat float32/64 correctly (#613)
@@ -6,6 +46,9 @@
* Fix alignment problem on some platform (#617, #518)
* Fix conflict std::tuple, std::pair, and boost::fusion::sequence problem (#619)
# 2017-08-03 version 2.1.4 (Invalid)
* See https://github.com/msgpack/msgpack-c/issues/623
# 2017-06-15 version 2.1.3
* Improve build system (#603)
* Add C++17 adaptors `std::optional` and `std::string_view`. (#607, #608)

View File

@@ -124,7 +124,7 @@ ENDIF ()
IF (MSGPACK_DEFAULT_API_VERSION)
SET (CMAKE_CXX_FLAGS "-DMSGPACK_DEFAULT_API_VERSION=${MSGPACK_DEFAULT_API_VERSION} ${CMAKE_CXX_FLAGS}")
ELSE ()
SET (CMAKE_CXX_FLAGS "-DMSGPACK_DEFAULT_API_VERSION=2 ${CMAKE_CXX_FLAGS}")
SET (CMAKE_CXX_FLAGS "-DMSGPACK_DEFAULT_API_VERSION=3 ${CMAKE_CXX_FLAGS}")
ENDIF ()
FILE (GLOB_RECURSE PREDEF_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/external/boost/predef/include/boost ${CMAKE_CURRENT_SOURCE_DIR}/external/boost/predef/include/boost/*.h)
@@ -150,12 +150,40 @@ ENDFOREACH ()
FIND_PACKAGE (GTest)
FIND_PACKAGE (ZLIB)
FIND_PACKAGE (Threads)
IF (GTEST_FOUND AND ZLIB_FOUND AND THREADS_FOUND)
IF (GTEST_FOUND AND ZLIB_FOUND AND THREADS_FOUND AND NOT "${MSGPACK_FUZZ_REGRESSION}" STREQUAL "ON")
OPTION (MSGPACK_BUILD_TESTS "Build msgpack tests." ON)
ENDIF ()
IF (DEFINED BUILD_SHARED_LIBS)
IF (BUILD_SHARED_LIBS)
IF (DEFINED MSGPACK_ENABLE_SHARED AND NOT MSGPACK_ENABLE_SHARED)
MESSAGE(WARNING "MSGPACK_ENABLE_SHARED is overridden to ON by BUILD_SHARED_LIBS")
ENDIF ()
SET (MSGPACK_ENABLE_SHARED ON)
IF (DEFINED MSGPACK_ENABLE_STATIC AND MSGPACK_ENABLE_STATIC)
MESSAGE(WARNING "MSGPACK_ENABLE_STATIC is overridden to OFF by BUILD_SHARED_LIBS")
ENDIF ()
SET (MSGPACK_ENABLE_STATIC OFF)
ELSE ()
IF (DEFINED MSGPACK_ENABLE_SHARED AND MSGPACK_ENABLE_SHARED)
MESSAGE(WARNING "MSGPACK_ENABLE_SHARED is overridden to OFF by BUILD_SHARED_LIBS")
ENDIF ()
SET (MSGPACK_ENABLE_SHARED OFF)
IF (DEFINED MSGPACK_ENABLE_STATIC AND NOT MSGPACK_ENABLE_STATIC)
MESSAGE(WARNING "MSGPACK_ENABLE_STATIC is overridden to ON by BUILD_SHARED_LIBS")
ENDIF ()
SET (MSGPACK_ENABLE_STATIC ON)
ENDIF ()
ELSE ()
IF (NOT DEFINED MSGPACK_ENABLE_SHARED)
SET (MSGPACK_ENABLE_SHARED ON)
ENDIF ()
IF (NOT DEFINED MSGPACK_ENABLE_STATIC)
SET (MSGPACK_ENABLE_STATIC ON)
ENDIF ()
ENDIF ()
OPTION (MSGPACK_ENABLE_CXX "Enable C++ interface." ON)
OPTION (MSGPACK_ENABLE_SHARED "Build shared libaries in addition to static libraries." ON)
INCLUDE (CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES ("
@@ -187,6 +215,8 @@ IF (MSGPACK_ENABLE_SHARED)
${msgpackc_HEADERS}
)
SET_TARGET_PROPERTIES (msgpackc PROPERTIES SOVERSION 2 VERSION 2.0.0)
TARGET_INCLUDE_DIRECTORIES (msgpackc
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
@@ -197,35 +227,60 @@ IF (MSGPACK_ENABLE_SHARED)
)
ENDIF ()
ADD_LIBRARY (msgpackc-static STATIC
IF (MSGPACK_ENABLE_CXX AND ((CMAKE_VERSION VERSION_GREATER 3.0) OR (CMAKE_VERSION VERSION_EQUAL 3.0)))
ADD_LIBRARY (msgpackc-cxx INTERFACE)
TARGET_INCLUDE_DIRECTORIES (msgpackc-cxx
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
)
ENDIF ()
IF (MSGPACK_ENABLE_STATIC)
ADD_LIBRARY (msgpackc-static STATIC
${msgpackc_SOURCES}
${msgpackc_HEADERS}
)
)
TARGET_INCLUDE_DIRECTORIES (msgpackc-static
TARGET_INCLUDE_DIRECTORIES (msgpackc-static
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
)
IF (NOT MSGPACK_ENABLE_SHARED)
IF (NOT MSGPACK_ENABLE_SHARED)
# Add alias for subdirectories
ADD_LIBRARY (msgpackc ALIAS msgpackc-static)
ENDIF ()
ENDIF ()
SET_TARGET_PROPERTIES (msgpackc-static PROPERTIES OUTPUT_NAME "msgpackc")
IF (MSGPACK_ENABLE_SHARED)
SET_TARGET_PROPERTIES (msgpackc-static PROPERTIES OUTPUT_NAME "msgpackc")
IF (MSGPACK_ENABLE_SHARED)
IF (MSVC)
SET_TARGET_PROPERTIES (msgpackc PROPERTIES IMPORT_SUFFIX "_import.lib")
ELSEIF (MINGW)
SET_TARGET_PROPERTIES (msgpackc PROPERTIES IMPORT_SUFFIX ".dll.a")
ENDIF ()
SET_TARGET_PROPERTIES (msgpackc PROPERTIES SOVERSION 2 VERSION 2.0.0)
ENDIF ()
ENDIF ()
# enable regression testing
IF ("${MSGPACK_FUZZ_REGRESSION}" STREQUAL "ON" AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
SET (CMAKE_CXX_FLAGS "-DMSGPACK_USE_BOOST ${CMAKE_CXX_FLAGS}")
SET (Boost_USE_MULTITHREADED ON)
SET (Boost_USE_STATIC_RUNTIME OFF)
enable_testing ()
ADD_SUBDIRECTORY (fuzz)
SET (MSGPACK_BUILD_EXAMPLES OFF)
ENDIF ()
IF (MSGPACK_BUILD_TESTS)
ENABLE_TESTING ()
# MEMORYCHECK_COMMAND_OPTIONS needs to place prior to CTEST_MEMORYCHECK_COMMAND
@@ -237,16 +292,20 @@ ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
IF (MSGPACK_ENABLE_SHARED)
SET_PROPERTY (TARGET msgpackc APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3 -DPIC")
SET_PROPERTY (TARGET msgpackc APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra -DPIC")
ENDIF ()
IF (MSGPACK_ENABLE_STATIC)
SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra" )
ENDIF ()
SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3" )
ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
IF (MSGPACK_ENABLE_SHARED)
SET_PROPERTY (TARGET msgpackc APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags")
ENDIF ()
IF (MSGPACK_ENABLE_STATIC)
SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags")
ENDIF ()
ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
@@ -279,9 +338,15 @@ IF (MSGPACK_BUILD_EXAMPLES)
ENDIF ()
IF (MSGPACK_ENABLE_SHARED)
SET (MSGPACK_INSTALLTARGETS msgpackc msgpackc-static)
ELSE()
SET (MSGPACK_INSTALLTARGETS msgpackc-static)
SET (MSGPACK_INSTALLTARGETS msgpackc)
ENDIF ()
IF (MSGPACK_ENABLE_CXX AND ((CMAKE_VERSION VERSION_GREATER 3.0) OR (CMAKE_VERSION VERSION_EQUAL 3.0)))
LIST (APPEND MSGPACK_INSTALLTARGETS msgpackc-cxx)
ENDIF ()
IF (MSGPACK_ENABLE_STATIC)
LIST (APPEND MSGPACK_INSTALLTARGETS msgpackc-static)
ENDIF ()
INSTALL (TARGETS ${MSGPACK_INSTALLTARGETS} EXPORT msgpack-targets
@@ -307,6 +372,7 @@ IF (DOXYGEN_FOUND)
COMMAND ${CMAKE_COMMAND} -E echo "INPUT = ${CMAKE_CURRENT_SOURCE_DIR}/include" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c
COMMAND ${CMAKE_COMMAND} -E echo "EXTRACT_ALL = YES" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c
COMMAND ${CMAKE_COMMAND} -E echo "PROJECT_NAME = \"MessagePack for C\"" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c
COMMAND ${CMAKE_COMMAND} -E echo "STRIP_FROM_PATH = ${CMAKE_CURRENT_SOURCE_DIR}/include" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c
)
IF (DOXYGEN_DOT_FOUND)
LIST (APPEND Doxyfile_c_CONTENT
@@ -325,6 +391,7 @@ IF (DOXYGEN_FOUND)
COMMAND ${CMAKE_COMMAND} -E echo "OUTPUT_DIRECTORY = doc_cpp" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp
COMMAND ${CMAKE_COMMAND} -E echo "INPUT = ${CMAKE_CURRENT_SOURCE_DIR}/include" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp
COMMAND ${CMAKE_COMMAND} -E echo "EXTRACT_ALL = YES" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp
COMMAND ${CMAKE_COMMAND} -E echo "STRIP_FROM_PATH = ${CMAKE_CURRENT_SOURCE_DIR}/include" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp
)
IF (DOXYGEN_DOT_FOUND)
LIST (APPEND Doxyfile_cpp_CONTENT

View File

@@ -281,7 +281,7 @@ TYPEDEF_HIDES_STRUCT = NO
# causing a significant performance penality.
# If the system has enough physical memory increasing the cache will improve the
# performance by keeping more symbols in memory. Note that the value works on
# a logarithmic scale so increasing the size by one will rougly double the
# a logarithmic scale so increasing the size by one will roughly double the
# memory usage. The cache size is given by this formula:
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
# corresponding to a cache size of 2^16 = 65536 symbols

View File

@@ -142,6 +142,7 @@ LIST (APPEND msgpackc_HEADERS
include/msgpack/predef/version_number.h
include/msgpack/sbuffer.h
include/msgpack/sysdep.h
include/msgpack/timestamp.h
include/msgpack/unpack.h
include/msgpack/unpack_define.h
include/msgpack/unpack_template.h
@@ -173,6 +174,7 @@ IF (MSGPACK_ENABLE_CXX)
include/msgpack/adaptor/cpp11/array.hpp
include/msgpack/adaptor/cpp11/array_char.hpp
include/msgpack/adaptor/cpp11/array_unsigned_char.hpp
include/msgpack/adaptor/cpp11/chrono.hpp
include/msgpack/adaptor/cpp11/forward_list.hpp
include/msgpack/adaptor/cpp11/reference_wrapper.hpp
include/msgpack/adaptor/cpp11/shared_ptr.hpp
@@ -180,8 +182,11 @@ IF (MSGPACK_ENABLE_CXX)
include/msgpack/adaptor/cpp11/unique_ptr.hpp
include/msgpack/adaptor/cpp11/unordered_map.hpp
include/msgpack/adaptor/cpp11/unordered_set.hpp
include/msgpack/adaptor/cpp17/byte.hpp
include/msgpack/adaptor/cpp17/carray_byte.hpp
include/msgpack/adaptor/cpp17/optional.hpp
include/msgpack/adaptor/cpp17/string_view.hpp
include/msgpack/adaptor/cpp17/vector_byte.hpp
include/msgpack/adaptor/define.hpp
include/msgpack/adaptor/define_decl.hpp
include/msgpack/adaptor/deque.hpp
@@ -216,6 +221,8 @@ IF (MSGPACK_ENABLE_CXX)
include/msgpack/adaptor/vector_unsigned_char.hpp
include/msgpack/cpp_config.hpp
include/msgpack/cpp_config_decl.hpp
include/msgpack/create_object_visitor.hpp
include/msgpack/create_object_visitor_decl.hpp
include/msgpack/fbuffer.hpp
include/msgpack/fbuffer_decl.hpp
include/msgpack/gcc_atomic.hpp
@@ -223,12 +230,16 @@ IF (MSGPACK_ENABLE_CXX)
include/msgpack/iterator_decl.hpp
include/msgpack/meta.hpp
include/msgpack/meta_decl.hpp
include/msgpack/null_visitor.hpp
include/msgpack/null_visitor_decl.hpp
include/msgpack/object.hpp
include/msgpack/object_decl.hpp
include/msgpack/object_fwd.hpp
include/msgpack/object_fwd_decl.hpp
include/msgpack/pack.hpp
include/msgpack/pack_decl.hpp
include/msgpack/parse.hpp
include/msgpack/parse_decl.hpp
include/msgpack/parse_return.hpp
include/msgpack/preprocessor.hpp
include/msgpack/preprocessor/arithmetic.hpp
@@ -523,6 +534,7 @@ IF (MSGPACK_ENABLE_CXX)
include/msgpack/v1/adaptor/cpp11/array.hpp
include/msgpack/v1/adaptor/cpp11/array_char.hpp
include/msgpack/v1/adaptor/cpp11/array_unsigned_char.hpp
include/msgpack/v1/adaptor/cpp11/chrono.hpp
include/msgpack/v1/adaptor/cpp11/forward_list.hpp
include/msgpack/v1/adaptor/cpp11/reference_wrapper.hpp
include/msgpack/v1/adaptor/cpp11/shared_ptr.hpp
@@ -530,8 +542,11 @@ IF (MSGPACK_ENABLE_CXX)
include/msgpack/v1/adaptor/cpp11/unique_ptr.hpp
include/msgpack/v1/adaptor/cpp11/unordered_map.hpp
include/msgpack/v1/adaptor/cpp11/unordered_set.hpp
include/msgpack/v1/adaptor/cpp17/byte.hpp
include/msgpack/v1/adaptor/cpp17/carray_byte.hpp
include/msgpack/v1/adaptor/cpp17/optional.hpp
include/msgpack/v1/adaptor/cpp17/string_view.hpp
include/msgpack/v1/adaptor/cpp17/vector_byte.hpp
include/msgpack/v1/adaptor/define.hpp
include/msgpack/v1/adaptor/define_decl.hpp
include/msgpack/v1/adaptor/deque.hpp
@@ -541,6 +556,7 @@ IF (MSGPACK_ENABLE_CXX)
include/msgpack/v1/adaptor/detail/cpp03_define_map_decl.hpp
include/msgpack/v1/adaptor/detail/cpp03_msgpack_tuple.hpp
include/msgpack/v1/adaptor/detail/cpp03_msgpack_tuple_decl.hpp
include/msgpack/v1/adaptor/detail/cpp11_convert_helper.hpp
include/msgpack/v1/adaptor/detail/cpp11_define_array.hpp
include/msgpack/v1/adaptor/detail/cpp11_define_array_decl.hpp
include/msgpack/v1/adaptor/detail/cpp11_define_map.hpp
@@ -632,31 +648,85 @@ IF (MSGPACK_ENABLE_CXX)
include/msgpack/v2/adaptor/v4raw_decl.hpp
include/msgpack/v2/cpp_config_decl.hpp
include/msgpack/v2/create_object_visitor.hpp
include/msgpack/v2/create_object_visitor_decl.hpp
include/msgpack/v2/detail/cpp03_zone_decl.hpp
include/msgpack/v2/detail/cpp11_zone_decl.hpp
include/msgpack/v2/fbuffer_decl.hpp
include/msgpack/v2/iterator_decl.hpp
include/msgpack/v2/meta_decl.hpp
include/msgpack/v2/null_visitor.hpp
include/msgpack/v2/null_visitor_decl.hpp
include/msgpack/v2/object.hpp
include/msgpack/v2/object_decl.hpp
include/msgpack/v2/object_fwd.hpp
include/msgpack/v2/object_fwd_decl.hpp
include/msgpack/v2/pack_decl.hpp
include/msgpack/v2/parse.hpp
include/msgpack/v2/parse_decl.hpp
include/msgpack/v2/parse_return.hpp
include/msgpack/v2/sbuffer_decl.hpp
include/msgpack/v2/unpack.hpp
include/msgpack/v2/unpack_decl.hpp
include/msgpack/v2/vrefbuffer_decl.hpp
include/msgpack/v2/x3_parse.hpp
include/msgpack/v2/x3_parse_decl.hpp
include/msgpack/v2/x3_unpack.hpp
include/msgpack/v2/x3_unpack_decl.hpp
include/msgpack/v2/zbuffer_decl.hpp
include/msgpack/v2/zone_decl.hpp
include/msgpack/v3/adaptor/adaptor_base.hpp
include/msgpack/v3/adaptor/adaptor_base_decl.hpp
include/msgpack/v3/adaptor/array_ref_decl.hpp
include/msgpack/v3/adaptor/boost/msgpack_variant_decl.hpp
include/msgpack/v3/adaptor/check_container_size_decl.hpp
include/msgpack/v3/adaptor/define_decl.hpp
include/msgpack/v3/adaptor/detail/cpp03_define_array_decl.hpp
include/msgpack/v3/adaptor/detail/cpp03_define_map_decl.hpp
include/msgpack/v3/adaptor/detail/cpp03_msgpack_tuple_decl.hpp
include/msgpack/v3/adaptor/detail/cpp11_define_array_decl.hpp
include/msgpack/v3/adaptor/detail/cpp11_define_map_decl.hpp
include/msgpack/v3/adaptor/detail/cpp11_msgpack_tuple_decl.hpp
include/msgpack/v3/adaptor/ext_decl.hpp
include/msgpack/v3/adaptor/fixint_decl.hpp
include/msgpack/v3/adaptor/int_decl.hpp
include/msgpack/v3/adaptor/map_decl.hpp
include/msgpack/v3/adaptor/msgpack_tuple_decl.hpp
include/msgpack/v3/adaptor/nil_decl.hpp
include/msgpack/v3/adaptor/raw_decl.hpp
include/msgpack/v3/adaptor/size_equal_only_decl.hpp
include/msgpack/v3/adaptor/v4raw_decl.hpp
include/msgpack/v3/cpp_config_decl.hpp
include/msgpack/v3/create_object_visitor_decl.hpp
include/msgpack/v3/detail/cpp03_zone_decl.hpp
include/msgpack/v3/detail/cpp11_zone_decl.hpp
include/msgpack/v3/fbuffer_decl.hpp
include/msgpack/v3/iterator_decl.hpp
include/msgpack/v3/meta_decl.hpp
include/msgpack/v3/null_visitor_decl.hpp
include/msgpack/v3/object_decl.hpp
include/msgpack/v3/object_fwd.hpp
include/msgpack/v3/object_fwd_decl.hpp
include/msgpack/v3/pack_decl.hpp
include/msgpack/v3/parse.hpp
include/msgpack/v3/parse_decl.hpp
include/msgpack/v3/parse_return.hpp
include/msgpack/v3/sbuffer_decl.hpp
include/msgpack/v3/unpack.hpp
include/msgpack/v3/unpack_decl.hpp
include/msgpack/v3/vrefbuffer_decl.hpp
include/msgpack/v3/x3_parse_decl.hpp
include/msgpack/v3/x3_unpack.hpp
include/msgpack/v3/x3_unpack_decl.hpp
include/msgpack/v3/zbuffer_decl.hpp
include/msgpack/v3/zone_decl.hpp
include/msgpack/version.hpp
include/msgpack/versioning.hpp
include/msgpack/vrefbuffer.hpp
include/msgpack/vrefbuffer_decl.hpp
include/msgpack/x3_parse.hpp
include/msgpack/x3_parse_decl.hpp
include/msgpack/x3_unpack.hpp
include/msgpack/x3_unpack_decl.hpp
include/msgpack/zbuffer.hpp
include/msgpack/zbuffer_decl.hpp
include/msgpack/zone.hpp

View File

@@ -20,7 +20,7 @@ You might need to run `sudo port selfupdate` before installing to update the pac
You can also install via Homebrew.
```
$ sudo brew install msgpack
$ brew install msgpack
```
## FreeBSD with Ports Collection

View File

@@ -1,9 +1,9 @@
`msgpack` for C/C++
===================
Version 2.1.3 [![Build Status](https://travis-ci.org/msgpack/msgpack-c.svg?branch=master)](https://travis-ci.org/msgpack/msgpack-c) [![Build status](https://ci.appveyor.com/api/projects/status/8kstcgt79qj123mw/branch/master?svg=true)](https://ci.appveyor.com/project/redboltz/msgpack-c/branch/master)
Version 3.1.0 [![Build Status](https://travis-ci.org/msgpack/msgpack-c.svg?branch=master)](https://travis-ci.org/msgpack/msgpack-c) [![Build status](https://ci.appveyor.com/api/projects/status/8kstcgt79qj123mw/branch/master?svg=true)](https://ci.appveyor.com/project/redboltz/msgpack-c/branch/master)
It's like JSON but small and fast.
It's like JSON but smaller and faster.
Overview
--------
@@ -11,7 +11,7 @@ Overview
[MessagePack](http://msgpack.org/) is an efficient binary serialization
format, which lets you exchange data among multiple languages like JSON,
except that it's faster and smaller. Small integers are encoded into a
single byte while typical short strings require only one extra byte in
single byte and short strings require only one extra byte in
addition to the strings themselves.
Example
@@ -97,6 +97,10 @@ int main(void)
msgpack::type::tuple<int, bool, std::string> dst;
deserialized.convert(dst);
// or create the new instance
msgpack::type::tuple<int, bool, std::string> dst2 =
deserialized.as<msgpack::type::tuple<int, bool, std::string> >();
return 0;
}
```
@@ -108,7 +112,7 @@ Usage
### C++ Header Only Library
When you use msgpack on C++03 and C++11, you can just add
When you use msgpack on C++, you can just add
msgpack-c/include to your include path:
g++ -I msgpack-c/include your_source_file.cpp
@@ -135,14 +139,18 @@ C and C++03:
$ make
$ sudo make install
If you want to setup C++11 version of msgpack instead,
If you want to setup C++11 or C++17 version of msgpack instead,
execute the following commands:
$ git clone https://github.com/msgpack/msgpack-c.git
$ cd msgpack-c
$ cmake -DMSGPACK_CXX11=ON .
$ cmake -DMSGPACK_CXX[11|17]=ON .
$ sudo make install
`MSGPACK_CXX[11|17]` flags are not affected to installing files. Just switching test cases. All files are installed in every settings.
When you use the C part of `msgpack-c`, you need to build and link the library. By default, both static/shared libraries are built. If you want to build only static library, set `BUILD_SHARED_LIBS=OFF` to cmake. If you want to build only shared library, set `BUILD_SHARED_L
#### GUI on Windows
Clone msgpack-c git repository.
@@ -170,7 +178,7 @@ the binaries:' text box.
### Documentation
You can get addtional information on the
You can get additional information including the tutorial on the
[wiki](https://github.com/msgpack/msgpack-c/wiki).
Contributing

View File

@@ -1,4 +1,4 @@
version: 2.1.4.{build}
version: 3.1.0.{build}
image:
- Visual Studio 2015

View File

@@ -23,7 +23,7 @@ else
export BIT32="OFF"
fi
cmake -DMSGPACK_CXX11=${CXX11} -DMSGPACK_32BIT=${BIT32} -DMSGPACK_BOOST=${BOOST} -DMSGPACK_ENABLE_SHARED=${SHARED} -DMSGPACK_CHAR_SIGN=${CHAR_SIGN} -DMSGPACK_DEFAULT_API_VERSION=${API_VERSION} -DMSGPACK_USE_X3_PARSE=${X3_PARSE} ..
cmake -DMSGPACK_CXX11=${CXX11} -DMSGPACK_CXX17=${CXX17} -DMSGPACK_32BIT=${BIT32} -DMSGPACK_BOOST=${BOOST} -DBUILD_SHARED_LIBS=${SHARED} -DMSGPACK_CHAR_SIGN=${CHAR_SIGN} -DMSGPACK_DEFAULT_API_VERSION=${API_VERSION} -DMSGPACK_USE_X3_PARSE=${X3_PARSE} ..
ret=$?
if [ $ret -ne 0 ]
@@ -39,7 +39,7 @@ then
exit $ret
fi
make test
ctest -VV
ret=$?
if [ $ret -ne 0 ]

49
ci/build_regression.sh Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/bash
mkdir -p build
ret=$?
if [ $ret -ne 0 ]
then
exit $ret
fi
cd build
ret=$?
if [ $ret -ne 0 ]
then
exit $ret
fi
if [ "${ARCH}" == "32" ]
then
echo "64 bit support required for regressions"
exit 1
fi
cmake -DMSGPACK_FUZZ_REGRESSION="ON" -DMSGPACK_CXX11="ON" -DMSGPACK_BOOST=${BOOST} -DMSGPACK_SAN=${MSGPACK_SAN} -v ..
ret=$?
if [ $ret -ne 0 ]
then
exit $ret
fi
make
ret=$?
if [ $ret -ne 0 ]
then
exit $ret
fi
make test
ret=$?
if [ $ret -ne 0 ]
then
exit $ret
fi
exit 0

View File

@@ -61,6 +61,7 @@ struct define_map<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> {
if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
std::map<std::string, msgpack::object const*> kvmap;
for (uint32_t i = 0; i < o.via.map.size; ++i) {
if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); }
kvmap.insert(
std::map<std::string, msgpack::object const*>::value_type(
std::string(

View File

@@ -39,7 +39,7 @@ FOREACH (source_file ${exec_PROGRAMS})
)
ENDIF()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3")
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra")
ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")

View File

@@ -70,13 +70,22 @@ int main() {
// Client
auto host = "localhost";
boost::asio::ip::tcp::resolver r(ios);
#if BOOST_VERSION < 106600
boost::asio::ip::tcp::resolver::query q(host, boost::lexical_cast<std::string>(port));
auto it = r.resolve(q);
boost::asio::ip::tcp::resolver::iterator end;
#else // BOOST_VERSION < 106600
auto eps = r.resolve(host, boost::lexical_cast<std::string>(port));
auto it = eps.begin();
auto end = eps.end();
#endif // BOOST_VERSION < 106600
boost::asio::ip::tcp::socket cs(ios);
boost::asio::async_connect(
cs,
it,
end,
[&]
(boost::system::error_code const& e, boost::asio::ip::tcp::resolver::iterator) {
if (e) {

View File

@@ -136,13 +136,24 @@ int main() {
// Client
auto host = "localhost";
boost::asio::ip::tcp::resolver r(ios);
#if BOOST_VERSION < 106600
boost::asio::ip::tcp::resolver::query q(host, boost::lexical_cast<std::string>(port));
auto it = r.resolve(q);
boost::asio::ip::tcp::resolver::iterator end;
#else // BOOST_VERSION < 106600
auto eps = r.resolve(host, boost::lexical_cast<std::string>(port));
auto it = eps.begin();
auto end = eps.end();
#endif // BOOST_VERSION < 106600
boost::asio::ip::tcp::socket cs(ios);
boost::asio::async_connect(
cs,
it,
end,
[&]
(boost::system::error_code const& e, boost::asio::ip::tcp::resolver::iterator) {
if (e) {

View File

@@ -1,6 +1,8 @@
IF (MSGPACK_ENABLE_SHARED)
SET (MSGPACK_LIB msgpackc)
ELSE ()
ENDIF ()
IF (MSGPACK_ENABLE_STATIC)
SET (MSGPACK_LIB msgpackc-static)
ENDIF ()
@@ -23,7 +25,7 @@ FOREACH (source_file ${exec_PROGRAMS})
${MSGPACK_LIB}
)
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3")
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra")
ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")

View File

@@ -40,7 +40,7 @@ FOREACH (source_file ${exec_PROGRAMS})
$<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES>
)
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3")
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra")
ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
IF (CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
@@ -65,7 +65,7 @@ FOREACH (source_file ${with_pthread_PROGRAMS})
${CMAKE_THREAD_LIBS_INIT}
)
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3")
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra")
ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
IF (CMAKE_CXX_FLAGS MATCHES "/W[0-4]")

View File

@@ -25,7 +25,7 @@ IF (MSGPACK_CXX11)
$<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES>
)
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3 ")
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra")
ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")

View File

@@ -1,4 +1,4 @@
IF (MSGPACK_USE_X3_PARSE)
IF (MSGPACK_USE_X3_PARSE AND MSGPACK_DEFAULT_API_VERSION VERSION_GREATER 1)
INCLUDE_DIRECTORIES (
../include
)
@@ -23,7 +23,7 @@ IF (MSGPACK_USE_X3_PARSE)
$<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES>
)
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g ")
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra")
ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
@@ -54,7 +54,7 @@ IF (MSGPACK_USE_X3_PARSE)
${CMAKE_THREAD_LIBS_INIT}
)
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g ")
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra")
ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")

43
fuzz/CMakeLists.txt Normal file
View File

@@ -0,0 +1,43 @@
FIND_PACKAGE (GTest REQUIRED)
FIND_PACKAGE (ZLIB REQUIRED)
FIND_PACKAGE (Boost REQUIRED COMPONENTS system filesystem)
INCLUDE_DIRECTORIES (
${GTEST_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
LIST (APPEND check_PROGRAMS
regression_runner.cpp
)
LINK_DIRECTORIES (
${Boost_LIBRARY_DIRS}
)
FOREACH (source_file ${check_PROGRAMS})
GET_FILENAME_COMPONENT (source_file_we ${source_file} NAME_WE)
ADD_EXECUTABLE (
${source_file_we}
${source_file}
)
TARGET_LINK_LIBRARIES (${source_file_we}
msgpackc
${GTEST_BOTH_LIBRARIES}
${ZLIB_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${Boost_LIBRARIES}
)
ADD_TEST (${source_file_we} ${source_file_we})
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Wno-mismatched-tags -g")
IF ("${MSGPACK_SAN}" STREQUAL "ASAN")
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
ELSEIF ("${MSGPACK_SAN}" STREQUAL "UBSAN")
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
ENDIF()
ENDIF()
ENDFOREACH ()

View File

@@ -0,0 +1,50 @@
#include <boost/filesystem.hpp>
#include <gtest/gtest.h>
#include <fstream>
#include <iostream>
#include <vector>
#include "unpack_pack_fuzzer.cpp"
using ::testing::TestWithParam;
using ::testing::ValuesIn;
std::vector<std::string> ListDirectory(const std::string& path) {
std::vector<std::string> v;
boost::filesystem::path p(path);
boost::filesystem::directory_iterator f{p};
if(boost::filesystem::is_directory(p)) {
while (f != boost::filesystem::directory_iterator{}) {
v.push_back((*f++).path().string());
}
}
return v;
}
class UnpackPackFuzzerRegressionTest : public ::testing::TestWithParam<std::string> {
public:
};
TEST_P(UnpackPackFuzzerRegressionTest, Returns0) {
auto fpath = GetParam();
std::ifstream in(fpath, std::ifstream::binary);
if (!in) {
FAIL() << fpath << " not found";
}
in.seekg(0, in.end);
size_t length = in.tellg();
in.seekg(0, in.beg);
std::vector<char> bytes(length);
in.read(bytes.data(), bytes.size());
assert(in);
EXPECT_EQ(0, LLVMFuzzerTestOneInput(reinterpret_cast<const uint8_t *>(bytes.data()),
bytes.size()));
}
INSTANTIATE_TEST_CASE_P(UnpackPackFuzzerRegressions,
UnpackPackFuzzerRegressionTest,
::testing::ValuesIn(ListDirectory("../../fuzz/unpack_pack_fuzzer_regressions")));

View File

@@ -0,0 +1,23 @@
#include <msgpack.hpp>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
try {
// NOTE(derwolfe): by default the limits are set at 2^32-1 length. I'm
// setting these at far smaller values to avoid OOMs
const int test_limit = 1000;
msgpack::object_handle unpacked = msgpack::unpack(reinterpret_cast<const char *>(data),
size,
nullptr,
nullptr,
msgpack::unpack_limit(test_limit,
test_limit,
test_limit,
test_limit,
test_limit,
test_limit));
msgpack::sbuffer sbuf;
msgpack::pack(sbuf, unpacked.get());
} catch (...) {
}
return 0;
}

View File

@@ -0,0 +1 @@
<EFBFBD>

View File

@@ -0,0 +1 @@
<EFBFBD>

View File

@@ -0,0 +1,2 @@
<EFBFBD><01><02><03><04><05><06><07><08> <09>
<EFBFBD> <0B> <0C>

Binary file not shown.

Binary file not shown.

View File

@@ -11,7 +11,11 @@
#include "msgpack/iterator.hpp"
#include "msgpack/zone.hpp"
#include "msgpack/pack.hpp"
#include "msgpack/null_visitor.hpp"
#include "msgpack/parse.hpp"
#include "msgpack/unpack.hpp"
#include "msgpack/x3_parse.hpp"
#include "msgpack/x3_unpack.hpp"
#include "msgpack/sbuffer.hpp"
#include "msgpack/vrefbuffer.hpp"
#include "msgpack/version.hpp"

View File

@@ -14,5 +14,6 @@
#include "msgpack/v1/adaptor/adaptor_base.hpp"
#include "msgpack/v2/adaptor/adaptor_base.hpp"
#include "msgpack/v3/adaptor/adaptor_base.hpp"
#endif // MSGPACK_ADAPTOR_BASE_HPP

View File

@@ -12,5 +12,6 @@
#include "msgpack/v1/adaptor/adaptor_base_decl.hpp"
#include "msgpack/v2/adaptor/adaptor_base_decl.hpp"
#include "msgpack/v3/adaptor/adaptor_base_decl.hpp"
#endif // MSGPACK_ADAPTOR_BASE_DECL_HPP

View File

@@ -12,5 +12,6 @@
#include "msgpack/v1/adaptor/array_ref_decl.hpp"
#include "msgpack/v2/adaptor/array_ref_decl.hpp"
#include "msgpack/v3/adaptor/array_ref_decl.hpp"
#endif // MSGPACK_TYPE_ARRAY_REF_DECL_HPP

View File

@@ -12,5 +12,6 @@
#include "msgpack/v1/adaptor/boost/msgpack_variant_decl.hpp"
#include "msgpack/v2/adaptor/boost/msgpack_variant_decl.hpp"
#include "msgpack/v3/adaptor/boost/msgpack_variant_decl.hpp"
#endif // MSGPACK_TYPE_BOOST_MSGPACK_VARIANT_DECL_HPP

View File

@@ -12,5 +12,6 @@
#include "msgpack/v1/adaptor/check_container_size_decl.hpp"
#include "msgpack/v2/adaptor/check_container_size_decl.hpp"
#include "msgpack/v3/adaptor/check_container_size_decl.hpp"
#endif // MSGPACK_CHECK_CONTAINER_SIZE_DECL_HPP

View File

@@ -0,0 +1,16 @@
//
// MessagePack for C++ static resolution routine
//
// Copyright (C) 2017 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_TYPE_CPP11_CHRONO_HPP
#define MSGPACK_TYPE_CPP11_CHRONO_HPP
#include "msgpack/v1/adaptor/cpp11/chrono.hpp"
#endif // MSGPACK_TYPE_CPP11_CHRONO_HPP

View File

@@ -0,0 +1,16 @@
//
// MessagePack for C++ static resolution routine
//
// Copyright (C) 2018 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_TYPE_CPP17_BYTE_HPP
#define MSGPACK_TYPE_CPP17_BYTE_HPP
#include "msgpack/v1/adaptor/cpp17/byte.hpp"
#endif // MSGPACK_TYPE_CPP17_BYTE_HPP

View File

@@ -0,0 +1,16 @@
//
// MessagePack for C++ static resolution routine
//
// Copyright (C) 2018 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_TYPE_CPP17_CARRAY_BYTE_HPP
#define MSGPACK_TYPE_CPP17_CARRAY_BYTE_HPP
#include "msgpack/v1/adaptor/cpp17/carray_byte.hpp"
#endif // MSGPACK_TYPE_CPP17_CARRAY_BYTE_HPP

View File

@@ -0,0 +1,16 @@
//
// MessagePack for C++ static resolution routine
//
// Copyright (C) 2018 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_TYPE_CPP17_VECTOR_BYTE_HPP
#define MSGPACK_TYPE_CPP17_VECTOR_BYTE_HPP
#include "msgpack/v1/adaptor/cpp17/vector_byte.hpp"
#endif // MSGPACK_TYPE_CPP17_VECTOR_BYTE_HPP

View File

@@ -27,18 +27,18 @@
#define MSGPACK_DEFINE_ARRAY(...) \
template <typename Packer> \
void msgpack_pack(Packer& pk) const \
void msgpack_pack(Packer& msgpack_pk) const \
{ \
msgpack::type::make_define_array(__VA_ARGS__).msgpack_pack(pk); \
msgpack::type::make_define_array(__VA_ARGS__).msgpack_pack(msgpack_pk); \
} \
void msgpack_unpack(msgpack::object const& o) \
void msgpack_unpack(msgpack::object const& msgpack_o) \
{ \
msgpack::type::make_define_array(__VA_ARGS__).msgpack_unpack(o); \
msgpack::type::make_define_array(__VA_ARGS__).msgpack_unpack(msgpack_o); \
}\
template <typename MSGPACK_OBJECT> \
void msgpack_object(MSGPACK_OBJECT* o, msgpack::zone& z) const \
void msgpack_object(MSGPACK_OBJECT* msgpack_o, msgpack::zone& msgpack_z) const \
{ \
msgpack::type::make_define_array(__VA_ARGS__).msgpack_object(o, z); \
msgpack::type::make_define_array(__VA_ARGS__).msgpack_object(msgpack_o, msgpack_z); \
}
#define MSGPACK_BASE_ARRAY(base) (*const_cast<base *>(static_cast<base const*>(this)))
@@ -62,24 +62,24 @@
#define MSGPACK_DEFINE_MAP(...) \
template <typename Packer> \
void msgpack_pack(Packer& pk) const \
void msgpack_pack(Packer& msgpack_pk) const \
{ \
msgpack::type::make_define_map \
MSGPACK_DEFINE_MAP_IMPL(__VA_ARGS__) \
.msgpack_pack(pk); \
.msgpack_pack(msgpack_pk); \
} \
void msgpack_unpack(msgpack::object const& o) \
void msgpack_unpack(msgpack::object const& msgpack_o) \
{ \
msgpack::type::make_define_map \
MSGPACK_DEFINE_MAP_IMPL(__VA_ARGS__) \
.msgpack_unpack(o); \
.msgpack_unpack(msgpack_o); \
}\
template <typename MSGPACK_OBJECT> \
void msgpack_object(MSGPACK_OBJECT* o, msgpack::zone& z) const \
void msgpack_object(MSGPACK_OBJECT* msgpack_o, msgpack::zone& msgpack_z) const \
{ \
msgpack::type::make_define_map \
MSGPACK_DEFINE_MAP_IMPL(__VA_ARGS__) \
.msgpack_object(o, z); \
.msgpack_object(msgpack_o, msgpack_z); \
}
#define MSGPACK_BASE_MAP(base) \
@@ -94,32 +94,32 @@
namespace adaptor { \
template<> \
struct convert<enum_name> { \
msgpack::object const& operator()(msgpack::object const& o, enum_name& v) const { \
msgpack::object const& operator()(msgpack::object const& msgpack_o, enum_name& msgpack_v) const { \
msgpack::underlying_type<enum_name>::type tmp; \
msgpack::operator>>(o, tmp); \
v = static_cast<enum_name>(tmp); \
return o; \
msgpack::operator>>(msgpack_o, tmp); \
msgpack_v = static_cast<enum_name>(tmp); \
return msgpack_o; \
} \
}; \
template<> \
struct object<enum_name> { \
void operator()(msgpack::object& o, const enum_name& v) const { \
msgpack::underlying_type<enum_name>::type tmp = static_cast<msgpack::underlying_type<enum_name>::type>(v); \
msgpack::operator<<(o, tmp); \
void operator()(msgpack::object& msgpack_o, const enum_name& msgpack_v) const { \
msgpack::underlying_type<enum_name>::type tmp = static_cast<msgpack::underlying_type<enum_name>::type>(msgpack_v); \
msgpack::operator<<(msgpack_o, tmp); \
} \
}; \
template<> \
struct object_with_zone<enum_name> { \
void operator()(msgpack::object::with_zone& o, const enum_name& v) const { \
msgpack::underlying_type<enum_name>::type tmp = static_cast<msgpack::underlying_type<enum_name>::type>(v); \
msgpack::operator<<(o, tmp); \
void operator()(msgpack::object::with_zone& msgpack_o, const enum_name& msgpack_v) const { \
msgpack::underlying_type<enum_name>::type tmp = static_cast<msgpack::underlying_type<enum_name>::type>(msgpack_v); \
msgpack::operator<<(msgpack_o, tmp); \
} \
}; \
template <> \
struct pack<enum_name> { \
template <typename Stream> \
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const enum_name& v) const { \
return msgpack::operator<<(o, static_cast<msgpack::underlying_type<enum_name>::type>(v)); \
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& msgpack_o, const enum_name& msgpack_v) const { \
return msgpack::operator<<(msgpack_o, static_cast<msgpack::underlying_type<enum_name>::type>(msgpack_v)); \
} \
}; \
} \
@@ -139,5 +139,6 @@
#include "msgpack/v1/adaptor/define_decl.hpp"
#include "msgpack/v2/adaptor/define_decl.hpp"
#include "msgpack/v3/adaptor/define_decl.hpp"
#endif // MSGPACK_DEFINE_DECL_HPP

View File

@@ -12,5 +12,6 @@
#include "msgpack/v1/adaptor/ext_decl.hpp"
#include "msgpack/v2/adaptor/ext_decl.hpp"
#include "msgpack/v3/adaptor/ext_decl.hpp"
#endif // MSGPACK_TYPE_EXT_DECL_HPP

View File

@@ -12,5 +12,6 @@
#include "msgpack/v1/adaptor/fixint_decl.hpp"
#include "msgpack/v2/adaptor/fixint_decl.hpp"
#include "msgpack/v3/adaptor/fixint_decl.hpp"
#endif // MSGPACK_TYPE_FIXINT_DECL_HPP

View File

@@ -12,5 +12,6 @@
#include "msgpack/v1/adaptor/int_decl.hpp"
#include "msgpack/v2/adaptor/int_decl.hpp"
#include "msgpack/v3/adaptor/int_decl.hpp"
#endif // MSGPACK_TYPE_INT_DECL_HPP

View File

@@ -12,5 +12,6 @@
#include "msgpack/v1/adaptor/map_decl.hpp"
#include "msgpack/v2/adaptor/map_decl.hpp"
#include "msgpack/v3/adaptor/map_decl.hpp"
#endif // MSGPACK_TYPE_MAP_DECL_HPP

View File

@@ -12,5 +12,6 @@
#include "msgpack/v1/adaptor/msgpack_tuple_decl.hpp"
#include "msgpack/v2/adaptor/msgpack_tuple_decl.hpp"
#include "msgpack/v3/adaptor/msgpack_tuple_decl.hpp"
#endif // MSGPACK_MSGPACK_TUPLE_DECL_HPP

View File

@@ -12,5 +12,6 @@
#include "msgpack/v1/adaptor/nil_decl.hpp"
#include "msgpack/v2/adaptor/nil_decl.hpp"
#include "msgpack/v3/adaptor/nil_decl.hpp"
#endif // MSGPACK_TYPE_NIL_DECL_HPP

View File

@@ -12,5 +12,6 @@
#include "msgpack/v1/adaptor/raw_decl.hpp"
#include "msgpack/v2/adaptor/raw_decl.hpp"
#include "msgpack/v3/adaptor/raw_decl.hpp"
#endif // MSGPACK_TYPE_RAW_DECL_HPP

View File

@@ -12,5 +12,6 @@
#include "msgpack/v1/adaptor/size_equal_only_decl.hpp"
#include "msgpack/v2/adaptor/size_equal_only_decl.hpp"
#include "msgpack/v3/adaptor/size_equal_only_decl.hpp"
#endif // MSGPACK_TYPE_SIZE_EQUAL_ONLY_DECL_HPP

View File

@@ -12,5 +12,6 @@
#include "msgpack/v1/adaptor/v4raw_decl.hpp"
#include "msgpack/v2/adaptor/v4raw_decl.hpp"
#include "msgpack/v3/adaptor/v4raw_decl.hpp"
#endif // MSGPACK_TYPE_V4RAW_DECL_HPP

View File

@@ -12,5 +12,6 @@
#include "msgpack/v1/cpp_config_decl.hpp"
#include "msgpack/v2/cpp_config_decl.hpp"
#include "msgpack/v3/cpp_config_decl.hpp"
#endif // MSGPACK_CPP_CONFIG_DECL_HPP

View File

@@ -0,0 +1,17 @@
//
// MessagePack for C++ deserializing routine
//
// Copyright (C) 2018 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_CREATE_OBJECT_VISITOR_HPP
#define MSGPACK_CREATE_OBJECT_VISITOR_HPP
#include "msgpack/create_object_visitor_decl.hpp"
#include "msgpack/v2/create_object_visitor.hpp"
#endif // MSGPACK_CREATE_OBJECT_VISITOR_HPP

View File

@@ -0,0 +1,16 @@
//
// MessagePack for C++ deserializing routine
//
// Copyright (C) 2018 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_CREATE_OBJECT_VISITOR_DECL_HPP
#define MSGPACK_CREATE_OBJECT_VISITOR_DECL_HPP
#include "msgpack/v2/create_object_visitor_decl.hpp"
#include "msgpack/v3/create_object_visitor_decl.hpp"
#endif // MSGPACK_CREATE_OBJECT_VISITOR_DECL_HPP

View File

@@ -12,5 +12,6 @@
#include "msgpack/v1/fbuffer_decl.hpp"
#include "msgpack/v2/fbuffer_decl.hpp"
#include "msgpack/v3/fbuffer_decl.hpp"
#endif // MSGPACK_FBUFFER_DECL_HPP

View File

@@ -13,5 +13,6 @@
#include <msgpack/v1/iterator_decl.hpp>
#include <msgpack/v2/iterator_decl.hpp>
#include <msgpack/v3/iterator_decl.hpp>
#endif // MSGPACK_V1_ITERATOR_DECL_HPP
#endif // MSGPACK_ITERATOR_DECL_HPP

View File

@@ -13,5 +13,6 @@
#include "msgpack/v1/meta_decl.hpp"
#include "msgpack/v2/meta_decl.hpp"
#include "msgpack/v3/meta_decl.hpp"
#endif // MSGPACK_META_DECL_HPP

View File

@@ -0,0 +1,17 @@
//
// MessagePack for C++ deserializing routine
//
// Copyright (C) 2018 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_NULL_VISITOR_HPP
#define MSGPACK_NULL_VISITOR_HPP
#include "msgpack/null_visitor_decl.hpp"
#include "msgpack/v2/null_visitor.hpp"
#endif // MSGPACK_NULL_VISITOR_HPP

View File

@@ -0,0 +1,16 @@
//
// MessagePack for C++ deserializing routine
//
// Copyright (C) 2018 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_NULL_VISITOR_DECL_HPP
#define MSGPACK_NULL_VISITOR_DECL_HPP
#include "msgpack/v2/null_visitor_decl.hpp"
#include "msgpack/v3/null_visitor_decl.hpp"
#endif // MSGPACK_NULL_VISITOR_DECL_HPP

View File

@@ -13,5 +13,6 @@
#include "msgpack/v1/object_decl.hpp"
#include "msgpack/v2/object_decl.hpp"
#include "msgpack/v3/object_decl.hpp"
#endif // MSGPACK_OBJECT_DECL_HPP

View File

@@ -15,5 +15,6 @@
#include "msgpack/v1/object_fwd.hpp"
#include "msgpack/v2/object_fwd.hpp"
#include "msgpack/v3/object_fwd.hpp"
#endif // MSGPACK_OBJECT_FWD_HPP

View File

@@ -13,5 +13,6 @@
#include "msgpack/v1/object_fwd_decl.hpp"
#include "msgpack/v2/object_fwd_decl.hpp"
#include "msgpack/v3/object_fwd_decl.hpp"
#endif // MSGPACK_OBJECT_FWD_DECL_HPP

View File

@@ -12,6 +12,7 @@
#include "pack_define.h"
#include "object.h"
#include "timestamp.h"
#include <stdlib.h>
#ifdef __cplusplus
@@ -98,6 +99,9 @@ static int msgpack_pack_bin_body(msgpack_packer* pk, const void* b, size_t l);
static int msgpack_pack_ext(msgpack_packer* pk, size_t l, int8_t type);
static int msgpack_pack_ext_body(msgpack_packer* pk, const void* b, size_t l);
static int msgpack_pack_timestamp(msgpack_packer* pk, const msgpack_timestamp* d);
MSGPACK_DLLEXPORT
int msgpack_pack_object(msgpack_packer* pk, msgpack_object d);

View File

@@ -12,5 +12,6 @@
#include "msgpack/v1/pack_decl.hpp"
#include "msgpack/v2/pack_decl.hpp"
#include "msgpack/v3/pack_decl.hpp"
#endif // MSGPACK_PACK_DECL_HPP

View File

@@ -890,6 +890,34 @@ msgpack_pack_inline_func(_ext_body)(msgpack_pack_user x, const void* b, size_t l
msgpack_pack_append_buffer(x, (const unsigned char*)b, l);
}
msgpack_pack_inline_func(_timestamp)(msgpack_pack_user x, const msgpack_timestamp* d)
{
if ((((int64_t)d->tv_sec) >> 34) == 0) {
uint64_t data64 = ((uint64_t) d->tv_nsec << 34) | d->tv_sec;
if ((data64 & 0xffffffff00000000L) == 0) {
// timestamp 32
char buf[4];
uint32_t data32 = (uint32_t)data64;
msgpack_pack_ext(x, 4, -1);
_msgpack_store32(buf, data32);
msgpack_pack_append_buffer(x, buf, 4);
} else {
// timestamp 64
char buf[8];
msgpack_pack_ext(x, 8, -1);
_msgpack_store64(buf, data64);
msgpack_pack_append_buffer(x, buf, 8);
}
} else {
// timestamp 96
char buf[12];
_msgpack_store32(&buf[0], d->tv_nsec);
_msgpack_store64(&buf[4], d->tv_sec);
msgpack_pack_ext(x, 12, -1);
msgpack_pack_append_buffer(x, buf, 12);
}
}
#undef msgpack_pack_inline_func
#undef msgpack_pack_user
#undef msgpack_pack_append_buffer

18
include/msgpack/parse.hpp Normal file
View File

@@ -0,0 +1,18 @@
//
// MessagePack for C++ deserializing routine
//
// Copyright (C) 2018 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_PARSE_HPP
#define MSGPACK_PARSE_HPP
#include "msgpack/parse_decl.hpp"
#include "msgpack/v2/parse.hpp"
#include "msgpack/v3/parse.hpp"
#endif // MSGPACK_PARSE_HPP

View File

@@ -0,0 +1,16 @@
//
// MessagePack for C++ deserializing routine
//
// Copyright (C) 2018 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_PARSE_DECL_HPP
#define MSGPACK_PARSE_DECL_HPP
#include "msgpack/v2/parse_decl.hpp"
#include "msgpack/v3/parse_decl.hpp"
#endif // MSGPACK_PARSE_DECL_HPP

View File

@@ -12,5 +12,6 @@
#include "msgpack/v1/parse_return.hpp"
#include "msgpack/v2/parse_return.hpp"
#include "msgpack/v3/parse_return.hpp"
#endif // MSGPACK_PARSE_RETURN_HPP

View File

@@ -12,6 +12,7 @@
#include "msgpack/v1/sbuffer_decl.hpp"
#include "msgpack/v2/sbuffer_decl.hpp"
#include "msgpack/v3/sbuffer_decl.hpp"
#endif // MSGPACK_SBUFFER_DECL_HPP

View File

@@ -0,0 +1,54 @@
/*
* MessagePack for C TimeStamp
*
* Copyright (C) 2018 KONDO Takatoshi
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef MSGPACK_TIMESTAMP_H
#define MSGPACK_TIMESTAMP_H
#include <msgpack/object.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct msgpack_timestamp {
int64_t tv_sec;
uint32_t tv_nsec;
} msgpack_timestamp;
static inline bool msgpack_object_to_timestamp(const msgpack_object* obj, msgpack_timestamp* ts) {
if (obj->type != MSGPACK_OBJECT_EXT) return false;
if (obj->via.ext.type != -1) return false;
switch (obj->via.ext.size) {
case 4:
ts->tv_nsec = 0;
_msgpack_load32(uint32_t, obj->via.ext.ptr, &ts->tv_sec);
return true;
case 8: {
uint64_t value;
_msgpack_load64(uint64_t, obj->via.ext.ptr, &value);
ts->tv_nsec = (uint32_t)(value >> 34);
ts->tv_sec = value & 0x00000003ffffffffL;
return true;
}
case 12:
_msgpack_load32(uint32_t, obj->via.ext.ptr, &ts->tv_nsec);
_msgpack_load64(int64_t, obj->via.ext.ptr + 4, &ts->tv_sec);
return true;
default:
return false;
}
}
#ifdef __cplusplus
}
#endif
#endif /* msgpack/timestamp.h */

View File

@@ -34,6 +34,7 @@
#include "adaptor/cpp11/array.hpp"
#include "adaptor/cpp11/array_char.hpp"
#include "adaptor/cpp11/array_unsigned_char.hpp"
#include "adaptor/cpp11/chrono.hpp"
#include "adaptor/cpp11/forward_list.hpp"
#include "adaptor/cpp11/reference_wrapper.hpp"
#include "adaptor/cpp11/shared_ptr.hpp"
@@ -42,12 +43,17 @@
#include "adaptor/cpp11/unordered_map.hpp"
#include "adaptor/cpp11/unordered_set.hpp"
#if __cplusplus >= 201703
#if MSGPACK_HAS_INCLUDE(<optional>)
#include "adaptor/cpp17/optional.hpp"
#include "adaptor/cpp17/string_view.hpp"
#endif // MSGPACK_HAS_INCLUDE(<optional>)
#endif // __cplusplus >= 201703
#if MSGPACK_HAS_INCLUDE(<string_view>)
#include "adaptor/cpp17/string_view.hpp"
#endif // MSGPACK_HAS_INCLUDE(<string_view>)
#include "adaptor/cpp17/byte.hpp"
#include "adaptor/cpp17/carray_byte.hpp"
#include "adaptor/cpp17/vector_byte.hpp"
#endif // defined(MSGPACK_USE_CPP03)

View File

@@ -14,6 +14,6 @@
#include "msgpack/v1/unpack.hpp"
#include "msgpack/v2/unpack.hpp"
#include "msgpack/v2/x3_unpack.hpp"
#include "msgpack/v3/unpack.hpp"
#endif // MSGPACK_UNPACK_HPP

View File

@@ -12,5 +12,6 @@
#include "msgpack/v1/unpack_decl.hpp"
#include "msgpack/v2/unpack_decl.hpp"
#include "msgpack/v3/unpack_decl.hpp"
#endif // MSGPACK_UNPACK_DECL_HPP

View File

@@ -0,0 +1,215 @@
//
// MessagePack for C++ static resolution routine
//
// Copyright (C) 2017 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_V1_TYPE_CPP11_CHRONO_HPP
#define MSGPACK_V1_TYPE_CPP11_CHRONO_HPP
#include "msgpack/versioning.hpp"
#include "msgpack/adaptor/adaptor_base.hpp"
#include "msgpack/adaptor/check_container_size.hpp"
#include <chrono>
namespace msgpack {
/// @cond
MSGPACK_API_VERSION_NAMESPACE(v1) {
/// @endcond
namespace adaptor {
template <>
struct as<std::chrono::system_clock::time_point> {
typename std::chrono::system_clock::time_point operator()(msgpack::object const& o) const {
if(o.type != msgpack::type::EXT) { throw msgpack::type_error(); }
if(o.via.ext.type() != -1) { throw msgpack::type_error(); }
std::chrono::system_clock::time_point tp;
switch(o.via.ext.size) {
case 4: {
uint32_t sec;
_msgpack_load32(uint32_t, o.via.ext.data(), &sec);
tp += std::chrono::seconds(sec);
} break;
case 8: {
uint64_t value;
_msgpack_load64(uint64_t, o.via.ext.data(), &value);
uint32_t nanosec = static_cast<uint32_t>(value >> 34);
uint64_t sec = value & 0x00000003ffffffffL;
tp += std::chrono::duration_cast<std::chrono::system_clock::duration>(
std::chrono::nanoseconds(nanosec));
tp += std::chrono::seconds(sec);
} break;
case 12: {
uint32_t nanosec;
_msgpack_load32(uint32_t, o.via.ext.data(), &nanosec);
int64_t sec;
_msgpack_load64(int64_t, o.via.ext.data() + 4, &sec);
tp += std::chrono::duration_cast<std::chrono::system_clock::duration>(
std::chrono::nanoseconds(nanosec));
tp += std::chrono::seconds(sec);
} break;
default:
throw msgpack::type_error();
}
return tp;
}
};
template <>
struct convert<std::chrono::system_clock::time_point> {
msgpack::object const& operator()(msgpack::object const& o, std::chrono::system_clock::time_point& v) const {
if(o.type != msgpack::type::EXT) { throw msgpack::type_error(); }
if(o.via.ext.type() != -1) { throw msgpack::type_error(); }
std::chrono::system_clock::time_point tp;
switch(o.via.ext.size) {
case 4: {
uint32_t sec;
_msgpack_load32(uint32_t, o.via.ext.data(), &sec);
tp += std::chrono::seconds(sec);
v = tp;
} break;
case 8: {
uint64_t value;
_msgpack_load64(uint64_t, o.via.ext.data(), &value);
uint32_t nanosec = static_cast<uint32_t>(value >> 34);
uint64_t sec = value & 0x00000003ffffffffL;
tp += std::chrono::duration_cast<std::chrono::system_clock::duration>(
std::chrono::nanoseconds(nanosec));
tp += std::chrono::seconds(sec);
v = tp;
} break;
case 12: {
uint32_t nanosec;
_msgpack_load32(uint32_t, o.via.ext.data(), &nanosec);
int64_t sec;
_msgpack_load64(int64_t, o.via.ext.data() + 4, &sec);
tp += std::chrono::duration_cast<std::chrono::system_clock::duration>(
std::chrono::nanoseconds(nanosec));
tp += std::chrono::seconds(sec);
v = tp;
} break;
default:
throw msgpack::type_error();
}
return o;
}
};
template <>
struct pack<std::chrono::system_clock::time_point> {
template <typename Stream>
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const std::chrono::system_clock::time_point& v) const {
int64_t count = static_cast<int64_t>(v.time_since_epoch().count());
int64_t nano_num =
std::chrono::system_clock::duration::period::ratio::num *
(1000000000 / std::chrono::system_clock::duration::period::ratio::den);
int64_t nanosec = count % (1000000000 / nano_num) * nano_num;
int64_t sec = 0;
if (nanosec < 0) {
nanosec = 1000000000 + nanosec;
--sec;
}
sec += count
* std::chrono::system_clock::duration::period::ratio::num
/ std::chrono::system_clock::duration::period::ratio::den;
if ((sec >> 34) == 0) {
uint64_t data64 = (nanosec << 34) | sec;
if ((data64 & 0xffffffff00000000L) == 0) {
// timestamp 32
o.pack_ext(4, -1);
uint32_t data32 = static_cast<uint32_t>(data64);
char buf[4];
_msgpack_store32(buf, data32);
o.pack_ext_body(buf, 4);
}
else {
// timestamp 64
o.pack_ext(8, -1);
char buf[8];
_msgpack_store64(buf, data64);
o.pack_ext_body(buf, 8);
}
}
else {
// timestamp 96
o.pack_ext(12, -1);
char buf[12];
_msgpack_store32(&buf[0], static_cast<uint32_t>(nanosec));
_msgpack_store64(&buf[4], sec);
o.pack_ext_body(buf, 12);
}
return o;
}
};
template <>
struct object_with_zone<std::chrono::system_clock::time_point> {
void operator()(msgpack::object::with_zone& o, const std::chrono::system_clock::time_point& v) const {
int64_t count = static_cast<int64_t>(v.time_since_epoch().count());
int64_t nano_num =
std::chrono::system_clock::duration::period::ratio::num *
(1000000000 / std::chrono::system_clock::duration::period::ratio::den);
int64_t nanosec = count % (1000000000 / nano_num) * nano_num;
int64_t sec = 0;
if (nanosec < 0) {
nanosec = 1000000000 + nanosec;
--sec;
}
sec += count
* std::chrono::system_clock::duration::period::ratio::num
/ std::chrono::system_clock::duration::period::ratio::den;
if ((sec >> 34) == 0) {
uint64_t data64 = (nanosec << 34) | sec;
if ((data64 & 0xffffffff00000000L) == 0) {
// timestamp 32
o.type = msgpack::type::EXT;
o.via.ext.size = 4;
char* p = static_cast<char*>(o.zone.allocate_no_align(o.via.ext.size + 1));
p[0] = -1;
uint32_t data32 = static_cast<uint32_t>(data64);
_msgpack_store32(&p[1], data32);
o.via.ext.ptr = p;
}
else {
// timestamp 64
o.type = msgpack::type::EXT;
o.via.ext.size = 8;
char* p = static_cast<char*>(o.zone.allocate_no_align(o.via.ext.size + 1));
p[0] = -1;
_msgpack_store64(&p[1], data64);
o.via.ext.ptr = p;
}
}
else {
// timestamp 96
o.type = msgpack::type::EXT;
o.via.ext.size = 12;
char* p = static_cast<char*>(o.zone.allocate_no_align(o.via.ext.size + 1));
p[0] = -1;
_msgpack_store32(&p[1], static_cast<uint32_t>(nanosec));
_msgpack_store64(&p[1 + 4], sec);
o.via.ext.ptr = p;
}
}
};
} // namespace adaptor
/// @cond
} // MSGPACK_API_VERSION_NAMESPACE(v1)
/// @endcond
} // namespace msgpack
#endif // MSGPACK_V1_TYPE_CPP11_CHRONO_HPP

View File

@@ -0,0 +1,74 @@
//
// MessagePack for C++ static resolution routine
//
// Copyright (C) 2018 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_V1_TYPE_BYTE_HPP
#define MSGPACK_V1_TYPE_BYTE_HPP
#if __cplusplus >= 201703
#include "msgpack/versioning.hpp"
#include "msgpack/adaptor/adaptor_base.hpp"
#include "msgpack/adaptor/adaptor_base.hpp"
#include "msgpack/adaptor/int_decl.hpp"
#include "msgpack/object.hpp"
#include <cstddef>
namespace msgpack {
/// @cond
MSGPACK_API_VERSION_NAMESPACE(v1) {
/// @endcond
namespace adaptor {
template <>
struct convert<std::byte> {
msgpack::object const& operator()(msgpack::object const& o, std::byte& v) const {
v = static_cast<std::byte>(type::detail::convert_integer<unsigned char>(o));
return o;
}
};
template <>
struct pack<std::byte> {
template <typename Stream>
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, std::byte v) const {
o.pack_unsigned_char(static_cast<unsigned char>(v));
return o;
}
};
template <>
struct object<std::byte> {
void operator()(msgpack::object& o, std::byte v) const {
o.type = msgpack::type::POSITIVE_INTEGER;
o.via.u64 = static_cast<unsigned char>(v);
}
};
template <>
struct object_with_zone<std::byte> {
void operator()(msgpack::object::with_zone& o, const std::byte& v) const {
static_cast<msgpack::object&>(o) << v;
}
};
} // namespace adaptor
/// @cond
} // MSGPACK_API_VERSION_NAMESPACE(v1)
/// @endcond
} // namespace msgpack
#endif // __cplusplus >= 201703
#endif // MSGPACK_V1_TYPE_BYTE_HPP

View File

@@ -0,0 +1,109 @@
//
// MessagePack for C++ static resolution routine
//
// Copyright (C) 2018 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_V1_TYPE_CARRAY_BYTE_HPP
#define MSGPACK_V1_TYPE_CARRAY_BYTE_HPP
#if __cplusplus >= 201703
#include "msgpack/versioning.hpp"
#include "msgpack/adaptor/adaptor_base.hpp"
#include "msgpack/adaptor/check_container_size.hpp"
#include <cstring>
#include <cstddef>
namespace msgpack {
/// @cond
MSGPACK_API_VERSION_NAMESPACE(v1) {
/// @endcond
namespace adaptor {
template <std::size_t N>
struct convert<std::byte[N]> {
msgpack::object const& operator()(msgpack::object const& o, std::byte(&v)[N]) const {
switch (o.type) {
case msgpack::type::BIN:
if (o.via.bin.size > N) { throw msgpack::type_error(); }
std::memcpy(v, o.via.bin.ptr, o.via.bin.size);
break;
case msgpack::type::STR:
if (o.via.str.size > N) { throw msgpack::type_error(); }
std::memcpy(v, o.via.str.ptr, o.via.str.size);
if (o.via.str.size < N) v[o.via.str.size] = std::byte{'\0'};
break;
default:
throw msgpack::type_error();
break;
}
return o;
}
};
template <std::size_t N>
struct pack<std::byte[N]> {
template <typename Stream>
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const std::byte(&v)[N]) const {
std::byte const* p = v;
uint32_t size = checked_get_container_size(N);
o.pack_bin(size);
o.pack_bin_body(reinterpret_cast<char const*>(p), size);
return o;
}
};
template <std::size_t N>
struct pack<const std::byte[N]> {
template <typename Stream>
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const std::byte(&v)[N]) const {
std::byte const* p = v;
uint32_t size = checked_get_container_size(N);
o.pack_bin(size);
o.pack_bin_body(reinterpret_cast<char const*>(p), size);
return o;
}
};
template <std::size_t N>
struct object_with_zone<std::byte[N]> {
void operator()(msgpack::object::with_zone& o, const std::byte(&v)[N]) const {
uint32_t size = checked_get_container_size(N);
o.type = msgpack::type::BIN;
char* ptr = static_cast<char*>(o.zone.allocate_align(size, MSGPACK_ZONE_ALIGNOF(char)));
o.via.bin.ptr = ptr;
o.via.bin.size = size;
std::memcpy(ptr, v, size);
}
};
template <std::size_t N>
struct object_with_zone<const std::byte[N]> {
void operator()(msgpack::object::with_zone& o, const std::byte(&v)[N]) const {
uint32_t size = checked_get_container_size(N);
o.type = msgpack::type::BIN;
char* ptr = static_cast<char*>(o.zone.allocate_align(size, MSGPACK_ZONE_ALIGNOF(char)));
o.via.bin.ptr = ptr;
o.via.bin.size = size;
std::memcpy(ptr, v, size);
}
};
} // namespace adaptor
/// @cond
} // MSGPACK_API_VERSION_NAMESPACE(v1)
/// @endcond
} // namespace msgpack
#endif // __cplusplus >= 201703
#endif // MSGPACK_V1_TYPE_CARRAY_BYTE_HPP

View File

@@ -0,0 +1,119 @@
//
// MessagePack for C++ static resolution routine
//
// Copyright (C) 2018 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_V1_TYPE_VECTOR_BYTE_HPP
#define MSGPACK_V1_TYPE_VECTOR_BYTE_HPP
#if __cplusplus >= 201703
#include "msgpack/versioning.hpp"
#include "msgpack/adaptor/adaptor_base.hpp"
#include "msgpack/adaptor/check_container_size.hpp"
#include <vector>
#include <cstring>
#include <cstddef>
namespace msgpack {
/// @cond
MSGPACK_API_VERSION_NAMESPACE(v1) {
/// @endcond
namespace adaptor {
template <typename Alloc>
struct convert<std::vector<std::byte, Alloc> > {
msgpack::object const& operator()(msgpack::object const& o, std::vector<std::byte, Alloc>& v) const {
switch (o.type) {
case msgpack::type::BIN:
v.resize(o.via.bin.size);
if (o.via.bin.size != 0) {
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif // (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
std::memcpy(&v.front(), o.via.bin.ptr, o.via.bin.size);
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif // (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
}
break;
case msgpack::type::STR:
v.resize(o.via.str.size);
if (o.via.str.size != 0) {
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif // (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
std::memcpy(&v.front(), o.via.str.ptr, o.via.str.size);
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif // (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
}
break;
default:
throw msgpack::type_error();
break;
}
return o;
}
};
template <typename Alloc>
struct pack<std::vector<std::byte, Alloc> > {
template <typename Stream>
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const std::vector<std::byte, Alloc>& v) const {
uint32_t size = checked_get_container_size(v.size());
o.pack_bin(size);
if (size != 0) {
o.pack_bin_body(reinterpret_cast<char const*>(&v.front()), size);
}
return o;
}
};
template <typename Alloc>
struct object<std::vector<std::byte, Alloc> > {
void operator()(msgpack::object& o, const std::vector<std::byte, Alloc>& v) const {
uint32_t size = checked_get_container_size(v.size());
o.type = msgpack::type::BIN;
if (size != 0) {
o.via.bin.ptr = reinterpret_cast<char const*>(&v.front());
}
o.via.bin.size = size;
}
};
template <typename Alloc>
struct object_with_zone<std::vector<std::byte, Alloc> > {
void operator()(msgpack::object::with_zone& o, const std::vector<std::byte, Alloc>& v) const {
uint32_t size = checked_get_container_size(v.size());
o.type = msgpack::type::BIN;
o.via.bin.size = size;
if (size != 0) {
char* ptr = static_cast<char*>(o.zone.allocate_align(size, MSGPACK_ZONE_ALIGNOF(char)));
o.via.bin.ptr = ptr;
std::memcpy(ptr, &v.front(), size);
}
}
};
} // namespace adaptor
/// @cond
} // MSGPACK_API_VERSION_NAMESPACE(v1)
/// @endcond
} // namespace msgpack
#endif // __cplusplus >= 201703
#endif // MSGPACK_V1_TYPE_VECTOR_BYTE_HPP

View File

@@ -62,6 +62,7 @@ struct define_map<A0, A1> {
if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
std::map<std::string, msgpack::object const*> kvmap;
for (uint32_t i = 0; i < o.via.map.size; ++i) {
if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); }
kvmap.insert(
std::map<std::string, msgpack::object const*>::value_type(
std::string(
@@ -114,6 +115,7 @@ struct define_map<A0, A1, A2, A3> {
if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
std::map<std::string, msgpack::object const*> kvmap;
for (uint32_t i = 0; i < o.via.map.size; ++i) {
if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); }
kvmap.insert(
std::map<std::string, msgpack::object const*>::value_type(
std::string(
@@ -180,6 +182,7 @@ struct define_map<A0, A1, A2, A3, A4, A5> {
if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
std::map<std::string, msgpack::object const*> kvmap;
for (uint32_t i = 0; i < o.via.map.size; ++i) {
if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); }
kvmap.insert(
std::map<std::string, msgpack::object const*>::value_type(
std::string(
@@ -260,6 +263,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7> {
if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
std::map<std::string, msgpack::object const*> kvmap;
for (uint32_t i = 0; i < o.via.map.size; ++i) {
if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); }
kvmap.insert(
std::map<std::string, msgpack::object const*>::value_type(
std::string(
@@ -354,6 +358,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9> {
if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
std::map<std::string, msgpack::object const*> kvmap;
for (uint32_t i = 0; i < o.via.map.size; ++i) {
if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); }
kvmap.insert(
std::map<std::string, msgpack::object const*>::value_type(
std::string(
@@ -462,6 +467,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11> {
if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
std::map<std::string, msgpack::object const*> kvmap;
for (uint32_t i = 0; i < o.via.map.size; ++i) {
if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); }
kvmap.insert(
std::map<std::string, msgpack::object const*>::value_type(
std::string(
@@ -584,6 +590,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13> {
if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
std::map<std::string, msgpack::object const*> kvmap;
for (uint32_t i = 0; i < o.via.map.size; ++i) {
if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); }
kvmap.insert(
std::map<std::string, msgpack::object const*>::value_type(
std::string(
@@ -720,6 +727,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
std::map<std::string, msgpack::object const*> kvmap;
for (uint32_t i = 0; i < o.via.map.size; ++i) {
if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); }
kvmap.insert(
std::map<std::string, msgpack::object const*>::value_type(
std::string(
@@ -870,6 +878,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
std::map<std::string, msgpack::object const*> kvmap;
for (uint32_t i = 0; i < o.via.map.size; ++i) {
if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); }
kvmap.insert(
std::map<std::string, msgpack::object const*>::value_type(
std::string(
@@ -1034,6 +1043,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
std::map<std::string, msgpack::object const*> kvmap;
for (uint32_t i = 0; i < o.via.map.size; ++i) {
if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); }
kvmap.insert(
std::map<std::string, msgpack::object const*>::value_type(
std::string(
@@ -1212,6 +1222,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
std::map<std::string, msgpack::object const*> kvmap;
for (uint32_t i = 0; i < o.via.map.size; ++i) {
if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); }
kvmap.insert(
std::map<std::string, msgpack::object const*>::value_type(
std::string(
@@ -1404,6 +1415,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
std::map<std::string, msgpack::object const*> kvmap;
for (uint32_t i = 0; i < o.via.map.size; ++i) {
if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); }
kvmap.insert(
std::map<std::string, msgpack::object const*>::value_type(
std::string(
@@ -1610,6 +1622,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
std::map<std::string, msgpack::object const*> kvmap;
for (uint32_t i = 0; i < o.via.map.size; ++i) {
if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); }
kvmap.insert(
std::map<std::string, msgpack::object const*>::value_type(
std::string(
@@ -1830,6 +1843,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
std::map<std::string, msgpack::object const*> kvmap;
for (uint32_t i = 0; i < o.via.map.size; ++i) {
if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); }
kvmap.insert(
std::map<std::string, msgpack::object const*>::value_type(
std::string(
@@ -2064,6 +2078,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
std::map<std::string, msgpack::object const*> kvmap;
for (uint32_t i = 0; i < o.via.map.size; ++i) {
if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); }
kvmap.insert(
std::map<std::string, msgpack::object const*>::value_type(
std::string(
@@ -2312,6 +2327,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
std::map<std::string, msgpack::object const*> kvmap;
for (uint32_t i = 0; i < o.via.map.size; ++i) {
if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); }
kvmap.insert(
std::map<std::string, msgpack::object const*>::value_type(
std::string(

View File

@@ -0,0 +1,45 @@
//
// MessagePack for C++ static resolution routine
//
// Copyright (C) 2017 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_V1_CPP11_CONVERT_HELPER_HPP
#define MSGPACK_V1_CPP11_CONVERT_HELPER_HPP
#include <tuple>
#include <msgpack/object_fwd.hpp>
namespace msgpack {
/// @cond
MSGPACK_API_VERSION_NAMESPACE(v1) {
/// @endcond
namespace type {
template <typename T>
inline typename std::enable_if<
has_as<T>::value
>::type
convert_helper(msgpack::object const& o, T& t) {
t = o.as<T>();
}
template <typename T>
inline typename std::enable_if<
!has_as<T>::value
>::type
convert_helper(msgpack::object const& o, T& t) {
o.convert(t);
}
} // namespace type
/// @cond
} // MSGPACK_API_VERSION_NAMESPACE(v1)
/// @endcond
} // namespace msgpack
#endif // MSGPACK_V1_CPP11_CONVERT_HELPER_HPP

View File

@@ -11,6 +11,7 @@
#define MSGPACK_V1_CPP11_DEFINE_ARRAY_HPP
#include "msgpack/v1/adaptor/detail/cpp11_define_array_decl.hpp"
#include "msgpack/v1/adaptor/detail/cpp11_convert_helper.hpp"
#include <tuple>
@@ -31,7 +32,7 @@ struct define_array_imp {
define_array_imp<Tuple, N-1>::unpack(o, t);
const size_t size = o.via.array.size;
if(size <= N-1) { return; }
o.via.array.ptr[N-1].convert(std::get<N-1>(t));
convert_helper(o.via.array.ptr[N-1], std::get<N-1>(t));
}
static void object(msgpack::object* o, msgpack::zone& z, Tuple const& t) {
define_array_imp<Tuple, N-1>::object(o, z, t);
@@ -48,7 +49,7 @@ struct define_array_imp<Tuple, 1> {
static void unpack(msgpack::object const& o, Tuple& t) {
const size_t size = o.via.array.size;
if(size <= 0) { return; }
o.via.array.ptr[0].convert(std::get<0>(t));
convert_helper(o.via.array.ptr[0], std::get<0>(t));
}
static void object(msgpack::object* o, msgpack::zone& z, Tuple const& t) {
o->via.array.ptr[0] = msgpack::object(std::get<0>(t), z);

View File

@@ -11,6 +11,7 @@
#define MSGPACK_V1_CPP11_DEFINE_MAP_HPP
#include "msgpack/v1/adaptor/detail/cpp11_define_map_decl.hpp"
#include "msgpack/v1/adaptor/detail/cpp11_convert_helper.hpp"
#include <tuple>
#include <map>
@@ -34,7 +35,7 @@ struct define_map_imp {
define_map_imp<Tuple, N-2>::unpack(o, t, kvmap);
auto it = kvmap.find(std::get<N-2>(t));
if (it != kvmap.end()) {
it->second->convert(std::get<N-1>(t));
convert_helper(*it->second, std::get<N-1>(t));
}
}
static void object(msgpack::object* o, msgpack::zone& z, Tuple const& t) {
@@ -71,6 +72,7 @@ struct define_map {
if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
std::map<std::string, msgpack::object const*> kvmap;
for (uint32_t i = 0; i < o.via.map.size; ++i) {
if (o.via.map.ptr[i].key.type != msgpack::type::STR) { throw msgpack::type_error(); }
kvmap.emplace(
std::string(
o.via.map.ptr[i].key.via.str.ptr,

View File

@@ -43,10 +43,10 @@ public:
return static_cast<int8_t>(m_data[0]);
}
const char* data() const {
return &m_data[1];
return &m_data[0] + 1;
}
char* data() {
return &m_data[1];
return &m_data[0] + 1;
}
uint32_t size() const {
return static_cast<uint32_t>(m_data.size()) - 1;

View File

@@ -201,75 +201,91 @@ struct object<type::fix_int64> {
template <>
struct object<type::fix_uint8> {
void operator()(msgpack::object& o, type::fix_uint8 v) const
{ o.type = msgpack::type::POSITIVE_INTEGER, o.via.u64 = v.get(); }
void operator()(msgpack::object& o, type::fix_uint8 v) const {
o.type = msgpack::type::POSITIVE_INTEGER;
o.via.u64 = v.get();
}
};
template <>
struct object<type::fix_uint16> {
void operator()(msgpack::object& o, type::fix_uint16 v) const
{ o.type = msgpack::type::POSITIVE_INTEGER, o.via.u64 = v.get(); }
void operator()(msgpack::object& o, type::fix_uint16 v) const {
o.type = msgpack::type::POSITIVE_INTEGER;
o.via.u64 = v.get();
}
};
template <>
struct object<type::fix_uint32> {
void operator()(msgpack::object& o, type::fix_uint32 v) const
{ o.type = msgpack::type::POSITIVE_INTEGER, o.via.u64 = v.get(); }
void operator()(msgpack::object& o, type::fix_uint32 v) const {
o.type = msgpack::type::POSITIVE_INTEGER;
o.via.u64 = v.get();
}
};
template <>
struct object<type::fix_uint64> {
void operator()(msgpack::object& o, type::fix_uint64 v) const
{ o.type = msgpack::type::POSITIVE_INTEGER, o.via.u64 = v.get(); }
void operator()(msgpack::object& o, type::fix_uint64 v) const {
o.type = msgpack::type::POSITIVE_INTEGER;
o.via.u64 = v.get();
}
};
template <>
struct object_with_zone<type::fix_int8> {
void operator()(msgpack::object::with_zone& o, type::fix_int8 v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, type::fix_int8 v) const {
static_cast<msgpack::object&>(o) << v;
}
};
template <>
struct object_with_zone<type::fix_int16> {
void operator()(msgpack::object::with_zone& o, type::fix_int16 v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, type::fix_int16 v) const {
static_cast<msgpack::object&>(o) << v;
}
};
template <>
struct object_with_zone<type::fix_int32> {
void operator()(msgpack::object::with_zone& o, type::fix_int32 v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, type::fix_int32 v) const {
static_cast<msgpack::object&>(o) << v;
}
};
template <>
struct object_with_zone<type::fix_int64> {
void operator()(msgpack::object::with_zone& o, type::fix_int64 v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, type::fix_int64 v) const {
static_cast<msgpack::object&>(o) << v;
}
};
template <>
struct object_with_zone<type::fix_uint8> {
void operator()(msgpack::object::with_zone& o, type::fix_uint8 v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, type::fix_uint8 v) const {
static_cast<msgpack::object&>(o) << v;
}
};
template <>
struct object_with_zone<type::fix_uint16> {
void operator()(msgpack::object::with_zone& o, type::fix_uint16 v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, type::fix_uint16 v) const {
static_cast<msgpack::object&>(o) << v;
}
};
template <>
struct object_with_zone<type::fix_uint32> {
void operator()(msgpack::object::with_zone& o, type::fix_uint32 v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, type::fix_uint32 v) const {
static_cast<msgpack::object&>(o) << v;
}
};
template <>
struct object_with_zone<type::fix_uint64> {
void operator()(msgpack::object::with_zone& o, type::fix_uint64 v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, type::fix_uint64 v) const {
static_cast<msgpack::object&>(o) << v;
}
};
} // namespace adaptor

View File

@@ -82,7 +82,8 @@ struct object_char_sign<true> {
template <>
struct object_char_sign<false> {
static void make(msgpack::object& o, char v) {
o.type = msgpack::type::POSITIVE_INTEGER, o.via.u64 = v;
o.type = msgpack::type::POSITIVE_INTEGER;
o.via.u64 = v;
}
};
@@ -320,99 +321,120 @@ struct object<signed long long> {
template <>
struct object<unsigned char> {
void operator()(msgpack::object& o, unsigned char v) const
{ o.type = msgpack::type::POSITIVE_INTEGER, o.via.u64 = v; }
void operator()(msgpack::object& o, unsigned char v) const {
o.type = msgpack::type::POSITIVE_INTEGER;
o.via.u64 = v;
}
};
template <>
struct object<unsigned short> {
void operator()(msgpack::object& o, unsigned short v) const
{ o.type = msgpack::type::POSITIVE_INTEGER, o.via.u64 = v; }
void operator()(msgpack::object& o, unsigned short v) const {
o.type = msgpack::type::POSITIVE_INTEGER;
o.via.u64 = v;
}
};
template <>
struct object<unsigned int> {
void operator()(msgpack::object& o, unsigned int v) const
{ o.type = msgpack::type::POSITIVE_INTEGER, o.via.u64 = v; }
void operator()(msgpack::object& o, unsigned int v) const {
o.type = msgpack::type::POSITIVE_INTEGER;
o.via.u64 = v;
}
};
template <>
struct object<unsigned long> {
void operator()(msgpack::object& o, unsigned long v) const
{ o.type = msgpack::type::POSITIVE_INTEGER, o.via.u64 = v; }
void operator()(msgpack::object& o, unsigned long v) const {
o.type = msgpack::type::POSITIVE_INTEGER;
o.via.u64 = v;
}
};
template <>
struct object<unsigned long long> {
void operator()(msgpack::object& o, unsigned long long v) const
{ o.type = msgpack::type::POSITIVE_INTEGER, o.via.u64 = v; }
void operator()(msgpack::object& o, unsigned long long v) const {
o.type = msgpack::type::POSITIVE_INTEGER;
o.via.u64 = v;
}
};
template <>
struct object_with_zone<char> {
void operator()(msgpack::object::with_zone& o, char v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, char v) const {
static_cast<msgpack::object&>(o) << v;
}
};
template <>
struct object_with_zone<signed char> {
void operator()(msgpack::object::with_zone& o, signed char v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, signed char v) const {
static_cast<msgpack::object&>(o) << v;
}
};
template <>
struct object_with_zone<signed short> {
void operator()(msgpack::object::with_zone& o, signed short v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, signed short v) const {
static_cast<msgpack::object&>(o) << v;
}
};
template <>
struct object_with_zone<signed int> {
void operator()(msgpack::object::with_zone& o, signed int v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, signed int v) const {
static_cast<msgpack::object&>(o) << v;
}
};
template <>
struct object_with_zone<signed long> {
void operator()(msgpack::object::with_zone& o, signed long v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, signed long v) const {
static_cast<msgpack::object&>(o) << v;
}
};
template <>
struct object_with_zone<signed long long> {
void operator()(msgpack::object::with_zone& o, const signed long long& v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, const signed long long& v) const {
static_cast<msgpack::object&>(o) << v;
}
};
template <>
struct object_with_zone<unsigned char> {
void operator()(msgpack::object::with_zone& o, unsigned char v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, unsigned char v) const {
static_cast<msgpack::object&>(o) << v;
}
};
template <>
struct object_with_zone<unsigned short> {
void operator()(msgpack::object::with_zone& o, unsigned short v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, unsigned short v) const {
static_cast<msgpack::object&>(o) << v;
}
};
template <>
struct object_with_zone<unsigned int> {
void operator()(msgpack::object::with_zone& o, unsigned int v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, unsigned int v) const {
static_cast<msgpack::object&>(o) << v;
}
};
template <>
struct object_with_zone<unsigned long> {
void operator()(msgpack::object::with_zone& o, unsigned long v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, unsigned long v) const {
static_cast<msgpack::object&>(o) << v;
}
};
template <>
struct object_with_zone<unsigned long long> {
void operator()(msgpack::object::with_zone& o, const unsigned long long& v) const
{ static_cast<msgpack::object&>(o) << v; }
void operator()(msgpack::object::with_zone& o, const unsigned long long& v) const {
static_cast<msgpack::object&>(o) << v;
}
};
} // namespace adaptor

View File

@@ -127,7 +127,11 @@ template<class T> struct is_pointer : detail::is_pointer_helper<typename remove_
#endif // MSGPACK_USE_CPP03
#if __cplusplus >= 201402L
#if defined(_MSC_VER)
#define MSGPACK_DEPRECATED(msg) __declspec(deprecated(msg))
#else // _MSC_VER 1914+ with /Zc:__cplusplus, @see https://docs.microsoft.com/cpp/build/reference/zc-cplusplus
#define MSGPACK_DEPRECATED(msg) [[deprecated(msg)]]
#endif
#else // __cplusplus >= 201402L
#define MSGPACK_DEPRECATED(msg)
#endif // __cplusplus >= 201402L

View File

@@ -128,4 +128,10 @@ MSGPACK_API_VERSION_NAMESPACE(v1) {
#endif // MSGPACK_USE_CPP03
#if defined(__has_include)
#define MSGPACK_HAS_INCLUDE __has_include
#else // defined(__has_include)
#define MSGPACK_HAS_INCLUDE(header) 0
#endif // defined(__has_include)
#endif // MSGPACK_V1_CPP_CONFIG_DECL_HPP

File diff suppressed because it is too large Load Diff

View File

@@ -83,6 +83,13 @@ bool operator!=(const T& y, const msgpack::object& x);
void operator<< (msgpack::object& o, const msgpack_object& v);
class object_parser;
template <typename Stream>
struct object_pack_visitor;
struct object_stringize_visitor;
// obsolete
template <typename T>
MSGPACK_DEPRECATED("please use member function version of object::convert(T&)")
@@ -104,7 +111,7 @@ msgpack::packer<Stream>& operator<< (msgpack::packer<Stream>& o, const msgpack::
template <typename Stream>
msgpack::packer<Stream>& operator<< (msgpack::packer<Stream>& o, const msgpack::object::with_zone& v);
std::ostream& operator<< (std::ostream& s, const msgpack::object& o);
std::ostream& operator<< (std::ostream& s, const msgpack::object& v);
/// @cond
} // MSGPACK_API_VERSION_NAMESPACE(v1)

View File

@@ -59,7 +59,7 @@ private:
decltype(adaptor::as<U>()(std::declval<msgpack::object>())),
T
>::type;
template <typename>
template <typename...>
static std::false_type check(...);
public:
using type = decltype(check<T>(MSGPACK_NULLPTR));

View File

@@ -848,7 +848,6 @@ class unpacker {
public:
/// Constructor
/**
* @param referenced If the unpacked object contains reference of the buffer, then set as true, otherwise false.
* @param f A judging function that msgpack::object refer to the buffer.
* @param user_data This parameter is passed to f.
* @param initial_buffer_size The memory size to allocate when unpacker is constructed.

View File

@@ -12,6 +12,7 @@
#include "msgpack/unpack_decl.hpp"
#include "msgpack/unpack_exception.hpp"
#include "msgpack/v2/create_object_visitor_decl.hpp"
#include "msgpack/v2/null_visitor.hpp"
namespace msgpack {

View File

@@ -0,0 +1,33 @@
//
// MessagePack for C++ deserializing routine
//
// Copyright (C) 2017 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_V2_CREATE_OBJECT_VISITOR_DECL_HPP
#define MSGPACK_V2_CREATE_OBJECT_VISITOR_DECL_HPP
#include "msgpack/versioning.hpp"
namespace msgpack {
/// @cond
MSGPACK_API_VERSION_NAMESPACE(v2) {
/// @endcond
namespace detail {
class create_object_visitor;
} // detail
/// @cond
} // MSGPACK_API_VERSION_NAMESPACE(v2)
/// @endcond
} // namespace msgpack
#endif // MSGPACK_V2_CREATE_OBJECT_VISITOR_DECL_HPP

View File

@@ -10,8 +10,7 @@
#ifndef MSGPACK_V2_NULL_VISITOR_HPP
#define MSGPACK_V2_NULL_VISITOR_HPP
#include "msgpack/versioning.hpp"
#include "msgpack/cpp_config.hpp"
#include "msgpack/v2/null_visitor_decl.hpp"
namespace msgpack {

View File

@@ -0,0 +1,29 @@
//
// MessagePack for C++ deserializing routine
//
// Copyright (C) 2018 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_V2_NULL_VISITOR_DECL_HPP
#define MSGPACK_V2_NULL_VISITOR_DECL_HPP
#include "msgpack/versioning.hpp"
namespace msgpack {
/// @cond
MSGPACK_API_VERSION_NAMESPACE(v2) {
/// @endcond
struct null_visitor;
/// @cond
} // MSGPACK_API_VERSION_NAMESPACE(v2)
/// @endcond
} // namespace msgpack
#endif // MSGPACK_V2_NULL_VISITOR_DECL_HPP

View File

@@ -37,6 +37,10 @@ using v1::detail::packer_serializer;
} // namespace detail
using v1::object_parser;
using v1::object_pack_visitor;
using v1::object_stringize_visitor;
using v1::operator==;
using v1::operator!=;

View File

@@ -91,7 +91,7 @@ private:
v1::has_as<U>::value,
std::true_type
>::type;
template <typename>
template <typename...>
static std::false_type check(...);
public:
using type = decltype(check<T>(MSGPACK_NULLPTR));

View File

@@ -22,6 +22,7 @@ using v1::packer;
using v1::pack;
#if MSGPACK_ENDIAN_LITTLE_BYTE
using v1::take8_8;

View File

@@ -10,8 +10,14 @@
#ifndef MSGPACK_V2_PARSE_HPP
#define MSGPACK_V2_PARSE_HPP
#if MSGPACK_DEFAULT_API_VERSION >= 2
#include <cstddef>
#include "msgpack/unpack_define.h"
#include "msgpack/parse_return.hpp"
#include "msgpack/unpack_exception.hpp"
#include "msgpack/unpack_decl.hpp"
#include "msgpack/v2/create_object_visitor.hpp"
namespace msgpack {
@@ -21,6 +27,10 @@ MSGPACK_API_VERSION_NAMESPACE(v2) {
namespace detail {
using v1::detail::fix_tag;
using v1::detail::value;
using v1::detail::load;
template <typename VisitorHolder>
class context {
public:
@@ -621,11 +631,11 @@ class parser : public detail::context<VisitorHolder> {
public:
/// Constructor
/**
* @param referenced If the unpacked object contains reference of the buffer, then set as true, otherwise false.
* @param f A judging function that msgpack::object refer to the buffer.
* @param user_data This parameter is passed to f.
* @param hook The handler that is called when buffer is allocated internally.
* `hook` should be callable with char* parameter.
* `parser` gives a chance to prepare finalizer.
* See https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_visitor#parse-api
* @param initial_buffer_size The memory size to allocate when unpacker is constructed.
* @param limit The size limit information of msgpack::object.
*
*/
parser(ReferencedBufferHook& hook,
@@ -998,23 +1008,23 @@ inline void parser<VisitorHolder, ReferencedBufferHook>::remove_nonparsed_buffer
template <typename Visitor>
inline bool parse(const char* data, size_t len, size_t& off, Visitor& v) {
parse_return ret = detail::parse_imp(data, len, off, v);
parse_return ret = msgpack::detail::parse_imp(data, len, off, v);
return ret == PARSE_SUCCESS || ret == PARSE_EXTRA_BYTES;
}
template <typename Visitor>
inline bool parse(const char* data, size_t len, Visitor& v) {
std::size_t off = 0;
return parse(data, len, off, v);
return msgpack::parse(data, len, off, v);
}
namespace detail {
template <typename Visitor>
struct parse_helper : context<parse_helper<Visitor> > {
struct parse_helper : detail::context<parse_helper<Visitor> > {
parse_helper(Visitor& v):m_visitor(v) {}
parse_return execute(const char* data, std::size_t len, std::size_t& off) {
return context<parse_helper<Visitor> >::execute(data, len, off);
return detail::context<parse_helper<Visitor> >::execute(data, len, off);
}
Visitor& visitor() const { return m_visitor; }
Visitor& m_visitor;
@@ -1057,5 +1067,6 @@ parse_imp(const char* data, size_t len, size_t& off, Visitor& v) {
} // namespace msgpack
#endif // MSGPACK_DEFAULT_API_VERSION >= 2
#endif // MSGPACK_V2_PARSE_HPP

View File

@@ -0,0 +1,79 @@
//
// MessagePack for C++ deserializing routine
//
// Copyright (C) 2018 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_V2_PARSE_DECL_HPP
#define MSGPACK_V2_PARSE_DECL_HPP
#include "msgpack/parse_return.hpp"
namespace msgpack {
/// @cond
MSGPACK_API_VERSION_NAMESPACE(v2) {
/// @endcond
namespace detail {
template <typename VisitorHolder>
class context;
} // detail
/// Parsing class for a stream deserialization.
template <typename VisitorHolder, typename ReferencedBufferHook>
class parser;
/// Unpack msgpack formatted data via a visitor
/**
* @param data The pointer to the buffer.
* @param len The length of the buffer.
* @param off The offset position of the buffer. It is read and overwritten.
* @param v The visitor that satisfies visitor concept. https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_visitor#visitor-concept
*
* @return if unpacking process finishes without error then return true, otherwise return false.
*
*/
template <typename Visitor>
bool parse(const char* data, size_t len, size_t& off, Visitor& v);
/// Unpack msgpack formatted data via a visitor
/**
* @param data The pointer to the buffer.
* @param len The length of the buffer.
* @param v The visitor that satisfies visitor concept. https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_visitor#visitor-concept
*
* @return if unpacking process finishes without error then return true, otherwise return false.
*
*/
template <typename Visitor>
bool parse(const char* data, size_t len, Visitor& v);
namespace detail {
template <typename Visitor>
struct parse_helper;
template <typename Visitor>
inline parse_return
parse_imp(const char* data, size_t len, size_t& off, Visitor& v);
} // detail
/// @cond
} // MSGPACK_API_VERSION_NAMESPACE(v2)
/// @endcond
} // namespace msgpack
#endif // MSGPACK_V2_PARSE_DECL_HPP

View File

@@ -10,9 +10,11 @@
#ifndef MSGPACK_V2_UNPACK_HPP
#define MSGPACK_V2_UNPACK_HPP
#if MSGPACK_DEFAULT_API_VERSION >= 2
#include "msgpack/unpack_decl.hpp"
#include "msgpack/v2/create_object_visitor.hpp"
#include "msgpack/v2/parse.hpp"
#include "msgpack/parse.hpp"
#include "msgpack/create_object_visitor.hpp"
namespace msgpack {
@@ -229,7 +231,7 @@ inline void unpack(
inline void unpack(
msgpack::object_handle& result,
const char* data, std::size_t len, std::size_t& off,
msgpack::v2::unpack_reference_func f, void* user_data,
unpack_reference_func f, void* user_data,
unpack_limit const& limit)
{
bool referenced;
@@ -341,5 +343,6 @@ unpack_imp(const char* data, std::size_t len, std::size_t& off,
} // namespace msgpack
#endif // MSGPACK_DEFAULT_API_VERSION >= 2
#endif // MSGPACK_V2_UNPACK_HPP

View File

@@ -100,7 +100,7 @@ class basic_unpacker;
* @return object_handle that contains unpacked data.
*
*/
object_handle unpack(
msgpack::object_handle unpack(
const char* data, std::size_t len, std::size_t& off, bool& referenced,
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, unpack_limit const& limit = unpack_limit());
@@ -116,7 +116,7 @@ object_handle unpack(
* @return object_handle that contains unpacked data.
*
*/
object_handle unpack(
msgpack::object_handle unpack(
const char* data, std::size_t len, std::size_t& off,
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, unpack_limit const& limit = unpack_limit());
@@ -132,7 +132,7 @@ object_handle unpack(
* @return object_handle that contains unpacked data.
*
*/
object_handle unpack(
msgpack::object_handle unpack(
const char* data, std::size_t len, bool& referenced,
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, unpack_limit const& limit = unpack_limit());
@@ -147,7 +147,7 @@ object_handle unpack(
* @return object_handle that contains unpacked data.
*
*/
object_handle unpack(
msgpack::object_handle unpack(
const char* data, std::size_t len,
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, unpack_limit const& limit = unpack_limit());
@@ -166,7 +166,7 @@ object_handle unpack(
*
*/
void unpack(
object_handle& result,
msgpack::object_handle& result,
const char* data, std::size_t len, std::size_t& off, bool& referenced,
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, unpack_limit const& limit = unpack_limit());
@@ -183,7 +183,7 @@ void unpack(
*
*/
void unpack(
object_handle& result,
msgpack::object_handle& result,
const char* data, std::size_t len, std::size_t& off,
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, unpack_limit const& limit = unpack_limit());
@@ -200,7 +200,7 @@ void unpack(
*
*/
void unpack(
object_handle& result,
msgpack::object_handle& result,
const char* data, std::size_t len, bool& referenced,
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, unpack_limit const& limit = unpack_limit());
@@ -216,7 +216,7 @@ void unpack(
*
*/
void unpack(
object_handle& result,
msgpack::object_handle& result,
const char* data, std::size_t len,
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, unpack_limit const& limit = unpack_limit());
@@ -292,31 +292,6 @@ msgpack::object unpack(
const char* data, std::size_t len,
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, unpack_limit const& limit = unpack_limit());
/// Unpack msgpack formatted data via a visitor
/**
* @param data The pointer to the buffer.
* @param len The length of the buffer.
* @param off The offset position of the buffer. It is read and overwritten.
* @param v The visitor that satisfies visitor concept. https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_visitor#visitor-concept
*
* @return if unpacking process finishs without error then return true, otherwise return false.
*
*/
template <typename Visitor>
bool parse(const char* data, size_t len, size_t& off, Visitor& v);
/// Unpack msgpack formatted data via a visitor
/**
* @param data The pointer to the buffer.
* @param len The length of the buffer.
* @param v The visitor that satisfies visitor concept. https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_visitor#visitor-concept
*
* @return if unpacking process finishs without error then return true, otherwise return false.
*
*/
template <typename Visitor>
bool parse(const char* data, size_t len, Visitor& v);
namespace detail {
parse_return
@@ -325,9 +300,6 @@ unpack_imp(const char* data, std::size_t len, std::size_t& off,
unpack_reference_func f, void* user_data,
unpack_limit const& limit);
template <typename UnpackVisitor>
parse_return
parse_imp(const char* data, size_t len, size_t& off, UnpackVisitor& v);
} // detail

View File

@@ -17,6 +17,7 @@
#if BOOST_VERSION >= 106100
#include "msgpack/versioning.hpp"
#include "msgpack/x3_parse_decl.hpp"
#if __GNUC__ >= 4
#pragma GCC diagnostic push
@@ -296,8 +297,7 @@ const auto mp_object_def =
(
[](auto& ctx){
auto& app_specific = x3::get<tag_app_specific>(ctx).get();
union { uint32_t i; float f; } mem;
mem.i = _attr(ctx);
union { uint32_t i; float f; } mem = { _attr(ctx) };
app_specific.vis.visit_float32(mem.f);
}
)
@@ -308,8 +308,7 @@ const auto mp_object_def =
(
[](auto& ctx){
auto& app_specific = x3::get<tag_app_specific>(ctx).get();
union { uint64_t i; double f; } mem;
mem.i = _attr(ctx);
union { uint64_t i; double f; } mem = { _attr(ctx) };
#if defined(TARGET_OS_IPHONE)
// ok
#elif defined(__arm__) && !(__ARM_EABI__) // arm-oabi

View File

@@ -0,0 +1,36 @@
//
// MessagePack for C++ deserializing routine
//
// Copyright (C) 2017 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_V2_X3_PARSE_DECL_HPP
#define MSGPACK_V2_X3_PARSE_DECL_HPP
#if defined(MSGPACK_USE_X3_PARSE)
#include "msgpack/versioning.hpp"
namespace msgpack {
/// @cond
MSGPACK_API_VERSION_NAMESPACE(v2) {
/// @endcond
template <typename Iterator, typename Visitor>
bool parse(Iterator&& begin, Iterator&& end, Visitor&& vis);
/// @cond
} // MSGPACK_API_VERSION_NAMESPACE(v2)
/// @endcond
} // namespace msgpack
#endif // defined(MSGPACK_USE_X3_PARSE)
#endif // MSGPACK_V2_X3_PARSE_DECL_HPP

Some files were not shown because too many files have changed in this diff Show More