mirror of
https://github.com/fraillt/bitsery.git
synced 2026-06-08 00:03:54 +00:00
release v5.2.1
BufferAdapter statically assert on underlying type size bugfix in StdBitset
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
# [5.2.1](https://github.com/fraillt/bitsery/compare/v5.2.0...v5.2.1) (2020-11-14)
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
* `Input/OutputBufferAdapter` now statically asserts that underlying type is 1byte in size.
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
* fixed serialization in `StdBitset` when it's size is less then `unsigned long long`.
|
||||||
|
|
||||||
# [5.2.0](https://github.com/fraillt/bitsery/compare/v5.1.0...v5.2.0) (2020-11-09)
|
# [5.2.0](https://github.com/fraillt/bitsery/compare/v5.1.0...v5.2.0) (2020-11-09)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.1)
|
cmake_minimum_required(VERSION 3.1)
|
||||||
project(bitsery
|
project(bitsery
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
VERSION 5.2.0)
|
VERSION 5.2.1)
|
||||||
|
|
||||||
#======== build options ===================================
|
#======== build options ===================================
|
||||||
option(BITSERY_BUILD_EXAMPLES "Build examples" OFF)
|
option(BITSERY_BUILD_EXAMPLES "Build examples" OFF)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ However, to make sure the process of accepting patches goes smoothly, you should
|
|||||||
you contribute:
|
you contribute:
|
||||||
|
|
||||||
1. Fork the repository.
|
1. Fork the repository.
|
||||||
2. Create new branch based on the *master* branch (`git checkout -b your_branch master`). If your contribution is a bug fix, you should name your branch `bugfix/xxx`; for a feature, it should be `feature/xxx`. Otherwise, just use your good judgment. Consistent naming of branches is appreciated since it makes the output of `git branch` easier to understand with a single glance.
|
2. Create new branch based on the *develop* branch (`git checkout -b your_branch develop`). If your contribution is a bug fix, you should name your branch `bugfix/xxx`; for a feature, it should be `feature/xxx`. Otherwise, just use your good judgment. Consistent naming of branches is appreciated since it makes the output of `git branch` easier to understand with a single glance.
|
||||||
3. Do your modifications on that branch. Except for special cases, your contribution should include proper unit tests and documentation.
|
3. Do your modifications on that branch. Except for special cases, your contribution should include proper unit tests and documentation.
|
||||||
4. Make sure your modifications did not break anything by building, running tests:
|
4. Make sure your modifications did not break anything by building, running tests:
|
||||||
```shell
|
```shell
|
||||||
@@ -23,7 +23,7 @@ you contribute:
|
|||||||
./show_coverage.sh build
|
./show_coverage.sh build
|
||||||
```
|
```
|
||||||
5. Commit your changes, and push to your fork (`git push origin your_branch`). Commit message should be one line short description. When applicable, please squash adjacent *wip* commits into a single *logical* commit.
|
5. Commit your changes, and push to your fork (`git push origin your_branch`). Commit message should be one line short description. When applicable, please squash adjacent *wip* commits into a single *logical* commit.
|
||||||
6. Open a pull request against Bitsery *master* branch. Currently ongoing development is on *master*. At some point an integration branch will be set-up, and pull-requests should target that, but for now its all against master. You may see feature branches come and go, too.
|
6. Open a pull request against Bitsery *develop* branch.
|
||||||
|
|
||||||
|
|
||||||
If you're working with visual studio, there is how to build and run all tests from command line
|
If you're working with visual studio, there is how to build and run all tests from command line
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ namespace bitsery {
|
|||||||
"Please define BufferAdapterTraits or include from <bitsery/traits/...>");
|
"Please define BufferAdapterTraits or include from <bitsery/traits/...>");
|
||||||
static_assert(traits::ContainerTraits<typename std::remove_const<Buffer>::type>::isContiguous,
|
static_assert(traits::ContainerTraits<typename std::remove_const<Buffer>::type>::isContiguous,
|
||||||
"BufferAdapter only works with contiguous containers");
|
"BufferAdapter only works with contiguous containers");
|
||||||
|
static_assert(sizeof(TValue) == 1, "BufferAdapter underlying type must be 1byte.");
|
||||||
|
|
||||||
InputBufferAdapter(TIterator beginIt, size_t size)
|
InputBufferAdapter(TIterator beginIt, size_t size)
|
||||||
: _beginIt{beginIt},
|
: _beginIt{beginIt},
|
||||||
@@ -196,6 +197,7 @@ namespace bitsery {
|
|||||||
"Please define BufferAdapterTraits or include from <bitsery/traits/...>");
|
"Please define BufferAdapterTraits or include from <bitsery/traits/...>");
|
||||||
static_assert(traits::ContainerTraits<Buffer>::isContiguous,
|
static_assert(traits::ContainerTraits<Buffer>::isContiguous,
|
||||||
"BufferAdapter only works with contiguous containers");
|
"BufferAdapter only works with contiguous containers");
|
||||||
|
static_assert(sizeof(TValue) == 1, "BufferAdapter underlying type must be 1byte.");
|
||||||
|
|
||||||
OutputBufferAdapter(Buffer &buffer)
|
OutputBufferAdapter(Buffer &buffer)
|
||||||
: _buffer{std::addressof(buffer)},
|
: _buffer{std::addressof(buffer)},
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#define BITSERY_MAJOR_VERSION 5
|
#define BITSERY_MAJOR_VERSION 5
|
||||||
#define BITSERY_MINOR_VERSION 2
|
#define BITSERY_MINOR_VERSION 2
|
||||||
#define BITSERY_PATCH_VERSION 0
|
#define BITSERY_PATCH_VERSION 1
|
||||||
|
|
||||||
#define BITSERY_QUOTE_MACRO(name) #name
|
#define BITSERY_QUOTE_MACRO(name) #name
|
||||||
#define BITSERY_BUILD_VERSION_STR(major,minor, patch) \
|
#define BITSERY_BUILD_VERSION_STR(major,minor, patch) \
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace bitsery {
|
|||||||
auto data = obj.to_ullong();
|
auto data = obj.to_ullong();
|
||||||
for(size_t i = 0u; i < BYTES; ++i) {
|
for(size_t i = 0u; i < BYTES; ++i) {
|
||||||
ser.value1b(static_cast<uint8_t>(data & 0xFF));
|
ser.value1b(static_cast<uint8_t>(data & 0xFF));
|
||||||
data >>= 1;
|
data >>= 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (LEFTOVER > 0) {
|
if (LEFTOVER > 0) {
|
||||||
|
|||||||
@@ -34,10 +34,13 @@ using testing::Eq;
|
|||||||
TEST(SerializeExtensionStdBitset, BitsetSmallerThanULongLong) {
|
TEST(SerializeExtensionStdBitset, BitsetSmallerThanULongLong) {
|
||||||
SerializationContext ctx;
|
SerializationContext ctx;
|
||||||
|
|
||||||
std::bitset<9> data;
|
std::bitset<31> data;
|
||||||
data[2] = true;
|
data[2] = true;
|
||||||
data[8] = true;
|
data[8] = true;
|
||||||
std::bitset<9> res;
|
data[15] = true;
|
||||||
|
data[25] = true;
|
||||||
|
data[30] = true;
|
||||||
|
std::bitset<31> res;
|
||||||
|
|
||||||
ctx.createSerializer().ext(data, StdBitset{});
|
ctx.createSerializer().ext(data, StdBitset{});
|
||||||
ctx.createDeserializer().ext(res, StdBitset{});
|
ctx.createDeserializer().ext(res, StdBitset{});
|
||||||
@@ -62,6 +65,8 @@ TEST(SerializeExtensionStdBitset, BitsetLargerThanULongLong) {
|
|||||||
|
|
||||||
std::bitset<200> data;
|
std::bitset<200> data;
|
||||||
data[1] = true;
|
data[1] = true;
|
||||||
|
data[31] = true;
|
||||||
|
data[63] = true;
|
||||||
data[100] = true;
|
data[100] = true;
|
||||||
data[191] = true;
|
data[191] = true;
|
||||||
std::bitset<200> res;
|
std::bitset<200> res;
|
||||||
|
|||||||
Reference in New Issue
Block a user