Bump version of protozero to 1.7.1

This commit is contained in:
Siarhei Fedartsou 2024-07-13 15:53:21 +02:00
commit 4fc4629e2b
25 changed files with 1454 additions and 614 deletions

View File

@ -1,8 +1,15 @@
--- ---
Checks: '*,-bugprone-signed-char-misuse,-cert-dcl21-cpp,-cert-err58-cpp,-cert-err60-cpp,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-macro-usage,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-type-reinterpret-cast,-fuchsia-*,-google-runtime-references,-hicpp-avoid-c-arrays,-hicpp-no-array-decay,-hicpp-vararg,-modernize-avoid-c-arrays,-modernize-use-trailing-return-type,-readability-implicit-bool-conversion,-readability-magic-numbers' Checks: '*,-altera-*,-bugprone-easily-swappable-parameters,-bugprone-signed-char-misuse,-cert-dcl21-cpp,-cert-err58-cpp,-cert-err60-cpp,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-non-const-global-variables,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-macro-usage,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-type-reinterpret-cast,-fuchsia-*,-google-runtime-references,-hicpp-avoid-c-arrays,-hicpp-no-array-decay,-hicpp-vararg,-llvmlibc-*,-misc-no-recursion,-modernize-avoid-c-arrays,-modernize-use-trailing-return-type,-readability-function-cognitive-complexity,-readability-identifier-length,-readability-implicit-bool-conversion,-readability-magic-numbers'
# #
# Disabled checks: # Disabled checks:
# #
# altera-*
# Doesn't apply.
#
# bugprone-easily-swappable-parameters
# Can't change this any more, because these functions are part of our public
# interface.
#
# bugprone-signed-char-misuse # bugprone-signed-char-misuse
# Lots of warnings in varint.hpp otherwise. # Lots of warnings in varint.hpp otherwise.
# #
@ -25,6 +32,9 @@ Checks: '*,-bugprone-signed-char-misuse,-cert-dcl21-cpp,-cert-err58-cpp,-cert-er
# readability-magic-numbers # readability-magic-numbers
# Good idea, but it goes too far to force this everywhere. # Good idea, but it goes too far to force this everywhere.
# #
# cppcoreguidelines-avoid-non-const-global-variables
# Getting these from Catch2 test framework, not from the code itself.
#
# cppcoreguidelines-macro-usage # cppcoreguidelines-macro-usage
# There are cases where macros are simply needed. # There are cases where macros are simply needed.
# #
@ -47,9 +57,21 @@ Checks: '*,-bugprone-signed-char-misuse,-cert-dcl21-cpp,-cert-err58-cpp,-cert-er
# hicpp-no-array-decay # hicpp-no-array-decay
# Limited use and many false positives including for all asserts. # Limited use and many false positives including for all asserts.
# #
# llvmlibc-*
# Doesn't apply.
#
# misc-no-recursion
# Nothing wrong with recursion.
#
# modernize-use-trailing-return-type # modernize-use-trailing-return-type
# We are not quite that modern. # We are not quite that modern.
# #
# readability-function-cognitive-complexity
# Getting these mostly from Catch2 test framework.
#
# readability-identifier-length
# Short identifiers do make sense sometimes.
#
# readability-implicit-bool-conversion # readability-implicit-bool-conversion
# Not necessarily more readable. # Not necessarily more readable.
# #

View File

@ -0,0 +1,10 @@
name: Build on Windows
runs:
using: composite
steps:
- name: Build
run: cmake --build . --config Release --verbose
shell: bash
working-directory: build

View File

@ -0,0 +1,10 @@
name: Build
runs:
using: composite
steps:
- name: Build
run: make VERBOSE=1
shell: bash
working-directory: build

View File

@ -0,0 +1,12 @@
name: CMake on Windows
runs:
using: composite
steps:
- name: Create build directory
run: mkdir build
shell: bash
- name: Configure
run: cmake -LA .. -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
shell: bash
working-directory: build

View File

@ -0,0 +1,16 @@
name: CMake
runs:
using: composite
steps:
- name: Create build directory
run: mkdir build
shell: bash
- name: Configure
run: |
cmake -LA .. \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DPROTOZERO_DATA_VIEW=${PROTOZERO_DATA_VIEW} \
-DCMAKE_CXX_STANDARD=${CPP_VERSION}
shell: bash
working-directory: build

View File

@ -0,0 +1,10 @@
name: Test on Windows
runs:
using: composite
steps:
- name: Test
run: ctest --output-on-failure -C Release
shell: bash
working-directory: build

View File

@ -0,0 +1,10 @@
name: Test
runs:
using: composite
steps:
- name: Test
run: ctest --output-on-failure
shell: bash
working-directory: build

View File

@ -0,0 +1,14 @@
name: Install Prerequisites on Ubuntu
runs:
using: composite
steps:
- name: Install packages
run: |
sudo apt-get update -q
sudo apt-get install -yq \
libprotobuf-dev \
protobuf-compiler
if [ "$CC" = clang-13 ]; then sudo apt-get install -yq --no-install-suggests --no-install-recommends clang-13; fi
shell: bash

View File

@ -0,0 +1,176 @@
name: CI
on: [ push, pull_request ]
jobs:
linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image:
- "ubuntu:18.04" # gcc 7.5.0, clang 6.0.0, cmake 3.10.2
- "ubuntu:20.04" # gcc 9.3.0, clang 10.0.0, cmake 3.16.3
- "ubuntu:21.04" # gcc 10.3.0, clang 12.0.0, cmake 3.18.4
- "ubuntu:21.10" # gcc 11.2.0, clang 13.0.0, cmake 3.18.4
- "debian:stretch" # gcc 6.3.0, clang 3.8.1, cmake 3.7.2
- "debian:buster" # gcc 8.3.0, clang 7.0.1, cmake 3.13.4
- "debian:bullseye" # gcc 10.2.1, clang 11.0.1, cmake 3.18.4
- "debian:testing" # gcc 10.3.0, clang 11.1.0, cmake 3.21.3
- "debian:experimental" # gcc 11.0.0, clang 14.0.0, cmake 3.21.3
- "fedora:34" # gcc 11.2.1, clang 12.0.1, cmake 3.20.5
- "fedora:35" # gcc 11.2.1, clang 13.0.0, cmake 3.22.0
build_type: [Debug]
cpp_compiler: [g++]
cpp_version: [11]
include:
- image: "debian:bullseye"
cpp_version: 14
- image: "debian:bullseye"
cpp_version: 17
- image: "debian:bullseye"
cpp_version: 20
- image: "debian:bullseye"
c_compiler: clang
cpp_compiler: clang++
cpp_version: 14
- image: "debian:bullseye"
c_compiler: clang
cpp_compiler: clang++
cpp_version: 17
- image: "debian:bullseye"
c_compiler: clang
cpp_compiler: clang++
cpp_version: 20
- image: "debian:bullseye"
build_type: Release
- image: "debian:bullseye"
c_compiler: clang
cpp_compiler: clang++
- image: "debian:bullseye"
c_compiler: clang
cpp_compiler: clang++
data_view: std::string_view
# Disabled because it fails due to a bug in the protobuf library
# See https://github.com/protocolbuffers/protobuf/issues/7224
# - image: "debian:bullseye"
# c_compiler: clang
# cpp_compiler: clang++
# CXXFLAGS: "-fsanitize=address,undefined,integer -fno-sanitize-recover=all -fno-omit-frame-pointer"
# LDFLAGS: "-fsanitize=address,undefined,integer"
- image: "debian:testing"
c_compiler: clang
cpp_compiler: clang++
- image: "debian:experimental"
c_compiler: clang-14
cpp_compiler: clang++-14
container:
image: ${{ matrix.image }}
env:
BUILD_TYPE: ${{ matrix.build_type }}
CC: ${{ matrix.c_compiler }}
CXX: ${{ matrix.cpp_compiler }}
CXXFLAGS: ${{ matrix.CXXFLAGS }}
LDFLAGS: ${{ matrix.LDFLAGS }}
CPP_VERSION: ${{ matrix.cpp_version }}
PROTOZERO_DATA_VIEW: ${{ matrix.data_view }}
APT_LISTCHANGES_FRONTEND: none
DEBIAN_FRONTEND: noninteractive
steps:
- name: Prepare container (apt)
shell: bash
if: startsWith(matrix.image, 'debian:') || startsWith(matrix.image, 'ubuntu:')
run: |
apt-get update -qq
apt-get install -y \
clang \
cmake \
doxygen \
g++ \
graphviz \
libprotobuf-dev \
make \
protobuf-compiler
- name: Install compiler
shell: bash
if: matrix.cpp_compiler == 'clang++-14'
run: apt-get install -y --no-install-suggests --no-install-recommends clang-14
- name: Prepare container (dnf)
shell: bash
if: startsWith(matrix.image, 'fedora:')
run: |
dnf install --quiet --assumeyes \
cmake \
doxygen \
gcc-c++ \
graphviz \
make \
protobuf-devel \
protobuf-lite-static
- uses: actions/checkout@v2
- uses: ./.github/actions/cmake
- uses: ./.github/actions/build
- uses: ./.github/actions/ctest
ubuntu-latest:
runs-on: ubuntu-20.04
env:
CC: clang-13
CXX: clang++-13
BUILD_TYPE: Debug
steps:
- name: Install new clang
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main'
shell: bash
- uses: actions/checkout@v2
- uses: ./.github/actions/install-ubuntu
- uses: ./.github/actions/cmake
- uses: ./.github/actions/build
- uses: ./.github/actions/ctest
macos:
strategy:
fail-fast: false
matrix:
os:
- "macos-10.15"
- "macos-11.0"
build_type: [Debug]
include:
- os: "macos-11.0"
build_type: Release
runs-on: ${{ matrix.os }}
env:
CC: clang
CXX: clang++
BUILD_TYPE: ${{ matrix.build_type }}
steps:
- run: brew install protobuf
- uses: actions/checkout@v2
- uses: ./.github/actions/cmake
- uses: ./.github/actions/build
- uses: ./.github/actions/ctest
windows:
strategy:
fail-fast: false
matrix:
os:
- windows-2019
- windows-2022
runs-on: ${{ matrix.os }}
steps:
- run: |
vcpkg install \
protobuf:x64-windows \
protobuf-c:x64-windows
shell: bash
- uses: actions/checkout@v2
with:
submodules: true
- uses: ./.github/actions/cmake-windows
- uses: ./.github/actions/build-windows
- uses: ./.github/actions/ctest-windows

View File

@ -2,8 +2,8 @@
# Changelog # Changelog
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) The format is based on [Keep a Changelog](https://keepachangelog.com/)
This project adheres to [Semantic Versioning](http://semver.org/). This project adheres to [Semantic Versioning](https://semver.org/).
## [unreleased] - ## [unreleased] -
@ -14,6 +14,24 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed ### Fixed
## [1.7.1] - 2022-01-10
### Changed
- Don't build tests if the standard CMake `BUILD_TESTING` variable is set to
off.
- Now needs CMake 3.5.0 or greater.
- Update included catch2 framework to current version v2.13.8.
- Only enable clang-tidy make target if protobuf was found.
- Allow setting C++ version to compile with in CMake config.
### Fixed
- Fixes undefined behaviour in `float` and `double` byteswap.
- Add missing includes of "config.hpp".
- Avoid narrowing conversion by doing an explicit `static_cast`.
## [1.7.0] - 2020-06-08 ## [1.7.0] - 2020-06-08
### Added ### Added
@ -381,7 +399,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Make pbf reader and writer code endianess-aware. - Make pbf reader and writer code endianess-aware.
[unreleased]: https://github.com/osmcode/libosmium/compare/v1.7.0...HEAD [unreleased]: https://github.com/osmcode/libosmium/compare/v1.7.1...HEAD
[1.7.1]: https://github.com/osmcode/libosmium/compare/v1.7.0...v1.7.1
[1.7.0]: https://github.com/osmcode/libosmium/compare/v1.6.8...v1.7.0 [1.7.0]: https://github.com/osmcode/libosmium/compare/v1.6.8...v1.7.0
[1.6.8]: https://github.com/osmcode/libosmium/compare/v1.6.7...v1.6.8 [1.6.8]: https://github.com/osmcode/libosmium/compare/v1.6.7...v1.6.8
[1.6.7]: https://github.com/osmcode/libosmium/compare/v1.6.6...v1.6.7 [1.6.7]: https://github.com/osmcode/libosmium/compare/v1.6.6...v1.6.7

View File

@ -6,32 +6,35 @@
# #
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8 FATAL_ERROR) cmake_minimum_required(VERSION 3.5.0 FATAL_ERROR)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
project(protozero) project(protozero VERSION 1.7.1 LANGUAGES CXX C)
set(PROTOZERO_VERSION_MAJOR 1)
set(PROTOZERO_VERSION_MINOR 7)
set(PROTOZERO_VERSION_PATCH 0)
set(PROTOZERO_VERSION
"${PROTOZERO_VERSION_MAJOR}.${PROTOZERO_VERSION_MINOR}.${PROTOZERO_VERSION_PATCH}")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
if (NOT "${CMAKE_CXX_STANDARD}")
set(CMAKE_CXX_STANDARD 11)
endif()
message(STATUS "Building in C++${CMAKE_CXX_STANDARD} mode")
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#-----------------------------------------------------------------------------
option(BUILD_TESTING "Build tests" ON)
option(WERROR "Add -Werror flag to build (turns warnings into errors)" ON) option(WERROR "Add -Werror flag to build (turns warnings into errors)" ON)
if(MSVC) if(MSVC)
add_definitions(/W3) add_compile_options(/W3)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
else() else()
add_definitions(-std=c++11 -Wall -Wextra -pedantic -Wsign-compare -Wunused-parameter -Wno-float-equal -Wno-covered-switch-default) add_compile_options(-Wall -Wextra -pedantic -Wsign-compare -Wunused-parameter -Wno-float-equal -Wno-covered-switch-default)
if(WERROR) if(WERROR)
add_definitions(-Werror) add_compile_options(-Werror)
endif() endif()
endif() endif()
@ -58,9 +61,9 @@ find_package(Protobuf)
# #
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
message(STATUS "Looking for clang-tidy") message(STATUS "Looking for clang-tidy")
find_program(CLANG_TIDY NAMES clang-tidy clang-tidy-10 clang-tidy-9 clang-tidy-8 clang-tidy-7 clang-tidy-6.0 clang-tidy-5.0) find_program(CLANG_TIDY NAMES clang-tidy clang-tidy-14 clang-tidy-13 clang-tidy-12 clang-tidy-11)
if(CLANG_TIDY) if(CLANG_TIDY AND PROTOBUF_FOUND)
message(STATUS "Looking for clang-tidy - found ${CLANG_TIDY}") message(STATUS "Looking for clang-tidy - found ${CLANG_TIDY}")
add_custom_target(clang-tidy add_custom_target(clang-tidy
${CLANG_TIDY} ${CLANG_TIDY}
@ -134,13 +137,13 @@ install(DIRECTORY include/protozero DESTINATION include)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
enable_testing()
add_subdirectory(doc) add_subdirectory(doc)
if(BUILD_TESTING)
enable_testing()
add_subdirectory(test)
endif()
add_subdirectory(tools) add_subdirectory(tools)
add_subdirectory(test)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
To do fuzz testing using [AFL](http://lcamtuf.coredump.cx/afl/) compile with To do fuzz testing using [AFL](https://lcamtuf.coredump.cx/afl/) compile with
the AFL compiler wrappers: the AFL compiler wrappers:
mkdir build mkdir build

View File

@ -11,7 +11,7 @@ changing frequently or lazy decoding is not critical for your application then
this approach offers no value: just use the C++ API that can be generated with this approach offers no value: just use the C++ API that can be generated with
the Google Protobufs `protoc` program. the Google Protobufs `protoc` program.
[![Travis Build Status](https://travis-ci.org/mapbox/protozero.svg?branch=master)](https://travis-ci.org/mapbox/protozero) [![Travis Build Status](https://travis-ci.com/mapbox/protozero.svg?branch=master)](https://travis-ci.com/mapbox/protozero)
[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/github/mapbox/protozero?svg=true)](https://ci.appveyor.com/project/Mapbox/protozero) [![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/github/mapbox/protozero?svg=true)](https://ci.appveyor.com/project/Mapbox/protozero)
[![Coverage Status](https://codecov.io/gh/mapbox/protozero/branch/master/graph/badge.svg)](https://codecov.io/gh/mapbox/protozero) [![Coverage Status](https://codecov.io/gh/mapbox/protozero/branch/master/graph/badge.svg)](https://codecov.io/gh/mapbox/protozero)
[![Packaging status](https://repology.org/badge/tiny-repos/protozero.svg)](https://repology.org/metapackage/protozero) [![Packaging status](https://repology.org/badge/tiny-repos/protozero.svg)](https://repology.org/metapackage/protozero)
@ -123,7 +123,7 @@ You might have to set `CLANG_TIDY` in CMake config.
## Cppcheck ## Cppcheck
For extra checks with [Cppcheck](http://cppcheck.sourceforge.net/) you can, For extra checks with [Cppcheck](https://cppcheck.sourceforge.io/) you can,
after the CMake step, call after the CMake step, call
make cppcheck make cppcheck

View File

@ -14,8 +14,6 @@ clone_depth: 1
environment: environment:
matrix: matrix:
- config: MSYS2
autocrlf: true
- config: Debug - config: Debug
autocrlf: true autocrlf: true
- config: RelWithDebInfo - config: RelWithDebInfo
@ -27,6 +25,9 @@ environment:
- config: Debug - config: Debug
autocrlf: false autocrlf: false
platform: x86 platform: x86
- config: MSYS2
autocrlf: true
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------

View File

@ -2,7 +2,7 @@
mapbox-streets-v6/14/8714/8017.vector.pbf mapbox-streets-v6/14/8714/8017.vector.pbf
- http://c.tile.openstreetmap.org/14/8714/8017.png - https://c.tile.openstreetmap.org/14/8714/8017.png
- https://a.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/14/8714/8017.vector.pbf - https://a.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/14/8714/8017.vector.pbf
- https://www.mapbox.com/developers/vector-tiles/mapbox-streets/ - https://www.mapbox.com/developers/vector-tiles/mapbox-streets/
@ -10,4 +10,4 @@ enf-14-4824-6157.vector.pbf
- enf.8k273nmi - enf.8k273nmi
- https://b.tiles.mapbox.com/v4/enf.c3a2de35/14/4824/6157@2x.png - https://b.tiles.mapbox.com/v4/enf.c3a2de35/14/4824/6157@2x.png
- https://www.mapbox.com/blog/twitter-map-every-tweet/ - https://www.mapbox.com/blog/twitter-map-every-tweet/

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,7 @@ documentation.
*/ */
#include "buffer_tmpl.hpp" #include "buffer_tmpl.hpp"
#include "config.hpp"
#include <cstddef> #include <cstddef>
#include <iterator> #include <iterator>
@ -56,7 +57,8 @@ struct buffer_customization<std::string> {
protozero_assert(from <= buffer->size()); protozero_assert(from <= buffer->size());
protozero_assert(to <= buffer->size()); protozero_assert(to <= buffer->size());
protozero_assert(from <= to); protozero_assert(from <= to);
buffer->erase(std::next(buffer->begin(), from), std::next(buffer->begin(), to)); buffer->erase(std::next(buffer->begin(), static_cast<std::string::iterator::difference_type>(from)),
std::next(buffer->begin(), static_cast<std::string::iterator::difference_type>(to)));
} }
static char* at_pos(std::string* buffer, std::size_t pos) { static char* at_pos(std::string* buffer, std::size_t pos) {

View File

@ -18,6 +18,7 @@ documentation.
*/ */
#include "buffer_tmpl.hpp" #include "buffer_tmpl.hpp"
#include "config.hpp"
#include <cstddef> #include <cstddef>
#include <iterator> #include <iterator>
@ -56,7 +57,8 @@ struct buffer_customization<std::vector<char>> {
protozero_assert(from <= buffer->size()); protozero_assert(from <= buffer->size());
protozero_assert(to <= buffer->size()); protozero_assert(to <= buffer->size());
protozero_assert(from <= to); protozero_assert(from <= to);
buffer->erase(std::next(buffer->begin(), from), std::next(buffer->begin(), to)); buffer->erase(std::next(buffer->begin(), static_cast<std::string::iterator::difference_type>(from)),
std::next(buffer->begin(), static_cast<std::string::iterator::difference_type>(to)));
} }
static char* at_pos(std::vector<char>* buffer, std::size_t pos) { static char* at_pos(std::vector<char>* buffer, std::size_t pos) {

View File

@ -19,6 +19,7 @@ documentation.
#include "config.hpp" #include "config.hpp"
#include <cstdint> #include <cstdint>
#include <cstring>
namespace protozero { namespace protozero {
namespace detail { namespace detail {
@ -75,14 +76,22 @@ inline void byteswap_inplace(int64_t* ptr) noexcept {
/// byteswap the data pointed to by ptr in-place. /// byteswap the data pointed to by ptr in-place.
inline void byteswap_inplace(float* ptr) noexcept { inline void byteswap_inplace(float* ptr) noexcept {
auto* bptr = reinterpret_cast<uint32_t*>(ptr); static_assert(sizeof(float) == 4, "Expecting four byte float");
*bptr = detail::byteswap_impl(*bptr);
uint32_t tmp = 0;
std::memcpy(&tmp, ptr, 4);
tmp = detail::byteswap_impl(tmp); // uint32 overload
std::memcpy(ptr, &tmp, 4);
} }
/// byteswap the data pointed to by ptr in-place. /// byteswap the data pointed to by ptr in-place.
inline void byteswap_inplace(double* ptr) noexcept { inline void byteswap_inplace(double* ptr) noexcept {
auto* bptr = reinterpret_cast<uint64_t*>(ptr); static_assert(sizeof(double) == 8, "Expecting eight byte double");
*bptr = detail::byteswap_impl(*bptr);
uint64_t tmp = 0;
std::memcpy(&tmp, ptr, 8);
tmp = detail::byteswap_impl(tmp); // uint64 overload
std::memcpy(ptr, &tmp, 8);
} }
namespace detail { namespace detail {

View File

@ -23,12 +23,12 @@ documentation.
#define PROTOZERO_VERSION_MINOR 7 #define PROTOZERO_VERSION_MINOR 7
/// The patch number /// The patch number
#define PROTOZERO_VERSION_PATCH 0 #define PROTOZERO_VERSION_PATCH 1
/// The complete version number /// The complete version number
#define PROTOZERO_VERSION_CODE (PROTOZERO_VERSION_MAJOR * 10000 + PROTOZERO_VERSION_MINOR * 100 + PROTOZERO_VERSION_PATCH) #define PROTOZERO_VERSION_CODE (PROTOZERO_VERSION_MAJOR * 10000 + PROTOZERO_VERSION_MINOR * 100 + PROTOZERO_VERSION_PATCH)
/// Version number as string /// Version number as string
#define PROTOZERO_VERSION_STRING "1.7.0" #define PROTOZERO_VERSION_STRING "1.7.1"
#endif // PROTOZERO_VERSION_HPP #endif // PROTOZERO_VERSION_HPP

View File

@ -1,7 +1,7 @@
# Tests # Tests
Tests are using the [Catch Unit Test Framework](https://github.com/philsquared/Catch). Tests are using the [Catch Unit Test Framework](https://github.com/catchorg/Catch2).
## Organization of the unit tests ## Organization of the unit tests

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,8 @@ namespace protozero {
protozero_assert(from <= buffer->size()); protozero_assert(from <= buffer->size());
protozero_assert(to <= buffer->size()); protozero_assert(to <= buffer->size());
protozero_assert(from <= to); protozero_assert(from <= to);
buffer->erase(std::next(buffer->begin(), from), std::next(buffer->begin(), to)); buffer->erase(std::next(buffer->begin(), static_cast<std::string::iterator::difference_type>(from)),
std::next(buffer->begin(), static_cast<std::string::iterator::difference_type>(to)));
} }
static char* at_pos(test_external::ext_buffer* buffer, std::size_t pos) { static char* at_pos(test_external::ext_buffer* buffer, std::size_t pos) {

View File

@ -9,7 +9,7 @@
#include <test.hpp> // IWYU pragma: keep #include <test.hpp> // IWYU pragma: keep
std::string load_data(const std::string& filename) { std::string load_data(const std::string& filename) {
const char* tests_dir = std::getenv("TESTS_DIR"); const char* tests_dir = std::getenv("TESTS_DIR"); // NOLINT(concurrency-mt-unsafe) okay in test
if (tests_dir == nullptr) { if (tests_dir == nullptr) {
tests_dir = "test"; tests_dir = "test";
} }

View File

@ -215,7 +215,7 @@ int main(int argc, char* argv[]) {
std::size_t length = std::numeric_limits<std::size_t>::max(); std::size_t length = std::numeric_limits<std::size_t>::max();
while (true) { while (true) {
const int c = getopt_long(argc, argv, "hl:o:", long_options, nullptr); const int c = getopt_long(argc, argv, "hl:o:", long_options, nullptr); // NOLINT(concurrency-mt-unsafe) no threads here
if (c == -1) { if (c == -1) {
break; break;
} }