mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-21 15:51:44 +02:00
Compare commits
41 Commits
cpp-6.1.1
...
cpp_master
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a0b2ec09da | ||
![]() |
6bd9a571f2 | ||
![]() |
9b801f087a | ||
![]() |
6d478cff4d | ||
![]() |
3b0fc097f0 | ||
![]() |
39aec8fe75 | ||
![]() |
cbeb5805cc | ||
![]() |
2644706289 | ||
![]() |
1cde61e205 | ||
![]() |
8023a857e1 | ||
![]() |
0225acf247 | ||
![]() |
1876badbae | ||
![]() |
712ec2e383 | ||
![]() |
800c483b99 | ||
![]() |
e18398a119 | ||
![]() |
f45dce33c2 | ||
![]() |
3ccc51f44a | ||
![]() |
86ce9185e2 | ||
![]() |
aa719e81ea | ||
![]() |
765de1fd6d | ||
![]() |
876a09b8ce | ||
![]() |
1e294d7a12 | ||
![]() |
766c8127df | ||
![]() |
f9f2917cc0 | ||
![]() |
919908742b | ||
![]() |
3c8ca3b29b | ||
![]() |
b41688c588 | ||
![]() |
405977dfa6 | ||
![]() |
3788b5ba63 | ||
![]() |
f2be864e04 | ||
![]() |
5c606bd638 | ||
![]() |
0605190fd3 | ||
![]() |
28cfb1ff81 | ||
![]() |
636a0130ba | ||
![]() |
22f6fa1cd2 | ||
![]() |
232fff18d4 | ||
![]() |
820ccf1f1d | ||
![]() |
a687df0e22 | ||
![]() |
8d57954246 | ||
![]() |
5c521bc346 | ||
![]() |
7bb73f3b98 |
6
.github/depends/boost.sh
vendored
6
.github/depends/boost.sh
vendored
@@ -49,9 +49,9 @@ while getopts "b:t:p:" c; do
|
||||
done
|
||||
|
||||
mkdir $prefix || exit 1
|
||||
wget https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2 || exit 1
|
||||
tar xf boost_1_76_0.tar.bz2 || exit 1
|
||||
cd boost_1_76_0
|
||||
wget https://archives.boost.io/release/1.85.0/source/boost_1_85_0.tar.bz2 || exit 1
|
||||
tar xf boost_1_85_0.tar.bz2 || exit 1
|
||||
cd boost_1_85_0
|
||||
./bootstrap.sh || exit 1
|
||||
|
||||
build()
|
||||
|
19
.github/workflows/coverage.yml
vendored
19
.github/workflows/coverage.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
@@ -24,10 +24,10 @@ jobs:
|
||||
|
||||
- name: Cache boost
|
||||
id: cache-boost
|
||||
uses: actions/cache@v1
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/boost-prefix/
|
||||
key: ${{ runner.os }}-boost-64-1-76-0-2021-08-09
|
||||
key: ${{ runner.os }}-boost-1-85-0-2024-05-27
|
||||
|
||||
- name: Build boost
|
||||
if: steps.cache-boost.outputs.cache-hit != 'true'
|
||||
@@ -35,7 +35,7 @@ jobs:
|
||||
|
||||
- name: Cache zlib
|
||||
id: cache-zlib
|
||||
uses: actions/cache@v1
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/zlib-prefix/
|
||||
key: ${{ runner.os }}-zlib-64-1-2-11-2021-08-09
|
||||
@@ -63,12 +63,15 @@ jobs:
|
||||
cmake --build build --target all || exit 1
|
||||
ctest --test-dir build || exit 1
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
- name: Generate coverage
|
||||
working-directory: build
|
||||
run: |
|
||||
# Create lcov report
|
||||
lcov --capture --directory . --output-file coverage.info
|
||||
lcov --capture --directory . --output-file coverage.info --ignore-errors mismatch
|
||||
lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter system-files
|
||||
lcov --list coverage.info # debug info
|
||||
# Uploading report to CodeCov
|
||||
bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports"
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
files: build/coverage.info
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
49
.github/workflows/gha.yml
vendored
49
.github/workflows/gha.yml
vendored
@@ -18,14 +18,19 @@ jobs:
|
||||
matrix:
|
||||
pattern: [0, 1, 2, 3, 4]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
brew update
|
||||
brew install --force llvm
|
||||
|
||||
- name: Cache boost
|
||||
id: cache-boost
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/boost-prefix/
|
||||
key: ${{ runner.os }}-boost-1-76-0-2022-08-09
|
||||
key: ${{ runner.os }}-boost-1-85-0-2024-05-27
|
||||
|
||||
- name: Build boost
|
||||
if: steps.cache-boost.outputs.cache-hit != 'true'
|
||||
@@ -33,7 +38,7 @@ jobs:
|
||||
|
||||
- name: Cache zlib
|
||||
id: cache-zlib
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/zlib-prefix/
|
||||
key: ${{ runner.os }}-zlib-1-2-13-2022-11-02
|
||||
@@ -55,7 +60,7 @@ jobs:
|
||||
|
||||
case ${{ matrix.pattern }} in
|
||||
0)
|
||||
export MSGPACK_CXX_VERSION="MSGPACK_CXX11=OFF"
|
||||
export MSGPACK_CXX_VERSION="MSGPACK_CXX11=ON"
|
||||
;;
|
||||
1)
|
||||
export API_VERSION=1
|
||||
@@ -79,13 +84,13 @@ jobs:
|
||||
|
||||
linux:
|
||||
name: ${{ format('Linux (pattern {0})', matrix.pattern) }}
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-24.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
pattern: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install build dependencies
|
||||
shell: bash
|
||||
@@ -97,10 +102,10 @@ jobs:
|
||||
|
||||
- name: Cache boost
|
||||
id: cache-boost
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/boost-prefix/
|
||||
key: ${{ runner.os }}-boost-1-76-0-2021-08-09
|
||||
key: ${{ runner.os }}-boost-1-85-0-2024-05-27
|
||||
|
||||
- name: Build boost
|
||||
if: steps.cache-boost.outputs.cache-hit != 'true'
|
||||
@@ -108,7 +113,7 @@ jobs:
|
||||
|
||||
- name: Cache zlib
|
||||
id: cache-zlib
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/zlib-prefix/
|
||||
key: ${{ runner.os }}-zlib-1-2-13-2022-11-02
|
||||
@@ -131,15 +136,15 @@ jobs:
|
||||
|
||||
case ${{ matrix.pattern }} in
|
||||
0)
|
||||
export CXX="clang++-10"
|
||||
export MSGPACK_CXX_VERSION="MSGPACK_CXX11=OFF"
|
||||
export CXX="clang++"
|
||||
export MSGPACK_CXX_VERSION="MSGPACK_CXX11=ON"
|
||||
;;
|
||||
1)
|
||||
export CXX="g++-10"
|
||||
export MSGPACK_CXX_VERSION="MSGPACK_CXX11=ON"
|
||||
;;
|
||||
2)
|
||||
export CXX="clang++-10"
|
||||
export CXX="clang++"
|
||||
export MSGPACK_CXX_VERSION="MSGPACK_CXX14=ON"
|
||||
;;
|
||||
3)
|
||||
@@ -148,7 +153,7 @@ jobs:
|
||||
export MSGPACK_USE_STD_VARIANT_ADAPTOR="MSGPACK_USE_STD_VARIANT_ADAPTOR=ON"
|
||||
;;
|
||||
4)
|
||||
export CXX="clang++-10"
|
||||
export CXX="clang++"
|
||||
export MSGPACK_CXX_VERSION="MSGPACK_CXX20=ON"
|
||||
export NO_BOOST="-DMSGPACK_NO_BOOST"
|
||||
;;
|
||||
@@ -157,7 +162,7 @@ jobs:
|
||||
export ARCH=32
|
||||
;;
|
||||
6)
|
||||
export CXX="clang++-10"
|
||||
export CXX="clang++"
|
||||
export API_VERSION=2
|
||||
;;
|
||||
7)
|
||||
@@ -165,7 +170,7 @@ jobs:
|
||||
export API_VERSION=1
|
||||
;;
|
||||
8)
|
||||
export CXX="clang++-10"
|
||||
export CXX="clang++"
|
||||
export CHAR_SIGN="unsigned"
|
||||
;;
|
||||
9)
|
||||
@@ -173,7 +178,7 @@ jobs:
|
||||
export X3_PARSE="ON"
|
||||
;;
|
||||
10)
|
||||
export CXX="clang++-10"
|
||||
export CXX="clang++"
|
||||
export ACTION="ci/build_regression.sh"
|
||||
;;
|
||||
11)
|
||||
@@ -190,19 +195,19 @@ jobs:
|
||||
|
||||
windows:
|
||||
name: ${{ format('Windows cxx{0}', matrix.cxx) }}
|
||||
runs-on: windows-2019
|
||||
runs-on: windows-2022
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# MSVC2019 only supports /std:c++14, /std:c++17 and /std:c++latest
|
||||
# MSVC2022 only supports /std:c++14, /std:c++17 and /std:c++latest
|
||||
cxx: [14, 17, 20]
|
||||
pp_flag: ["/Zc:preprocessor-", "/Zc:preprocessor"]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Cache vcpkg dependencies
|
||||
id: cache-vcpkg
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: C:/vcpkg/installed/x64-windows
|
||||
key: ${{ runner.os }}-vcpkg-2021-08-09
|
||||
@@ -223,7 +228,7 @@ jobs:
|
||||
md build
|
||||
cmake `
|
||||
-A x64 `
|
||||
-G "Visual Studio 16 2019" `
|
||||
-G "Visual Studio 17 2022" `
|
||||
-D CMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" `
|
||||
-D MSGPACK_BUILD_TESTS=ON `
|
||||
-D $CPPVER `
|
||||
|
10
CHANGELOG.md
10
CHANGELOG.md
@@ -1,3 +1,13 @@
|
||||
# 2024-11-02 version 7.0.0
|
||||
* Refine build system (#1133)
|
||||
* Refine CI (#1122)
|
||||
* Refine documents (#1117)
|
||||
## << breaking changes >>
|
||||
* Revert double and fload packing behavior (#1144)
|
||||
* If below decimal point is zero (e.g. 2.00),
|
||||
* Before: pack as int format family `0x02`
|
||||
* After : pack as float format family `0xcb 0x40 0x00 0x00 0x00 0x00 0x00 0x00 0x00`
|
||||
|
||||
# 2024-04-02 version 6.1.1
|
||||
* Fix compilation error when std::variant has the same types (#1112)
|
||||
* Improve CI (#1090, #1110)
|
||||
|
@@ -1,6 +1,4 @@
|
||||
CMAKE_MINIMUM_REQUIRED (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
CMAKE_POLICY (SET CMP0054 NEW)
|
||||
CMAKE_MINIMUM_REQUIRED (VERSION 3.5...4.0)
|
||||
|
||||
PROJECT (msgpack-cxx LANGUAGES CXX)
|
||||
|
||||
@@ -18,7 +16,7 @@ SET (VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION})
|
||||
LIST (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
|
||||
SET (GNUCXX_STD_SUPPORT_VERSION "4.3")
|
||||
|
||||
OPTION (MSGPACK_CXX11 "Using c++11 compiler" OFF)
|
||||
OPTION (MSGPACK_CXX11 "Using c++11 compiler" ON)
|
||||
OPTION (MSGPACK_CXX14 "Using c++14 compiler" OFF)
|
||||
OPTION (MSGPACK_CXX17 "Using c++17 compiler" OFF)
|
||||
OPTION (MSGPACK_CXX20 "Using c++20 compiler" OFF)
|
||||
@@ -67,6 +65,10 @@ IF (MSGPACK_32BIT)
|
||||
ENDIF ()
|
||||
|
||||
IF (MSGPACK_USE_BOOST)
|
||||
IF ((CMAKE_VERSION VERSION_GREATER 3.30) OR
|
||||
(CMAKE_VERSION VERSION_EQUAL 3.30))
|
||||
CMAKE_POLICY(SET CMP0167 NEW)
|
||||
ENDIF ()
|
||||
SET (Boost_USE_MULTITHREADED ON)
|
||||
|
||||
IF (MSGPACK_USE_STATIC_BOOST)
|
||||
@@ -143,14 +145,21 @@ IF (MSGPACK_GEN_COVERAGE)
|
||||
ENDIF ()
|
||||
|
||||
IF (MSGPACK_BUILD_TESTS)
|
||||
IF (${CMAKE_CXX_STANDARD} EQUAL 98)
|
||||
MESSAGE (FATAL_ERROR "Tests requires C++11 or newer")
|
||||
ENDIF ()
|
||||
IF ((CMAKE_VERSION VERSION_GREATER 3.27) OR
|
||||
(CMAKE_VERSION VERSION_EQUAL 3.27))
|
||||
CMAKE_POLICY(SET CMP0145 OLD)
|
||||
ENDIF ()
|
||||
IF (NOT MSGPACK_USE_BOOST)
|
||||
MESSAGE(FATAL_ERROR "Test requires -DMSGPACK_USE_BOOST=ON")
|
||||
ENDIF ()
|
||||
ENABLE_TESTING ()
|
||||
INCLUDE (CTest)
|
||||
# MEMORYCHECK_COMMAND_OPTIONS needs to place prior to CTEST_MEMORYCHECK_COMMAND
|
||||
SET (MEMORYCHECK_COMMAND_OPTIONS "--leak-check=full --show-leak-kinds=definite,possible --error-exitcode=1")
|
||||
FIND_PROGRAM (CTEST_MEMORYCHECK_COMMAND NAMES valgrind)
|
||||
INCLUDE (Dart)
|
||||
ADD_SUBDIRECTORY (test)
|
||||
ENDIF ()
|
||||
|
||||
|
@@ -12,7 +12,7 @@ Same as QuickStart for C Language.
|
||||
|
||||
## First program
|
||||
|
||||
Include `msgpack.hpp` header and link `msgpack` library to use MessagePack on your program.
|
||||
Include `msgpack.hpp` header to use MessagePack on your program.
|
||||
|
||||
```cpp
|
||||
#include <msgpack.hpp>
|
||||
|
@@ -1,8 +1,8 @@
|
||||
`msgpack` for C++
|
||||
===================
|
||||
|
||||
Version 6.1.1 [](https://github.com/msgpack/msgpack-c/actions) [](https://ci.appveyor.com/project/redboltz/msgpack-c/branch/cpp_master)
|
||||
[](https://codecov.io/gh/msgpack/msgpack-c/branch/cpp_master)
|
||||
Version 7.0.0 [](https://github.com/msgpack/msgpack-c/actions) [](https://ci.appveyor.com/project/redboltz/msgpack-c/branch/cpp_master)
|
||||
[](https://app.codecov.io/gh/msgpack/msgpack-c/tree/cpp_master)
|
||||
|
||||
It's like JSON but smaller and faster.
|
||||
|
||||
@@ -87,7 +87,6 @@ For C++ compiler
|
||||
clang++ -DMSGPACK_NO_BOOST your_code.cpp
|
||||
```
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
@@ -96,7 +95,7 @@ Usage
|
||||
|
||||
```cmake
|
||||
# ...
|
||||
find_package(msgpack REQUIRED)
|
||||
find_package(msgpack-cxx REQUIRED)
|
||||
# ...
|
||||
target_link_libraries(your_target_name <PRIVATE/PUBLIC/INTERFACE> msgpack-cxx)
|
||||
# ...
|
||||
|
12
appveyor.yml
12
appveyor.yml
@@ -1,4 +1,4 @@
|
||||
version: 6.1.1.{build}
|
||||
version: 7.0.0.{build}
|
||||
|
||||
branches:
|
||||
only:
|
||||
@@ -6,16 +6,6 @@ branches:
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
cpp11: -DMSGPACK_CXX11=OFF
|
||||
msvc: '"Visual Studio 12 2013"'
|
||||
boost_prefix: C:\Libraries\boost_1_58_0
|
||||
boost_subdir: lib32-msvc-12.0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
cpp11: -DMSGPACK_CXX11=OFF
|
||||
msvc: '"Visual Studio 14 2015"'
|
||||
boost_prefix: C:\Libraries\boost_1_69_0
|
||||
boost_subdir: lib32-msvc-14.0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
cpp11: -DMSGPACK_CXX11=ON
|
||||
msvc: '"Visual Studio 14 2015"'
|
||||
|
@@ -48,7 +48,7 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
|
||||
|
||||
# Show info where to find the report
|
||||
ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
|
||||
COMMAND ;
|
||||
COMMAND ${CMAKE_COMMAND} -E echo ""
|
||||
COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report."
|
||||
)
|
||||
|
||||
|
@@ -31,6 +31,6 @@ ignore:
|
||||
- "erb"
|
||||
- "ci"
|
||||
- "cmake"
|
||||
- "examle"
|
||||
- "example"
|
||||
- "external"
|
||||
- "usr"
|
||||
|
@@ -73,7 +73,11 @@
|
||||
|
||||
#if !defined(MSGPACK_NO_BOOST)
|
||||
#include "adaptor/boost/fusion.hpp"
|
||||
|
||||
#if !defined(MSGPACK_USE_CPP03)
|
||||
#include "adaptor/boost/msgpack_variant.hpp"
|
||||
#endif // !defined(MSGPACK_USE_CPP03)
|
||||
|
||||
#include "adaptor/boost/optional.hpp"
|
||||
#include "adaptor/boost/string_ref.hpp"
|
||||
#include "adaptor/boost/string_view.hpp"
|
||||
|
@@ -13,7 +13,6 @@
|
||||
#include "msgpack/versioning.hpp"
|
||||
#include "msgpack/adaptor/adaptor_base.hpp"
|
||||
#include "msgpack/object.hpp"
|
||||
#include "msgpack/object.hpp"
|
||||
|
||||
#include <ctime>
|
||||
|
||||
|
@@ -87,6 +87,7 @@ struct is_pointer;
|
||||
|
||||
#include <memory>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
|
||||
namespace msgpack {
|
||||
/// @cond
|
||||
|
@@ -31,6 +31,7 @@ public:
|
||||
{
|
||||
MSGPACK_ASSERT(buf || len == 0);
|
||||
if (!buf) return;
|
||||
if (len == 0) return;
|
||||
if (1 != fwrite(buf, len, 1, m_file)) {
|
||||
throw std::runtime_error("fwrite() failed");
|
||||
}
|
||||
|
@@ -32,11 +32,11 @@ struct object_kv {
|
||||
msgpack::object val;
|
||||
};
|
||||
|
||||
struct object::with_zone : msgpack::object {
|
||||
with_zone(msgpack::zone& z) : zone(z) { }
|
||||
struct object_with_zone_type : msgpack::object {
|
||||
object_with_zone_type(msgpack::zone& z) : zone(z) { }
|
||||
msgpack::zone& zone;
|
||||
private:
|
||||
with_zone();
|
||||
object_with_zone_type();
|
||||
};
|
||||
|
||||
|
||||
|
@@ -68,6 +68,8 @@ public:
|
||||
|
||||
#endif // !defined(MSGPACK_USE_CPP03)
|
||||
|
||||
struct object_with_zone_type;
|
||||
|
||||
/// Object class that corresponding to MessagePack format object
|
||||
/**
|
||||
* See https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_object
|
||||
@@ -219,7 +221,8 @@ struct object {
|
||||
template <typename T>
|
||||
object& operator=(const T& v);
|
||||
|
||||
struct with_zone;
|
||||
// Not a nested struct (i.e. 'struct with_zone;') to work around MSVC C++20 modules error C2504
|
||||
typedef object_with_zone_type with_zone;
|
||||
|
||||
protected:
|
||||
struct implicit_type;
|
||||
|
@@ -1138,17 +1138,6 @@ inline packer<Stream>& packer<Stream>::pack_unsigned_long_long(unsigned long lon
|
||||
template <typename Stream>
|
||||
inline packer<Stream>& packer<Stream>::pack_float(float d)
|
||||
{
|
||||
if(d == d) { // check for nan
|
||||
// compare d to limits to avoid undefined behaviour
|
||||
if(d >= 0 && d <= float(std::numeric_limits<uint64_t>::max()) && d == float(uint64_t(d))) {
|
||||
pack_imp_uint64(uint64_t(d));
|
||||
return *this;
|
||||
} else if(d < 0 && d >= float(std::numeric_limits<int64_t>::min()) && d == float(int64_t(d))) {
|
||||
pack_imp_int64(int64_t(d));
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
||||
union { float f; uint32_t i; } mem;
|
||||
mem.f = d;
|
||||
char buf[5];
|
||||
@@ -1160,17 +1149,6 @@ inline packer<Stream>& packer<Stream>::pack_float(float d)
|
||||
template <typename Stream>
|
||||
inline packer<Stream>& packer<Stream>::pack_double(double d)
|
||||
{
|
||||
if(d == d) { // check for nan
|
||||
// compare d to limits to avoid undefined behaviour
|
||||
if(d >= 0 && d <= double(std::numeric_limits<uint64_t>::max()) && d == double(uint64_t(d))) {
|
||||
pack_imp_uint64(uint64_t(d));
|
||||
return *this;
|
||||
} else if(d < 0 && d >= double(std::numeric_limits<int64_t>::min()) && d == double(int64_t(d))) {
|
||||
pack_imp_int64(int64_t(d));
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
||||
union { double f; uint64_t i; } mem;
|
||||
mem.f = d;
|
||||
char buf[9];
|
||||
|
@@ -1,3 +1,3 @@
|
||||
#define MSGPACK_VERSION_MAJOR 6
|
||||
#define MSGPACK_VERSION_MINOR 1
|
||||
#define MSGPACK_VERSION_REVISION 1
|
||||
#define MSGPACK_VERSION_MAJOR 7
|
||||
#define MSGPACK_VERSION_MINOR 0
|
||||
#define MSGPACK_VERSION_REVISION 0
|
||||
|
@@ -8,7 +8,6 @@ LIST (APPEND check_PROGRAMS
|
||||
boost_optional.cpp
|
||||
boost_string_ref.cpp
|
||||
boost_string_view.cpp
|
||||
boost_variant.cpp
|
||||
buffer.cpp
|
||||
carray.cpp
|
||||
cases.cpp
|
||||
@@ -43,6 +42,7 @@ ENDIF ()
|
||||
|
||||
IF (MSGPACK_CXX11 OR MSGPACK_CXX14 OR MSGPACK_CXX17 OR MSGPACK_CXX20)
|
||||
LIST (APPEND check_PROGRAMS
|
||||
boost_variant.cpp
|
||||
iterator_cpp11.cpp
|
||||
msgpack_cpp11.cpp
|
||||
reference_cpp11.cpp
|
||||
|
@@ -90,6 +90,7 @@ BOOST_AUTO_TEST_CASE(fbuffer)
|
||||
fbuf.write("a", 1);
|
||||
fbuf.write("a", 1);
|
||||
fbuf.write("a", 1);
|
||||
fbuf.write("", 0);
|
||||
|
||||
fflush(file);
|
||||
rewind(file);
|
||||
|
@@ -154,8 +154,6 @@ BOOST_AUTO_TEST_CASE(simple_buffer_float)
|
||||
v.push_back(-0.0);
|
||||
v.push_back(1.0);
|
||||
v.push_back(-1.0);
|
||||
v.push_back(1.1f);
|
||||
v.push_back(-1.1f);
|
||||
v.push_back(numeric_limits<float>::min());
|
||||
v.push_back(numeric_limits<float>::max());
|
||||
v.push_back(nanf("tag"));
|
||||
@@ -188,12 +186,6 @@ BOOST_AUTO_TEST_CASE(simple_buffer_float)
|
||||
BOOST_CHECK(std::isinf(val2));
|
||||
else
|
||||
BOOST_CHECK(fabs(val2 - val1) <= kEPS);
|
||||
|
||||
// check for compact storing of float
|
||||
if (val1 == val1 && val1 >= float(std::numeric_limits<int64_t>::min()) && val1 <= float(std::numeric_limits<int64_t>::max()) && val1 == float(int64_t(val1)))
|
||||
BOOST_REQUIRE_EQUAL(sbuf.size(),1);
|
||||
else
|
||||
BOOST_REQUIRE_EQUAL(sbuf.data()[0],char(0xca));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,8 +236,6 @@ BOOST_AUTO_TEST_CASE(simple_buffer_double)
|
||||
v.push_back(-0.0);
|
||||
v.push_back(1.0);
|
||||
v.push_back(-1.0);
|
||||
v.push_back(1.1);
|
||||
v.push_back(-1.1);
|
||||
v.push_back(numeric_limits<double>::min());
|
||||
v.push_back(numeric_limits<double>::max());
|
||||
v.push_back(nanf("tag"));
|
||||
@@ -282,12 +272,6 @@ BOOST_AUTO_TEST_CASE(simple_buffer_double)
|
||||
BOOST_CHECK(std::isinf(val2));
|
||||
else
|
||||
BOOST_CHECK(fabs(val2 - val1) <= kEPS);
|
||||
|
||||
// check for compact storing of double
|
||||
if (val1 == val1 && val1 >= double(std::numeric_limits<int64_t>::min()) && val1 <= double(std::numeric_limits<int64_t>::max()) && val1 == double(int64_t(val1)))
|
||||
BOOST_REQUIRE_EQUAL(sbuf.size(),1);
|
||||
else
|
||||
BOOST_REQUIRE_EQUAL(uint8_t(sbuf.data()[0]),uint8_t(0xcb));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user