Compare commits

...

182 Commits

Author SHA1 Message Date
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
Takatoshi Kondo
fd4e28f23d Merge pull request #621 from redboltz/v2.1.4
Updated the version to 2.1.4.
2017-08-03 23:59:16 +09:00
Takatoshi Kondo
2098062613 Updated the version to 2.1.4. 2017-08-03 22:46:40 +09:00
Takatoshi Kondo
22bc707035 Merge pull request #619 from msgpack/fix_fusion_conflict
Fixed conflict between boost fusion sequence and std::tuple/std::pair.
2017-07-26 11:30:43 +09:00
Takatoshi Kondo
7ad743f2da Fixed conflict between boost fusion sequence and std::tuple/std::pair. 2017-07-26 10:24:17 +09:00
Takatoshi Kondo
315bbd4b40 Merge branch 'chshaob1-alignment' 2017-07-24 08:13:43 +09:00
Takatoshi Kondo
288a6b2e31 Fixed zone expansion algorithm. 2017-07-23 19:12:17 +09:00
Takatoshi Kondo
a0e4294b5a Set MSGPACK_ZONE_ALIGNOF(char) explicitly.
It makes efficient zone allocation.
If it was omitted, the default alignment was applied. It was inefficient.
2017-07-23 19:11:12 +09:00
Takatoshi Kondo
64baa15f8e Fixed aligned size. 2017-07-22 15:35:02 +09:00
Takatoshi Kondo
354ee5b9a3 Merge branch 'alignment' of https://github.com/chshaob1/msgpack-c into chshaob1-alignment 2017-07-22 15:28:12 +09:00
Takatoshi Kondo
2ddd79499c Merge pull request #617 from redboltz/partial_fix_460
Partially fixed #460.
2017-07-20 14:16:07 +09:00
Takatoshi Kondo
7f0614e998 Merge branch 'clarkli86-master' 2017-07-20 11:24:50 +09:00
Takatoshi Kondo
150d74508e Fixed msgpack_unpack_next(), C interface, return value. 2017-07-20 11:23:01 +09:00
Takatoshi Kondo
8674c821c4 Merge branch 'master' of https://github.com/clarkli86/msgpack-c into clarkli86-master 2017-07-20 11:18:38 +09:00
Takatoshi Kondo
10be66712d Partially fixed #460.
If msgpack-c compiles on "sparc" platform, then define
MSGPACK_ZONE_ALIGN=8 macro.
It allocates 8byte (64bit) alignment memory on zone allocating.
2017-07-20 11:00:16 +09:00
Clark Li
2698cfc254 Fix return type in C quickstart examples 2017-07-18 23:22:56 +09:30
Takatoshi Kondo
333ee98ab2 Merge pull request #613 from redboltz/fix_612
Fixed #612
2017-07-13 18:58:59 +09:00
Takatoshi Kondo
156e315394 Fixed #612
Removed visit_float() and added visit_float32() and visit_float64()
from/to unpack visitor.
2017-07-11 13:51:51 +09:00
Takatoshi Kondo
01fedf847b Merge pull request #611 from redboltz/fix_msvc_warning
Fixed msvc2015.
2017-07-04 08:49:56 +09:00
Takatoshi Kondo
56db4475f2 Fixed msvc2015. 2017-07-04 07:44:03 +09:00
Takatoshi Kondo
f065c2a447 Merge pull request #610 from redboltz/add_asio_examples
Added boost asio examples.
2017-07-03 22:48:55 +09:00
Takatoshi Kondo
ba4d8df63e Added boost asio examples. 2017-07-03 21:41:39 +09:00
Takatoshi Kondo
c00584281f Merge pull request #609 from redboltz/updated_to_2.1.3
Updated to version 2.1.3.
2017-06-15 23:58:21 +09:00
Takatoshi Kondo
45a0124ede Updated to version 2.1.3. 2017-06-15 22:37:33 +09:00
Takatoshi Kondo
ceb27348bd Merge pull request #608 from redboltz/add_cpp17_files
Added C++17 files to build setting.
2017-06-15 20:42:40 +09:00
Takatoshi Kondo
1ad737ee08 Added C++17 files to build setting. 2017-06-15 20:41:52 +09:00
Takatoshi Kondo
7024a1ec2c Merge pull request #607 from redboltz/fix_597
Solved #597.
2017-06-15 20:38:22 +09:00
Takatoshi Kondo
ca4a425a52 Merge pull request #602 from redboltz/fix_600
Fixed #600.
2017-06-15 16:08:24 +09:00
Takatoshi Kondo
a502097fd0 Solved #597.
Added `std::optional` and `std::string_view` adaptors.
2017-06-13 18:22:48 +09:00
Takatoshi Kondo
6b99a0c8b7 Merge branch 'jasperla-openbsd' 2017-06-13 12:51:27 +09:00
Takatoshi Kondo
1a3fcc3a22 Prevent iovec redefinition on C++. 2017-06-13 12:50:53 +09:00
Takatoshi Kondo
111739f8ce Merge branch 'openbsd' of https://github.com/jasperla/msgpack-c into jasperla-openbsd 2017-06-13 12:27:49 +09:00
Takatoshi Kondo
f638e2186b Merge pull request #605 from redboltz/fix_nonnull_warning
Fixed nonnull warnings on gcc 7.1.
2017-06-12 23:38:34 +09:00
Takatoshi Kondo
002376c678 Merge pull request #604 from redboltz/fix_gcc71_warning
Suppressed gcc 7.1 `maybe-uninitialized` warning.
2017-06-12 23:38:21 +09:00
Takatoshi Kondo
09a2f81b5f Merge pull request #603 from redboltz/add_missing_cmake_on_dist
Added a missing cmake file to makedist.sh.
2017-06-12 23:38:06 +09:00
Takatoshi Kondo
ffcaaeb482 Fixed #600.
Added `maybe-uninitialized` warning suppression code.
2017-06-12 15:33:05 +09:00
Takatoshi Kondo
bd511a4bd1 Fixed nonnull warnings on gcc 7.1. 2017-06-12 15:14:37 +09:00
Takatoshi Kondo
684c5e0bb0 Suppressed gcc 7.1 maybe-uninitialized warning.
When I execute cmake `-DMSGPACK_CXX11=OFF`, gcc 7.1 reports the warning.
I've already added the warning suppression pragma, but it doesn't work
in this case. So I added explicit initializing code even if it is redundant.
2017-06-12 14:11:21 +09:00
Takatoshi Kondo
8e74449181 Added a missing cmake file to makedist.sh. 2017-06-12 14:10:08 +09:00
Jasper Lievisse Adriaanse
f2b788e51f Sprinkle __OpenBSD__: include missing headers and prevent iovec redefinition 2017-06-11 18:13:10 +02:00
Takatoshi Kondo
7214b4c73f Merge pull request #599 from redboltz/fix_598
Fixed #598.
2017-06-08 20:44:21 +09:00
Takatoshi Kondo
a7a78bde9b Fixed #598. 2017-06-08 09:26:05 +00:00
Takatoshi Kondo
c50fbe4ce9 Merge pull request #595 from redboltz/ver_2.1.2
Updated the version to 2.1.2.
2017-06-07 13:23:23 +09:00
Takatoshi Kondo
d7d28b6f24 Updated the version to 2.1.2. 2017-06-06 12:26:09 +09:00
Takatoshi Kondo
5ebed34376 Merge pull request #592 from leolchat/master
Do not convert file everytime it is configured
2017-05-29 00:53:19 +09:00
Léonard Gérard
6871a82af7 Do not convert file everytime it is configured 2017-05-22 21:57:21 -07:00
Takatoshi Kondo
3f79968910 Merge branch 'herbrechtsmeier-ci' 2017-05-18 20:25:14 +09:00
Takatoshi Kondo
2e10adabb1 Removed X3_PARSE from osx build. 2017-05-18 19:47:53 +09:00
Takatoshi Kondo
0411ef85e7 Added warning supression pragma. 2017-05-15 16:52:29 +09:00
Takatoshi Kondo
28b6ee0db0 Updated clang version. 2017-05-15 15:55:52 +09:00
Takatoshi Kondo
3d0fa6043c Merge branch 'ci' of https://github.com/herbrechtsmeier/msgpack-c into herbrechtsmeier-ci 2017-05-15 13:57:06 +09:00
Stefan Herbrechtsmeier
ee169c4eb5 appveyor: Disable boost for non default compiler
The appveyor pre-installed software is only compiled with the default
compiler and couldn't be used with other compiler versions.

Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
2017-05-13 00:58:10 +02:00
Stefan Herbrechtsmeier
0aaf95608f cmake: Make boost mandatory if MSGPACK_BOOST is ON
Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
2017-05-13 00:57:03 +02:00
Stefan Herbrechtsmeier
918e7edba4 cmake: Add Boost library link directory
Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
2017-05-13 00:56:19 +02:00
Takatoshi Kondo
88338195c0 Merge branch 'kraj-devtool' 2017-04-26 17:46:27 +09:00
Takatoshi Kondo
e90231c865 Added 'fallthrough' comments to suppress gcc7 warnings. 2017-04-24 17:16:43 +09:00
Khem Raj
15d8bb6792 Comment intentional fallthrough in case statements
Fixes build with gcc7

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2017-04-22 08:53:50 -07:00
Takatoshi Kondo
20ef1f925b Merge pull request #586 from jamessan/gcc-7-fix
Comment the intentional fallthrough to default from _fixed_trail_again
2017-04-17 17:22:54 +09:00
Takatoshi Kondo
89b8f4ee13 Merge pull request #580 from herbrechtsmeier/config
Add cmake package config support
2017-04-17 16:38:29 +09:00
James McCoy
304ff96d04 Comment the intentional fallthrough to default from _fixed_trail_again
GCC 7 added a new diagnostic, -Wimplicit-fallthrough, which is enabled
with -Wextra that warns about implicitly falling through a case
statement.

    [  4%] Building C object CMakeFiles/msgpackc-static.dir/src/unpack.c.o
    /usr/lib/gcc-snapshot/bin/gcc   -I/home/jamessan/src/msgpack-c/. -I/home/jamessan/src/msgpack-c/include -I/home/jamessan/src/msgpack-c/build/include  -g -O2 -fdebug-prefix-map=/home/jamessan/src/msgpack-c=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -Wall -Wextra -Werror -g -O3 -o CMakeFiles/msgpackc-static.dir/src/unpack.c.o   -c /home/jamessan/src/msgpack-c/src/unpack.c
    In file included from /home/jamessan/src/msgpack-c/src/unpack.c:283:0:
    /home/jamessan/src/msgpack-c/include/msgpack/unpack_template.h: In function 'template_execute':
    /home/jamessan/src/msgpack-c/include/msgpack/unpack_template.h:238:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
                     ++p;
                     ^~~
    /home/jamessan/src/msgpack-c/include/msgpack/unpack_template.h:240:13: note: here
                 default:
                 ^~~~~~~
    cc1: all warnings being treated as errors

Adding the comment makes it explicit that the fallthrough is
intentional, so gcc doesn't complain.
2017-04-13 11:43:27 -04:00
Takatoshi Kondo
10c1917f22 Merge pull request #582 from qehgt/fix-winsock-already-included
Fix 'WinSock.h has already been included' compiler error.
2017-04-12 20:44:56 +09:00
Takatoshi Kondo
d85e731ab4 Merge pull request #585 from redboltz/fix_584
Fixed #584.
2017-04-12 19:02:24 +09:00
Takatoshi Kondo
d431e25257 Fixed #584.
Reset m_cs to MSGPACK_CS_HEADER after visitor called.
2017-04-11 12:29:12 +09:00
Stefan Herbrechtsmeier
3d82c2d651 Add cmake package config support
Add support for CMake find_package command to msgpack. The package
exports the two targets msgpackc-static and msgpackc if shared is
enabled. The CMake find_package command works after installation
of msgpack and during build of another project which adds msgpack
as sub project via add_subdirectory command.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
2017-04-04 08:33:18 +02:00
Vasily Titskiy
2cbaa3a7db Fix 'WinSock.h has already been included' compiler error.
Fix compiler error if Boost.Asio & msgpack are used together on Windows
Platform
2017-03-29 11:48:29 -04:00
Takatoshi Kondo
bfc6e45a2f Merge pull request #579 from herbrechtsmeier/boost
Add boost include directories only if MSGPACK_BOOST is enabled
2017-03-25 18:11:53 +09:00
Takatoshi Kondo
e8fa6c1aee Merge pull request #578 from herbrechtsmeier/wildcard
Pass wildcard precision of snprintf as int
2017-03-25 18:10:49 +09:00
Takatoshi Kondo
d49bec4e11 Merge pull request #577 from herbrechtsmeier/posix
Detect POSIX compatiblity explicit
2017-03-25 18:10:01 +09:00
Stefan Herbrechtsmeier
004939e732 Pass wildcard precision of snprintf as int
Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
2017-03-22 13:05:47 +01:00
Stefan Herbrechtsmeier
09e8833d53 Add boost include directories only if MSGPACK_BOOST is enabled
Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
2017-03-22 13:04:03 +01:00
Stefan Herbrechtsmeier
9ed842c014 Detect POSIX compatiblity explicit
Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
2017-03-22 13:03:33 +01:00
Takatoshi Kondo
99c4d37a39 Merge pull request #574 from redboltz/fix_536
Fixed #536.
2017-03-16 08:21:49 +09:00
Takatoshi Kondo
4df2bdecda Fixed #536.
Replaced __GNUC_MINOR__ 6 with 7 for suppress maybe-uninitialized.
2017-03-15 21:30:07 +09:00
Takatoshi Kondo
597cd63121 Merge pull request #572 from speleo3/PATH-alias
CMake <= 2.8.11 compatibility
2017-03-12 11:14:42 +09:00
Thomas Holder
a51f33c02f CMake <= 2.8.11 compatibility
Keep compatible with cmake <= 2.8.11 by using the legacy PATH alias for
DIRECTORY with get_filename_component.
2017-03-08 21:45:13 -05:00
Takatoshi Kondo
88032f37e1 Merge pull request #570 from lluixhi/boost
Enable building against dynamically-linked Boost
2017-03-05 13:02:14 +09:00
Takatoshi Kondo
a76911a72c Merge pull request #569 from lluixhi/master
Make header install obey MSGPACK_ENABLE_CXX
2017-03-05 11:53:56 +09:00
Takatoshi Kondo
1bc27d72cc Merge pull request #568 from dstahlke/fix
Fixed spurious start_map_key/start_array_item calls
2017-03-05 11:02:05 +09:00
Aric Belsito
a6599e5fb4 Enable building against dynamically-linked Boost 2017-03-03 12:31:56 -08:00
Aric Belsito
791f55da35 Make header install obey MSGPACK_ENABLE_CXX 2017-03-03 12:25:55 -08:00
Dan L. Stahlke
e58b00016b Fixed spurious start_map_key/start_array_item calls 2017-03-03 09:00:15 -08:00
Takatoshi Kondo
b4fe698777 Merge pull request #565 from mongi3/patch-1
Minor fix to Quickstart (broke with 2.0)
2017-02-13 15:05:13 +09:00
mongi3
e89045cfcd Minor fix to Quickstart (broke with 2.0)
non reference version won't compile with 2.0 release.
2017-02-11 15:06:42 -07:00
Takatoshi Kondo
c6e6dbc608 Added string view to file list. 2017-02-04 20:17:37 +09:00
Takatoshi Kondo
e271cf2aed Merge pull request #563 from redboltz/ver2.1.1
Updated the version to 2.1.1.
2017-02-04 20:14:37 +09:00
Takatoshi Kondo
53e4bb92fe Updated the version to 2.1.1. 2017-02-04 19:04:14 +09:00
Takatoshi Kondo
303c1000c2 Merge pull request #562 from redboltz/fix_561
Fixed #561
2017-02-04 12:45:51 +09:00
Takatoshi Kondo
088ce946b9 Fixed #561
Fixed unpacker's buffer expansion logic.
2017-02-03 17:11:51 +09:00
Takatoshi Kondo
dc86adbf8e Merge pull request #558 from redboltz/add_boost_string_view
Added boost string_view adaptor.
2017-01-20 09:33:23 +09:00
Takatoshi Kondo
ad0cae30ad Merge pull request #559 from raeraex2/fix_compilation_warning
Fix compilation warnings about possible loss of data
2017-01-19 09:43:32 +09:00
raeraex2
bf3e2abc9e Update appveyor.yml
Updated zlib to 1.2.11
2017-01-17 23:22:18 +01:00
raeraex2
b7543e1386 Fix compilation warnings about possible loss of data 2017-01-17 22:16:05 +01:00
Takatoshi Kondo
1f515b3ae7 Added boost string_view adaptor. 2017-01-15 19:09:31 +09:00
Takatoshi Kondo
a933fa5892 Merge pull request #557 from obache/neatsrc/fix-char-subscripts-warnings
Make sure to pass `unsigned char` to `isprint()`
2017-01-13 14:15:15 +09:00
Takatoshi Kondo
a07622c276 Merge pull request #556 from obache/neatsrc/strip-cr
Strip unwanted CR before EOL
2017-01-12 20:47:35 +09:00
OBATA Akio
c955727d8c Make sure to pass unsigned char to isprint()
This change make safe for `char = signed char`.

As the spec, argment of `isprintf()` must be representabe as an
`unsigned char` (or equal to EOF, not expected here).
Additionally, some implementation define it as a macro using array,
then it cause warning "array subscript has type `char` [-Wchar-subscripts]"
with `char` argments.
2017-01-12 15:01:04 +09:00
OBATA Akio
094b70213a Strip unwanted CR before EOL 2017-01-12 14:35:51 +09:00
Beilu Shao
b4786711df alignment: use proper alignment size
Pass proper alignment size when use allocate_align(). This will
fix alignment trap issues on ARM.

Signed-off-by: Beilu Shao <beilushao@gmail.com>
2016-10-16 23:59:13 +02:00
210 changed files with 7748 additions and 974 deletions

View File

@@ -1,5 +1,6 @@
language: cpp
sudo: false
dist: trusty
install:
- export BASE=`pwd`
@@ -10,7 +11,8 @@ install:
- 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.7" CC="clang-3.7"; fi
- if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then export CXX="clang++-3.9" CC="clang-3.9"; 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
@@ -27,7 +29,8 @@ install:
# 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-timer --with-chrono address-model=${ARCH} install > /dev/null && cd ..; fi
- if [ "$BOOST" == "ON" ]; then wget http://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.zip && unzip -q boost_1_66_0.zip && cd boost_1_66_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 [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ln -s /usr/include/x86_64-linux-gnu/zconf.h /usr/include; fi
matrix:
include:
@@ -36,7 +39,7 @@ matrix:
env: ACTION="ci/build_cmake.sh" CXX11="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" X3_PARSE="ON"
env: ACTION="ci/build_cmake.sh" CXX11="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"
@@ -50,7 +53,7 @@ matrix:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
- llvm-toolchain-precise-3.9
- llvm-toolchain-precise
packages:
- g++-multilib
@@ -58,7 +61,7 @@ matrix:
- gcc-5-multilib
- g++-5-multilib
- bzip2
- clang-3.7
- clang-3.9
- libc6-dbg
- os: linux
compiler: clang
@@ -67,7 +70,7 @@ matrix:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
- llvm-toolchain-precise-3.9
- llvm-toolchain-precise
packages:
- g++-multilib
@@ -78,17 +81,18 @@ matrix:
- lib32gcc1
- libc6-i386
- lib32z1-dev
- zlib1g-dev
- bzip2
- clang-3.7
- clang-3.9
- 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" CXX11="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.7
- llvm-toolchain-precise-3.9
- llvm-toolchain-precise
packages:
- g++-multilib
@@ -96,7 +100,7 @@ matrix:
- gcc-5-multilib
- g++-5-multilib
- bzip2
- clang-3.7
- clang-3.9
- libc6-dbg
- os: linux
compiler: clang
@@ -105,7 +109,7 @@ matrix:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
- llvm-toolchain-precise-3.9
- llvm-toolchain-precise
packages:
- g++-multilib
@@ -116,8 +120,9 @@ matrix:
- lib32gcc1
- libc6-i386
- lib32z1-dev
- zlib1g-dev
- bzip2
- clang-3.7
- clang-3.9
- libc6-dbg
- os: linux
compiler: gcc
@@ -135,7 +140,7 @@ matrix:
- 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" CXX11="ON" ARCH="32" BOOST="ON" SHARED="ON" CHAR_SIGN="unsigned" API_VERSION="3" X3_PARSE="ON"
addons:
apt:
sources:
@@ -149,6 +154,7 @@ matrix:
- lib32gcc1
- libc6-i386
- lib32z1-dev
- zlib1g-dev
- bzip2
- libc6-dbg
- os: linux
@@ -181,6 +187,7 @@ matrix:
- lib32gcc1
- libc6-i386
- lib32z1-dev
- zlib1g-dev
- bzip2
- libc6-dbg
- os: linux
@@ -199,8 +206,10 @@ matrix:
- lib32gcc1
- libc6-i386
- lib32z1-dev
- zlib1g-dev
- bzip2
- libc6-dbg
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,3 +1,62 @@
# 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 is happend, 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)
* Improve documents (#616)
* 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)
* Improve cross platform configuration (#601)
* Remove some warnings (#599, #602, #605)
# 2017-06-07 version 2.1.2
* Improve documents (#565)
* Fix empty map parse bug (#568)
* Improve build system (#569, #570, #572, #579, #591, #592)
* Remove some warnings (#574, #578, #586, #588)
* Improve cross platform configuration (#577, #582)
* Add cmake package config support (#580)
* Fix streaming unpack bug (#585)
# 2017-02-04 version 2.1.1
* Fix unpacker's buffer management bug (#561)
* Add boost string_view adaptor (#558)
* Remove some warnings (#557, #559)
* Improve coding style (#556)
# 2017-01-10 version 2.1.0
## << breaking changes >>

View File

@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED (VERSION 2.8.6)
CMAKE_MINIMUM_REQUIRED (VERSION 2.8.12)
IF ((CMAKE_VERSION VERSION_GREATER 3.1) OR
(CMAKE_VERSION VERSION_EQUAL 3.1))
@@ -50,7 +50,15 @@ IF (MSGPACK_USE_X3_PARSE)
ENDIF ()
ENDIF ()
ELSE ()
IF (MSGPACK_CXX11)
IF (MSGPACK_CXX17)
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET (CMAKE_CXX_FLAGS "-std=c++17 ${CMAKE_CXX_FLAGS}")
ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
SET (CMAKE_CXX_FLAGS "-std=c++17 ${CMAKE_CXX_FLAGS}")
ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
MESSAGE ( FATAL_ERROR "MSVC doesn't support C++17.")
ENDIF ()
ELSEIF (MSGPACK_CXX11)
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET (CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
@@ -92,21 +100,20 @@ OPTION (MSGPACK_BUILD_EXAMPLES "Build msgpack examples." ON)
IF (MSGPACK_BOOST)
SET (CMAKE_CXX_FLAGS "-DMSGPACK_USE_BOOST ${CMAKE_CXX_FLAGS}")
ENDIF ()
SET (Boost_USE_STATIC_LIBS ON) # only find static libs
SET (Boost_USE_MULTITHREADED ON)
SET (Boost_USE_STATIC_RUNTIME OFF)
FIND_PACKAGE (Boost COMPONENTS chrono context timer system)
IF (Boost_INCLUDE_DIRS)
INCLUDE_DIRECTORIES (
${Boost_INCLUDE_DIRS}
)
ENDIF ()
IF (MSGPACK_BOOST_DIR)
INCLUDE_DIRECTORIES (
${MSGPACK_BOOST_DIR}
)
SET (Boost_USE_MULTITHREADED ON)
SET (Boost_USE_STATIC_RUNTIME OFF)
FIND_PACKAGE (Boost REQUIRED COMPONENTS chrono context system timer)
INCLUDE_DIRECTORIES (
${Boost_INCLUDE_DIRS}
)
LINK_DIRECTORIES (
${Boost_LIBRARY_DIRS}
)
IF (MSGPACK_BOOST_DIR)
INCLUDE_DIRECTORIES (
${MSGPACK_BOOST_DIR}
)
ENDIF ()
ENDIF ()
IF (MSGPACK_CHAR_SIGN)
@@ -117,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)
@@ -127,7 +134,7 @@ FOREACH (F ${PREDEF_FILES})
FILE (READ ${CMAKE_CURRENT_SOURCE_DIR}/external/boost/predef/include/boost/${F} CONTENT)
STRING(REPLACE "BOOST_" "MSGPACK_" CONTENT ${CONTENT})
STRING(REPLACE "boost/" "msgpack/" CONTENT ${CONTENT})
FILE (WRITE ${CMAKE_CURRENT_SOURCE_DIR}/include/msgpack/${F} ${CONTENT})
FILE (GENERATE OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/include/msgpack/${F} CONTENT ${CONTENT})
ENDFOREACH ()
FILE (GLOB_RECURSE PREPROCESSOR_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/external/boost/preprocessor/include/boost ${CMAKE_CURRENT_SOURCE_DIR}/external/boost/preprocessor/include/boost/*.hpp)
@@ -137,7 +144,7 @@ FOREACH (F ${PREPROCESSOR_FILES})
FILE (READ ${CMAKE_CURRENT_SOURCE_DIR}/external/boost/preprocessor/include/boost/${F} CONTENT)
STRING(REPLACE "BOOST_" "MSGPACK_" CONTENT ${CONTENT})
STRING(REPLACE "boost/" "msgpack/" CONTENT ${CONTENT})
FILE (WRITE ${CMAKE_CURRENT_SOURCE_DIR}/include/msgpack/${F} ${CONTENT})
FILE (GENERATE OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/include/msgpack/${F} CONTENT ${CONTENT})
ENDFOREACH ()
FIND_PACKAGE (GTest)
@@ -174,17 +181,20 @@ CONFIGURE_FILE (
@ONLY
)
INCLUDE_DIRECTORIES (
./
include/
${CMAKE_CURRENT_BINARY_DIR}/include/
)
IF (MSGPACK_ENABLE_SHARED)
ADD_LIBRARY (msgpackc SHARED
${msgpackc_SOURCES}
${msgpackc_HEADERS}
)
TARGET_INCLUDE_DIRECTORIES (msgpackc
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
ENDIF ()
ADD_LIBRARY (msgpackc-static STATIC
@@ -192,6 +202,20 @@ ADD_LIBRARY (msgpackc-static STATIC
${msgpackc_HEADERS}
)
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)
# Add alias for subdirectories
ADD_LIBRARY (msgpackc ALIAS msgpackc-static)
ENDIF ()
SET_TARGET_PROPERTIES (msgpackc-static PROPERTIES OUTPUT_NAME "msgpackc")
IF (MSGPACK_ENABLE_SHARED)
IF (MSVC)
@@ -213,9 +237,9 @@ 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 ()
SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3" )
SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra" )
ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
@@ -235,7 +259,12 @@ ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC90" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC10")
SET_SOURCE_FILES_PROPERTIES(${msgpackc_SOURCES} PROPERTIES LANGUAGE CXX)
ENDIF()
ENDIF ()
IF ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "sparc")
SET (CMAKE_C_FLAGS "-DMSGPACK_ZONE_ALIGN=8 ${CMAKE_C_FLAGS}")
SET (CMAKE_CXX_FLAGS "-DMSGPACK_ZONE_ALIGN=8 ${CMAKE_CXX_FLAGS}")
ENDIF ()
IF (NOT DEFINED CMAKE_INSTALL_BINDIR)
SET(CMAKE_INSTALL_BINDIR bin)
@@ -255,10 +284,15 @@ ELSE()
SET (MSGPACK_INSTALLTARGETS msgpackc-static)
ENDIF ()
INSTALL (TARGETS ${MSGPACK_INSTALLTARGETS} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
INSTALL (DIRECTORY include DESTINATION ${CMAKE_INSTALL_PREFIX})
INSTALL (TARGETS ${MSGPACK_INSTALLTARGETS} EXPORT msgpack-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
FOREACH (file ${msgpackc_HEADERS})
GET_FILENAME_COMPONENT (dir ${file} PATH)
INSTALL (FILES ${file} DESTINATION ${CMAKE_INSTALL_PREFIX}/${dir})
ENDFOREACH ()
IF (NOT MSVC)
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/msgpack.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
ENDIF ()
@@ -309,3 +343,39 @@ IF (DOXYGEN_FOUND)
DEPENDS doxygen_c doxygen_cpp
)
ENDIF ()
INCLUDE (CMakePackageConfigHelpers)
SET (CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/msgpack")
WRITE_BASIC_PACKAGE_VERSION_FILE (
msgpack-config-version.cmake
VERSION ${VERSION}
COMPATIBILITY SameMajorVersion
)
IF (NOT CMAKE_VERSION VERSION_LESS 3.0)
EXPORT (EXPORT msgpack-targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/msgpack-targets.cmake"
)
ENDIF ()
CONFIGURE_PACKAGE_CONFIG_FILE (msgpack-config.cmake.in
msgpack-config.cmake
INSTALL_DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
)
INSTALL (EXPORT msgpack-targets
FILE
msgpack-targets.cmake
DESTINATION
"${CMAKE_INSTALL_CMAKEDIR}"
)
INSTALL (
FILES
"${CMAKE_CURRENT_BINARY_DIR}/msgpack-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/msgpack-config-version.cmake"
DESTINATION
"${CMAKE_INSTALL_CMAKEDIR}"
)

View File

@@ -165,6 +165,7 @@ IF (MSGPACK_ENABLE_CXX)
include/msgpack/adaptor/boost/msgpack_variant_decl.hpp
include/msgpack/adaptor/boost/optional.hpp
include/msgpack/adaptor/boost/string_ref.hpp
include/msgpack/adaptor/boost/string_view.hpp
include/msgpack/adaptor/carray.hpp
include/msgpack/adaptor/char_ptr.hpp
include/msgpack/adaptor/check_container_size.hpp
@@ -179,6 +180,8 @@ 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/optional.hpp
include/msgpack/adaptor/cpp17/string_view.hpp
include/msgpack/adaptor/define.hpp
include/msgpack/adaptor/define_decl.hpp
include/msgpack/adaptor/deque.hpp
@@ -213,6 +216,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
@@ -220,12 +225,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
@@ -512,6 +521,7 @@ IF (MSGPACK_ENABLE_CXX)
include/msgpack/v1/adaptor/boost/msgpack_variant_decl.hpp
include/msgpack/v1/adaptor/boost/optional.hpp
include/msgpack/v1/adaptor/boost/string_ref.hpp
include/msgpack/v1/adaptor/boost/string_view.hpp
include/msgpack/v1/adaptor/carray.hpp
include/msgpack/v1/adaptor/char_ptr.hpp
include/msgpack/v1/adaptor/check_container_size.hpp
@@ -526,6 +536,8 @@ 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/optional.hpp
include/msgpack/v1/adaptor/cpp17/string_view.hpp
include/msgpack/v1/adaptor/define.hpp
include/msgpack/v1/adaptor/define_decl.hpp
include/msgpack/v1/adaptor/deque.hpp
@@ -535,6 +547,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
@@ -626,31 +639,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
@@ -96,7 +96,7 @@ int main(void) {
/* deserializes it. */
msgpack_unpacked msg;
msgpack_unpacked_init(&msg);
bool success = msgpack_unpack_next(&msg, buffer->data, buffer->size, NULL);
msgpack_unpack_return ret = msgpack_unpack_next(&msg, buffer->data, buffer->size, NULL);
/* prints the deserialized object. */
msgpack_object obj = msg.data;
@@ -137,7 +137,7 @@ int main(void) {
/* deserializes it. */
msgpack_unpacked msg;
msgpack_unpacked_init(&msg);
bool success = msgpack_unpack_next(&msg, buffer->data, buffer->size, NULL);
msgpack_unpack_return ret = msgpack_unpack_next(&msg, buffer->data, buffer->size, NULL);
/* prints the deserialized object. */
msgpack_object obj = msg.data;

View File

@@ -78,7 +78,7 @@ int main(void) {
// now starts streaming deserialization.
msgpack::object_handle oh;
while(pac.next(&oh)) {
while(pac.next(oh)) {
std::cout << oh.get() << std::endl;
}

View File

@@ -1,9 +1,9 @@
`msgpack` for C/C++
===================
Version 2.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)
Version 3.0.1 [![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

View File

@@ -1,15 +1,19 @@
version: 2.1.0.{build}
version: 3.0.1.{build}
image:
- Visual Studio 2015
environment:
global:
BOOST_ROOT: C:\Libraries\boost_1_60_0
matrix:
- cpp11: -DMSGPACK_CXX11=OFF
boost: -DMSGPACK_BOOST=ON
boost: -DMSGPACK_BOOST=OFF
msvc: '"Visual Studio 10 2010"'
- cpp11: -DMSGPACK_CXX11=OFF
boost: -DMSGPACK_BOOST=ON
boost: -DMSGPACK_BOOST=OFF
msvc: '"Visual Studio 11 2012"'
- cpp11: -DMSGPACK_CXX11=OFF
boost: -DMSGPACK_BOOST=ON
boost: -DMSGPACK_BOOST=OFF
msvc: '"Visual Studio 12 2013"'
- cpp11: -DMSGPACK_CXX11=ON
boost: -DMSGPACK_BOOST=ON
@@ -33,10 +37,10 @@ build_script:
- cmake --build . --config Release
- cd ..
- cd ..
- appveyor DownloadFile http://zlib.net/zlib-1.2.10.tar.gz -FileName zlib-1.2.10.tar.gz
- 7z x zlib-1.2.10.tar.gz > NUL
- 7z x zlib-1.2.10.tar > NUL
- cd zlib-1.2.10
- appveyor DownloadFile http://zlib.net/zlib-1.2.11.tar.gz -FileName zlib-1.2.11.tar.gz
- 7z x zlib-1.2.11.tar.gz > NUL
- 7z x zlib-1.2.11.tar > NUL
- cd zlib-1.2.11
- md build
- cd build
- cmake -G %msvc% ..
@@ -46,9 +50,9 @@ build_script:
- cd ..
- md build
- cd build
- cmake -G %msvc% %cpp11% %boost% %x3_parse% -DMSGPACK_BOOST_DIR=C:\Libraries\\boost_1_60_0 -DGTEST_LIBRARY=%APPVEYOR_BUILD_FOLDER%\googletest-release-1.7.0\build\Release\gtest.lib -DGTEST_MAIN_LIBRARY=%APPVEYOR_BUILD_FOLDER%\googletest-release-1.7.0\build\Release\gtest_main.lib -DGTEST_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%\googletest-release-1.7.0\include -DZLIB_LIBRARY=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.10\build\Release\zlib.lib -DZLIB_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.10 -DCMAKE_CXX_FLAGS='"/D_VARIADIC_MAX=10 /EHsc"' ..
- cmake -G %msvc% %cpp11% %boost% %x3_parse% -DGTEST_LIBRARY=%APPVEYOR_BUILD_FOLDER%\googletest-release-1.7.0\build\Release\gtest.lib -DGTEST_MAIN_LIBRARY=%APPVEYOR_BUILD_FOLDER%\googletest-release-1.7.0\build\Release\gtest_main.lib -DGTEST_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%\googletest-release-1.7.0\include -DZLIB_LIBRARY=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.11\build\Release\zlib.lib -DZLIB_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.11 -DCMAKE_CXX_FLAGS='"/D_VARIADIC_MAX=10 /EHsc"' ..
- cmake --build . --config Release
test_script:
- set PATH=%PATH%;%APPVEYOR_BUILD_FOLDER%\googletest-release-1.7.0\build\Release;%APPVEYOR_BUILD_FOLDER%\zlib-1.2.10\build\Release;%APPVEYOR_BUILD_FOLDER%\build\release
- set PATH=%PATH%;%APPVEYOR_BUILD_FOLDER%\googletest-release-1.7.0\build\Release;%APPVEYOR_BUILD_FOLDER%\zlib-1.2.11\build\Release;%APPVEYOR_BUILD_FOLDER%\build\release
- ctest -V

View File

@@ -66,14 +66,16 @@ struct define_array<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> {
msgpack::object *ptr = o.via.array.ptr;
switch(size) {
default:<%(i).downto(0) {|j|%>
case <%=j+1%>: ptr[<%=j%>].convert(a<%=j%>);<%}%>
case <%=j+1%>: ptr[<%=j%>].convert(a<%=j%>);
// fallthrough
<%}%>
}
}
}
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::ARRAY;
o->via.array.ptr = static_cast<msgpack::object*>(z.allocate_align(sizeof(msgpack::object)*<%=i+1%>));
o->via.array.ptr = static_cast<msgpack::object*>(z.allocate_align(sizeof(msgpack::object)*<%=i+1%>, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o->via.array.size = <%=i+1%>;
<%0.upto(i) {|j|%>
o->via.array.ptr[<%=j%>] = msgpack::object(a<%=j%>, z);<%}%>

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(
@@ -82,7 +83,7 @@ struct define_map<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> {
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::MAP;
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*<%=(i+1)/2%>));
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*<%=(i+1)/2%>, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
o->via.map.size = <%=(i+1)/2%>;
<%0.step(i,2) {|j|%>
o->via.map.ptr[<%=j/2%>].key = msgpack::object(a<%=j%>, z);

View File

@@ -207,7 +207,7 @@ struct object_with_zone<type::tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> > {
msgpack::object::with_zone& o,
const type::tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*<%=i+1%>));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*<%=i+1%>, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = <%=i+1%>;
<%0.upto(i) {|j|%>
o.via.array.ptr[<%=j%>] = msgpack::object(v.template get<<%=j%>>(), o.zone);<%}%>

View File

@@ -178,7 +178,9 @@ private:
template <typename T>
static void object_delete(void* obj);
void* allocate_expand(size_t size);
static char* get_aligned(char* ptr, size_t align);
char* allocate_expand(size_t size);
private:
zone(const zone&);
zone& operator=(const zone&);
@@ -188,37 +190,42 @@ inline zone::zone(size_t chunk_size) /* throw() */ :m_chunk_size(chunk_size), m_
{
}
inline void* zone::allocate_align(size_t size, size_t align)
inline char* zone::get_aligned(char* ptr, size_t align)
{
char* aligned =
return
reinterpret_cast<char*>(
reinterpret_cast<size_t>(
(m_chunk_list.m_ptr + (align - 1))) / align * align);
(ptr + (align - 1))) / align * align);
}
inline void* zone::allocate_align(size_t size, size_t align)
{
char* aligned = get_aligned(m_chunk_list.m_ptr, align);
size_t adjusted_size = size + (aligned - m_chunk_list.m_ptr);
if(m_chunk_list.m_free >= adjusted_size) {
m_chunk_list.m_free -= adjusted_size;
m_chunk_list.m_ptr += adjusted_size;
return aligned;
if (m_chunk_list.m_free < adjusted_size) {
size_t enough_size = size + align - 1;
char* ptr = allocate_expand(enough_size);
aligned = get_aligned(ptr, align);
adjusted_size = size + (aligned - m_chunk_list.m_ptr);
}
return reinterpret_cast<char*>(
reinterpret_cast<size_t>(
allocate_expand(size + (align - 1))) / align * align);
m_chunk_list.m_free -= adjusted_size;
m_chunk_list.m_ptr += adjusted_size;
return aligned;
}
inline void* zone::allocate_no_align(size_t size)
{
if(m_chunk_list.m_free < size) {
return allocate_expand(size);
}
char* ptr = m_chunk_list.m_ptr;
if(m_chunk_list.m_free < size) {
ptr = allocate_expand(size);
}
m_chunk_list.m_free -= size;
m_chunk_list.m_ptr += size;
return ptr;
}
inline void* zone::allocate_expand(size_t size)
inline char* zone::allocate_expand(size_t size)
{
chunk_list* const cl = &m_chunk_list;
@@ -240,8 +247,8 @@ inline void* zone::allocate_expand(size_t size)
c->m_next = cl->m_head;
cl->m_head = c;
cl->m_free = sz - size;
cl->m_ptr = ptr + size;
cl->m_free = sz;
cl->m_ptr = ptr;
return ptr;
}
@@ -300,7 +307,7 @@ inline std::size_t aligned_size(
template <typename T<%1.upto(i) {|j|%>, typename A<%=j%><%}%>>
T* zone::allocate(<%=(1..i).map{|j|"A#{j} a#{j}"}.join(', ')%>)
{
void* x = allocate_align(sizeof(T));
void* x = allocate_align(sizeof(T), MSGPACK_ZONE_ALIGNOF(T));
try {
m_finalizer_array.push(&zone::object_destruct<T>, x);
} catch (...) {

View File

@@ -24,6 +24,14 @@
#define MSGPACK_ZONE_ALIGN sizeof(void*)
#endif
#if defined(_MSC_VER)
#define MSGPACK_ZONE_ALIGNOF(type) __alignof(type)
#else
#define MSGPACK_ZONE_ALIGNOF(type) __alignof__(type)
#endif
// For a compiler that doesn't support __alignof__:
// #define MSGPACK_ZONE_ALIGNOF(type) MSGPACK_ZONE_ALIGN
<% GENERATION_LIMIT = 15 %>
namespace msgpack {

View File

@@ -3,6 +3,20 @@ IF (MSGPACK_BOOST)
msgpack_variant_capitalize.cpp
msgpack_variant_mapbased.cpp
)
IF (MSGPACK_CXX11 OR MSGPACK_CXX17)
FIND_PACKAGE (Threads REQUIRED)
LIST (APPEND exec_PROGRAMS
asio_send_recv.cpp
)
IF (ZLIB_FOUND)
INCLUDE_DIRECTORIES (
${ZLIB_INCLUDE_DIRS}
)
LIST (APPEND exec_PROGRAMS
asio_send_recv_zlib.cpp
)
ENDIF ()
ENDIF ()
ENDIF ()
FOREACH (source_file ${exec_PROGRAMS})
@@ -11,8 +25,21 @@ FOREACH (source_file ${exec_PROGRAMS})
${source_file_we}
${source_file}
)
TARGET_INCLUDE_DIRECTORIES (${source_file_we}
PRIVATE
$<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES>
)
TARGET_LINK_LIBRARIES (${source_file_we}
${Boost_SYSTEM_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
)
IF (ZLIB_FOUND)
TARGET_LINK_LIBRARIES (${source_file_we}
${ZLIB_LIBRARIES}
)
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

@@ -0,0 +1,104 @@
// MessagePack for C++ example
//
// 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)
//
#include <string>
#include <sstream>
#include <iostream>
#include <boost/asio.hpp>
#include <boost/lexical_cast.hpp>
#include <msgpack.hpp>
int main() {
boost::asio::io_service ios;
std::uint16_t const port = 12345;
// Server
std::size_t const window_size = 10;
boost::asio::ip::tcp::acceptor ac(ios, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port));
boost::asio::ip::tcp::socket ss(ios);
std::function<void()> do_accept;
std::function<void()> do_async_read_some;
msgpack::unpacker unp;
do_accept = [&] {
ac.async_accept(
ss,
[&]
(boost::system::error_code const& e) {
if (e) {
std::cout << __LINE__ << ":" << e.message() << std::endl;
return;
}
unp.reserve_buffer(window_size);
do_async_read_some = [&] {
ss.async_read_some(
boost::asio::buffer(unp.buffer(), window_size),
[&](boost::system::error_code const& e, std::size_t bytes_transferred) {
if (e) {
std::cout << __LINE__ << ":" << e.message() << std::endl;
return;
}
std::cout << bytes_transferred << " bytes read." << std::endl;
unp.buffer_consumed(bytes_transferred);
msgpack::object_handle oh;
while (unp.next(oh)) {
std::cout << oh.get() << std::endl;
// In order to finish the program,
// return if one complete msgpack is processed.
// In actual server, don't return here.
return;
}
do_async_read_some();
}
);
};
do_async_read_some();
}
);
};
do_accept();
// 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) {
std::cout << __LINE__ << ":" << e.message() << std::endl;
return;
}
std::cout << __LINE__ << ":client connected" << std::endl;
msgpack::sbuffer sb;
msgpack::pack(sb, std::make_tuple(42, false, "hello world", 12.3456));
write(cs, boost::asio::buffer(sb.data(), sb.size()));
}
);
// Start
ios.run();
}

View File

@@ -0,0 +1,176 @@
// MessagePack for C++ example
//
// 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)
//
#include <string>
#include <sstream>
#include <iostream>
#include <boost/asio.hpp>
#include <boost/lexical_cast.hpp>
#include <msgpack.hpp>
#include <msgpack/zbuffer.hpp>
#include <zlib.h>
void print(std::string const& buf) {
for (std::string::const_iterator it = buf.begin(), end = buf.end();
it != end;
++it) {
std::cout
<< std::setw(2)
<< std::hex
<< std::setfill('0')
<< (static_cast<int>(*it) & 0xff)
<< ' ';
}
std::cout << std::dec << std::endl;
}
int main() {
boost::asio::io_service ios;
std::uint16_t const port = 12345;
int num_of_zlib_data = 2;
int idx_zlib_data = 0;
// Server
std::size_t const window_size = 11;
boost::asio::ip::tcp::acceptor ac(ios, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port));
boost::asio::ip::tcp::socket ss(ios);
std::function<void()> do_accept;
std::function<void()> do_async_read_some;
// zlib for decompress
z_stream strm;
auto zlib_init = [&] {
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
strm.next_in = Z_NULL;
{
int zret = inflateInit(&strm);
if (zret != Z_OK) {
std::cout << "Zlib inflateInit() error = " << zret << std::endl;
}
}
};
zlib_init();
std::vector<char> buf(4); // buf size
msgpack::unpacker unp;
do_accept = [&] {
ac.async_accept(
ss,
[&]
(boost::system::error_code const& e) {
if (e) {
std::cout << __LINE__ << ":" << e.message() << std::endl;
return;
}
do_async_read_some = [&] {
ss.async_read_some(
boost::asio::buffer(buf),
[&](boost::system::error_code const& e, std::size_t bytes_transferred) {
if (e) {
std::cout << __LINE__ << ":" << e.message() << std::endl;
return;
}
std::cout << bytes_transferred << " bytes read." << std::endl;
print(std::string(std::string(&buf[0], buf.size())));
strm.avail_in = bytes_transferred;
do {
strm.next_in = reinterpret_cast<unsigned char*>(&buf[0]) + (bytes_transferred - strm.avail_in);
int zret;
unp.reserve_buffer(window_size);
strm.avail_out = window_size;
strm.next_out = reinterpret_cast<unsigned char*>(unp.buffer());
do {
zret = inflate(&strm, Z_NO_FLUSH);
assert(zret != Z_STREAM_ERROR);
switch (zret) {
case Z_NEED_DICT:
zret = Z_DATA_ERROR;
// fall through
case Z_DATA_ERROR:
case Z_MEM_ERROR:
inflateEnd(&strm);
std::cout << "Zlib inflate() error = " << zret << std::endl;
std::exit(-1);
}
std::size_t decompressed_size = window_size - strm.avail_out;
std::cout << decompressed_size << " bytes decompressed." << std::endl;
unp.buffer_consumed(decompressed_size);
msgpack::object_handle oh;
while (unp.next(oh)) {
std::cout << oh.get() << std::endl;
}
} while (strm.avail_out == 0);
if (zret == Z_STREAM_END) {
inflateEnd(&strm);
std::cout << "Zlib decompress finished." << std::endl;
++idx_zlib_data;
if (idx_zlib_data == num_of_zlib_data) {
std::cout << "All zlib decompress finished." << std::endl;
return;
}
zlib_init();
}
} while (strm.avail_in != 0);
do_async_read_some();
}
);
};
do_async_read_some();
}
);
};
do_accept();
// 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) {
std::cout << __LINE__ << ":" << e.message() << std::endl;
return;
}
std::cout << __LINE__ << ":client connected" << std::endl;
for (int i = 0; i != num_of_zlib_data; ++i) {
msgpack::zbuffer zb;
msgpack::pack(zb, std::make_tuple(i, false, "hello world", 12.3456));
zb.flush(); // finalize zbuffer (don't forget it)
print(std::string(zb.data(), zb.size()));
write(cs, boost::asio::buffer(zb.data(), zb.size()));
}
}
);
// Start
ios.run();
}

View File

@@ -23,7 +23,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

@@ -22,7 +22,7 @@ void test()
msgpack_unpacked_init(&msg);
while (msgpack_unpack_next(&msg, buf.data, buf.size, &upk_pos)) {
while (msgpack_unpack_next(&msg, buf.data, buf.size, &upk_pos) == MSGPACK_UNPACK_SUCCESS) {
}
msgpack_sbuffer_destroy(&buf);

View File

@@ -23,7 +23,7 @@ void test()
msgpack_unpacked_init(&msg);
while (msgpack_unpack_next(&msg, buf.data, buf.size, &upk_pos)) {
while (msgpack_unpack_next(&msg, buf.data, buf.size, &upk_pos) == MSGPACK_UNPACK_SUCCESS) {
}
msgpack_sbuffer_destroy(&buf);

View File

@@ -22,7 +22,7 @@ IF (NOT MSVC)
)
ENDIF ()
IF (Boost_TIMER_LIBRARY AND Boost_CHRONO_LIBRARY AND Boost_SYSTEM_LIBRARY)
IF (MSGPACK_BOOST)
LIST (APPEND with_boost_lib_PROGRAMS
speed_test.cpp
speed_test_nested_array.cpp
@@ -35,8 +35,12 @@ FOREACH (source_file ${exec_PROGRAMS})
${source_file_we}
${source_file}
)
TARGET_INCLUDE_DIRECTORIES (${source_file_we}
PRIVATE
$<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]")
@@ -53,11 +57,15 @@ FOREACH (source_file ${with_pthread_PROGRAMS})
${source_file_we}
${source_file}
)
TARGET_INCLUDE_DIRECTORIES (${source_file_we}
PRIVATE
$<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES>
)
TARGET_LINK_LIBRARIES (${source_file_we}
${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]")
@@ -78,6 +86,10 @@ FOREACH (source_file ${with_boost_lib_PROGRAMS})
${source_file_we}
${source_file}
)
TARGET_INCLUDE_DIRECTORIES (${source_file_we}
PRIVATE
$<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES>
)
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
TARGET_LINK_LIBRARIES (${source_file_we}
${Boost_TIMER_LIBRARY}

View File

@@ -69,7 +69,7 @@ struct object_with_zone<my_class> {
o.type = type::ARRAY;
o.via.array.size = 2;
o.via.array.ptr = static_cast<msgpack::object*>(
o.zone.allocate_align(sizeof(msgpack::object) * o.via.array.size));
o.zone.allocate_align(sizeof(msgpack::object) * o.via.array.size, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.ptr[0] = msgpack::object(v.get_name(), o.zone);
o.via.array.ptr[1] = msgpack::object(v.get_age(), o.zone);
}

View File

@@ -20,8 +20,12 @@ IF (MSGPACK_CXX11)
${source_file_we}
${source_file}
)
TARGET_INCLUDE_DIRECTORIES (${source_file_we}
PRIVATE
$<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
)
@@ -7,7 +7,7 @@ IF (MSGPACK_USE_X3_PARSE)
unpack.cpp
parse.cpp
)
IF (Boost_CONTEXT_LIBRARY AND Boost_SYSTEM_LIBRARY AND CMAKE_THREAD_LIBS_INIT)
IF (MSGPACK_BOOST)
LIST (APPEND with_boost_PROGRAMS
stream_unpack.cpp
)
@@ -18,8 +18,12 @@ IF (MSGPACK_USE_X3_PARSE)
${source_file_we}
${source_file}
)
TARGET_INCLUDE_DIRECTORIES (${source_file_we}
PRIVATE
$<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")
@@ -40,13 +44,17 @@ IF (MSGPACK_USE_X3_PARSE)
${source_file_we}
${source_file}
)
TARGET_INCLUDE_DIRECTORIES (${source_file_we}
PRIVATE
$<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES>
)
TARGET_LINK_LIBRARIES (${source_file_we}
${Boost_CONTEXT_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${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")

View File

@@ -40,7 +40,13 @@ struct json_like_visitor : msgpack::v2::null_visitor {
m_s += ss.str();
return true;
}
bool visit_float(double v) {
bool visit_float32(float v) {
std::stringstream ss;
ss << v;
m_s += ss.str();
return true;
}
bool visit_float64(double v) {
std::stringstream ss;
ss << v;
m_s += ss.str();

View File

@@ -21,8 +21,17 @@
#include <boost/asio.hpp>
#include <boost/coroutine2/all.hpp>
#if defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif // defined(__clang__)
#include <boost/spirit/home/support/multi_pass.hpp>
#if defined(__clang__)
#pragma GCC diagnostic pop
#endif // defined(__clang__)
namespace as = boost::asio;
namespace x3 = boost::spirit::x3;

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

@@ -0,0 +1,15 @@
//
// 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_BOOST_STRING_VIEW_HPP
#define MSGPACK_TYPE_BOOST_STRING_VIEW_HPP
#include "msgpack/v1/adaptor/boost/string_view.hpp"
#endif // MSGPACK_TYPE_BOOST_STRING_VIEW_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_CPP17_OPTIONAL_HPP
#define MSGPACK_TYPE_CPP17_OPTIONAL_HPP
#include "msgpack/v1/adaptor/cpp17/optional.hpp"
#endif // MSGPACK_TYPE_CPP17_OPTIONAL_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_CPP17_STRING_VIEW_HPP
#define MSGPACK_TYPE_CPP17_STRING_VIEW_HPP
#include "msgpack/v1/adaptor/cpp17/string_view.hpp"
#endif // MSGPACK_TYPE_CPP17_STRING_VIEW_HPP

View File

@@ -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

@@ -84,7 +84,7 @@ struct object_with_zone<MSGPACK_STD_TR1::unordered_map<K, V, Hash, Pred, Alloc>
o.via.map.size = 0;
} else {
uint32_t size = checked_get_container_size(v.size());
msgpack::object_kv* p = static_cast<msgpack::object_kv*>(o.zone.allocate_align(sizeof(msgpack::object_kv)*size));
msgpack::object_kv* p = static_cast<msgpack::object_kv*>(o.zone.allocate_align(sizeof(msgpack::object_kv)*size, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
msgpack::object_kv* const pend = p + size;
o.via.map.ptr = p;
o.via.map.size = size;
@@ -141,7 +141,7 @@ struct object_with_zone<MSGPACK_STD_TR1::unordered_multimap<K, V, Hash, Pred, Al
o.via.map.size = 0;
} else {
uint32_t size = checked_get_container_size(v.size());
msgpack::object_kv* p = static_cast<msgpack::object_kv*>(o.zone.allocate_align(sizeof(msgpack::object_kv)*size));
msgpack::object_kv* p = static_cast<msgpack::object_kv*>(o.zone.allocate_align(sizeof(msgpack::object_kv)*size, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
msgpack::object_kv* const pend = p + size;
o.via.map.ptr = p;
o.via.map.size = size;

View File

@@ -82,7 +82,7 @@ struct object_with_zone<MSGPACK_STD_TR1::unordered_set<T, Hash, Compare, Alloc>
o.via.array.size = 0;
} else {
uint32_t size = checked_get_container_size(v.size());
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size));
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
msgpack::object* const pend = p + size;
o.via.array.ptr = p;
o.via.array.size = size;
@@ -136,7 +136,7 @@ struct object_with_zone<MSGPACK_STD_TR1::unordered_multiset<T, Hash, Compare, Al
o.via.array.size = 0;
} else {
uint32_t size = checked_get_container_size(v.size());
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size));
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
msgpack::object* const pend = p + size;
o.via.array.ptr = p;
o.via.array.size = size;

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

@@ -98,6 +98,7 @@ 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);
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

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

@@ -45,6 +45,9 @@
#ifdef _WIN32
# define _msgpack_atomic_counter_header <windows.h>
# if !defined(WIN32_LEAN_AND_MEAN)
# define WIN32_LEAN_AND_MEAN
# endif /* WIN32_LEAN_AND_MEAN */
typedef long _msgpack_atomic_counter_t;
# define _msgpack_sync_decr_and_fetch(ptr) InterlockedDecrement(ptr)
# define _msgpack_sync_incr_and_fetch(ptr) InterlockedIncrement(ptr)
@@ -74,7 +77,7 @@
# endif
# endif
#else /* _*/
#elif defined(unix) || defined(__unix) || defined(__APPLE__) || defined(__OpenBSD__)
#include <arpa/inet.h> /* __BYTE_ORDER */
# if defined(linux)
@@ -85,34 +88,34 @@
#if MSGPACK_ENDIAN_LITTLE_BYTE
# ifdef _WIN32
# if defined(ntohs)
# if defined(unix) || defined(__unix) || defined(__APPLE__) || defined(__OpenBSD__)
# define _msgpack_be16(x) ntohs(x)
# elif defined(_byteswap_ushort) || (defined(_MSC_VER) && _MSC_VER >= 1400)
# define _msgpack_be16(x) ((uint16_t)_byteswap_ushort((unsigned short)x))
# else
# define _msgpack_be16(x) ( \
((((uint16_t)x) << 8) ) | \
((((uint16_t)x) >> 8) ) )
# endif
# else
# define _msgpack_be16(x) ntohs(x)
# if defined(ntohs)
# define _msgpack_be16(x) ntohs(x)
# elif defined(_byteswap_ushort) || (defined(_MSC_VER) && _MSC_VER >= 1400)
# define _msgpack_be16(x) ((uint16_t)_byteswap_ushort((unsigned short)x))
# else
# define _msgpack_be16(x) ( \
((((uint16_t)x) << 8) ) | \
((((uint16_t)x) >> 8) ) )
# endif
# endif
# ifdef _WIN32
# if defined(ntohl)
# define _msgpack_be32(x) ntohl(x)
# elif defined(_byteswap_ulong) || (defined(_MSC_VER) && _MSC_VER >= 1400)
# define _msgpack_be32(x) ((uint32_t)_byteswap_ulong((unsigned long)x))
# else
# define _msgpack_be32(x) \
( ((((uint32_t)x) << 24) ) | \
((((uint32_t)x) << 8) & 0x00ff0000U ) | \
((((uint32_t)x) >> 8) & 0x0000ff00U ) | \
((((uint32_t)x) >> 24) ) )
# endif
# if defined(unix) || defined(__unix) || defined(__APPLE__) || defined(__OpenBSD__)
# define _msgpack_be32(x) ntohl(x)
# else
# define _msgpack_be32(x) ntohl(x)
# if defined(ntohl)
# define _msgpack_be32(x) ntohl(x)
# elif defined(_byteswap_ulong) || (defined(_MSC_VER) && _MSC_VER >= 1400)
# define _msgpack_be32(x) ((uint32_t)_byteswap_ulong((unsigned long)x))
# else
# define _msgpack_be32(x) \
( ((((uint32_t)x) << 24) ) | \
((((uint32_t)x) << 8) & 0x00ff0000U ) | \
((((uint32_t)x) >> 8) & 0x0000ff00U ) | \
((((uint32_t)x) >> 24) ) )
# endif
# endif
# if defined(_byteswap_uint64) || (defined(_MSC_VER) && _MSC_VER >= 1400)

View File

@@ -42,6 +42,14 @@
#include "adaptor/cpp11/unordered_map.hpp"
#include "adaptor/cpp11/unordered_set.hpp"
#if MSGPACK_HAS_INCLUDE(<optional>)
#include "adaptor/cpp17/optional.hpp"
#endif // MSGPACK_HAS_INCLUDE(<optional>)
#if MSGPACK_HAS_INCLUDE(<string_view>)
#include "adaptor/cpp17/string_view.hpp"
#endif // MSGPACK_HAS_INCLUDE(<string_view>)
#endif // defined(MSGPACK_USE_CPP03)
#if defined(MSGPACK_USE_BOOST)
@@ -50,5 +58,6 @@
#include "adaptor/boost/msgpack_variant.hpp"
#include "adaptor/boost/optional.hpp"
#include "adaptor/boost/string_ref.hpp"
#include "adaptor/boost/string_view.hpp"
#endif // defined(MSGPACK_USE_BOOST)

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

@@ -236,6 +236,7 @@ msgpack_unpack_func(int, _execute)(msgpack_unpack_struct(_context)* ctx, const c
_fixed_trail_again:
++p;
// fallthrough
default:
if((size_t)(pe - p) < trail) { goto _out; }

View File

@@ -253,20 +253,20 @@ struct object_with_zone<msgpack::type::array_ref<T> > {
}
else {
uint32_t size = checked_get_container_size(v.size());
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size));
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
msgpack::object* const pend = p + size;
o.via.array.ptr = p;
o.via.array.size = size;
typename T::const_iterator it(v.data->begin());
do {
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && !defined(__clang__)
#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__ >= 6)) && !defined(__clang__)
#endif // (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
*p = msgpack::object(*it, o.zone);
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && !defined(__clang__)
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif // (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && !defined(__clang__)
#endif // (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
++p;
++it;
} while(p < pend);
@@ -280,7 +280,7 @@ struct object_with_zone<msgpack::type::array_ref<T[N]> > {
if (!v.data) { throw msgpack::type_error(); }
o.type = msgpack::type::ARRAY;
uint32_t size = checked_get_container_size(v.size());
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size));
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
msgpack::object* const pend = p + size;
o.via.array.ptr = p;
o.via.array.size = size;

View File

@@ -15,6 +15,8 @@
#include "msgpack/adaptor/check_container_size.hpp"
#include "msgpack/meta.hpp"
#include "msgpack/adaptor/pair.hpp"
#if !defined (MSGPACK_USE_CPP03)
#include "msgpack/adaptor/cpp11/tuple.hpp"
#endif // #if !defined (MSGPACK_USE_CPP03)
@@ -34,13 +36,54 @@ MSGPACK_API_VERSION_NAMESPACE(v1) {
namespace adaptor {
namespace detail {
template <typename T>
struct is_std_pair {
static bool const value = false;
};
template <typename T, typename U>
struct is_std_pair<std::pair<T, U> > {
static bool const value = true;
};
#if !defined(MSGPACK_USE_CPP03)
template <typename T>
struct is_std_tuple {
static bool const value = false;
};
template <typename... Args>
struct is_std_tuple<std::tuple<Args...>> {
static bool const value = true;
};
#endif // !defined(MSGPACK_USE_CPP03)
template <typename T>
struct is_seq_no_pair_no_tuple {
static bool const value =
boost::fusion::traits::is_sequence<T>::value
&&
!is_std_pair<T>::value
#if !defined (MSGPACK_USE_CPP03)
&&
!is_std_tuple<T>::value
#endif // !defined (MSGPACK_USE_CPP03)
;
};
} // namespace detail
#if !defined (MSGPACK_USE_CPP03)
template <typename T>
struct as<
T,
typename msgpack::enable_if<
boost::fusion::traits::is_sequence<T>::value &&
detail::is_seq_no_pair_no_tuple<T>::value &&
boost::mpl::fold<
T,
boost::mpl::bool_<true>,
@@ -82,7 +125,7 @@ struct as<
#endif // !defined (MSGPACK_USE_CPP03)
template <typename T>
struct convert<T, typename msgpack::enable_if<boost::fusion::traits::is_sequence<T>::value>::type > {
struct convert<T, typename msgpack::enable_if<detail::is_seq_no_pair_no_tuple<T>::value>::type > {
msgpack::object const& operator()(msgpack::object const& o, T& v) const {
if (o.type != msgpack::type::ARRAY) { throw msgpack::type_error(); }
if (o.via.array.size != checked_get_container_size(boost::fusion::size(v))) {
@@ -106,7 +149,7 @@ private:
};
template <typename T>
struct pack<T, typename msgpack::enable_if<boost::fusion::traits::is_sequence<T>::value>::type > {
struct pack<T, typename msgpack::enable_if<detail::is_seq_no_pair_no_tuple<T>::value>::type > {
template <typename Stream>
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const T& v) const {
uint32_t size = checked_get_container_size(boost::fusion::size(v));
@@ -128,11 +171,11 @@ private:
};
template <typename T>
struct object_with_zone<T, typename msgpack::enable_if<boost::fusion::traits::is_sequence<T>::value>::type > {
struct object_with_zone<T, typename msgpack::enable_if<detail::is_seq_no_pair_no_tuple<T>::value>::type > {
void operator()(msgpack::object::with_zone& o, const T& v) const {
uint32_t size = checked_get_container_size(boost::fusion::size(v));
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = size;
uint32_t count = 0;
boost::fusion::for_each(v, with_zone_imp(o, count));

View File

@@ -0,0 +1,87 @@
//
// 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_BOOST_STRING_VIEW_HPP
#define MSGPACK_V1_TYPE_BOOST_STRING_VIEW_HPP
#include <boost/version.hpp>
#if (BOOST_VERSION / 100000) >= 1 && ((BOOST_VERSION / 100) % 1000) >= 61
#include "msgpack/versioning.hpp"
#include "msgpack/adaptor/adaptor_base.hpp"
#include "msgpack/adaptor/check_container_size.hpp"
#include <boost/utility/string_view.hpp>
namespace msgpack {
/// @cond
MSGPACK_API_VERSION_NAMESPACE(v1) {
/// @endcond
namespace adaptor {
template <>
struct convert<boost::string_view> {
msgpack::object const& operator()(msgpack::object const& o, boost::string_view& v) const {
switch (o.type) {
case msgpack::type::BIN:
v = boost::string_view(o.via.bin.ptr, o.via.bin.size);
break;
case msgpack::type::STR:
v = boost::string_view(o.via.str.ptr, o.via.str.size);
break;
default:
throw msgpack::type_error();
break;
}
return o;
}
};
template <>
struct pack<boost::string_view> {
template <typename Stream>
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const boost::string_view& v) const {
uint32_t size = checked_get_container_size(v.size());
o.pack_str(size);
o.pack_str_body(v.data(), size);
return o;
}
};
template <>
struct object<boost::string_view> {
void operator()(msgpack::object& o, const boost::string_view& v) const {
uint32_t size = checked_get_container_size(v.size());
o.type = msgpack::type::STR;
o.via.str.ptr = v.data();
o.via.str.size = size;
}
};
template <>
struct object_with_zone<boost::string_view> {
void operator()(msgpack::object::with_zone& o, const boost::string_view& v) const {
static_cast<msgpack::object&>(o) << v;
}
};
} // namespace adaptor
/// @cond
} // MSGPACK_API_VERSION_NAMESPACE(v1)
/// @endcond
} // namespace msgpack
#endif // (BOOST_VERSION / 100000) >= 1 && ((BOOST_VERSION / 100) % 1000) >= 53
#endif // MSGPACK_V1_TYPE_BOOST_STRING_VIEW_HPP

View File

@@ -101,7 +101,7 @@ struct pack<char[N]> {
char const* p = v;
uint32_t size = checked_get_container_size(N);
char const* p2 = static_cast<char const*>(std::memchr(p, '\0', size));
uint32_t adjusted_size = p2 ? p2 - p : size;
uint32_t adjusted_size = p2 ? static_cast<uint32_t>(p2 - p) : size;
o.pack_str(adjusted_size);
o.pack_str_body(p, adjusted_size);
return o;
@@ -115,7 +115,7 @@ struct pack<const char[N]> {
uint32_t size = checked_get_container_size(N);
char const* p = v;
char const* p2 = static_cast<char const*>(std::memchr(p, '\0', size));
uint32_t adjusted_size = p2 ? p2 - p : size;
uint32_t adjusted_size = p2 ? static_cast<uint32_t>(p2 - p) : size;
o.pack_str(adjusted_size);
o.pack_str_body(p, adjusted_size);
return o;
@@ -151,7 +151,7 @@ struct object_with_zone<T[N]> {
void operator()(msgpack::object::with_zone& o, const T(&v)[N]) const {
uint32_t size = checked_get_container_size(N);
o.type = msgpack::type::ARRAY;
msgpack::object* ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object) * size));
msgpack::object* ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object) * size, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.ptr = ptr;
o.via.array.size = size;
const T* pv = v;
@@ -167,9 +167,9 @@ struct object_with_zone<char[N]> {
char const* p = v;
uint32_t size = checked_get_container_size(N);
char const* p2 = static_cast<char const*>(std::memchr(p, '\0', size));
uint32_t adjusted_size = p2 ? p2 - p : size;
uint32_t adjusted_size = p2 ? static_cast<uint32_t>(p2 - p) : size;
o.type = msgpack::type::STR;
char* ptr = static_cast<char*>(o.zone.allocate_align(adjusted_size));
char* ptr = static_cast<char*>(o.zone.allocate_align(adjusted_size, MSGPACK_ZONE_ALIGNOF(char)));
o.via.str.ptr = ptr;
o.via.str.size = adjusted_size;
std::memcpy(ptr, p, adjusted_size);
@@ -182,9 +182,9 @@ struct object_with_zone<const char[N]> {
char const* p = v;
uint32_t size = checked_get_container_size(N);
char const* p2 = static_cast<char const*>(std::memchr(p, '\0', size));
uint32_t adjusted_size = p2 ? p2 - p : size;
uint32_t adjusted_size = p2 ? static_cast<uint32_t>(p2 - p) : size;
o.type = msgpack::type::STR;
char* ptr = static_cast<char*>(o.zone.allocate_align(adjusted_size));
char* ptr = static_cast<char*>(o.zone.allocate_align(adjusted_size, MSGPACK_ZONE_ALIGNOF(char)));
o.via.str.ptr = ptr;
o.via.str.size = adjusted_size;
std::memcpy(ptr, p, adjusted_size);
@@ -196,7 +196,7 @@ struct object_with_zone<unsigned char[N]> {
void operator()(msgpack::object::with_zone& o, const unsigned char(&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));
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);
@@ -208,7 +208,7 @@ struct object_with_zone<const unsigned char[N]> {
void operator()(msgpack::object::with_zone& o, const unsigned char(&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));
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);
@@ -221,7 +221,7 @@ struct object<char[N]> {
char const* p = v;
uint32_t size = checked_get_container_size(N);
char const* p2 = static_cast<char const*>(std::memchr(p, '\0', size));
uint32_t adjusted_size = p2 ? p2 - p : size;
uint32_t adjusted_size = p2 ? static_cast<uint32_t>(p2 - p) : size;
o.type = msgpack::type::STR;
o.via.str.ptr = p;
o.via.str.size = adjusted_size;
@@ -234,7 +234,7 @@ struct object<const char[N]> {
char const* p = v;
uint32_t size = checked_get_container_size(N);
char const* p2 = static_cast<char const*>(std::memchr(p, '\0', size));
uint32_t adjusted_size = p2 ? p2 - p : size;
uint32_t adjusted_size = p2 ? static_cast<uint32_t>(p2 - p) : size;
o.type = msgpack::type::STR;
o.via.str.ptr = p;
o.via.str.size = adjusted_size;

View File

@@ -41,7 +41,7 @@ struct object_with_zone<const char*> {
void operator()(msgpack::object::with_zone& o, const char* v) const {
uint32_t size = checked_get_container_size(std::strlen(v));
o.type = msgpack::type::STR;
char* ptr = static_cast<char*>(o.zone.allocate_align(size));
char* ptr = static_cast<char*>(o.zone.allocate_align(size, MSGPACK_ZONE_ALIGNOF(char)));
o.via.str.ptr = ptr;
o.via.str.size = size;
std::memcpy(ptr, v, size);

View File

@@ -119,7 +119,7 @@ struct object_with_zone<std::array<T, N>> {
o.via.array.size = 0;
} else {
uint32_t size = checked_get_container_size(v.size());
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size));
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = size;
o.via.array.ptr = p;
for (auto const& e : v) *p++ = msgpack::object(e, o.zone);

View File

@@ -45,6 +45,13 @@ struct convert<std::array<char, N>> {
}
};
template <>
struct convert<std::array<char, 0>> {
msgpack::object const& operator()(msgpack::object const& o, std::array<char, 0>&) const {
return o;
}
};
template <std::size_t N>
struct pack<std::array<char, N>> {
template <typename Stream>
@@ -72,7 +79,7 @@ struct object_with_zone<std::array<char, N>> {
void operator()(msgpack::object::with_zone& o, const std::array<char, N>& v) const {
uint32_t size = checked_get_container_size(v.size());
o.type = msgpack::type::BIN;
char* ptr = static_cast<char*>(o.zone.allocate_align(size));
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.data(), size);

View File

@@ -45,6 +45,13 @@ struct convert<std::array<unsigned char, N>> {
}
};
template <>
struct convert<std::array<unsigned char, 0>> {
msgpack::object const& operator()(msgpack::object const& o, std::array<unsigned char, 0>&) const {
return o;
}
};
template <std::size_t N>
struct pack<std::array<unsigned char, N>> {
template <typename Stream>
@@ -72,7 +79,7 @@ struct object_with_zone<std::array<unsigned char, N>> {
void operator()(msgpack::object::with_zone& o, const std::array<unsigned char, N>& v) const {
uint32_t size = checked_get_container_size(v.size());
o.type = msgpack::type::BIN;
char* ptr = static_cast<char*>(o.zone.allocate_align(size));
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.data(), size);

View File

@@ -76,7 +76,7 @@ struct object_with_zone<std::forward_list<T, Alloc>> {
uint32_t size = checked_get_container_size(std::distance(v.begin(), v.end()));
o.via.array.size = size;
msgpack::object* p = static_cast<msgpack::object*>(
o.zone.allocate_align(sizeof(msgpack::object)*size));
o.zone.allocate_align(sizeof(msgpack::object)*size, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.ptr = p;
for(auto const& e : v) *p++ = msgpack::object(e, o.zone);
}

View File

@@ -158,7 +158,7 @@ struct object_with_zone<std::tuple<Args...>> {
std::tuple<Args...> const& v) const {
uint32_t size = checked_get_container_size(sizeof...(Args));
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = size;
StdTupleToObjectWithZone<decltype(v), sizeof...(Args)>::convert(o, v);
}

View File

@@ -81,7 +81,7 @@ struct object_with_zone<std::unordered_map<K, V, Hash, Compare, Alloc>> {
o.via.map.size = 0;
} else {
uint32_t size = checked_get_container_size(v.size());
msgpack::object_kv* p = static_cast<msgpack::object_kv*>(o.zone.allocate_align(sizeof(msgpack::object_kv)*size));
msgpack::object_kv* p = static_cast<msgpack::object_kv*>(o.zone.allocate_align(sizeof(msgpack::object_kv)*size, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
msgpack::object_kv* const pend = p + size;
o.via.map.ptr = p;
o.via.map.size = size;
@@ -155,7 +155,7 @@ struct object_with_zone<std::unordered_multimap<K, V, Hash, Compare, Alloc>> {
o.via.map.size = 0;
} else {
uint32_t size = checked_get_container_size(v.size());
msgpack::object_kv* p = static_cast<msgpack::object_kv*>(o.zone.allocate_align(sizeof(msgpack::object_kv)*size));
msgpack::object_kv* p = static_cast<msgpack::object_kv*>(o.zone.allocate_align(sizeof(msgpack::object_kv)*size, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
msgpack::object_kv* const pend = p + size;
o.via.map.ptr = p;
o.via.map.size = size;

View File

@@ -78,7 +78,7 @@ struct object_with_zone<std::unordered_set<Key, Hash, Compare, Alloc>> {
o.via.array.size = 0;
} else {
uint32_t size = checked_get_container_size(v.size());
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size));
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
msgpack::object* const pend = p + size;
o.via.array.ptr = p;
o.via.array.size = size;
@@ -147,7 +147,7 @@ struct object_with_zone<std::unordered_multiset<Key, Hash, Compare, Alloc>> {
o.via.array.size = 0;
} else {
uint32_t size = checked_get_container_size(v.size());
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size));
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
msgpack::object* const pend = p + size;
o.via.array.ptr = p;
o.via.array.size = size;

View File

@@ -0,0 +1,90 @@
//
// 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_OPTIONAL_HPP
#define MSGPACK_V1_TYPE_OPTIONAL_HPP
#if __cplusplus >= 201703
#include "msgpack/versioning.hpp"
#include "msgpack/adaptor/adaptor_base.hpp"
#include "msgpack/adaptor/check_container_size.hpp"
#include <optional>
namespace msgpack {
/// @cond
MSGPACK_API_VERSION_NAMESPACE(v1) {
/// @endcond
namespace adaptor {
#if !defined (MSGPACK_USE_CPP03)
template <typename T>
struct as<std::optional<T>, typename std::enable_if<msgpack::has_as<T>::value>::type> {
std::optional<T> operator()(msgpack::object const& o) const {
if(o.is_nil()) return std::nullopt;
return o.as<T>();
}
};
#endif // !defined (MSGPACK_USE_CPP03)
template <typename T>
struct convert<std::optional<T> > {
msgpack::object const& operator()(msgpack::object const& o, std::optional<T>& v) const {
if(o.is_nil()) v = std::nullopt;
else {
T t;
msgpack::adaptor::convert<T>()(o, t);
v = t;
}
return o;
}
};
template <typename T>
struct pack<std::optional<T> > {
template <typename Stream>
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const std::optional<T>& v) const {
if (v) o.pack(*v);
else o.pack_nil();
return o;
}
};
template <typename T>
struct object<std::optional<T> > {
void operator()(msgpack::object& o, const std::optional<T>& v) const {
if (v) msgpack::adaptor::object<T>()(o, *v);
else o.type = msgpack::type::NIL;
}
};
template <typename T>
struct object_with_zone<std::optional<T> > {
void operator()(msgpack::object::with_zone& o, const std::optional<T>& v) const {
if (v) msgpack::adaptor::object_with_zone<T>()(o, *v);
else o.type = msgpack::type::NIL;
}
};
} // namespace adaptor
/// @cond
} // MSGPACK_API_VERSION_NAMESPACE(v1)
/// @endcond
} // namespace msgpack
#endif // __cplusplus >= 201703
#endif // MSGPACK_V1_TYPE_OPTIONAL_HPP

View File

@@ -0,0 +1,86 @@
//
// 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_STRING_VIEW_HPP
#define MSGPACK_V1_TYPE_STRING_VIEW_HPP
#if __cplusplus >= 201703
#include "msgpack/versioning.hpp"
#include "msgpack/adaptor/adaptor_base.hpp"
#include "msgpack/adaptor/check_container_size.hpp"
#include <string_view>
namespace msgpack {
/// @cond
MSGPACK_API_VERSION_NAMESPACE(v1) {
/// @endcond
namespace adaptor {
template <>
struct convert<std::string_view> {
msgpack::object const& operator()(msgpack::object const& o, std::string_view& v) const {
switch (o.type) {
case msgpack::type::BIN:
v = std::string_view(o.via.bin.ptr, o.via.bin.size);
break;
case msgpack::type::STR:
v = std::string_view(o.via.str.ptr, o.via.str.size);
break;
default:
throw msgpack::type_error();
break;
}
return o;
}
};
template <>
struct pack<std::string_view> {
template <typename Stream>
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const std::string_view& v) const {
uint32_t size = checked_get_container_size(v.size());
o.pack_str(size);
o.pack_str_body(v.data(), size);
return o;
}
};
template <>
struct object<std::string_view> {
void operator()(msgpack::object& o, const std::string_view& v) const {
uint32_t size = checked_get_container_size(v.size());
o.type = msgpack::type::STR;
o.via.str.ptr = v.data();
o.via.str.size = size;
}
};
template <>
struct object_with_zone<std::string_view> {
void operator()(msgpack::object::with_zone& o, const std::string_view& 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_STRING_VIEW_HPP

View File

@@ -83,7 +83,7 @@ struct object_with_zone<std::deque<T, Alloc> > {
o.via.array.size = 0;
} else {
uint32_t size = checked_get_container_size(v.size());
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size));
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
msgpack::object* const pend = p + size;
o.via.array.ptr = p;
o.via.array.size = size;

File diff suppressed because it is too large Load Diff

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(
@@ -83,7 +84,7 @@ struct define_map<A0, A1> {
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::MAP;
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*1));
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*1, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
o->via.map.size = 1;
o->via.map.ptr[0].key = msgpack::object(a0, z);
@@ -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(
@@ -142,7 +144,7 @@ struct define_map<A0, A1, A2, A3> {
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::MAP;
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*2));
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*2, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
o->via.map.size = 2;
o->via.map.ptr[0].key = msgpack::object(a0, z);
@@ -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(
@@ -215,7 +218,7 @@ struct define_map<A0, A1, A2, A3, A4, A5> {
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::MAP;
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*3));
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*3, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
o->via.map.size = 3;
o->via.map.ptr[0].key = msgpack::object(a0, z);
@@ -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(
@@ -302,7 +306,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7> {
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::MAP;
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*4));
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*4, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
o->via.map.size = 4;
o->via.map.ptr[0].key = msgpack::object(a0, z);
@@ -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(
@@ -403,7 +408,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9> {
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::MAP;
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*5));
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*5, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
o->via.map.size = 5;
o->via.map.ptr[0].key = msgpack::object(a0, z);
@@ -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(
@@ -518,7 +524,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11> {
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::MAP;
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*6));
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*6, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
o->via.map.size = 6;
o->via.map.ptr[0].key = msgpack::object(a0, z);
@@ -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(
@@ -647,7 +654,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13> {
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::MAP;
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*7));
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*7, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
o->via.map.size = 7;
o->via.map.ptr[0].key = msgpack::object(a0, z);
@@ -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(
@@ -790,7 +798,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::MAP;
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*8));
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*8, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
o->via.map.size = 8;
o->via.map.ptr[0].key = msgpack::object(a0, z);
@@ -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(
@@ -947,7 +956,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::MAP;
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*9));
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*9, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
o->via.map.size = 9;
o->via.map.ptr[0].key = msgpack::object(a0, z);
@@ -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(
@@ -1118,7 +1128,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::MAP;
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*10));
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*10, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
o->via.map.size = 10;
o->via.map.ptr[0].key = msgpack::object(a0, z);
@@ -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(
@@ -1303,7 +1314,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::MAP;
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*11));
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*11, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
o->via.map.size = 11;
o->via.map.ptr[0].key = msgpack::object(a0, z);
@@ -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(
@@ -1502,7 +1514,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::MAP;
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*12));
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*12, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
o->via.map.size = 12;
o->via.map.ptr[0].key = msgpack::object(a0, z);
@@ -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(
@@ -1715,7 +1728,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::MAP;
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*13));
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*13, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
o->via.map.size = 13;
o->via.map.ptr[0].key = msgpack::object(a0, z);
@@ -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(
@@ -1942,7 +1956,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::MAP;
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*14));
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*14, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
o->via.map.size = 14;
o->via.map.ptr[0].key = msgpack::object(a0, z);
@@ -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(
@@ -2183,7 +2198,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::MAP;
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*15));
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*15, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
o->via.map.size = 15;
o->via.map.ptr[0].key = msgpack::object(a0, z);
@@ -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(
@@ -2438,7 +2454,7 @@ struct define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::MAP;
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*16));
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*16, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
o->via.map.size = 16;
o->via.map.ptr[0].key = msgpack::object(a0, z);

View File

@@ -13506,7 +13506,7 @@ struct object_with_zone<type::tuple<A0> > {
msgpack::object::with_zone& o,
const type::tuple<A0>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*1));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*1, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 1;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13519,7 +13519,7 @@ struct object_with_zone<type::tuple<A0, A1> > {
msgpack::object::with_zone& o,
const type::tuple<A0, A1>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*2));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*2, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 2;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13533,7 +13533,7 @@ struct object_with_zone<type::tuple<A0, A1, A2> > {
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*3));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*3, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 3;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13548,7 +13548,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3> > {
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*4));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*4, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 4;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13564,7 +13564,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4> > {
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*5));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*5, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 5;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13581,7 +13581,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5> > {
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*6));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*6, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 6;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13599,7 +13599,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6> > {
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*7));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*7, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 7;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13618,7 +13618,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7> > {
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*8));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*8, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 8;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13638,7 +13638,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8> > {
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*9));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*9, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 9;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13659,7 +13659,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*10));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*10, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 10;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13681,7 +13681,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*11));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*11, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 11;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13704,7 +13704,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*12));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*12, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 12;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13728,7 +13728,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*13));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*13, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 13;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13753,7 +13753,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*14));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*14, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 14;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13779,7 +13779,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*15));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*15, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 15;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13806,7 +13806,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*16));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*16, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 16;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13834,7 +13834,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*17));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*17, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 17;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13863,7 +13863,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*18));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*18, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 18;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13893,7 +13893,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*19));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*19, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 19;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13924,7 +13924,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*20));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*20, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 20;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13956,7 +13956,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*21));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*21, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 21;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -13989,7 +13989,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*22));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*22, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 22;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -14023,7 +14023,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*23));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*23, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 23;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -14058,7 +14058,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*24));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*24, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 24;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -14094,7 +14094,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*25));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*25, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 25;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -14131,7 +14131,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*26));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*26, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 26;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -14169,7 +14169,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*27));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*27, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 27;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -14208,7 +14208,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*28));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*28, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 28;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -14248,7 +14248,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*29));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*29, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 29;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -14289,7 +14289,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28, A29>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*30));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*30, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 30;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -14331,7 +14331,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28, A29, A30>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*31));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*31, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 31;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);
@@ -14374,7 +14374,7 @@ struct object_with_zone<type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
msgpack::object::with_zone& o,
const type::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28, A29, A30, A31>& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*32));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*32, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = 32;
o.via.array.ptr[0] = msgpack::object(v.template get<0>(), o.zone);

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);
@@ -77,7 +78,7 @@ struct define_array {
void msgpack_object(msgpack::object* o, msgpack::zone& z) const
{
o->type = msgpack::type::ARRAY;
o->via.array.ptr = static_cast<msgpack::object*>(z.allocate_align(sizeof(msgpack::object)*sizeof...(Args)));
o->via.array.ptr = static_cast<msgpack::object*>(z.allocate_align(sizeof(msgpack::object)*sizeof...(Args), MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o->via.array.size = sizeof...(Args);
define_array_imp<std::tuple<Args&...>, sizeof...(Args)>::object(o, z, a);

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,
@@ -83,7 +85,7 @@ struct define_map {
{
static_assert(sizeof...(Args) % 2 == 0, "");
o->type = msgpack::type::MAP;
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*sizeof...(Args)/2));
o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*sizeof...(Args)/2, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv)));
o->via.map.size = sizeof...(Args) / 2;
define_map_imp<std::tuple<Args&...>, sizeof...(Args)>::object(o, z, a);

View File

@@ -203,7 +203,7 @@ template <typename... Args>
msgpack::object::with_zone& o,
msgpack::type::tuple<Args...> const& v) const {
o.type = msgpack::type::ARRAY;
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*sizeof...(Args)));
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*sizeof...(Args), MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = sizeof...(Args);
MsgpackTupleToObjectWithZone<decltype(v), sizeof...(Args)>::convert(o, v);
}

View File

@@ -104,7 +104,7 @@ struct object_with_zone<msgpack::type::ext> {
// size limit has already been checked at ext's constructor
uint32_t size = v.size();
o.type = msgpack::type::EXT;
char* ptr = static_cast<char*>(o.zone.allocate_align(size + 1));
char* ptr = static_cast<char*>(o.zone.allocate_align(size + 1, MSGPACK_ZONE_ALIGNOF(char)));
o.via.ext.ptr = ptr;
o.via.ext.size = size;
ptr[0] = static_cast<char>(v.type());

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

@@ -81,7 +81,7 @@ struct object_with_zone<std::list<T, Alloc> > {
}
else {
uint32_t size = checked_get_container_size(v.size());
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size));
msgpack::object* p = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object)*size, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
msgpack::object* const pend = p + size;
o.via.array.ptr = p;
o.via.array.size = size;

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