Compare commits

..

60 Commits

Author SHA1 Message Date
Takatoshi Kondo
83a82e3eb5 Merge pull request #727 from redboltz/update_311
Updated the version to 3.1.1.
2018-09-09 15:27:47 +09:00
Takatoshi Kondo
aa9c73352c Added more fixes. 2018-09-09 13:51:43 +09:00
Takatoshi Kondo
df9e003b35 Merge pull request #736 from redboltz/force_set_endian
Added enforcing endian functionality.
2018-09-08 22:06:02 +09:00
Takatoshi Kondo
f6ddc9b85a Added enforcing endian functionality. 2018-09-08 20:06:00 +09:00
Takatoshi Kondo
11cfeeec92 Merge pull request #733 from tbeu/add-int-overflow-check-to-vrefbuffer
Adding int overflow checks to vrefbuffer
2018-09-07 09:04:22 +09:00
tbeu
d72765870a Move overflow check up 2018-09-06 15:09:52 +02:00
jwang
349c133171 Fix malloc size 2018-09-05 10:28:22 +02:00
tbeu
c056026dad Fix memory leaks 2018-09-04 22:24:40 +02:00
jwang
0421dabc1e removing unused vars 2018-09-03 22:23:54 +02:00
jwang
60930f4b12 adding unit tests and fixing same overflow issue in hpp files 2018-09-03 22:23:53 +02:00
jwang
b3dfe28be4 adding int overflow checks to vrefbuffer 2018-09-03 22:23:52 +02:00
jwang
e703d8a2f7 adding int overflow checks to vrefbuffer 2018-09-03 22:23:52 +02:00
Takatoshi Kondo
801f61c12c Merge pull request #732 from tbeu/fix-static-cast
Fix VS2010 warning C4309: 'static_cast' : truncation of constant value
2018-09-03 17:20:52 +09:00
Takatoshi Kondo
a3e75a0709 Merge pull request #731 from tbeu/fix-return-types
Fix VS2010 build errors on return types
2018-09-03 17:20:24 +09:00
tbeu
92d34cbd79 Fix VS2010 warning C4309: 'static_cast' : truncation of constant value 2018-09-02 20:36:48 +02:00
tbeu
c99fd62ae6 Fix VS2010 build errors on return types 2018-09-02 19:55:33 +02:00
Takatoshi Kondo
a3986b3bdc Merge pull request #730 from froydnj/update-predef-and-preprocessor
update boost predef and preprocessor from 1.61.0 to 1.68.0
2018-09-01 21:31:58 +09:00
Takatoshi Kondo
7fed49e6fe Merge branch 'froydnj-update-predef-and-preprocessor' 2018-09-01 20:36:18 +09:00
Takatoshi Kondo
005e06e00a Updated appveyor's boost. 2018-09-01 19:45:14 +09:00
Nathan Froyd
b6d4bb5cb0 update boost predef and preprocessor from 1.61.0 to 1.68.0
...via `git submodule foreach git pull origin boost-1.68.0` and
initializing cmake.

Fixes #728.
2018-08-31 14:57:19 -04:00
Takatoshi Kondo
f57bfd998b Updated the version to 3.1.1. 2018-08-28 00:17:42 +09:00
Takatoshi Kondo
e8d3387a04 Merge pull request #726 from redboltz/fix_724
Fixed #724.
2018-08-28 00:13:49 +09:00
Takatoshi Kondo
53d2ea9ad3 Fixed #724.
Fixed type mismatch in msgpack_timestamp.
Added 64bit singed postfix.
2018-08-27 22:40:04 +09:00
Takatoshi Kondo
b6803a5fec Merge pull request #723 from redboltz/update_readme
Updated readme.
2018-08-21 22:30:54 +09:00
Takatoshi Kondo
210d3ce390 Updated readme. 2018-08-21 07:13:38 +09:00
Takatoshi Kondo
a350e0714e Merge pull request #716 from redboltz/update_310
Updated the version to 3.1.0
2018-08-21 06:43:27 +09:00
Takatoshi Kondo
72757feae4 Updated the version to 3.1.0 2018-08-20 21:58:54 +09:00
Takatoshi Kondo
fe2346efa1 Merge pull request #721 from dennisklein/master
Export an interface target for the C++ header-only library
2018-08-17 07:41:31 +09:00
Takatoshi Kondo
43ae287be3 Merge pull request #722 from redboltz/fix_build_shared_libs
Fixed BUILD_SHARED_LIBS meaning.
2018-08-17 07:40:53 +09:00
Takatoshi Kondo
b804e12dec Fixed BUILD_SHARED_LIBS meaning.
There are three switches to build static/shared libraries.

Here is the logic.

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

Here is common settings:

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

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

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

--- a/msgpack_8h.html	2018-05-12 14:03:34.098715879 -0400
+++ b/msgpack_8h.html	2018-05-12 14:04:17.386349607 -0400
@@ -5,7 +5,7 @@
 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
 <meta name="generator" content="Doxygen 1.8.13"/>
 <meta name="viewport" content="width=device-width, initial-scale=1"/>
-<title>MessagePack for C: /home/jamessan/src/debian.org/pkg-vim/msgpack-c/include/msgpack.h File Reference</title>
+<title>MessagePack for C: msgpack.h File Reference</title>
 <link href="tabs.css" rel="stylesheet" type="text/css"/>
 <script type="text/javascript" src="jquery.js"></script>
 <script type="text/javascript" src="dynsections.js"></script>
2018-05-12 14:04:48 -04:00
86 changed files with 2637 additions and 212 deletions

View File

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

View File

@@ -1,3 +1,26 @@
# 2018-09-09 version 3.1.1
* Add force endian set functionality (#736)
* Fix vrefbuffer memory management problem (#733)
* Fix msvc specific problem (#731, #732)
* Update boost from 1.61.0 to 1.68.0 (#730)
* Fix msgpack_timestamp type mismatch bug (#726)
# 2018-08-10 version 3.1.0
* Improve documents (#687, #718)
* Add fuzzer support (#689)
* Fix msgpack::object union member access bug (#694)
* Improve cross platform configuration (#704)
* Fix out of range dereference bug of EXT (#705)
* Add timestamp support. std::chrono::system_clock::time_point is mapped to TIMESTAMP (#706)
* Add minimal timestamp support for C. The type `msgpack_timestamp` and the function `msgpack_object_to_timestamp()` are introduced (#707)
* Improve MSGPACK_DEFINE family name confliction probability (#710)
* Add no static-library build option (BUILD_SHARED_LIBS=ON) (#713, #717, #722)
* Add header only cmake target (#721)
* Add `std::byte` adaptor (#719)
* Remove some warnings (#720)
# 2018-05-12 version 3.0.1
* Add fuzz directory to release tar ball (#686)
@@ -7,7 +30,7 @@
## << breaking changes >>
* Change offset parameter updating rule. If parse error is happend, offset is updated to the error position. (#639, #666)
* Change offset parameter updating rule. If parse error happens, offset is updated to the error position. (#639, #666)
## << other updates >>

View File

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

View File

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

View File

@@ -24,6 +24,7 @@ LIST (APPEND msgpackc_HEADERS
include/msgpack/predef/architecture/mips.h
include/msgpack/predef/architecture/parisc.h
include/msgpack/predef/architecture/ppc.h
include/msgpack/predef/architecture/ptx.h
include/msgpack/predef/architecture/pyramid.h
include/msgpack/predef/architecture/rs6k.h
include/msgpack/predef/architecture/sparc.h
@@ -57,6 +58,7 @@ LIST (APPEND msgpackc_HEADERS
include/msgpack/predef/compiler/metrowerks.h
include/msgpack/predef/compiler/microtec.h
include/msgpack/predef/compiler/mpw.h
include/msgpack/predef/compiler/nvcc.h
include/msgpack/predef/compiler/palm.h
include/msgpack/predef/compiler/pgi.h
include/msgpack/predef/compiler/sgi_mipspro.h
@@ -83,12 +85,14 @@ LIST (APPEND msgpackc_HEADERS
include/msgpack/predef/hardware/simd/x86_amd.h
include/msgpack/predef/hardware/simd/x86_amd/versions.h
include/msgpack/predef/language.h
include/msgpack/predef/language/cuda.h
include/msgpack/predef/language/objc.h
include/msgpack/predef/language/stdc.h
include/msgpack/predef/language/stdcpp.h
include/msgpack/predef/library.h
include/msgpack/predef/library/c.h
include/msgpack/predef/library/c/_prefix.h
include/msgpack/predef/library/c/cloudabi.h
include/msgpack/predef/library/c/gnu.h
include/msgpack/predef/library/c/uc.h
include/msgpack/predef/library/c/vms.h
@@ -132,16 +136,25 @@ LIST (APPEND msgpackc_HEADERS
include/msgpack/predef/os/windows.h
include/msgpack/predef/other.h
include/msgpack/predef/other/endian.h
include/msgpack/predef/other/workaround.h
include/msgpack/predef/platform.h
include/msgpack/predef/platform/cloudabi.h
include/msgpack/predef/platform/ios.h
include/msgpack/predef/platform/mingw.h
include/msgpack/predef/platform/mingw32.h
include/msgpack/predef/platform/mingw64.h
include/msgpack/predef/platform/windows_desktop.h
include/msgpack/predef/platform/windows_phone.h
include/msgpack/predef/platform/windows_runtime.h
include/msgpack/predef/platform/windows_server.h
include/msgpack/predef/platform/windows_store.h
include/msgpack/predef/platform/windows_system.h
include/msgpack/predef/platform/windows_uwp.h
include/msgpack/predef/version.h
include/msgpack/predef/version_number.h
include/msgpack/sbuffer.h
include/msgpack/sysdep.h
include/msgpack/timestamp.h
include/msgpack/unpack.h
include/msgpack/unpack_define.h
include/msgpack/unpack_template.h
@@ -173,6 +186,7 @@ IF (MSGPACK_ENABLE_CXX)
include/msgpack/adaptor/cpp11/array.hpp
include/msgpack/adaptor/cpp11/array_char.hpp
include/msgpack/adaptor/cpp11/array_unsigned_char.hpp
include/msgpack/adaptor/cpp11/chrono.hpp
include/msgpack/adaptor/cpp11/forward_list.hpp
include/msgpack/adaptor/cpp11/reference_wrapper.hpp
include/msgpack/adaptor/cpp11/shared_ptr.hpp
@@ -180,8 +194,11 @@ IF (MSGPACK_ENABLE_CXX)
include/msgpack/adaptor/cpp11/unique_ptr.hpp
include/msgpack/adaptor/cpp11/unordered_map.hpp
include/msgpack/adaptor/cpp11/unordered_set.hpp
include/msgpack/adaptor/cpp17/byte.hpp
include/msgpack/adaptor/cpp17/carray_byte.hpp
include/msgpack/adaptor/cpp17/optional.hpp
include/msgpack/adaptor/cpp17/string_view.hpp
include/msgpack/adaptor/cpp17/vector_byte.hpp
include/msgpack/adaptor/define.hpp
include/msgpack/adaptor/define_decl.hpp
include/msgpack/adaptor/deque.hpp
@@ -439,6 +456,7 @@ IF (MSGPACK_ENABLE_CXX)
include/msgpack/preprocessor/seq/detail/binary_transform.hpp
include/msgpack/preprocessor/seq/detail/is_empty.hpp
include/msgpack/preprocessor/seq/detail/split.hpp
include/msgpack/preprocessor/seq/detail/to_list_msvc.hpp
include/msgpack/preprocessor/seq/elem.hpp
include/msgpack/preprocessor/seq/enum.hpp
include/msgpack/preprocessor/seq/filter.hpp
@@ -529,6 +547,7 @@ IF (MSGPACK_ENABLE_CXX)
include/msgpack/v1/adaptor/cpp11/array.hpp
include/msgpack/v1/adaptor/cpp11/array_char.hpp
include/msgpack/v1/adaptor/cpp11/array_unsigned_char.hpp
include/msgpack/v1/adaptor/cpp11/chrono.hpp
include/msgpack/v1/adaptor/cpp11/forward_list.hpp
include/msgpack/v1/adaptor/cpp11/reference_wrapper.hpp
include/msgpack/v1/adaptor/cpp11/shared_ptr.hpp
@@ -536,8 +555,11 @@ IF (MSGPACK_ENABLE_CXX)
include/msgpack/v1/adaptor/cpp11/unique_ptr.hpp
include/msgpack/v1/adaptor/cpp11/unordered_map.hpp
include/msgpack/v1/adaptor/cpp11/unordered_set.hpp
include/msgpack/v1/adaptor/cpp17/byte.hpp
include/msgpack/v1/adaptor/cpp17/carray_byte.hpp
include/msgpack/v1/adaptor/cpp17/optional.hpp
include/msgpack/v1/adaptor/cpp17/string_view.hpp
include/msgpack/v1/adaptor/cpp17/vector_byte.hpp
include/msgpack/v1/adaptor/define.hpp
include/msgpack/v1/adaptor/define_decl.hpp
include/msgpack/v1/adaptor/deque.hpp

View File

@@ -1,7 +1,7 @@
`msgpack` for C/C++
===================
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)
Version 3.1.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 smaller and faster.
@@ -97,6 +97,10 @@ int main(void)
msgpack::type::tuple<int, bool, std::string> dst;
deserialized.convert(dst);
// or create the new instance
msgpack::type::tuple<int, bool, std::string> dst2 =
deserialized.as<msgpack::type::tuple<int, bool, std::string> >();
return 0;
}
```
@@ -108,7 +112,7 @@ Usage
### C++ Header Only Library
When you use msgpack on C++03 and C++11, you can just add
When you use msgpack on C++, you can just add
msgpack-c/include to your include path:
g++ -I msgpack-c/include your_source_file.cpp
@@ -135,14 +139,18 @@ C and C++03:
$ make
$ sudo make install
If you want to setup C++11 version of msgpack instead,
If you want to setup C++11 or C++17 version of msgpack instead,
execute the following commands:
$ git clone https://github.com/msgpack/msgpack-c.git
$ cd msgpack-c
$ cmake -DMSGPACK_CXX11=ON .
$ cmake -DMSGPACK_CXX[11|17]=ON .
$ sudo make install
`MSGPACK_CXX[11|17]` flags are not affected to installing files. Just switching test cases. All files are installed in every settings.
When you use the C part of `msgpack-c`, you need to build and link the library. By default, both static/shared libraries are built. If you want to build only static library, set `BUILD_SHARED_LIBS=OFF` to cmake. If you want to build only shared library, set `BUILD_SHARED_L
#### GUI on Windows
Clone msgpack-c git repository.
@@ -170,7 +178,7 @@ the binaries:' text box.
### Documentation
You can get addtional information on the
You can get additional information including the tutorial on the
[wiki](https://github.com/msgpack/msgpack-c/wiki).
Contributing

View File

@@ -1,10 +1,10 @@
version: 3.0.1.{build}
version: 3.1.1.{build}
image:
- Visual Studio 2015
environment:
global:
BOOST_ROOT: C:\Libraries\boost_1_60_0
BOOST_ROOT: C:\Libraries\boost_1_67_0
matrix:
- cpp11: -DMSGPACK_CXX11=OFF
boost: -DMSGPACK_BOOST=OFF

View File

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

49
ci/build_regression.sh Executable file
View File

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

View File

@@ -1,6 +1,8 @@
IF (MSGPACK_ENABLE_SHARED)
SET (MSGPACK_LIB msgpackc)
ELSE ()
ENDIF ()
IF (MSGPACK_ENABLE_STATIC)
SET (MSGPACK_LIB msgpackc-static)
ENDIF ()

43
fuzz/CMakeLists.txt Normal file
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -19,6 +19,7 @@ http://www.boost.org/LICENSE_1_0.txt)
#include <msgpack/predef/architecture/mips.h>
#include <msgpack/predef/architecture/parisc.h>
#include <msgpack/predef/architecture/ppc.h>
#include <msgpack/predef/architecture/ptx.h>
#include <msgpack/predef/architecture/pyramid.h>
#include <msgpack/predef/architecture/rs6k.h>
#include <msgpack/predef/architecture/sparc.h>

View File

@@ -27,11 +27,14 @@ http://www.boost.org/LICENSE_1_0.txt)
[[`__TARGET_ARCH_ARM`] [__predef_detection__]]
[[`__TARGET_ARCH_THUMB`] [__predef_detection__]]
[[`_M_ARM`] [__predef_detection__]]
[[`_M_ARM64`] [__predef_detection__]]
[[`__arm64`] [8.0.0]]
[[`__TARGET_ARCH_ARM`] [V.0.0]]
[[`__TARGET_ARCH_THUMB`] [V.0.0]]
[[`__ARM_ARCH`] [V.0.0]]
[[`_M_ARM`] [V.0.0]]
[[`_M_ARM64`] [8.0.0]]
]
*/
@@ -39,7 +42,8 @@ http://www.boost.org/LICENSE_1_0.txt)
#if defined(__arm__) || defined(__arm64) || defined(__thumb__) || \
defined(__TARGET_ARCH_ARM) || defined(__TARGET_ARCH_THUMB) || \
defined(_M_ARM)
defined(__ARM_ARCH) || \
defined(_M_ARM) || defined(_M_ARM64)
# undef MSGPACK_ARCH_ARM
# if !defined(MSGPACK_ARCH_ARM) && defined(__arm64)
# define MSGPACK_ARCH_ARM MSGPACK_VERSION_NUMBER(8,0,0)
@@ -50,6 +54,12 @@ http://www.boost.org/LICENSE_1_0.txt)
# if !defined(MSGPACK_ARCH_ARM) && defined(__TARGET_ARCH_THUMB)
# define MSGPACK_ARCH_ARM MSGPACK_VERSION_NUMBER(__TARGET_ARCH_THUMB,0,0)
# endif
# if !defined(MSGPACK_ARCH_ARM) && defined(__ARM_ARCH)
# define MSGPACK_ARCH_ARM MSGPACK_VERSION_NUMBER(__ARM_ARCH,0,0)
# endif
# if !defined(MSGPACK_ARCH_ARM) && defined(_M_ARM64)
# define MSGPACK_ARCH_ARM MSGPACK_VERSION_NUMBER(8,0,0)
# endif
# if !defined(MSGPACK_ARCH_ARM) && defined(_M_ARM)
# define MSGPACK_ARCH_ARM MSGPACK_VERSION_NUMBER(_M_ARM,0,0)
# endif

View File

@@ -12,7 +12,7 @@ http://www.boost.org/LICENSE_1_0.txt)
#include <msgpack/predef/make.h>
/*`
[heading `MSGPACK_ARCH_PARISK`]
[heading `MSGPACK_ARCH_PARISC`]
[@http://en.wikipedia.org/wiki/PA-RISC_family HP/PA RISC] architecture.

View File

@@ -0,0 +1,44 @@
/*
Copyright Benjamin Worpitz 2018
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_PREDEF_ARCHITECTURE_PTX_H
#define MSGPACK_PREDEF_ARCHITECTURE_PTX_H
#include <msgpack/predef/version_number.h>
#include <msgpack/predef/make.h>
/*`
[heading `MSGPACK_ARCH_PTX`]
[@https://en.wikipedia.org/wiki/Parallel_Thread_Execution PTX] architecture.
[table
[[__predef_symbol__] [__predef_version__]]
[[`__CUDA_ARCH__`] [__predef_detection__]]
[[`__CUDA_ARCH__`] [V.R.0]]
]
*/
#define MSGPACK_ARCH_PTX MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
#if defined(__CUDA_ARCH__)
# undef MSGPACK_ARCH_PTX
# define MSGPACK_ARCH_PTX MSGPACK_PREDEF_MAKE_10_VR0(__CUDA_ARCH__)
#endif
#if MSGPACK_ARCH_PTX
# define MSGPACK_ARCH_PTX_AVAILABLE
#endif
#define MSGPACK_ARCH_PTX_NAME "PTX"
#endif
#include <msgpack/predef/detail/test.h>
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_ARCH_PTX,MSGPACK_ARCH_PTX_NAME)

View File

@@ -32,6 +32,7 @@ http://www.boost.org/LICENSE_1_0.txt)
#include <msgpack/predef/compiler/metrowerks.h>
#include <msgpack/predef/compiler/microtec.h>
#include <msgpack/predef/compiler/mpw.h>
#include <msgpack/predef/compiler/nvcc.h>
#include <msgpack/predef/compiler/palm.h>
#include <msgpack/predef/compiler/pgi.h>
#include <msgpack/predef/compiler/sgi_mipspro.h>

View File

@@ -1,5 +1,5 @@
/*
Copyright Rene Rivera 2008-2015
Copyright Rene Rivera 2008-2017
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)
@@ -25,7 +25,8 @@ Version number available as major, minor, and patch.
[[`__ICC`] [__predef_detection__]]
[[`__ECC`] [__predef_detection__]]
[[`__INTEL_COMPILER`] [V.R.P]]
[[`__INTEL_COMPILER`] [V.R]]
[[`__INTEL_COMPILER` and `__INTEL_COMPILER_UPDATE`] [V.R.P]]
]
*/
@@ -33,8 +34,21 @@ Version number available as major, minor, and patch.
#if defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || \
defined(__ECC)
/*`
[note Because of an Intel mistake in the release version numbering when
`__INTEL_COMPILER` is `9999` it is detected as version 12.1.0.]
*/
# if !defined(MSGPACK_COMP_INTEL_DETECTION) && defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 9999)
# define MSGPACK_COMP_INTEL_DETECTION MSGPACK_VERSION_NUMBER(12,1,0)
# endif
# if !defined(MSGPACK_COMP_INTEL_DETECTION) && defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE)
# define MSGPACK_COMP_INTEL_DETECTION MSGPACK_VERSION_NUMBER( \
MSGPACK_VERSION_NUMBER_MAJOR(MSGPACK_PREDEF_MAKE_10_VVRR(__INTEL_COMPILER)), \
MSGPACK_VERSION_NUMBER_MINOR(MSGPACK_PREDEF_MAKE_10_VVRR(__INTEL_COMPILER)), \
__INTEL_COMPILER_UPDATE)
# endif
# if !defined(MSGPACK_COMP_INTEL_DETECTION) && defined(__INTEL_COMPILER)
# define MSGPACK_COMP_INTEL_DETECTION MSGPACK_PREDEF_MAKE_10_VRP(__INTEL_COMPILER)
# define MSGPACK_COMP_INTEL_DETECTION MSGPACK_PREDEF_MAKE_10_VVRR(__INTEL_COMPILER)
# endif
# if !defined(MSGPACK_COMP_INTEL_DETECTION)
# define MSGPACK_COMP_INTEL_DETECTION MSGPACK_VERSION_NUMBER_AVAILABLE

View File

@@ -0,0 +1,60 @@
/*
Copyright Benjamin Worpitz 2018
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_PREDEF_COMPILER_NVCC_H
#define MSGPACK_PREDEF_COMPILER_NVCC_H
#include <msgpack/predef/version_number.h>
#include <msgpack/predef/make.h>
/*`
[heading `MSGPACK_COMP_NVCC`]
[@https://en.wikipedia.org/wiki/NVIDIA_CUDA_Compiler NVCC] compiler.
Version number available as major, minor, and patch beginning with version 7.5.
[table
[[__predef_symbol__] [__predef_version__]]
[[`__NVCC__`] [__predef_detection__]]
[[`__CUDACC_VER_MAJOR__`, `__CUDACC_VER_MINOR__`, `__CUDACC_VER_BUILD__`] [V.R.P]]
]
*/
#define MSGPACK_COMP_NVCC MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
#if defined(__NVCC__)
# if !defined(__CUDACC_VER_MAJOR__) || !defined(__CUDACC_VER_MINOR__) || !defined(__CUDACC_VER_BUILD__)
# define MSGPACK_COMP_NVCC_DETECTION MSGPACK_VERSION_NUMBER_AVAILABLE
# else
# define MSGPACK_COMP_NVCC_DETECTION MSGPACK_VERSION_NUMBER(__CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, __CUDACC_VER_BUILD__)
# endif
#endif
#ifdef MSGPACK_COMP_NVCC_DETECTION
# if defined(MSGPACK_PREDEF_DETAIL_COMP_DETECTED)
# define MSGPACK_COMP_NVCC_EMULATED MSGPACK_COMP_NVCC_DETECTION
# else
# undef MSGPACK_COMP_NVCC
# define MSGPACK_COMP_NVCC MSGPACK_COMP_NVCC_DETECTION
# endif
# define MSGPACK_COMP_NVCC_AVAILABLE
# include <msgpack/predef/detail/comp_detected.h>
#endif
#define MSGPACK_COMP_NVCC_NAME "NVCC"
#endif
#include <msgpack/predef/detail/test.h>
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_COMP_NVCC,MSGPACK_COMP_NVCC_NAME)
#ifdef MSGPACK_COMP_NVCC_EMULATED
#include <msgpack/predef/detail/test.h>
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_COMP_NVCC_EMULATED,MSGPACK_COMP_NVCC_NAME)
#endif

View File

@@ -29,6 +29,10 @@ Version number available as major, minor, and patch.
[[`_MSC_FULL_VER`] [V.R.P]]
[[`_MSC_VER`] [V.R.0]]
]
[note Release of Visual Studio after 2015 will no longer be identified
by Boost Predef as the marketing version number. Instead we use the
compiler version number directly, i.e. the _MSC_VER number.]
*/
#define MSGPACK_COMP_MSVC MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
@@ -53,8 +57,18 @@ Version number available as major, minor, and patch.
means that the compiler and VS product versions are no longer
in sync. Hence we need to use different formulas for
mapping from MSC version to VS product version.
VS2017 is a total nightmare when it comes to version numbers.
Hence to avoid arguments relating to that both present and
future.. Any version after VS2015 will use solely the compiler
version, i.e. cl.exe, as the version number here.
*/
# if (_MSC_VER >= 1900)
# if (_MSC_VER > 1900)
# define MSGPACK_COMP_MSVC_DETECTION MSGPACK_VERSION_NUMBER(\
_MSC_VER/100,\
_MSC_VER%100,\
MSGPACK_COMP_MSVC_BUILD)
# elif (_MSC_VER >= 1900)
# define MSGPACK_COMP_MSVC_DETECTION MSGPACK_VERSION_NUMBER(\
_MSC_VER/100-5,\
_MSC_VER%100,\

View File

@@ -24,6 +24,7 @@ http://www.boost.org/LICENSE_1_0.txt)
[[`__ARM_NEON__`] [__predef_detection__]]
[[`__aarch64__`] [__predef_detection__]]
[[`_M_ARM`] [__predef_detection__]]
[[`_M_ARM64`] [__predef_detection__]]
]
[table
@@ -32,6 +33,7 @@ http://www.boost.org/LICENSE_1_0.txt)
[[`__ARM_NEON__`] [MSGPACK_HW_SIMD_ARM_NEON_VERSION]]
[[`__aarch64__`] [MSGPACK_HW_SIMD_ARM_NEON_VERSION]]
[[`_M_ARM`] [MSGPACK_HW_SIMD_ARM_NEON_VERSION]]
[[`_M_ARM64`] [MSGPACK_HW_SIMD_ARM_NEON_VERSION]]
]
*/
@@ -39,7 +41,7 @@ http://www.boost.org/LICENSE_1_0.txt)
#define MSGPACK_HW_SIMD_ARM MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
#undef MSGPACK_HW_SIMD_ARM
#if !defined(MSGPACK_HW_SIMD_ARM) && (defined(__ARM_NEON__) || defined(__aarch64__) || defined (_M_ARM))
#if !defined(MSGPACK_HW_SIMD_ARM) && (defined(__ARM_NEON__) || defined(__aarch64__) || defined (_M_ARM) || defined (_M_ARM64))
# define MSGPACK_HW_SIMD_ARM MSGPACK_HW_SIMD_ARM_NEON_VERSION
#endif

View File

@@ -21,7 +21,7 @@ http://www.boost.org/LICENSE_1_0.txt)
// ---------------------------------
/*`
[heading `MSGPACK_HW_SIMD_X86_SSE4A_VERSION`]
[heading `MSGPACK_HW_SIMD_X86_AMD_SSE4A_VERSION`]
[@https://en.wikipedia.org/wiki/SSE4##SSE4A SSE4A] x86 extension (AMD specific).
@@ -30,7 +30,7 @@ http://www.boost.org/LICENSE_1_0.txt)
#define MSGPACK_HW_SIMD_X86_AMD_SSE4A_VERSION MSGPACK_VERSION_NUMBER(4, 0, 0)
/*`
[heading `MSGPACK_HW_SIMD_X86_FMA4_VERSION`]
[heading `MSGPACK_HW_SIMD_X86_AMD_FMA4_VERSION`]
[@https://en.wikipedia.org/wiki/FMA_instruction_set#FMA4_instruction_set FMA4] x86 extension (AMD specific).
@@ -39,7 +39,7 @@ http://www.boost.org/LICENSE_1_0.txt)
#define MSGPACK_HW_SIMD_X86_AMD_FMA4_VERSION MSGPACK_VERSION_NUMBER(5, 1, 0)
/*`
[heading `MSGPACK_HW_SIMD_X86_XOP_VERSION`]
[heading `MSGPACK_HW_SIMD_X86_AMD_XOP_VERSION`]
[@https://en.wikipedia.org/wiki/XOP_instruction_set XOP] x86 extension (AMD specific).

View File

@@ -13,5 +13,6 @@ http://www.boost.org/LICENSE_1_0.txt)
#include <msgpack/predef/language/stdc.h>
#include <msgpack/predef/language/stdcpp.h>
#include <msgpack/predef/language/objc.h>
#include <msgpack/predef/language/cuda.h>
#endif

View File

@@ -0,0 +1,52 @@
/*
Copyright Benjamin Worpitz 2018
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_PREDEF_LANGUAGE_CUDA_H
#define MSGPACK_PREDEF_LANGUAGE_CUDA_H
#include <msgpack/predef/version_number.h>
#include <msgpack/predef/make.h>
/*`
[heading `MSGPACK_LANG_CUDA`]
[@https://en.wikipedia.org/wiki/CUDA CUDA C/C++] language.
If available, the version is detected as VV.RR.P.
[table
[[__predef_symbol__] [__predef_version__]]
[[`__CUDACC__`] [__predef_detection__]]
[[`__CUDA__`] [__predef_detection__]]
[[`CUDA_VERSION`] [VV.RR.P]]
]
*/
#define MSGPACK_LANG_CUDA MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
#if defined(__CUDACC__) || defined(__CUDA__)
# undef MSGPACK_LANG_CUDA
# include <cuda.h>
# if defined(CUDA_VERSION)
# define MSGPACK_LANG_CUDA MSGPACK_PREDEF_MAKE_10_VVRRP(CUDA_VERSION)
# else
# define MSGPACK_LANG_CUDA MSGPACK_VERSION_NUMBER_AVAILABLE
# endif
#endif
#if MSGPACK_LANG_CUDA
# define MSGPACK_LANG_CUDA_AVAILABLE
#endif
#define MSGPACK_LANG_CUDA_NAME "CUDA C/C++"
#endif
#include <msgpack/predef/detail/test.h>
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_LANG_CUDA,MSGPACK_LANG_CUDA_NAME)

View File

@@ -12,6 +12,7 @@ http://www.boost.org/LICENSE_1_0.txt)
#include <msgpack/predef/library/c/_prefix.h>
#include <msgpack/predef/library/c/cloudabi.h>
#include <msgpack/predef/library/c/gnu.h>
#include <msgpack/predef/library/c/uc.h>
#include <msgpack/predef/library/c/vms.h>

View File

@@ -0,0 +1,53 @@
/*
* Copyright (C) 2017 James E. King III
*
* 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_PREDEF_LIBRARY_C_CLOUDABI_H
#define MSGPACK_PREDEF_LIBRARY_C_CLOUDABI_H
#include <msgpack/predef/version_number.h>
#include <msgpack/predef/make.h>
#include <msgpack/predef/library/c/_prefix.h>
#if defined(__CloudABI__)
#include <stddef.h>
#endif
/*`
[heading `MSGPACK_LIB_C_CLOUDABI`]
[@https://github.com/NuxiNL/cloudlibc cloudlibc] - CloudABI's standard C library.
Version number available as major, and minor.
[table
[[__predef_symbol__] [__predef_version__]]
[[`__cloudlibc__`] [__predef_detection__]]
[[`__cloudlibc_major__`, `__cloudlibc_minor__`] [V.R.0]]
]
*/
#define MSGPACK_LIB_C_CLOUDABI MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
#if defined(__cloudlibc__)
# undef MSGPACK_LIB_C_CLOUDABI
# define MSGPACK_LIB_C_CLOUDABI \
MSGPACK_VERSION_NUMBER(__cloudlibc_major__,__cloudlibc_minor__,0)
#endif
#if MSGPACK_LIB_C_CLOUDABI
# define MSGPACK_LIB_C_CLOUDABI_AVAILABLE
#endif
#define MSGPACK_LIB_C_CLOUDABI_NAME "cloudlibc"
#endif
#include <msgpack/predef/detail/test.h>
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_LIB_C_CLOUDABI,MSGPACK_LIB_C_CLOUDABI_NAME)

View File

@@ -46,10 +46,14 @@ Macros are:
#define MSGPACK_PREDEF_MAKE_0X_VVRRPP(V) MSGPACK_VERSION_NUMBER((V&0xFF0000)>>16,(V&0xFF00)>>8,(V&0xFF))
/*` `MSGPACK_PREDEF_MAKE_10_VPPP(V)` */
#define MSGPACK_PREDEF_MAKE_10_VPPP(V) MSGPACK_VERSION_NUMBER(((V)/1000)%10,0,(V)%1000)
/*` `MSGPACK_PREDEF_MAKE_10_VR0(V)` */
#define MSGPACK_PREDEF_MAKE_10_VR0(V) MSGPACK_VERSION_NUMBER(((V)/100)%10,((V)/10)%10,0)
/*` `MSGPACK_PREDEF_MAKE_10_VRP(V)` */
#define MSGPACK_PREDEF_MAKE_10_VRP(V) MSGPACK_VERSION_NUMBER(((V)/100)%10,((V)/10)%10,(V)%10)
/*` `MSGPACK_PREDEF_MAKE_10_VRP000(V)` */
#define MSGPACK_PREDEF_MAKE_10_VRP000(V) MSGPACK_VERSION_NUMBER(((V)/100000)%10,((V)/10000)%10,((V)/1000)%10)
/*` `MSGPACK_PREDEF_MAKE_10_VRPPPP(V)` */
#define MSGPACK_PREDEF_MAKE_10_VRPPPP(V) MSGPACK_VERSION_NUMBER(((V)/100000)%10,((V)/10000)%10,(V)%10000)
/*` `MSGPACK_PREDEF_MAKE_10_VRPP(V)` */
#define MSGPACK_PREDEF_MAKE_10_VRPP(V) MSGPACK_VERSION_NUMBER(((V)/1000)%10,((V)/100)%10,(V)%100)
/*` `MSGPACK_PREDEF_MAKE_10_VRR(V)` */
@@ -62,8 +66,12 @@ Macros are:
#define MSGPACK_PREDEF_MAKE_10_VV00(V) MSGPACK_VERSION_NUMBER(((V)/100)%100,0,0)
/*` `MSGPACK_PREDEF_MAKE_10_VVRR(V)` */
#define MSGPACK_PREDEF_MAKE_10_VVRR(V) MSGPACK_VERSION_NUMBER(((V)/100)%100,(V)%100,0)
/*` `MSGPACK_PREDEF_MAKE_10_VVRRP(V)` */
#define MSGPACK_PREDEF_MAKE_10_VVRRP(V) MSGPACK_VERSION_NUMBER(((V)/1000)%100,((V)/10)%100,(V)%10)
/*` `MSGPACK_PREDEF_MAKE_10_VVRRPP(V)` */
#define MSGPACK_PREDEF_MAKE_10_VVRRPP(V) MSGPACK_VERSION_NUMBER(((V)/10000)%100,((V)/100)%100,(V)%100)
/*` `MSGPACK_PREDEF_MAKE_10_VVRRPPP(V)` */
#define MSGPACK_PREDEF_MAKE_10_VVRRPPP(V) MSGPACK_VERSION_NUMBER(((V)/100000)%100,((V)/1000)%100,(V)%1000)
/*` `MSGPACK_PREDEF_MAKE_10_VVRR0PP00(V)` */
#define MSGPACK_PREDEF_MAKE_10_VVRR0PP00(V) MSGPACK_VERSION_NUMBER(((V)/10000000)%100,((V)/100000)%100,((V)/100)%100)
/*` `MSGPACK_PREDEF_MAKE_10_VVRR0PPPP(V)` */

View File

@@ -5,8 +5,8 @@ Distributed under the Boost Software License, Version 1.0.
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef MSGPACK_PREDEF_OS_ADROID_H
#define MSGPACK_PREDEF_OS_ADROID_H
#ifndef MSGPACK_PREDEF_OS_ANDROID_H
#define MSGPACK_PREDEF_OS_ANDROID_H
#include <msgpack/predef/version_number.h>
#include <msgpack/predef/make.h>

View File

@@ -34,13 +34,20 @@ http://www.boost.org/LICENSE_1_0.txt)
# define MSGPACK_OS_BSD_AVAILABLE
# endif
# undef MSGPACK_OS_BSD_FREE
# include <sys/param.h>
# if defined(__FreeBSD_version)
# if __FreeBSD_version < 500000
# if __FreeBSD_version == 491000
# define MSGPACK_OS_BSD_FREE \
MSGPACK_PREDEF_MAKE_10_VRP000(__FreeBSD_version)
MSGPACK_VERSION_NUMBER(4, 10, 0)
# elif __FreeBSD_version == 492000
# define MSGPACK_OS_BSD_FREE \
MSGPACK_VERSION_NUMBER(4, 11, 0)
# elif __FreeBSD_version < 500000
# define MSGPACK_OS_BSD_FREE \
MSGPACK_PREDEF_MAKE_10_VRPPPP(__FreeBSD_version)
# else
# define MSGPACK_OS_BSD_FREE \
MSGPACK_PREDEF_MAKE_10_VRR000(__FreeBSD_version)
MSGPACK_PREDEF_MAKE_10_VVRRPPP(__FreeBSD_version)
# endif
# else
# define MSGPACK_OS_BSD_FREE MSGPACK_VERSION_NUMBER_AVAILABLE

View File

@@ -50,6 +50,26 @@ http://www.boost.org/LICENSE_1_0.txt)
[[`OpenBSD4_7`] [4.7.0]]
[[`OpenBSD4_8`] [4.8.0]]
[[`OpenBSD4_9`] [4.9.0]]
[[`OpenBSD5_0`] [5.0.0]]
[[`OpenBSD5_1`] [5.1.0]]
[[`OpenBSD5_2`] [5.2.0]]
[[`OpenBSD5_3`] [5.3.0]]
[[`OpenBSD5_4`] [5.4.0]]
[[`OpenBSD5_5`] [5.5.0]]
[[`OpenBSD5_6`] [5.6.0]]
[[`OpenBSD5_7`] [5.7.0]]
[[`OpenBSD5_8`] [5.8.0]]
[[`OpenBSD5_9`] [5.9.0]]
[[`OpenBSD6_0`] [6.0.0]]
[[`OpenBSD6_1`] [6.1.0]]
[[`OpenBSD6_2`] [6.2.0]]
[[`OpenBSD6_3`] [6.3.0]]
[[`OpenBSD6_4`] [6.4.0]]
[[`OpenBSD6_5`] [6.5.0]]
[[`OpenBSD6_6`] [6.6.0]]
[[`OpenBSD6_7`] [6.7.0]]
[[`OpenBSD6_8`] [6.8.0]]
[[`OpenBSD6_9`] [6.9.0]]
]
*/
@@ -153,6 +173,66 @@ http://www.boost.org/LICENSE_1_0.txt)
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD4_9)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(4,9,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_0)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,0,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_1)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,1,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_2)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,2,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_3)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,3,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_4)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,4,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_5)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,5,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_6)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,6,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_7)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,7,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_8)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,8,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_9)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,9,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_0)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,0,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_1)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,1,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_2)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,2,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_3)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,3,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_4)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,4,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_5)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,5,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_6)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,6,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_7)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,7,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_8)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,8,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_9)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,9,0)
# endif
# if !defined(MSGPACK_OS_BSD_OPEN)
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER_AVAILABLE
# endif

View File

@@ -148,8 +148,7 @@ information and acquired knowledge:
# undef MSGPACK_ENDIAN_BIG_BYTE
# define MSGPACK_ENDIAN_BIG_BYTE MSGPACK_VERSION_NUMBER_AVAILABLE
# endif
# if MSGPACK_ARCH_AMD64 || \
MSGPACK_ARCH_IA64 || \
# if MSGPACK_ARCH_IA64 || \
MSGPACK_ARCH_X86 || \
MSGPACK_ARCH_BLACKFIN
# undef MSGPACK_ENDIAN_LITTLE_BYTE

View File

@@ -0,0 +1,87 @@
/*
Copyright Rene Rivera 2017
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_PREDEF_WORKAROUND_H
#define MSGPACK_PREDEF_WORKAROUND_H
/*`
[heading `MSGPACK_PREDEF_WORKAROUND`]
``
MSGPACK_PREDEF_WORKAROUND(symbol,comp,major,minor,patch)
``
Usage:
``
#if MSGPACK_PREDEF_WORKAROUND(MSGPACK_COMP_CLANG,<,3,0,0)
// Workaround for old clang compilers..
#endif
``
Defines a comparison against two version numbers that depends on the definion
of `MSGPACK_STRICT_CONFIG`. When `MSGPACK_STRICT_CONFIG` is defined this will expand
to a value convertible to `false`. Which has the effect of disabling all code
conditionally guarded by `MSGPACK_PREDEF_WORKAROUND`. When `MSGPACK_STRICT_CONFIG`
is undefine this expand to test the given `symbol` version value with the
`comp` comparison against `MSGPACK_VERSION_NUMBER(major,minor,patch)`.
*/
#ifdef MSGPACK_STRICT_CONFIG
# define MSGPACK_PREDEF_WORKAROUND(symbol, comp, major, minor, patch) (0)
#else
# include <msgpack/predef/version_number.h>
# define MSGPACK_PREDEF_WORKAROUND(symbol, comp, major, minor, patch) \
( (symbol) != (0) ) && \
( (symbol) comp (MSGPACK_VERSION_NUMBER( (major) , (minor) , (patch) )) )
#endif
/*`
[heading `MSGPACK_PREDEF_TESTED_AT`]
``
MSGPACK_PREDEF_TESTED_AT(symbol,major,minor,patch)
``
Usage:
``
#if MSGPACK_PREDEF_TESTED_AT(MSGPACK_COMP_CLANG,3,5,0)
// Needed for clang, and last checked for 3.5.0.
#endif
``
Defines a comparison against two version numbers that depends on the definion
of `MSGPACK_STRICT_CONFIG` and `MSGPACK_DETECT_OUTDATED_WORKAROUNDS`.
When `MSGPACK_STRICT_CONFIG` is defined this will expand to a value convertible
to `false`. Which has the effect of disabling all code
conditionally guarded by `MSGPACK_PREDEF_TESTED_AT`. When `MSGPACK_STRICT_CONFIG`
is undefined this expand to either:
* A value convertible to `true` when `MSGPACK_DETECT_OUTDATED_WORKAROUNDS` is not
defined.
* A value convertible `true` when the expansion of
`MSGPACK_PREDEF_WORKAROUND(symbol, <=, major, minor, patch)` is `true` and
`MSGPACK_DETECT_OUTDATED_WORKAROUNDS` is defined.
* A compile error when the expansion of
`MSGPACK_PREDEF_WORKAROUND(symbol, >, major, minor, patch)` is true and
`MSGPACK_DETECT_OUTDATED_WORKAROUNDS` is defined.
*/
#ifdef MSGPACK_STRICT_CONFIG
# define MSGPACK_PREDEF_TESTED_AT(symbol, major, minor, patch) (0)
#else
# ifdef MSGPACK_DETECT_OUTDATED_WORKAROUNDS
# define MSGPACK_PREDEF_TESTED_AT(symbol, major, minor, patch) ( \
MSGPACK_PREDEF_WORKAROUND(symbol, <=, major, minor, patch) \
? 1 \
: (1%0) )
# else
# define MSGPACK_PREDEF_TESTED_AT(symbol, major, minor, patch) \
( (symbol) >= MSGPACK_VERSION_NUMBER_AVAILABLE )
# endif
#endif
#endif

View File

@@ -11,11 +11,18 @@ http://www.boost.org/LICENSE_1_0.txt)
#define MSGPACK_PREDEF_PLATFORM_H
#endif
#include <msgpack/predef/platform/cloudabi.h>
#include <msgpack/predef/platform/mingw.h>
#include <msgpack/predef/platform/mingw32.h>
#include <msgpack/predef/platform/mingw64.h>
#include <msgpack/predef/platform/windows_uwp.h>
#include <msgpack/predef/platform/windows_desktop.h>
#include <msgpack/predef/platform/windows_store.h>
#include <msgpack/predef/platform/windows_phone.h>
#include <msgpack/predef/platform/windows_runtime.h>
#include <msgpack/predef/platform/windows_server.h>
#include <msgpack/predef/platform/windows_store.h>
#include <msgpack/predef/platform/windows_system.h>
#include <msgpack/predef/platform/windows_runtime.h> // deprecated
#include <msgpack/predef/platform/ios.h>
/*#include <msgpack/predef/platform/.h>*/
#endif

View File

@@ -0,0 +1,43 @@
/*
Copyright 2017 James E. King, III
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_PREDEF_PLAT_CLOUDABI_H
#define MSGPACK_PREDEF_PLAT_CLOUDABI_H
#include <msgpack/predef/version_number.h>
#include <msgpack/predef/make.h>
/*`
[heading `MSGPACK_PLAT_CLOUDABI`]
[@https://github.com/NuxiNL/cloudabi CloudABI] platform.
[table
[[__predef_symbol__] [__predef_version__]]
[[`__CloudABI__`] [__predef_detection__]]
]
*/
#define MSGPACK_PLAT_CLOUDABI MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
#if defined(__CloudABI__)
# undef MSGPACK_PLAT_CLOUDABI
# define MSGPACK_PLAT_CLOUDABI MSGPACK_VERSION_NUMBER_AVAILABLE
#endif
#if MSGPACK_PLAT_CLOUDABI
# define MSGPACK_PLAT_CLOUDABI_AVAILABLE
# include <msgpack/predef/detail/platform_detected.h>
#endif
#define MSGPACK_PLAT_CLOUDABI_NAME "CloudABI"
#endif
#include <msgpack/predef/detail/test.h>
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_CLOUDABI,MSGPACK_PLAT_CLOUDABI_NAME)

View File

@@ -0,0 +1,58 @@
/*
Copyright Ruslan Baratov 2017
Copyright Rene Rivera 2017
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_PREDEF_PLAT_IOS_H
#define MSGPACK_PREDEF_PLAT_IOS_H
#include <msgpack/predef/os/ios.h> // MSGPACK_OS_IOS
#include <msgpack/predef/version_number.h> // MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
/*`
[heading `MSGPACK_PLAT_IOS_DEVICE`]
[heading `MSGPACK_PLAT_IOS_SIMULATOR`]
[table
[[__predef_symbol__] [__predef_version__]]
[[`TARGET_IPHONE_SIMULATOR`] [__predef_detection__]]
]
*/
#define MSGPACK_PLAT_IOS_DEVICE MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
#define MSGPACK_PLAT_IOS_SIMULATOR MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
// https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h
#if MSGPACK_OS_IOS
# include <TargetConditionals.h>
# if TARGET_IPHONE_SIMULATOR == 1
# undef MSGPACK_PLAT_IOS_SIMULATOR
# define MSGPACK_PLAT_IOS_SIMULATOR MSGPACK_VERSION_NUMBER_AVAILABLE
# else
# undef MSGPACK_PLAT_IOS_DEVICE
# define MSGPACK_PLAT_IOS_DEVICE MSGPACK_VERSION_NUMBER_AVAILABLE
# endif
#endif
#if MSGPACK_PLAT_IOS_SIMULATOR
# define MSGPACK_PLAT_IOS_SIMULATOR_AVAILABLE
# include <msgpack/predef/detail/platform_detected.h>
#endif
#if MSGPACK_PLAT_IOS_DEVICE
# define MSGPACK_PLAT_IOS_DEVICE_AVAILABLE
# include <msgpack/predef/detail/platform_detected.h>
#endif
#define MSGPACK_PLAT_IOS_SIMULATOR_NAME "iOS Simulator"
#define MSGPACK_PLAT_IOS_DEVICE_NAME "iOS Device"
#endif // MSGPACK_PREDEF_PLAT_IOS_H
#include <msgpack/predef/detail/test.h>
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_IOS_SIMULATOR,MSGPACK_PLAT_IOS_SIMULATOR_NAME)
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_IOS_DEVICE,MSGPACK_PLAT_IOS_DEVICE_NAME)

View File

@@ -5,8 +5,8 @@ Distributed under the Boost Software License, Version 1.0.
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef MSGPACK_PREDEF_COMPILER_MINGW_H
#define MSGPACK_PREDEF_COMPILER_MINGW_H
#ifndef MSGPACK_PREDEF_PLAT_MINGW_H
#define MSGPACK_PREDEF_PLAT_MINGW_H
#include <msgpack/predef/version_number.h>
#include <msgpack/predef/make.h>
@@ -14,7 +14,7 @@ http://www.boost.org/LICENSE_1_0.txt)
/*`
[heading `MSGPACK_PLAT_MINGW`]
[@http://en.wikipedia.org/wiki/MinGW MinGW] platform.
[@http://en.wikipedia.org/wiki/MinGW MinGW] platform, either variety.
Version number available as major, minor, and patch.
[table
@@ -56,7 +56,7 @@ Version number available as major, minor, and patch.
# include <msgpack/predef/detail/platform_detected.h>
#endif
#define MSGPACK_PLAT_MINGW_NAME "MinGW"
#define MSGPACK_PLAT_MINGW_NAME "MinGW (any variety)"
#endif

View File

@@ -0,0 +1,63 @@
/*
Copyright Rene Rivera 2008-2015
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_PREDEF_PLAT_MINGW32_H
#define MSGPACK_PREDEF_PLAT_MINGW32_H
#include <msgpack/predef/version_number.h>
#include <msgpack/predef/make.h>
/*`
[heading `MSGPACK_PLAT_MINGW32`]
[@http://www.mingw.org/ MinGW] platform.
Version number available as major, minor, and patch.
[table
[[__predef_symbol__] [__predef_version__]]
[[`__MINGW32__`] [__predef_detection__]]
[[`__MINGW32_VERSION_MAJOR`, `__MINGW32_VERSION_MINOR`] [V.R.0]]
]
*/
#define MSGPACK_PLAT_MINGW32 MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
#if defined(__MINGW32__)
# include <_mingw.h>
# if !defined(MSGPACK_PLAT_MINGW32_DETECTION) && (defined(__MINGW32_VERSION_MAJOR) && defined(__MINGW32_VERSION_MINOR))
# define MSGPACK_PLAT_MINGW32_DETECTION \
MSGPACK_VERSION_NUMBER(__MINGW32_VERSION_MAJOR,__MINGW32_VERSION_MINOR,0)
# endif
# if !defined(MSGPACK_PLAT_MINGW32_DETECTION)
# define MSGPACK_PLAT_MINGW32_DETECTION MSGPACK_VERSION_NUMBER_AVAILABLE
# endif
#endif
#ifdef MSGPACK_PLAT_MINGW32_DETECTION
# define MSGPACK_PLAT_MINGW32_AVAILABLE
# if defined(MSGPACK_PREDEF_DETAIL_PLAT_DETECTED)
# define MSGPACK_PLAT_MINGW32_EMULATED MSGPACK_PLAT_MINGW32_DETECTION
# else
# undef MSGPACK_PLAT_MINGW32
# define MSGPACK_PLAT_MINGW32 MSGPACK_PLAT_MINGW32_DETECTION
# endif
# include <msgpack/predef/detail/platform_detected.h>
#endif
#define MSGPACK_PLAT_MINGW32_NAME "MinGW"
#endif
#include <msgpack/predef/detail/test.h>
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_MINGW32,MSGPACK_PLAT_MINGW32_NAME)
#ifdef MSGPACK_PLAT_MINGW32_EMULATED
#include <msgpack/predef/detail/test.h>
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_MINGW32_EMULATED,MSGPACK_PLAT_MINGW32_NAME)
#endif

View File

@@ -0,0 +1,63 @@
/*
Copyright Rene Rivera 2008-2015
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_PREDEF_PLAT_MINGW64_H
#define MSGPACK_PREDEF_PLAT_MINGW64_H
#include <msgpack/predef/version_number.h>
#include <msgpack/predef/make.h>
/*`
[heading `MSGPACK_PLAT_MINGW64`]
[@https://mingw-w64.org/ MinGW-w64] platform.
Version number available as major, minor, and patch.
[table
[[__predef_symbol__] [__predef_version__]]
[[`__MINGW64__`] [__predef_detection__]]
[[`__MINGW64_VERSION_MAJOR`, `__MINGW64_VERSION_MINOR`] [V.R.0]]
]
*/
#define MSGPACK_PLAT_MINGW64 MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
#if defined(__MINGW64__)
# include <_mingw.h>
# if !defined(MSGPACK_PLAT_MINGW64_DETECTION) && (defined(__MINGW64_VERSION_MAJOR) && defined(__MINGW64_VERSION_MINOR))
# define MSGPACK_PLAT_MINGW64_DETECTION \
MSGPACK_VERSION_NUMBER(__MINGW64_VERSION_MAJOR,__MINGW64_VERSION_MINOR,0)
# endif
# if !defined(MSGPACK_PLAT_MINGW64_DETECTION)
# define MSGPACK_PLAT_MINGW64_DETECTION MSGPACK_VERSION_NUMBER_AVAILABLE
# endif
#endif
#ifdef MSGPACK_PLAT_MINGW64_DETECTION
# define MSGPACK_PLAT_MINGW64_AVAILABLE
# if defined(MSGPACK_PREDEF_DETAIL_PLAT_DETECTED)
# define MSGPACK_PLAT_MINGW64_EMULATED MSGPACK_PLAT_MINGW64_DETECTION
# else
# undef MSGPACK_PLAT_MINGW64
# define MSGPACK_PLAT_MINGW64 MSGPACK_PLAT_MINGW64_DETECTION
# endif
# include <msgpack/predef/detail/platform_detected.h>
#endif
#define MSGPACK_PLAT_MINGW64_NAME "MinGW-w64"
#endif
#include <msgpack/predef/detail/test.h>
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_MINGW64,MSGPACK_PLAT_MINGW64_NAME)
#ifdef MSGPACK_PLAT_MINGW64_EMULATED
#include <msgpack/predef/detail/test.h>
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_MINGW64_EMULATED,MSGPACK_PLAT_MINGW64_NAME)
#endif

View File

@@ -9,25 +9,31 @@ http://www.boost.org/LICENSE_1_0.txt)
#ifndef MSGPACK_PREDEF_PLAT_WINDOWS_DESKTOP_H
#define MSGPACK_PREDEF_PLAT_WINDOWS_DESKTOP_H
#include <msgpack/predef/version_number.h>
#include <msgpack/predef/make.h>
#include <msgpack/predef/os/windows.h>
#include <msgpack/predef/platform/windows_uwp.h>
#include <msgpack/predef/version_number.h>
/*`
[heading `MSGPACK_PLAT_WINDOWS_DESKTOP`]
[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP]
for Windows Desktop development. Also available if the Platform SDK is too
old to support UWP.
[table
[[__predef_symbol__] [__predef_version__]]
[[`!WINAPI_FAMILY`] [__predef_detection__]]
[[`WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP`] [__predef_detection__]]
[[`!MSGPACK_PLAT_WINDOWS_UWP`] [__predef_detection__]]
]
*/
#define MSGPACK_PLAT_WINDOWS_DESKTOP MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
#if MSGPACK_OS_WINDOWS && \
( !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) )
((defined(WINAPI_FAMILY_DESKTOP_APP) && WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) || \
!MSGPACK_PLAT_WINDOWS_UWP)
# undef MSGPACK_PLAT_WINDOWS_DESKTOP
# define MSGPACK_PLAT_WINDOWS_DESKTOP MSGPACK_VERSION_NUMBER_AVAILABLE
#endif

View File

@@ -9,13 +9,17 @@ http://www.boost.org/LICENSE_1_0.txt)
#ifndef MSGPACK_PREDEF_PLAT_WINDOWS_PHONE_H
#define MSGPACK_PREDEF_PLAT_WINDOWS_PHONE_H
#include <msgpack/predef/version_number.h>
#include <msgpack/predef/make.h>
#include <msgpack/predef/os/windows.h>
#include <msgpack/predef/platform/windows_uwp.h>
#include <msgpack/predef/version_number.h>
/*`
[heading `MSGPACK_PLAT_WINDOWS_PHONE`]
[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP]
for Windows Phone development.
[table
[[__predef_symbol__] [__predef_version__]]
@@ -25,7 +29,8 @@ http://www.boost.org/LICENSE_1_0.txt)
#define MSGPACK_PLAT_WINDOWS_PHONE MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
#if MSGPACK_OS_WINDOWS && defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
#if MSGPACK_OS_WINDOWS && \
defined(WINAPI_FAMILY_PHONE_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
# undef MSGPACK_PLAT_WINDOWS_PHONE
# define MSGPACK_PLAT_WINDOWS_PHONE MSGPACK_VERSION_NUMBER_AVAILABLE
#endif

View File

@@ -9,25 +9,33 @@ http://www.boost.org/LICENSE_1_0.txt)
#ifndef MSGPACK_PREDEF_PLAT_WINDOWS_RUNTIME_H
#define MSGPACK_PREDEF_PLAT_WINDOWS_RUNTIME_H
#include <msgpack/predef/version_number.h>
#include <msgpack/predef/make.h>
#include <msgpack/predef/os/windows.h>
#include <msgpack/predef/platform/windows_phone.h>
#include <msgpack/predef/platform/windows_store.h>
#include <msgpack/predef/version_number.h>
/*`
[heading `MSGPACK_PLAT_WINDOWS_RUNTIME`]
Deprecated.
[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP]
for Windows Phone or Store development. This does not align to the existing development model for
UWP and is deprecated. Use one of the other `MSGPACK_PLAT_WINDOWS_*`definitions instead.
[table
[[__predef_symbol__] [__predef_version__]]
[[`WINAPI_FAMILY == WINAPI_FAMILY_APP`] [__predef_detection__]]
[[`WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP`] [__predef_detection__]]
[[`MSGPACK_PLAT_WINDOWS_PHONE`] [__predef_detection__]]
[[`MSGPACK_PLAT_WINDOWS_STORE`] [__predef_detection__]]
]
*/
#define MSGPACK_PLAT_WINDOWS_RUNTIME MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
#if MSGPACK_OS_WINDOWS && defined(WINAPI_FAMILY) && \
( WINAPI_FAMILY == WINAPI_FAMILY_APP || WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP )
#if MSGPACK_OS_WINDOWS && \
(MSGPACK_PLAT_WINDOWS_STORE || MSGPACK_PLAT_WINDOWS_PHONE)
# undef MSGPACK_PLAT_WINDOWS_RUNTIME
# define MSGPACK_PLAT_WINDOWS_RUNTIME MSGPACK_VERSION_NUMBER_AVAILABLE
#endif

View File

@@ -0,0 +1,47 @@
/*
Copyright James E. King III, 2017
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_PREDEF_PLAT_WINDOWS_SERVER_H
#define MSGPACK_PREDEF_PLAT_WINDOWS_SERVER_H
#include <msgpack/predef/make.h>
#include <msgpack/predef/os/windows.h>
#include <msgpack/predef/platform/windows_uwp.h>
#include <msgpack/predef/version_number.h>
/*`
[heading `MSGPACK_PLAT_WINDOWS_SERVER`]
[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP]
for Windows Server development.
[table
[[__predef_symbol__] [__predef_version__]]
[[`WINAPI_FAMILY == WINAPI_FAMILY_SERVER`] [__predef_detection__]]
]
*/
#define MSGPACK_PLAT_WINDOWS_SERVER MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
#if MSGPACK_OS_WINDOWS && \
defined(WINAPI_FAMILY_SERVER) && WINAPI_FAMILY == WINAPI_FAMILY_SERVER
# undef MSGPACK_PLAT_WINDOWS_SERVER
# define MSGPACK_PLAT_WINDOWS_SERVER MSGPACK_VERSION_NUMBER_AVAILABLE
#endif
#if MSGPACK_PLAT_WINDOWS_SERVER
# define MSGPACK_PLAT_WINDOWS_SERVER_AVAILABLE
# include <msgpack/predef/detail/platform_detected.h>
#endif
#define MSGPACK_PLAT_WINDOWS_SERVER_NAME "Windows Server"
#endif
#include <msgpack/predef/detail/test.h>
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_WINDOWS_SERVER,MSGPACK_PLAT_WINDOWS_SERVER_NAME)

View File

@@ -9,23 +9,30 @@ http://www.boost.org/LICENSE_1_0.txt)
#ifndef MSGPACK_PREDEF_PLAT_WINDOWS_STORE_H
#define MSGPACK_PREDEF_PLAT_WINDOWS_STORE_H
#include <msgpack/predef/version_number.h>
#include <msgpack/predef/make.h>
#include <msgpack/predef/os/windows.h>
#include <msgpack/predef/platform/windows_uwp.h>
#include <msgpack/predef/version_number.h>
/*`
[heading `MSGPACK_PLAT_WINDOWS_STORE`]
[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP]
for Windows Store development.
[table
[[__predef_symbol__] [__predef_version__]]
[[`WINAPI_FAMILY == WINAPI_FAMILY_APP`] [__predef_detection__]]
]
[[`WINAPI_FAMILY == WINAPI_FAMILY_PC_APP`] [__predef_detection__]]
[[`WINAPI_FAMILY == WINAPI_FAMILY_APP` (deprecated)] [__predef_detection__]]
]
*/
#define MSGPACK_PLAT_WINDOWS_STORE MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
#if MSGPACK_OS_WINDOWS && defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_APP
#if MSGPACK_OS_WINDOWS && \
((defined(WINAPI_FAMILY_PC_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) || \
(defined(WINAPI_FAMILY_APP) && WINAPI_FAMILY == WINAPI_FAMILY_APP))
# undef MSGPACK_PLAT_WINDOWS_STORE
# define MSGPACK_PLAT_WINDOWS_STORE MSGPACK_VERSION_NUMBER_AVAILABLE
#endif

View File

@@ -0,0 +1,47 @@
/*
Copyright James E. King III, 2017
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_PREDEF_PLAT_WINDOWS_SYSTEM_H
#define MSGPACK_PREDEF_PLAT_WINDOWS_SYSTEM_H
#include <msgpack/predef/make.h>
#include <msgpack/predef/os/windows.h>
#include <msgpack/predef/platform/windows_uwp.h>
#include <msgpack/predef/version_number.h>
/*`
[heading `MSGPACK_PLAT_WINDOWS_SYSTEM`]
[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP]
for Windows System development.
[table
[[__predef_symbol__] [__predef_version__]]
[[`WINAPI_FAMILY == WINAPI_FAMILY_SYSTEM`] [__predef_detection__]]
]
*/
#define MSGPACK_PLAT_WINDOWS_SYSTEM MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
#if MSGPACK_OS_WINDOWS && \
defined(WINAPI_FAMILY_SYSTEM) && WINAPI_FAMILY == WINAPI_FAMILY_SYSTEM
# undef MSGPACK_PLAT_WINDOWS_SYSTEM
# define MSGPACK_PLAT_WINDOWS_SYSTEM MSGPACK_VERSION_NUMBER_AVAILABLE
#endif
#if MSGPACK_PLAT_WINDOWS_SYSTEM
# define MSGPACK_PLAT_WINDOWS_SYSTEM_AVAILABLE
# include <msgpack/predef/detail/platform_detected.h>
#endif
#define MSGPACK_PLAT_WINDOWS_SYSTEM_NAME "Windows Drivers and Tools"
#endif
#include <msgpack/predef/detail/test.h>
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_WINDOWS_SYSTEM,MSGPACK_PLAT_WINDOWS_SYSTEM_NAME)

View File

@@ -0,0 +1,60 @@
/*
Copyright James E. King III, 2017
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_PREDEF_PLAT_WINDOWS_UWP_H
#define MSGPACK_PREDEF_PLAT_WINDOWS_UWP_H
#include <msgpack/predef/make.h>
#include <msgpack/predef/os/windows.h>
#include <msgpack/predef/version_number.h>
/*`
[heading `MSGPACK_PLAT_WINDOWS_UWP`]
[@http://docs.microsoft.com/windows/uwp/ Universal Windows Platform]
is available if the current development environment is capable of targeting
UWP development.
[table
[[__predef_symbol__] [__predef_version__]]
[[`__MINGW64_VERSION_MAJOR` from `_mingw.h`] [`>= 3`]]
[[`VER_PRODUCTBUILD` from `ntverp.h`] [`>= 9200`]]
]
*/
#define MSGPACK_PLAT_WINDOWS_UWP MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
#define MSGPACK_PLAT_WINDOWS_SDK_VERSION MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
#if MSGPACK_OS_WINDOWS
// MinGW (32-bit) has no ntverp.h header
#if !defined(__MINGW32__)
# include <ntverp.h>
# undef MSGPACK_PLAT_WINDOWS_SDK_VERSION
# define MSGPACK_PLAT_WINDOWS_SDK_VERSION MSGPACK_VERSION_NUMBER(0, 0, VER_PRODUCTBUILD)
#endif
// 9200 is Windows SDK 8.0 from ntverp.h which introduced family support
#if ((MSGPACK_PLAT_WINDOWS_SDK_VERSION >= MSGPACK_VERSION_NUMBER(0, 0, 9200)) || \
(defined(__MINGW64__) && __MINGW64_VERSION_MAJOR >= 3))
# undef MSGPACK_PLAT_WINDOWS_UWP
# define MSGPACK_PLAT_WINDOWS_UWP MSGPACK_VERSION_NUMBER_AVAILABLE
#endif
#endif
#if MSGPACK_PLAT_WINDOWS_UWP
# define MSGPACK_PLAT_WINDOWS_UWP_AVAILABLE
# include <msgpack/predef/detail/platform_detected.h>
# include <winapifamily.h> // Windows SDK
#endif
#define MSGPACK_PLAT_WINDOWS_UWP_NAME "Universal Windows Platform"
#endif
#include <msgpack/predef/detail/test.h>
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_WINDOWS_UWP, MSGPACK_PLAT_WINDOWS_UWP_NAME)

View File

@@ -10,6 +10,6 @@ http://www.boost.org/LICENSE_1_0.txt)
#include <msgpack/predef/version_number.h>
#define MSGPACK_PREDEF_VERSION MSGPACK_VERSION_NUMBER(1,4,1)
#define MSGPACK_PREDEF_VERSION MSGPACK_VERSION_NUMBER(1,8,0)
#endif

View File

@@ -1,5 +1,5 @@
/*
Copyright Rene Rivera 2005, 2008-2013
Copyright Rene Rivera 2005-2016
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)
@@ -50,4 +50,23 @@ Defines standard version numbers, with these properties:
#define MSGPACK_VERSION_NUMBER_NOT_AVAILABLE \
MSGPACK_VERSION_NUMBER_ZERO
/*`
``
MSGPACK_VERSION_NUMBER_MAJOR(N), MSGPACK_VERSION_NUMBER_MINOR(N), MSGPACK_VERSION_NUMBER_PATCH(N)
``
The macros extract the major, minor, and patch portion from a well formed
version number resulting in a preprocessor expression in the range of
\[0,99\] or \[0,99999\] for the major and minor, or patch numbers
respectively.
*/
#define MSGPACK_VERSION_NUMBER_MAJOR(N) \
( ((N)/10000000)%100 )
#define MSGPACK_VERSION_NUMBER_MINOR(N) \
( ((N)/100000)%100 )
#define MSGPACK_VERSION_NUMBER_PATCH(N) \
( (N)%100000 )
#endif

View File

@@ -25,7 +25,7 @@
# define MSGPACK_PP_CAT_OO(par) MSGPACK_PP_CAT_I ## par
# endif
#
# if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_MSVC()
# if (~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_MSVC()) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700)
# define MSGPACK_PP_CAT_I(a, b) a ## b
# else
# define MSGPACK_PP_CAT_I(a, b) MSGPACK_PP_CAT_II(~, a ## b)

View File

@@ -25,18 +25,16 @@
# define MSGPACK_PP_CONFIG_DMC() 0x0040
#
# ifndef MSGPACK_PP_CONFIG_FLAGS
# if defined(__GCCXML__)
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_STRICT())
# elif defined(__WAVE__)
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_STRICT())
# elif defined(__MWERKS__) && __MWERKS__ >= 0x3200
# if defined(__GCCXML__) || defined(__WAVE__) || defined(__MWERKS__) && __MWERKS__ >= 0x3200
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_STRICT())
# elif defined(__EDG__) || defined(__EDG_VERSION__)
# if defined(_MSC_VER) && (defined(__INTELLISENSE__) || __EDG_VERSION__ >= 308)
# if defined(_MSC_VER) && !defined(__clang__) && (defined(__INTELLISENSE__) || __EDG_VERSION__ >= 308)
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_MSVC())
# else
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_EDG() | MSGPACK_PP_CONFIG_STRICT())
# endif
# elif defined(_MSC_VER) && defined(__clang__)
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_STRICT())
# elif defined(__MWERKS__)
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_MWCC())
# elif defined(__DMC__)
@@ -45,7 +43,7 @@
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_STRICT())
# elif defined(__BORLANDC__) || defined(__IBMC__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_BCC())
# elif defined(_MSC_VER) && !defined(__clang__)
# elif defined(_MSC_VER)
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_MSVC())
# else
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_STRICT())
@@ -73,10 +71,14 @@
# define MSGPACK_PP_VARIADICS_MSVC 0
# if !defined MSGPACK_PP_VARIADICS
# /* variadic support explicitly disabled for all untested compilers */
# if defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || ( defined __SUNPRO_CC && __SUNPRO_CC < 0x5120 ) || defined __HP_aCC && !defined __EDG__ || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI
# if defined __GCCXML__ || defined __PATHSCALE__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || ( defined __SUNPRO_CC && __SUNPRO_CC < 0x5120 ) || defined __HP_aCC && !defined __EDG__ || defined __MRC__ || defined __SC__ || defined __PGI
# define MSGPACK_PP_VARIADICS 0
# /* VC++ (C/C++) */
# elif defined _MSC_VER && _MSC_VER >= 1400 && (!defined __EDG__ || defined(__INTELLISENSE__)) && !defined __clang__
# elif defined(__CUDACC__)
# define MSGPACK_PP_VARIADICS 1
# elif defined(_MSC_VER) && defined(__clang__)
# define MSGPACK_PP_VARIADICS 1
# /* VC++ (C/C++) and Intel C++ Compiler >= 17.0 with MSVC */
# elif defined _MSC_VER && _MSC_VER >= 1400 && (!defined __EDG__ || defined(__INTELLISENSE__) || defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700)
# define MSGPACK_PP_VARIADICS 1
# undef MSGPACK_PP_VARIADICS_MSVC
# define MSGPACK_PP_VARIADICS_MSVC 1
@@ -92,7 +94,7 @@
# elif !MSGPACK_PP_VARIADICS + 1 < 2
# undef MSGPACK_PP_VARIADICS
# define MSGPACK_PP_VARIADICS 1
# if defined _MSC_VER && _MSC_VER >= 1400 && (defined(__INTELLISENSE__) || !(defined __EDG__ || defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __clang__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || defined __SUNPRO_CC || defined __HP_aCC || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI))
# if defined _MSC_VER && _MSC_VER >= 1400 && !defined(__clang__) && (defined(__INTELLISENSE__) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700) || !(defined __EDG__ || defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || defined __SUNPRO_CC || defined __HP_aCC || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI))
# undef MSGPACK_PP_VARIADICS_MSVC
# define MSGPACK_PP_VARIADICS_MSVC 1
# endif

View File

@@ -30,14 +30,13 @@
# endif
# if MSGPACK_PP_VARIADICS
# if MSGPACK_PP_VARIADICS_MSVC
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_GET_REM(...) \
MSGPACK_PP_VARIADIC_IS_SINGLE_RETURN(MSGPACK_PP_REM_CAT,MSGPACK_PP_REM,__VA_ARGS__) \
/**/
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_REM(data) data
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_A(...) (MSGPACK_PP_SEQ_BINARY_TRANSFORM_REM, __VA_ARGS__)() MSGPACK_PP_SEQ_BINARY_TRANSFORM_B
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_B(...) (MSGPACK_PP_SEQ_BINARY_TRANSFORM_REM, __VA_ARGS__)() MSGPACK_PP_SEQ_BINARY_TRANSFORM_A
# else
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_GET_REM(...) MSGPACK_PP_REM
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_A(...) (MSGPACK_PP_REM, __VA_ARGS__)() MSGPACK_PP_SEQ_BINARY_TRANSFORM_B
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_B(...) (MSGPACK_PP_REM, __VA_ARGS__)() MSGPACK_PP_SEQ_BINARY_TRANSFORM_A
# endif
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_A(...) (MSGPACK_PP_SEQ_BINARY_TRANSFORM_GET_REM(__VA_ARGS__), __VA_ARGS__)() MSGPACK_PP_SEQ_BINARY_TRANSFORM_B
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_B(...) (MSGPACK_PP_SEQ_BINARY_TRANSFORM_GET_REM(__VA_ARGS__), __VA_ARGS__)() MSGPACK_PP_SEQ_BINARY_TRANSFORM_A
# else
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_A(e) (MSGPACK_PP_REM, e)() MSGPACK_PP_SEQ_BINARY_TRANSFORM_B
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_B(e) (MSGPACK_PP_REM, e)() MSGPACK_PP_SEQ_BINARY_TRANSFORM_A

View File

@@ -0,0 +1,55 @@
# /* **************************************************************************
# * *
# * (C) Copyright Edward Diener 2016. *
# * 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) *
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef MSGPACK_PREPROCESSOR_SEQ_DETAIL_TO_LIST_MSVC_HPP
# define MSGPACK_PREPROCESSOR_SEQ_DETAIL_TO_LIST_MSVC_HPP
#
# include <msgpack/preprocessor/config/config.hpp>
#
# if MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_MSVC()
#
# include <msgpack/preprocessor/cat.hpp>
# include <msgpack/preprocessor/arithmetic/dec.hpp>
# include <msgpack/preprocessor/control/while.hpp>
# include <msgpack/preprocessor/tuple/elem.hpp>
#
# define MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_STATE_RESULT(state) \
MSGPACK_PP_TUPLE_ELEM(2, 0, state) \
/**/
# define MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_STATE_SIZE(state) \
MSGPACK_PP_TUPLE_ELEM(2, 1, state) \
/**/
# define MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_PRED(d,state) \
MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_STATE_SIZE(state) \
/**/
# define MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_OP(d,state) \
( \
MSGPACK_PP_CAT(MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_STATE_RESULT(state),), \
MSGPACK_PP_DEC(MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_STATE_SIZE(state)) \
) \
/**/
#
# /* MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC */
#
# define MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC(result,seqsize) \
MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_STATE_RESULT \
( \
MSGPACK_PP_WHILE \
( \
MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_PRED, \
MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_OP, \
(result,seqsize) \
) \
) \
/**/
# endif // MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_MSVC()
#
# endif // MSGPACK_PREPROCESSOR_SEQ_DETAIL_TO_LIST_MSVC_HPP

View File

@@ -19,7 +19,19 @@
#
# /* MSGPACK_PP_SEQ_TO_LIST */
#
# if MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_MSVC()
# include <msgpack/preprocessor/seq/size.hpp>
# include <msgpack/preprocessor/seq/detail/to_list_msvc.hpp>
# define MSGPACK_PP_SEQ_TO_LIST(seq) \
MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC \
( \
MSGPACK_PP_SEQ_TO_LIST_I(MSGPACK_PP_SEQ_BINARY_TRANSFORM(seq)), \
MSGPACK_PP_SEQ_SIZE(seq) \
) \
/**/
# else
# define MSGPACK_PP_SEQ_TO_LIST(seq) MSGPACK_PP_SEQ_TO_LIST_I(MSGPACK_PP_SEQ_BINARY_TRANSFORM(seq))
# endif
# define MSGPACK_PP_SEQ_TO_LIST_I(bseq) MSGPACK_PP_SEQ_TO_LIST_A bseq MSGPACK_PP_NIL MSGPACK_PP_SEQ_TO_LIST_B bseq
# define MSGPACK_PP_SEQ_TO_LIST_A(m, e) m(MSGPACK_PP_LPAREN() e MSGPACK_PP_COMMA() MSGPACK_PP_SEQ_TO_LIST_A_ID)
# define MSGPACK_PP_SEQ_TO_LIST_A_ID() MSGPACK_PP_SEQ_TO_LIST_A

View File

@@ -10,8 +10,6 @@
#ifndef MSGPACK_SYSDEP_H
#define MSGPACK_SYSDEP_H
#include <msgpack/predef.h>
#include <stdlib.h>
#include <stddef.h>
@@ -86,6 +84,10 @@
#endif
#if !defined(MSGPACK_ENDIAN_LITTLE_BYTE) && !defined(MSGPACK_ENDIAN_BIG_BYTE)
#include <msgpack/predef/other/endian.h>
#endif // !defined(MSGPACK_ENDIAN_LITTLE_BYTE) && !defined(MSGPACK_ENDIAN_BIG_BYTE)
#if MSGPACK_ENDIAN_LITTLE_BYTE
# if defined(unix) || defined(__unix) || defined(__APPLE__) || defined(__OpenBSD__)

View File

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

View File

@@ -34,6 +34,7 @@
#include "adaptor/cpp11/array.hpp"
#include "adaptor/cpp11/array_char.hpp"
#include "adaptor/cpp11/array_unsigned_char.hpp"
#include "adaptor/cpp11/chrono.hpp"
#include "adaptor/cpp11/forward_list.hpp"
#include "adaptor/cpp11/reference_wrapper.hpp"
#include "adaptor/cpp11/shared_ptr.hpp"
@@ -50,6 +51,10 @@
#include "adaptor/cpp17/string_view.hpp"
#endif // MSGPACK_HAS_INCLUDE(<string_view>)
#include "adaptor/cpp17/byte.hpp"
#include "adaptor/cpp17/carray_byte.hpp"
#include "adaptor/cpp17/vector_byte.hpp"
#endif // defined(MSGPACK_USE_CPP03)
#if defined(MSGPACK_USE_BOOST)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -370,7 +370,7 @@ struct object_pack_visitor {
return true;
}
bool start_map(uint32_t num_kv_pairs) {
m_packer.pack_array(num_kv_pairs);
m_packer.pack_map(num_kv_pairs);
return true;
}
bool start_map_key() {

View File

@@ -58,6 +58,10 @@ public:
:m_ref_size(std::max(ref_size, detail::packer_max_buffer_size + 1)),
m_chunk_size(chunk_size)
{
if((sizeof(chunk) + chunk_size) < chunk_size) {
throw std::bad_alloc();
}
size_t nfirst = (sizeof(iovec) < 72/2) ?
72 / sizeof(iovec) : 8;
@@ -141,7 +145,11 @@ public:
if(sz < len) {
sz = len;
}
if(sizeof(chunk) + sz < sz){
throw std::bad_alloc();
}
chunk* c = static_cast<chunk*>(::malloc(sizeof(chunk) + sz));
if(!c) {
throw std::bad_alloc();
@@ -183,6 +191,10 @@ public:
{
size_t sz = m_chunk_size;
if((sizeof(chunk) + sz) < sz){
throw std::bad_alloc();
}
chunk* empty = static_cast<chunk*>(::malloc(sizeof(chunk) + sz));
if(!empty) {
throw std::bad_alloc();

View File

@@ -39,7 +39,7 @@ class parser;
* @param off The offset position of the buffer. It is read and overwritten.
* @param v The visitor that satisfies visitor concept. https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_visitor#visitor-concept
*
* @return if unpacking process finishs without error then return true, otherwise return false.
* @return if unpacking process finishes without error then return true, otherwise return false.
*
*/
template <typename Visitor>
@@ -52,7 +52,7 @@ bool parse(const char* data, size_t len, size_t& off, Visitor& v);
* @param len The length of the buffer.
* @param v The visitor that satisfies visitor concept. https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_visitor#visitor-concept
*
* @return if unpacking process finishs without error then return true, otherwise return false.
* @return if unpacking process finishes without error then return true, otherwise return false.
*
*/
template <typename Visitor>

View File

@@ -297,8 +297,7 @@ const auto mp_object_def =
(
[](auto& ctx){
auto& app_specific = x3::get<tag_app_specific>(ctx).get();
union { uint32_t i; float f; } mem;
mem.i = _attr(ctx);
union { uint32_t i; float f; } mem = { _attr(ctx) };
app_specific.vis.visit_float32(mem.f);
}
)
@@ -309,8 +308,7 @@ const auto mp_object_def =
(
[](auto& ctx){
auto& app_specific = x3::get<tag_app_specific>(ctx).get();
union { uint64_t i; double f; } mem;
mem.i = _attr(ctx);
union { uint64_t i; double f; } mem = { _attr(ctx) };
#if defined(TARGET_OS_IPHONE)
// ok
#elif defined(__arm__) && !(__ARM_EABI__) // arm-oabi

View File

@@ -1,3 +1,3 @@
#define MSGPACK_VERSION_MAJOR 3
#define MSGPACK_VERSION_MINOR 0
#define MSGPACK_VERSION_MINOR 1
#define MSGPACK_VERSION_REVISION 1

View File

@@ -537,7 +537,7 @@ static inline msgpack_unpack_return unpacker_next(msgpack_unpacker* mpac,
if(ret < 0) {
result->zone = NULL;
memset(&result->data, 0, sizeof(msgpack_object));
return ret;
return (msgpack_unpack_return)ret;
}
if(ret == 0) {
@@ -552,7 +552,7 @@ static inline msgpack_unpack_return unpacker_next(msgpack_unpacker* mpac,
msgpack_unpack_return msgpack_unpacker_next(msgpack_unpacker* mpac,
msgpack_unpacked* result)
{
int ret;
msgpack_unpack_return ret;
ret = unpacker_next(mpac, result);
if (ret == MSGPACK_UNPACK_SUCCESS) {
@@ -566,7 +566,7 @@ msgpack_unpack_return
msgpack_unpacker_next_with_size(msgpack_unpacker* mpac,
msgpack_unpacked* result, size_t *p_bytes)
{
int ret;
msgpack_unpack_return ret;
ret = unpacker_next(mpac, result);
if (ret == MSGPACK_UNPACK_SUCCESS || ret == MSGPACK_UNPACK_CONTINUE) {
@@ -601,7 +601,7 @@ msgpack_unpack(const char* data, size_t len, size_t* off,
e = template_execute(&ctx, data, len, &noff);
if(e < 0) {
return e;
return (msgpack_unpack_return)e;
}
if(off != NULL) { *off = noff; }
@@ -655,7 +655,7 @@ msgpack_unpack_next(msgpack_unpacked* result,
if(e < 0) {
msgpack_zone_free(result->zone);
result->zone = NULL;
return e;
return (msgpack_unpack_return)e;
}
if(e == 0) {

View File

@@ -30,6 +30,10 @@ bool msgpack_vrefbuffer_init(msgpack_vrefbuffer* vbuf,
ref_size > MSGPACK_PACKER_MAX_BUFFER_SIZE + 1 ?
ref_size : MSGPACK_PACKER_MAX_BUFFER_SIZE + 1 ;
if((sizeof(msgpack_vrefbuffer_chunk) + chunk_size) < chunk_size) {
return false;
}
nfirst = (sizeof(struct iovec) < 72/2) ?
72 / sizeof(struct iovec) : 8;
@@ -135,6 +139,9 @@ int msgpack_vrefbuffer_append_copy(msgpack_vrefbuffer* vbuf,
sz = len;
}
if((sizeof(msgpack_vrefbuffer_chunk) + sz) < sz){
return -1;
}
chunk = (msgpack_vrefbuffer_chunk*)malloc(
sizeof(msgpack_vrefbuffer_chunk) + sz);
if(chunk == NULL) {
@@ -164,8 +171,13 @@ int msgpack_vrefbuffer_append_copy(msgpack_vrefbuffer* vbuf,
int msgpack_vrefbuffer_migrate(msgpack_vrefbuffer* vbuf, msgpack_vrefbuffer* to)
{
size_t sz = vbuf->chunk_size;
msgpack_vrefbuffer_chunk* empty;
msgpack_vrefbuffer_chunk* empty = (msgpack_vrefbuffer_chunk*)malloc(
if((sizeof(msgpack_vrefbuffer_chunk) + sz) < sz){
return -1;
}
empty = (msgpack_vrefbuffer_chunk*)malloc(
sizeof(msgpack_vrefbuffer_chunk) + sz);
if(empty == NULL) {
return -1;

View File

@@ -329,7 +329,7 @@ TEST(MSGPACK_BOOST, object_with_zone_variant_str_ref)
EXPECT_EQ(val1.as_boost_string_ref(), "ABC");
msgpack::object obj(val1, z);
msgpack::type::variant val2 = obj.as<msgpack::type::variant>();
// Coverted as std::string.
// Converted as std::string.
EXPECT_TRUE(val2.is_string());
EXPECT_EQ(val2.as_string(), "ABC");
EXPECT_NO_THROW(boost::get<std::string>(val2));
@@ -399,7 +399,7 @@ TEST(MSGPACK_BOOST, object_with_zone_variant_raw_ref)
EXPECT_EQ(val1.as_raw_ref(), msgpack::type::raw_ref(&v.front(), v.size()));
msgpack::object obj(val1, z);
msgpack::type::variant val2 = obj.as<msgpack::type::variant>();
// Coverted as std::vector<char>.
// Converted as std::vector<char>.
EXPECT_TRUE(val2.is_vector_char());
EXPECT_EQ(val2.as_vector_char(), v);
EXPECT_NO_THROW(boost::get<std::vector<char> >(val2));
@@ -469,7 +469,7 @@ TEST(MSGPACK_BOOST, object_with_zone_variant_ext_ref)
EXPECT_EQ(val1.as_ext_ref(), e);
msgpack::object obj(val1, z);
msgpack::type::variant val2 = obj.as<msgpack::type::variant>();
// Coverted as msgpack::type::ext.
// Converted as msgpack::type::ext.
EXPECT_TRUE(val2.is_ext());
EXPECT_EQ(val2.as_ext(), e);
EXPECT_NO_THROW(boost::get<msgpack::type::ext>(val2));

View File

@@ -627,6 +627,105 @@ TEST(MSGPACKC, simple_buffer_fixext_4byte_65536)
msgpack_sbuffer_destroy(&sbuf);
}
TEST(MSGPACKC, simple_buffer_timestamp_32)
{
msgpack_timestamp ts = {
0xffffffff,
0
};
msgpack_sbuffer sbuf;
msgpack_sbuffer_init(&sbuf);
msgpack_packer pk;
msgpack_packer_init(&pk, &sbuf, msgpack_sbuffer_write);
msgpack_pack_timestamp(&pk, &ts);
msgpack_zone z;
msgpack_zone_init(&z, 2048);
msgpack_object obj;
msgpack_unpack_return ret =
msgpack_unpack(sbuf.data, sbuf.size, NULL, &z, &obj);
EXPECT_EQ(MSGPACK_UNPACK_SUCCESS, ret);
EXPECT_EQ(MSGPACK_OBJECT_EXT, obj.type);
EXPECT_EQ(4u, obj.via.ext.size);
EXPECT_EQ(-1, obj.via.ext.type);
msgpack_timestamp ts2;
bool r = msgpack_object_to_timestamp(&obj, &ts2);
EXPECT_TRUE(r);
EXPECT_EQ(ts.tv_sec, ts2.tv_sec);
EXPECT_EQ(ts.tv_nsec, ts2.tv_nsec);
msgpack_zone_destroy(&z);
msgpack_sbuffer_destroy(&sbuf);
}
TEST(MSGPACKC, simple_buffer_timestamp_64)
{
msgpack_timestamp ts = {
0x3ffffffffL,
999999999
};
msgpack_sbuffer sbuf;
msgpack_sbuffer_init(&sbuf);
msgpack_packer pk;
msgpack_packer_init(&pk, &sbuf, msgpack_sbuffer_write);
msgpack_pack_timestamp(&pk, &ts);
msgpack_zone z;
msgpack_zone_init(&z, 2048);
msgpack_object obj;
msgpack_unpack_return ret =
msgpack_unpack(sbuf.data, sbuf.size, NULL, &z, &obj);
EXPECT_EQ(MSGPACK_UNPACK_SUCCESS, ret);
EXPECT_EQ(MSGPACK_OBJECT_EXT, obj.type);
EXPECT_EQ(8u, obj.via.ext.size);
EXPECT_EQ(-1, obj.via.ext.type);
msgpack_timestamp ts2;
bool r = msgpack_object_to_timestamp(&obj, &ts2);
EXPECT_TRUE(r);
EXPECT_EQ(ts.tv_sec, ts2.tv_sec);
EXPECT_EQ(ts.tv_nsec, ts2.tv_nsec);
msgpack_zone_destroy(&z);
msgpack_sbuffer_destroy(&sbuf);
}
TEST(MSGPACKC, simple_buffer_timestamp_96)
{
msgpack_timestamp ts = {
0x7fffffffffffffffLL,
999999999
};
msgpack_sbuffer sbuf;
msgpack_sbuffer_init(&sbuf);
msgpack_packer pk;
msgpack_packer_init(&pk, &sbuf, msgpack_sbuffer_write);
msgpack_pack_timestamp(&pk, &ts);
msgpack_zone z;
msgpack_zone_init(&z, 2048);
msgpack_object obj;
msgpack_unpack_return ret =
msgpack_unpack(sbuf.data, sbuf.size, NULL, &z, &obj);
EXPECT_EQ(MSGPACK_UNPACK_SUCCESS, ret);
EXPECT_EQ(MSGPACK_OBJECT_EXT, obj.type);
EXPECT_EQ(12u, obj.via.ext.size);
EXPECT_EQ(-1, obj.via.ext.type);
msgpack_timestamp ts2;
bool r = msgpack_object_to_timestamp(&obj, &ts2);
EXPECT_TRUE(r);
EXPECT_EQ(ts.tv_sec, ts2.tv_sec);
EXPECT_EQ(ts.tv_nsec, ts2.tv_nsec);
msgpack_zone_destroy(&z);
msgpack_sbuffer_destroy(&sbuf);
}
TEST(MSGPACKC, simple_buffer_array)
{
unsigned int array_size = 5;
@@ -1253,3 +1352,14 @@ TEST(MSGPACKC, unpack_array_uint64)
EXPECT_EQ(0xFFF0000000000001LL, obj.via.array.ptr[0].via.u64);
msgpack_zone_destroy(&z);
}
TEST(MSGPACKC, vref_buffer_overflow)
{
msgpack_vrefbuffer vbuf;
msgpack_vrefbuffer to;
size_t ref_size = 0;
size_t chunk_size = std::numeric_limits<size_t>::max();
EXPECT_FALSE(msgpack_vrefbuffer_init(&vbuf, ref_size, chunk_size));
EXPECT_EQ(-1, msgpack_vrefbuffer_migrate(&vbuf, &to));
}

View File

@@ -856,4 +856,192 @@ TEST(MSGPACK_NO_DEF_CON_ARRAY, simple_buffer)
EXPECT_EQ(val1, val2);
}
TEST(MSGPACK_CHRONO, system_clock)
{
std::chrono::system_clock::time_point val1;
msgpack::sbuffer sbuf;
msgpack::pack(sbuf, val1);
msgpack::object_handle oh =
msgpack::unpack(sbuf.data(), sbuf.size());
std::chrono::system_clock::time_point val2 = oh.get().as<std::chrono::system_clock::time_point>();
EXPECT_EQ(val1, val2);
std::chrono::system_clock::time_point val3;
oh.get().convert(val3);
EXPECT_EQ(val1, val3);
}
TEST(MSGPACK_CHRONO, system_clock_32)
{
std::chrono::system_clock::time_point val1(std::chrono::seconds(0x12345678L));
msgpack::sbuffer sbuf;
msgpack::pack(sbuf, val1);
char packed[] = {
static_cast<char>(0xd6),
static_cast<char>(-1),
static_cast<char>(0x12),
static_cast<char>(0x34),
static_cast<char>(0x56),
static_cast<char>(0x78)
};
EXPECT_EQ(memcmp(sbuf.data(), packed, sizeof(packed)), 0);
msgpack::object_handle oh =
msgpack::unpack(sbuf.data(), sbuf.size());
std::chrono::system_clock::time_point val2 = oh.get().as<std::chrono::system_clock::time_point>();
EXPECT_EQ(val1, val2);
std::chrono::system_clock::time_point val3;
oh.get().convert(val3);
EXPECT_EQ(val1, val3);
}
TEST(MSGPACK_CHRONO, system_clock_32_max)
{
std::chrono::system_clock::time_point val1(std::chrono::seconds(0xffffffffL));
msgpack::sbuffer sbuf;
msgpack::pack(sbuf, val1);
char packed[] = {
static_cast<char>(0xd6),
static_cast<char>(-1),
static_cast<char>(0xff),
static_cast<char>(0xff),
static_cast<char>(0xff),
static_cast<char>(0xff)
};
EXPECT_EQ(memcmp(sbuf.data(), packed, sizeof(packed)), 0);
msgpack::object_handle oh =
msgpack::unpack(sbuf.data(), sbuf.size());
std::chrono::system_clock::time_point val2 = oh.get().as<std::chrono::system_clock::time_point>();
EXPECT_EQ(val1, val2);
std::chrono::system_clock::time_point val3;
oh.get().convert(val3);
EXPECT_EQ(val1, val3);
}
TEST(MSGPACK_CHRONO, system_clock_64)
{
std::chrono::system_clock::time_point val1(std::chrono::seconds(0x31234567L));
val1 +=
std::chrono::duration_cast<std::chrono::system_clock::duration>(
std::chrono::nanoseconds(0x312345678L)
);
msgpack::sbuffer sbuf;
msgpack::pack(sbuf, val1);
msgpack::object_handle oh =
msgpack::unpack(sbuf.data(), sbuf.size());
std::chrono::system_clock::time_point val2 = oh.get().as<std::chrono::system_clock::time_point>();
EXPECT_EQ(val1, val2);
std::chrono::system_clock::time_point val3;
oh.get().convert(val3);
EXPECT_EQ(val1, val3);
}
TEST(MSGPACK_CHRONO, system_clock_64_max)
{
std::chrono::system_clock::time_point val1(std::chrono::seconds(0xffffffffL));
val1 +=
std::chrono::duration_cast<std::chrono::system_clock::duration>(
std::chrono::nanoseconds(0x3b9ac9ffL) // 999,999,999
);
msgpack::sbuffer sbuf;
msgpack::pack(sbuf, val1);
char packed_nano[] = {
static_cast<char>(0xd7),
static_cast<char>(-1),
static_cast<char>(0xee), // 999,999,999 << 2
static_cast<char>(0x6b),
static_cast<char>(0x27),
static_cast<char>(0xfc),
static_cast<char>(0xff), // 32 bit sec
static_cast<char>(0xff),
static_cast<char>(0xff),
static_cast<char>(0xff)
};
char packed_micro[] = {
static_cast<char>(0xd7),
static_cast<char>(-1),
static_cast<char>(0xee), // 999,999,000 << 2
static_cast<char>(0x6b),
static_cast<char>(0x18),
static_cast<char>(0x60),
static_cast<char>(0xff), // 32 bit sec
static_cast<char>(0xff),
static_cast<char>(0xff),
static_cast<char>(0xff)
};
if (std::chrono::system_clock::duration::period::ratio::den == 1000000000) {
EXPECT_EQ(memcmp(sbuf.data(), packed_nano, sizeof(packed_nano)), 0);
}
else if (std::chrono::system_clock::duration::period::ratio::den == 1000000) {
EXPECT_EQ(memcmp(sbuf.data(), packed_micro, sizeof(packed_micro)), 0);
}
msgpack::object_handle oh =
msgpack::unpack(sbuf.data(), sbuf.size());
std::chrono::system_clock::time_point val2 = oh.get().as<std::chrono::system_clock::time_point>();
EXPECT_EQ(val1, val2);
std::chrono::system_clock::time_point val3;
oh.get().convert(val3);
EXPECT_EQ(val1, val3);
}
TEST(MSGPACK_CHRONO, system_clock_impl_min)
{
std::chrono::system_clock::time_point val1(std::chrono::system_clock::time_point::min());
msgpack::sbuffer sbuf;
msgpack::pack(sbuf, val1);
msgpack::object_handle oh =
msgpack::unpack(sbuf.data(), sbuf.size());
std::chrono::system_clock::time_point val2 = oh.get().as<std::chrono::system_clock::time_point>();
EXPECT_EQ(val1, val2);
std::chrono::system_clock::time_point val3;
oh.get().convert(val3);
EXPECT_EQ(val1, val3);
}
TEST(MSGPACK_CHRONO, system_clock_impl_max)
{
std::chrono::system_clock::time_point val1(std::chrono::system_clock::time_point::max());
msgpack::sbuffer sbuf;
msgpack::pack(sbuf, val1);
msgpack::object_handle oh =
msgpack::unpack(sbuf.data(), sbuf.size());
std::chrono::system_clock::time_point val2 = oh.get().as<std::chrono::system_clock::time_point>();
EXPECT_EQ(val1, val2);
std::chrono::system_clock::time_point val3;
oh.get().convert(val3);
EXPECT_EQ(val1, val3);
}
TEST(MSGPACK_CHRONO, system_clock_impl_now)
{
std::chrono::system_clock::time_point val1(std::chrono::system_clock::now());
msgpack::sbuffer sbuf;
msgpack::pack(sbuf, val1);
msgpack::object_handle oh =
msgpack::unpack(sbuf.data(), sbuf.size());
std::chrono::system_clock::time_point val2 = oh.get().as<std::chrono::system_clock::time_point>();
EXPECT_EQ(val1, val2);
std::chrono::system_clock::time_point val3;
oh.get().convert(val3);
EXPECT_EQ(val1, val3);
}
#endif // !defined(MSGPACK_USE_CPP03)

View File

@@ -6,10 +6,17 @@
#include "config.h"
#endif
// To avoid link error
TEST(MSGPACK_CPP17, dummy)
{
}
#if !defined(MSGPACK_USE_CPP03) && __cplusplus >= 201703
// C++17
#if MSGPACK_HAS_INCLUDE(<optional>)
TEST(MSGPACK_CPP17, optional_pack_convert_nil)
{
std::stringstream ss;
@@ -171,7 +178,11 @@ TEST(MSGPACK_CPP17, optional_pack_convert_no_def_con)
EXPECT_TRUE(val1 == val2);
}
TEST(MSGPACK_CPP17, string_view_pack_convert_string_view)
#endif // MSGPACK_HAS_INCLUDE(<optional>)
#if MSGPACK_HAS_INCLUDE(<string_view>)
TEST(MSGPACK_CPP17, string_view_pack_convert)
{
std::stringstream ss;
std::string s = "ABC";
@@ -185,7 +196,7 @@ TEST(MSGPACK_CPP17, string_view_pack_convert_string_view)
EXPECT_TRUE(val1 == val2);
}
TEST(MSGPACK_CPP17, string_view_object_strinf_view)
TEST(MSGPACK_CPP17, string_view_object)
{
std::string s = "ABC";
std::string_view val1(s);
@@ -194,7 +205,7 @@ TEST(MSGPACK_CPP17, string_view_object_strinf_view)
EXPECT_TRUE(val1 == val2);
}
TEST(MSGPACK_CPP17, string_view_object_with_zone_string_view)
TEST(MSGPACK_CPP17, string_view_object_with_zone)
{
msgpack::zone z;
std::string s = "ABC";
@@ -204,4 +215,119 @@ TEST(MSGPACK_CPP17, string_view_object_with_zone_string_view)
EXPECT_TRUE(val1 == val2);
}
#endif // MSGPACK_HAS_INCLUDE(<string_view>)
TEST(MSGPACK_CPP17, byte_pack_convert)
{
std::stringstream ss;
std::byte val1{0xff};
msgpack::pack(ss, val1);
msgpack::object_handle oh;
msgpack::unpack(oh, ss.str().data(), ss.str().size());
std::byte val2 = oh.get().as<std::byte>();
EXPECT_EQ(val1, val2);
}
TEST(MSGPACK_CPP17, byte_object)
{
std::byte val1{0x00};
msgpack::object obj(val1);
std::byte val2 = obj.as<std::byte>();
EXPECT_EQ(val1, val2);
}
TEST(MSGPACK_CPP17, byte_object_with_zone)
{
msgpack::zone z;
std::byte val1{80};
msgpack::object obj(val1, z);
std::byte val2 = obj.as<std::byte>();
EXPECT_EQ(val1, val2);
}
TEST(MSGPACK_CPP17, vector_byte_pack_convert)
{
std::stringstream ss;
std::vector<std::byte> val1{
std::byte{0x01}, std::byte{0x02}, std::byte{0x7f}, std::byte{0x80}, std::byte{0xff}
};
msgpack::pack(ss, val1);
char packed[] = { char(0xc4), char(0x05), char(0x01), char(0x02), char(0x7f), char(0x80), char(0xff) };
for (size_t i = 0; i != sizeof(packed); ++i) {
EXPECT_EQ(ss.str()[i], packed[i]);
}
msgpack::object_handle oh;
msgpack::unpack(oh, ss.str().data(), ss.str().size());
std::vector<std::byte> val2 = oh.get().as<std::vector<std::byte>>();
EXPECT_EQ(val1, val2);
}
TEST(MSGPACK_CPP17, vector_byte_object)
{
std::vector<std::byte> val1{
std::byte{0x01}, std::byte{0x02}, std::byte{0x7f}, std::byte{0x80}, std::byte{0xff}
};
// Caller need to manage val1's lifetime. The Data is not copied.
msgpack::object obj(val1);
std::vector<std::byte> val2 = obj.as<std::vector<std::byte>>();
EXPECT_EQ(val1, val2);
}
TEST(MSGPACK_CPP17, vector_byte_object_with_zone)
{
msgpack::zone z;
std::vector<std::byte> val1{
std::byte{0x01}, std::byte{0x02}, std::byte{0x7f}, std::byte{0x80}, std::byte{0xff}
};
msgpack::object obj(val1, z);
std::vector<std::byte> val2 = obj.as<std::vector<std::byte>>();
EXPECT_EQ(val1, val2);
}
TEST(MSGPACK_CPP17, carray_byte_pack_convert)
{
std::stringstream ss;
std::byte val1[] = {
std::byte{0x01}, std::byte{0x02}, std::byte{0x7f}, std::byte{0x80}, std::byte{0xff}
};
msgpack::pack(ss, val1);
char packed[] = { char(0xc4), char(0x05), char(0x01), char(0x02), char(0x7f), char(0x80), char(0xff) };
for (size_t i = 0; i != sizeof(packed); ++i) {
EXPECT_EQ(ss.str()[i], packed[i]);
}
msgpack::object_handle oh;
msgpack::unpack(oh, ss.str().data(), ss.str().size());
std::byte val2[sizeof(val1)];
oh.get().convert(val2);
for (size_t i = 0; i != sizeof(val1); ++i) {
EXPECT_EQ(val1[i], val2[i]);
}
}
TEST(MSGPACK_CPP17, carray_byte_object_with_zone)
{
msgpack::zone z;
std::byte val1[] = {
std::byte{0x01}, std::byte{0x02}, std::byte{0x7f}, std::byte{0x80}, std::byte{0xff}
};
msgpack::object obj(val1, z);
std::byte val2[sizeof(val1)];
obj.convert(val2);
for (size_t i = 0; i != sizeof(val1); ++i) {
EXPECT_EQ(val1[i], val2[i]);
}
}
#endif // !defined(MSGPACK_USE_CPP03) && __cplusplus >= 201703

View File

@@ -264,3 +264,14 @@ TEST(MSGPACK, vrefbuffer_small_int64)
msgpack::vrefbuffer vbuf(0, 0);
GEN_TEST_VREF(int64_t, vbuf);
}
TEST(MSGPACK, vref_buffer_overflow)
{
size_t ref_size = 0;
size_t chunk_size = std::numeric_limits<size_t>::max();
char *buf = (char *)malloc(0x1000);
ASSERT_THROW(msgpack::vrefbuffer vbuf(ref_size, chunk_size), std::bad_alloc);
msgpack::vrefbuffer vbuf2(0, 0x1000);
ASSERT_THROW(vbuf2.append_copy(buf, chunk_size), std::bad_alloc);
free(buf);
}

View File

@@ -953,6 +953,70 @@ TEST(object_with_zone, tuple_empty)
EXPECT_TRUE(obj.as<test_t>() == v);
}
TEST(object_with_zone, system_clock)
{
std::chrono::system_clock::time_point v;
msgpack::zone z;
msgpack::object obj(v, z);
EXPECT_TRUE(obj.as<std::chrono::system_clock::time_point>() == v);
}
TEST(object_with_zone, system_clock_32)
{
std::chrono::system_clock::time_point v(std::chrono::seconds(0x12345678L));
msgpack::zone z;
msgpack::object obj(v, z);
EXPECT_TRUE(obj.as<std::chrono::system_clock::time_point>() == v);
}
TEST(object_with_zone, system_clock_32_max)
{
std::chrono::system_clock::time_point v(std::chrono::seconds(0xffffffffL));
msgpack::zone z;
msgpack::object obj(v, z);
EXPECT_TRUE(obj.as<std::chrono::system_clock::time_point>() == v);
}
TEST(object_with_zone, system_clock_64)
{
std::chrono::system_clock::time_point v(std::chrono::seconds(0x31234567L));
v +=
std::chrono::duration_cast<std::chrono::system_clock::duration>(
std::chrono::nanoseconds(0x312345678L)
);
msgpack::zone z;
msgpack::object obj(v, z);
EXPECT_TRUE(obj.as<std::chrono::system_clock::time_point>() == v);
}
TEST(object_with_zone, system_clock_64_max)
{
std::chrono::system_clock::time_point v(std::chrono::seconds(0xffffffffL));
v +=
std::chrono::duration_cast<std::chrono::system_clock::duration>(
std::chrono::nanoseconds(0x3b9ac9ffL) // 999,999,999
);
msgpack::zone z;
msgpack::object obj(v, z);
EXPECT_TRUE(obj.as<std::chrono::system_clock::time_point>() == v);
}
TEST(object_with_zone, system_clock_impl_min)
{
std::chrono::system_clock::time_point v(std::chrono::system_clock::time_point::min());
msgpack::zone z;
msgpack::object obj(v, z);
EXPECT_TRUE(obj.as<std::chrono::system_clock::time_point>() == v);
}
TEST(object_with_zone, system_clock_impl_max)
{
std::chrono::system_clock::time_point v(std::chrono::system_clock::time_point::max());
msgpack::zone z;
msgpack::object obj(v, z);
EXPECT_TRUE(obj.as<std::chrono::system_clock::time_point>() == v);
}
#endif // !defined(MSGPACK_USE_CPP03)
TEST(object_with_zone, ext_empty)

View File

@@ -517,7 +517,7 @@ TEST(unpack, int_off_larger_than_length)
TEST(unpack, empty_array_fix)
{
std::string buf;
buf.push_back(static_cast<char>(0x90));
buf.push_back(static_cast<unsigned char>(0x90));
std::size_t off = 0;
msgpack::object_handle oh = msgpack::unpack(buf.data(), buf.size(), off);
@@ -529,9 +529,9 @@ TEST(unpack, empty_array_fix)
TEST(unpack, empty_array_16)
{
std::string buf;
buf.push_back(static_cast<char>(0xdc));
buf.push_back(static_cast<char>(0x00));
buf.push_back(static_cast<char>(0x00));
buf.push_back(static_cast<unsigned char>(0xdc));
buf.push_back(static_cast<unsigned char>(0x00));
buf.push_back(static_cast<unsigned char>(0x00));
std::size_t off = 0;
msgpack::object_handle oh = msgpack::unpack(buf.data(), buf.size(), off);
@@ -543,11 +543,11 @@ TEST(unpack, empty_array_16)
TEST(unpack, empty_array_32)
{
std::string buf;
buf.push_back(static_cast<char>(0xdd));
buf.push_back(static_cast<char>(0x00));
buf.push_back(static_cast<char>(0x00));
buf.push_back(static_cast<char>(0x00));
buf.push_back(static_cast<char>(0x00));
buf.push_back(static_cast<unsigned char>(0xdd));
buf.push_back(static_cast<unsigned char>(0x00));
buf.push_back(static_cast<unsigned char>(0x00));
buf.push_back(static_cast<unsigned char>(0x00));
buf.push_back(static_cast<unsigned char>(0x00));
std::size_t off = 0;
msgpack::object_handle oh = msgpack::unpack(buf.data(), buf.size(), off);
@@ -559,7 +559,7 @@ TEST(unpack, empty_array_32)
TEST(unpack, empty_map_fix)
{
std::string buf;
buf.push_back(static_cast<char>(0x80));
buf.push_back(static_cast<unsigned char>(0x80));
std::size_t off = 0;
msgpack::object_handle oh = msgpack::unpack(buf.data(), buf.size(), off);
@@ -571,9 +571,9 @@ TEST(unpack, empty_map_fix)
TEST(unpack, empty_map_16)
{
std::string buf;
buf.push_back(static_cast<char>(0xde));
buf.push_back(static_cast<char>(0x00));
buf.push_back(static_cast<char>(0x00));
buf.push_back(static_cast<unsigned char>(0xde));
buf.push_back(static_cast<unsigned char>(0x00));
buf.push_back(static_cast<unsigned char>(0x00));
std::size_t off = 0;
msgpack::object_handle oh = msgpack::unpack(buf.data(), buf.size(), off);
@@ -585,11 +585,11 @@ TEST(unpack, empty_map_16)
TEST(unpack, empty_map_32)
{
std::string buf;
buf.push_back(static_cast<char>(0xdf));
buf.push_back(static_cast<char>(0x00));
buf.push_back(static_cast<char>(0x00));
buf.push_back(static_cast<char>(0x00));
buf.push_back(static_cast<char>(0x00));
buf.push_back(static_cast<unsigned char>(0xdf));
buf.push_back(static_cast<unsigned char>(0x00));
buf.push_back(static_cast<unsigned char>(0x00));
buf.push_back(static_cast<unsigned char>(0x00));
buf.push_back(static_cast<unsigned char>(0x00));
std::size_t off = 0;
msgpack::object_handle oh = msgpack::unpack(buf.data(), buf.size(), off);