...
 
Commits (12)
......@@ -6,9 +6,7 @@
language: generic
sudo: false
dist: trusty
dist: xenial
#-----------------------------------------------------------------------------
......@@ -32,182 +30,138 @@ addons_shortcuts:
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-3.5']
addons_clang38: &clang38
apt:
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ]
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-3.8']
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-3.8']
addons_clang39: &clang39
apt:
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ]
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-3.9']
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-3.9']
addons_clang50: &clang50
apt:
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest', 'llvm-toolchain-trusty-5.0' ]
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-5.0', 'g++-6', 'gcc-6']
sources: [ 'ubuntu-toolchain-r-test' ]
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-5.0', 'g++-6', 'gcc-6']
addons_clang60: &clang60
apt:
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest', 'llvm-toolchain-trusty-6.0' ]
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-6.0', 'g++-6', 'gcc-6']
sources: [ 'ubuntu-toolchain-r-test' ]
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-6.0', 'g++-6', 'gcc-6']
addons_gcc48: &gcc48
apt:
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ]
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-4.8', 'gcc-4.8' ]
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-4.8', 'gcc-4.8' ]
addons_gcc49: &gcc49
apt:
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ]
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-4.9', 'gcc-4.9' ]
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-4.9', 'gcc-4.9' ]
addons_gcc5: &gcc5
apt:
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ]
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-5', 'gcc-5' ]
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-5', 'gcc-5' ]
addons_gcc6: &gcc6
apt:
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ]
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-6', 'gcc-6' ]
sources: [ 'ubuntu-toolchain-r-test' ]
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-6', 'gcc-6' ]
addons_gcc7: &gcc7
apt:
sources: [ 'ubuntu-toolchain-r-test' ]
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-7', 'gcc-7' ]
#-----------------------------------------------------------------------------
matrix:
include:
# 1/ Linux Clang Builds
- os: linux
compiler: linux-clang35-release
env: CC='clang-3.5' CXX='clang++-3.5' BUILD_TYPE='Release'
addons: *clang35
# Linux Clang Builds
- os: linux
compiler: linux-clang35-dev
env: CC='clang-3.5' CXX='clang++-3.5' BUILD_TYPE='Dev'
addons: *clang35
- os: linux
compiler: linux-clang38-release
env: CC='clang-3.8' CXX='clang++-3.8' BUILD_TYPE='Release'
addons: *clang38
dist: trusty
- os: linux
compiler: linux-clang38-dev
env: CC='clang-3.8' CXX='clang++-3.8' BUILD_TYPE='Dev'
addons: *clang38
- os: linux
compiler: linux-clang39-release
env: CC='clang-3.9' CXX='clang++-3.9' BUILD_TYPE='Release'
addons: *clang39
- os: linux
compiler: linux-clang39-dev
env: CC='clang-3.9' CXX='clang++-3.9' BUILD_TYPE='Dev'
addons: *clang39
- os: linux
compiler: linux-clang50-release
env: CC='clang-5.0' CXX='clang++-5.0' BUILD_TYPE='Release'
addons: *clang50
- os: linux
compiler: linux-clang50-dev
env: CC='clang-5.0' CXX='clang++-5.0' BUILD_TYPE='Dev'
addons: *clang50
- os: linux
compiler: linux-clang60-release
env: CC='clang-6.0' CXX='clang++-6.0' BUILD_TYPE='Release'
compiler: linux-clang60-dev
env: CC='clang-6.0' CXX='clang++-6.0' BUILD_TYPE='Dev'
addons: *clang60
- os: linux
compiler: linux-clang60-dev
env: CC='clang-6.0' CXX='clang++-6.0' BUILD_TYPE='Dev'
compiler: linux-clang60-debug
env: CC='clang-6.0' CXX='clang++-6.0' BUILD_TYPE='Debug'
CXXFLAGS="-fsanitize=address,undefined,integer -fno-sanitize-recover=all -fno-omit-frame-pointer"
LDFLAGS="-fsanitize=address,undefined,integer"
addons: *clang60
# Disabled because it creates false-positives on the old travis systems
# - os: linux
# compiler: linux-clang50-debug
# env: CC='clang-5.0' CXX='clang++-5.0' BUILD_TYPE='Debug'
# CXXFLAGS="-fsanitize=address,undefined,integer -fno-sanitize-recover=all -fno-omit-frame-pointer"
# LDFLAGS="-fsanitize=address,undefined,integer"
# # LSAN doesn't work on container-based system
# sudo: required
# addons: *clang50
# 2/ Linux GCC Builds
- os: linux
compiler: linux-gcc48-release
env: CC='gcc-4.8' CXX='g++-4.8' BUILD_TYPE='Release'
CXXFLAGS='-Wno-return-type'
addons: *gcc48
compiler: linux-clang60-release
env: CC='clang-6.0' CXX='clang++-6.0' BUILD_TYPE='Release'
addons: *clang60
# Linux GCC Builds
- os: linux
compiler: linux-gcc48-dev
env: CC='gcc-4.8' CXX='g++-4.8' BUILD_TYPE='Dev'
CXXFLAGS='-Wno-return-type'
addons: *gcc48
- os: linux
compiler: linux-gcc49-release
env: CC='gcc-4.9' CXX='g++-4.9' BUILD_TYPE='Release'
addons: *gcc49
- os: linux
compiler: linux-gcc49-dev
env: CC='gcc-4.9' CXX='g++-4.9' BUILD_TYPE='Dev'
addons: *gcc49
- os: linux
compiler: linux-gcc5-release
env: CC='gcc-5' CXX='g++-5' BUILD_TYPE='Release'
addons: *gcc5
- os: linux
compiler: linux-gcc5-dev
env: CC='gcc-5' CXX='g++-5' BUILD_TYPE='Dev'
addons: *gcc5
- os: linux
compiler: linux-gcc6-release
env: CC='gcc-6' CXX='g++-6' BUILD_TYPE='Release'
addons: *gcc6
- os: linux
compiler: linux-gcc6-dev
env: CC='gcc-6' CXX='g++-6' BUILD_TYPE='Dev'
addons: *gcc6
- os: linux
compiler: linux-gcc6-coverage
env: CC='gcc-6' CXX='g++-6' BUILD_TYPE='Coverage'
addons: *gcc6
compiler: linux-gcc7-dev
env: CC='gcc-7' CXX='g++-7' BUILD_TYPE='Dev'
addons: *gcc7
# 3/ OSX Clang Builds
- os: osx
osx_image: xcode6.4
compiler: xcode64-clang-release
env: CC='clang' CXX='clang++' BUILD_TYPE='Release'
- os: linux
compiler: linux-gcc7-coverage
env: CC='gcc-7' CXX='g++-7' BUILD_TYPE='Coverage'
addons: *gcc7
- os: linux
compiler: linux-gcc7-release
env: CC='gcc-7' CXX='g++-7' BUILD_TYPE='Release'
addons: *gcc7
# OSX Clang Builds
- os: osx
osx_image: xcode6.4
compiler: xcode64-clang-dev
osx_image: xcode8.3
compiler: xcode83-clang-dev
env: CC='clang' CXX='clang++' BUILD_TYPE='Dev'
- os: osx
osx_image: xcode7
compiler: xcode7-clang-release
env: CC='clang' CXX='clang++' BUILD_TYPE='Release'
osx_image: xcode9.4
compiler: xcode94-clang-dev
env: CC='clang' CXX='clang++' BUILD_TYPE='Dev'
- os: osx
osx_image: xcode7
compiler: xcode7-clang-dev
osx_image: xcode10.1
compiler: xcode10-clang-dev
env: CC='clang' CXX='clang++' BUILD_TYPE='Dev'
- os: osx
osx_image: xcode8.3
compiler: xcode8-clang-release
osx_image: xcode10.1
compiler: xcode10-clang-release
env: CC='clang' CXX='clang++' BUILD_TYPE='Release'
- os: osx
osx_image: xcode8.3
compiler: xcode8-clang-dev
env: CC='clang' CXX='clang++' BUILD_TYPE='Dev'
install:
- git clone --quiet --depth 1 https://github.com/mapbox/protozero.git ../protozero
......
......@@ -13,6 +13,34 @@ This project adheres to [Semantic Versioning](https://semver.org/).
### Fixed
## [2.15.0] - 2018-12-07
### Added
* Function `dump_as_array()` to dump sparse array indexes.
* Set the `xml_josm_upload` header option when reading XML files.
* New function `OSMObject::remove_tags()` marks tags on OSM objects as
removed.
* More tests.
### Changed
* When reading OSM files Libosmium now has less memory overhead, especially
when reading PBF files. This works by using more, but smaller buffers.
* The `TagsFilter` class is now based on the `TagsFilterBase` template
class which allows setting the result type. This allows the filter to
return more data depending on the rule that matched.
* Use enums for many constants instead of (static) const(expr) variables.
* Make `chunk_bits` in `IdSetDense` configurable.
* Hardcode `%lld` format instead of using `<cinttypes>` PRI macro.
* Update included gdalcpp to version 1.2.0.
### Fixed
* The gzip/bzip2 compression code was overhauled and is better tested now.
This fixes some bugs on Windows.
## [2.14.2] - 2018-07-23
### Fixed
......@@ -869,7 +897,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
Doxygen (up to version 1.8.8). This version contains a workaround to fix
this.
[unreleased]: https://github.com/osmcode/libosmium/compare/v2.14.2...HEAD
[unreleased]: https://github.com/osmcode/libosmium/compare/v2.15.0...HEAD
[2.15.0]: https://github.com/osmcode/libosmium/compare/v2.14.2...v2.15.0
[2.14.2]: https://github.com/osmcode/libosmium/compare/v2.14.1...v2.14.2
[2.14.1]: https://github.com/osmcode/libosmium/compare/v2.14.0...v2.14.1
[2.14.0]: https://github.com/osmcode/libosmium/compare/v2.13.1...v2.14.0
......
......@@ -12,20 +12,35 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
#-----------------------------------------------------------------------------
#
# Project version
# Configurations
#
#-----------------------------------------------------------------------------
set(CMAKE_CXX_FLAGS_COVERAGE
"-g -O0 -fno-inline-functions -fno-inline --coverage ${extra_coverage_flags_}"
CACHE STRING "Flags used by the compiler during coverage builds.")
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
"--coverage"
CACHE STRING "Flags used by the linker during coverage builds.")
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRel;Dev;Coverage"
CACHE STRING
"List of available configuration types"
FORCE)
#-----------------------------------------------------------------------------
#
# Project version
#
#-----------------------------------------------------------------------------
project(libosmium)
set(LIBOSMIUM_VERSION_MAJOR 2)
set(LIBOSMIUM_VERSION_MINOR 14)
set(LIBOSMIUM_VERSION_PATCH 2)
set(LIBOSMIUM_VERSION_MINOR 15)
set(LIBOSMIUM_VERSION_PATCH 0)
set(LIBOSMIUM_VERSION
"${LIBOSMIUM_VERSION_MAJOR}.${LIBOSMIUM_VERSION_MINOR}.${LIBOSMIUM_VERSION_PATCH}")
......@@ -100,14 +115,6 @@ endif()
# set(extra_coverage_flags_ "-fkeep-inline-functions")
#endif()
set(CMAKE_CXX_FLAGS_COVERAGE
"-g -O0 -fno-inline-functions -fno-inline --coverage ${extra_coverage_flags_}"
CACHE STRING "Flags used by the compiler during coverage builds.")
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
"--coverage"
CACHE STRING "Flags used by the linker during coverage builds.")
if(CMAKE_BUILD_TYPE STREQUAL "Coverage")
if(BUILD_EXAMPLES OR BUILD_HEADERS OR BUILD_BENCHMARKS)
message(WARNING "Coverage builds don't work for anything but the tests")
......
......@@ -68,7 +68,7 @@ cmake:
This will build the examples and tests. Call `ctest` to run the tests.
For more detals see the
For more details see the
[Building Libosmium](https://osmcode.org/libosmium/manual.html#building-libosmium)
chapter in the manual.
......
......@@ -4,6 +4,14 @@
#
#-----------------------------------------------------------------------------
os: Visual Studio 2017
platform: x64
clone_depth: 1
#-----------------------------------------------------------------------------
environment:
matrix:
- config: MSYS2
......@@ -17,12 +25,7 @@ environment:
- config: Release
autocrlf: false
clone_depth: 1
# Operating system (build VM template)
os: Visual Studio 2015
platform: x64
#-----------------------------------------------------------------------------
# scripts that are called at very beginning, before repo cloning
init:
......
......@@ -46,7 +46,7 @@ SET CMAKE_CMD=cmake .. -LA -G "Visual Studio 14 Win64" ^
-DOsmium_DEBUG=TRUE ^
-DCMAKE_BUILD_TYPE=%config% ^
-DBUILD_HEADERS=OFF ^
-DBOOST_ROOT=C:/Libraries/boost_1_63_0 ^
-DBOOST_ROOT=C:/Libraries/boost_1_67_0 ^
-DZLIB_INCLUDE_DIR=C:/projects/zlib-vc140-static-64.1.2.11/lib/native/include ^
-DZLIB_LIBRARY=C:/projects/zlib-vc140-static-64.1.2.11/lib/native/libs/x64/static/%config%/zlibstatic.lib ^
-DEXPAT_INCLUDE_DIR=C:/projects/expat.v140.2.2.5/build/native/include ^
......@@ -68,7 +68,7 @@ msbuild libosmium.sln ^
/p:PlatformToolset=v140 %avlogger%
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ctest --output-on-failure -C %config% -E testdata-overview
ctest --output-on-failure -C %config%
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
GOTO DONE
......
......@@ -71,6 +71,9 @@ find_path(OSMIUM_INCLUDE_DIR osmium/version.hpp
# Check libosmium version number
if(Osmium_FIND_VERSION)
if(NOT EXISTS "${OSMIUM_INCLUDE_DIR}/osmium/version.hpp")
message(FATAL_ERROR "Missing ${OSMIUM_INCLUDE_DIR}/osmium/version.hpp. Either your libosmium version is too old, or libosmium wasn't found in the place you said.")
endif()
file(STRINGS "${OSMIUM_INCLUDE_DIR}/osmium/version.hpp" _libosmium_version_define REGEX "#define LIBOSMIUM_VERSION_STRING")
if("${_libosmium_version_define}" MATCHES "#define LIBOSMIUM_VERSION_STRING \"([0-9.]+)\"")
set(_libosmium_version "${CMAKE_MATCH_1}")
......
libosmium (2.15.0-1~bpo9+1) stretch-backports; urgency=medium
* Rebuild for stretch-backports.
-- Bas Couwenberg <sebastic@debian.org> Mon, 17 Dec 2018 09:48:55 +0100
libosmium (2.15.0-1) unstable; urgency=medium
* New upstream release.
* Bump Standards-Version to 4.2.1, no changes.
* Update watch file to limit matches to archive path.
-- Bas Couwenberg <sebastic@debian.org> Sat, 08 Dec 2018 09:55:16 +0100
libosmium (2.14.2-2) unstable; urgency=medium
* Drop autopkgtest to test installability.
* Add lintian override for testsuite-autopkgtest-missing.
-- Bas Couwenberg <sebastic@debian.org> Tue, 31 Jul 2018 20:31:10 +0200
libosmium (2.14.2-1~bpo9+1) stretch-backports; urgency=medium
* Rebuild for stretch-backports.
......
......@@ -15,7 +15,7 @@ Build-Depends: debhelper (>= 9),
libprotozero-dev (>= 1.6.3),
libsparsehash-dev,
zlib1g-dev
Standards-Version: 4.1.5
Standards-Version: 4.2.1
Vcs-Browser: https://salsa.debian.org/debian-gis-team/libosmium/
Vcs-Git: https://salsa.debian.org/debian-gis-team/libosmium.git -b stretch-backports
Homepage: https://osmcode.org/libosmium/
......
# Not worth the effort
testsuite-autopkgtest-missing
# Test installability
Depends: @
Test-Command: /bin/true
......@@ -4,4 +4,4 @@ dversionmangle=s/\+(debian|dfsg|ds|deb)\d*$//,\
uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/;s/RC/rc/,\
filenamemangle=s/(?:.*\/)?(?:rel|v|libosmium)[\-\_]?(\d[\d\-\.]+)\.(tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))/libosmium-$1.$2/ \
https://github.com/osmcode/libosmium/releases \
(?:.*/)?(?:rel|v|libosmium)[\-\_]?(\d[\d\-\.]+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
(?:.*?/archive/)?(?:rel|v|libosmium)[\-\_]?(\d[\d\-\.]+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
This diff is collapsed.
......@@ -105,7 +105,9 @@ namespace osmium {
struct slocation {
static constexpr const uint32_t invalid_item = 1u << 30u;
enum {
invalid_item = 1u << 30u
};
uint32_t item : 31;
uint32_t reverse : 1;
......
......@@ -147,14 +147,14 @@ namespace osmium {
m_debug(debug) {
}
~SegmentList() noexcept = default;
SegmentList(const SegmentList&) = delete;
SegmentList(SegmentList&&) = delete;
SegmentList& operator=(const SegmentList&) = delete;
SegmentList& operator=(SegmentList&&) = delete;
~SegmentList() noexcept = default;
/// The number of segments in the list.
std::size_t size() const noexcept {
return m_segments.size();
......@@ -181,7 +181,7 @@ namespace osmium {
return m_segments[n];
}
NodeRefSegment& operator[](std::size_t n) noexcept {
NodeRefSegment& operator[](const std::size_t n) noexcept {
assert(n < m_segments.size());
return m_segments[n];
}
......@@ -206,7 +206,7 @@ namespace osmium {
* Enable or disable debug output to stderr. This is used
* for debugging libosmium itself.
*/
void enable_debug_output(bool debug = true) noexcept {
void enable_debug_output(const bool debug = true) noexcept {
m_debug = debug;
}
......
......@@ -68,8 +68,6 @@ namespace osmium {
detail::BasicAssembler(config) {
}
~GeomAssembler() noexcept = default;
/**
* Assemble an area from the given way.
*
......
......@@ -85,8 +85,13 @@ namespace osmium {
area_stats m_stats;
static constexpr size_t initial_output_buffer_size = 1024 * 1024;
static constexpr size_t max_buffer_size_for_flush = 100 * 1024;
enum {
initial_output_buffer_size = 1024ul * 1024ul
};
enum {
max_buffer_size_for_flush = 100ul * 1024ul
};
void flush_output_buffer() {
if (this->callback()) {
......
......@@ -764,7 +764,7 @@ namespace osmium {
template <typename TBuilder, typename THandler, typename... TArgs>
inline typename std::enable_if<is_handled_by<THandler, TArgs...>::value>::type
add_list(osmium::builder::Builder& parent, const TArgs&... args) {
TBuilder builder(parent.buffer(), &parent);
TBuilder builder{parent.buffer(), &parent};
(void)std::initializer_list<int>{
(THandler::set_value(builder, args), 0)...
};
......@@ -792,7 +792,7 @@ namespace osmium {
static_assert(detail::are_all_handled_by<detail::any_node_handlers, TArgs...>::value, "Attribute not allowed in add_node()");
{
NodeBuilder builder(buffer);
NodeBuilder builder{buffer};
detail::add_basic<detail::node_handler>(builder, args...);
detail::add_user(builder, args...);
......@@ -815,7 +815,7 @@ namespace osmium {
static_assert(detail::are_all_handled_by<detail::any_way_handlers, TArgs...>::value, "Attribute not allowed in add_way()");
{
WayBuilder builder(buffer);
WayBuilder builder{buffer};
detail::add_basic<detail::object_handler>(builder, args...);
detail::add_user(builder, args...);
......@@ -839,7 +839,7 @@ namespace osmium {
static_assert(detail::are_all_handled_by<detail::any_relation_handlers, TArgs...>::value, "Attribute not allowed in add_relation()");
{
RelationBuilder builder(buffer);
RelationBuilder builder{buffer};
detail::add_basic<detail::object_handler>(builder, args...);
detail::add_user(builder, args...);
......@@ -863,7 +863,7 @@ namespace osmium {
static_assert(detail::are_all_handled_by<detail::any_changeset_handlers, TArgs...>::value, "Attribute not allowed in add_changeset()");
{
ChangesetBuilder builder(buffer);
ChangesetBuilder builder{buffer};
detail::add_basic<detail::changeset_handler>(builder, args...);
detail::add_user(builder, args...);
......@@ -887,7 +887,7 @@ namespace osmium {
static_assert(detail::are_all_handled_by<detail::any_area_handlers, TArgs...>::value, "Attribute not allowed in add_area()");
{
AreaBuilder builder(buffer);
AreaBuilder builder{buffer};
detail::add_basic<detail::object_handler>(builder, args...);
detail::add_user(builder, args...);
......@@ -914,7 +914,7 @@ namespace osmium {
static_assert(detail::are_all_handled_by<detail::nodes_handler, TArgs...>::value, "Attribute not allowed in add_way_node_list()");
{
WayNodeListBuilder builder(buffer);
WayNodeListBuilder builder{buffer};
(void)std::initializer_list<int>{
(detail::nodes_handler::set_value(builder, args), 0)...
};
......@@ -936,7 +936,7 @@ namespace osmium {
static_assert(detail::are_all_handled_by<detail::tags_handler, TArgs...>::value, "Attribute not allowed in add_tag_list()");
{
TagListBuilder builder(buffer);
TagListBuilder builder{buffer};
(void)std::initializer_list<int>{
(detail::tags_handler::set_value(builder, args), 0)...
};
......
......@@ -65,7 +65,7 @@ namespace osmium {
explicit Builder(osmium::memory::Buffer& buffer, Builder* parent, osmium::memory::item_size_type size) :
m_buffer(buffer),
m_parent(parent),
m_item_offset(buffer.written()) {
m_item_offset(buffer.written() - buffer.committed()) {
reserve_space(size);
assert(buffer.is_aligned());
if (m_parent) {
......@@ -80,7 +80,7 @@ namespace osmium {
}
#ifdef NDEBUG
~Builder() = default;
~Builder() noexcept = default;
#else
~Builder() noexcept {
m_buffer.decrement_builder_count();
......@@ -88,7 +88,7 @@ namespace osmium {
#endif
osmium::memory::Item& item() const {
return *reinterpret_cast<osmium::memory::Item*>(m_buffer.data() + m_item_offset);
return *reinterpret_cast<osmium::memory::Item*>(m_buffer.data() + m_buffer.committed() + m_item_offset);
}
unsigned char* reserve_space(std::size_t size) {
......
......@@ -98,6 +98,10 @@ namespace osmium {
*/
struct Tile {
enum {
max_zoom = 30u
};
/// x coordinate
uint32_t x;
......@@ -119,7 +123,7 @@ namespace osmium {
x(tx),
y(ty),
z(zoom) {
assert(zoom <= 30u);
assert(zoom <= max_zoom);
assert(x < num_tiles_in_zoom(zoom));
assert(y < num_tiles_in_zoom(zoom));
}
......@@ -134,7 +138,7 @@ namespace osmium {
*/
explicit Tile(uint32_t zoom, const osmium::Location& location) :
z(zoom) {
assert(zoom <= 30u);
assert(zoom <= max_zoom);
assert(location.valid());
const auto coordinates = lonlat_to_mercator(location);
x = mercx_to_tilex(zoom, coordinates.x);
......@@ -151,7 +155,7 @@ namespace osmium {
*/
explicit Tile(uint32_t zoom, const osmium::geom::Coordinates& coordinates) :
z(zoom) {
assert(zoom <= 30u);
assert(zoom <= max_zoom);
x = mercx_to_tilex(zoom, coordinates.x);
y = mercy_to_tiley(zoom, coordinates.y);
}
......@@ -162,7 +166,7 @@ namespace osmium {
* each be between 0 and 2^zoom-1.
*/
bool valid() const noexcept {
if (z > 30) {
if (z > max_zoom) {
return false;
}
const auto max = num_tiles_in_zoom(z);
......
......@@ -46,7 +46,9 @@ namespace osmium {
namespace detail {
constexpr size_t mmap_vector_size_increment = 1024 * 1024;
enum {
mmap_vector_size_increment = 1024ul * 1024ul
};
/**
* This is a base class for implementing classes that look like
......@@ -58,12 +60,12 @@ namespace osmium {
protected:
size_t m_size = 0;
std::size_t m_size = 0;
osmium::TypedMemoryMapping<T> m_mapping;
public:
mmap_vector_base(int fd, size_t capacity, size_t size = 0) :
mmap_vector_base(const int fd, const std::size_t capacity, const std::size_t size = 0) :
m_size(size),
m_mapping(capacity, osmium::MemoryMapping::mapping_mode::write_shared, fd) {
assert(size <= capacity);
......@@ -71,7 +73,7 @@ namespace osmium {
shrink_to_fit();
}
explicit mmap_vector_base(size_t capacity = mmap_vector_size_increment) :
explicit mmap_vector_base(const std::size_t capacity = mmap_vector_size_increment) :
m_mapping(capacity) {
std::fill_n(data(), capacity, osmium::index::empty_value<T>());
}
......@@ -88,11 +90,11 @@ namespace osmium {
m_mapping.unmap();
}
size_t capacity() const noexcept {
std::size_t capacity() const noexcept {
return m_mapping.size();
}
size_t size() const noexcept {
std::size_t size() const noexcept {
return m_size;
}
......@@ -108,17 +110,17 @@ namespace osmium {
return m_mapping.begin();
}
const_reference operator[](size_t n) const {
const_reference operator[](const std::size_t n) const {
assert(n < m_size);
return data()[n];
}
reference operator[](size_t n) {
reference operator[](const std::size_t n) {
assert(n < m_size);
return data()[n];
}
value_type at(size_t n) const {
value_type at(const std::size_t n) const {
if (n >= m_size) {
throw std::out_of_range{"out of range"};
}
......@@ -140,17 +142,17 @@ namespace osmium {
data()[m_size - 1] = value;
}
void reserve(size_t new_capacity) {
void reserve(const std::size_t new_capacity) {
if (new_capacity > capacity()) {
const size_t old_capacity = capacity();
const std::size_t old_capacity = capacity();
m_mapping.resize(new_capacity);
std::fill(data() + old_capacity, data() + new_capacity, osmium::index::empty_value<value_type>());
}
}
void resize(size_t new_size) {
void resize(const std::size_t new_size) {
if (new_size > capacity()) {
reserve(new_size + osmium::detail::mmap_vector_size_increment);
reserve(new_size + mmap_vector_size_increment);
}
m_size = new_size;
}
......
......@@ -53,7 +53,7 @@ namespace osmium {
template <typename T>
class mmap_vector_file : public mmap_vector_base<T> {
static std::size_t filesize(int fd) {
static std::size_t filesize(const int fd) {
const auto size = osmium::file_size(fd);
if (size % sizeof(T) != 0) {
......@@ -71,10 +71,10 @@ namespace osmium {
osmium::detail::mmap_vector_size_increment) {
}
explicit mmap_vector_file(int fd) :
explicit mmap_vector_file(const int fd) :
mmap_vector_base<T>(
fd,
std::max(osmium::detail::mmap_vector_size_increment, filesize(fd)),
std::max(static_cast<std::size_t>(mmap_vector_size_increment), filesize(fd)),
filesize(fd)) {
}
......
......@@ -39,8 +39,10 @@ DEALINGS IN THE SOFTWARE.
#include <algorithm>
#include <cstddef>
#include <memory>
#include <utility>
namespace osmium {
namespace index {
......@@ -221,6 +223,26 @@ namespace osmium {
std::sort(m_vector.begin(), m_vector.end());
}
void dump_as_array(const int fd) final {
constexpr const size_t value_size = sizeof(TValue);
constexpr const size_t buffer_size = (10L * 1024L * 1024L) / value_size;
std::unique_ptr<TValue[]> output_buffer{new TValue[buffer_size]};
size_t buffer_start_id = 0;
for (auto it = cbegin(); it != cend();) {
std::fill_n(output_buffer.get(), buffer_size, osmium::index::empty_value<TValue>());
size_t offset = 0;
for (; offset < buffer_size && it != end(); ++offset) {
if (buffer_start_id + offset == it->first) {
output_buffer[offset] = it->second;
++it;
}
}
osmium::io::detail::reliable_write(fd, reinterpret_cast<const unsigned char*>(output_buffer.get()), offset * value_size);
buffer_start_id += buffer_size;
}
}
void dump_as_list(const int fd) final {
osmium::io::detail::reliable_write(fd, reinterpret_cast<const char*>(m_vector.data()), byte_size());
}
......
......@@ -95,30 +95,44 @@ namespace osmium {
}; // class IdSet
template <typename T>
namespace detail {
// This value is a compromise. For node Ids it could be bigger
// which would mean less (but larger) memory allocations. For
// relations Ids it could be smaller, because they would all fit
// into a smaller allocation.
enum : std::size_t {
default_chunk_bits = 22u
};
} // namespace detail
template <typename T, std::size_t chunk_bits = detail::default_chunk_bits>
class IdSetDense;
/**
* Const_iterator for iterating over a IdSetDense.
*/
template <typename T>
template <typename T, std::size_t chunk_bits>
class IdSetDenseIterator {
static_assert(std::is_unsigned<T>::value, "Needs unsigned type");
static_assert(sizeof(T) >= 4, "Needs at least 32bit type");
const IdSetDense<T>* m_set;
using id_set = IdSetDense<T, chunk_bits>;
const id_set* m_set;
T m_value;
T m_last;
void next() noexcept {
while (m_value != m_last && !m_set->get(m_value)) {
const T cid = IdSetDense<T>::chunk_id(m_value);
const T cid = id_set::chunk_id(m_value);
assert(cid < m_set->m_data.size());
if (!m_set->m_data[cid]) {
m_value = (cid + 1) << (IdSetDense<T>::chunk_bits + 3);
m_value = (cid + 1) << (chunk_bits + 3);
} else {
const auto slot = m_set->m_data[cid][IdSetDense<T>::offset(m_value)];
const auto slot = m_set->m_data[cid][id_set::offset(m_value)];
if (slot == 0) {
m_value += 8;
m_value &= ~0x7ull;
......@@ -136,14 +150,14 @@ namespace osmium {
using pointer = value_type*;
using reference = value_type&;
IdSetDenseIterator(const IdSetDense<T>* set, T value, T last) noexcept :
IdSetDenseIterator(const id_set* set, T value, T last) noexcept :
m_set(set),
m_value(value),
m_last(last) {
next();
}
IdSetDenseIterator<T>& operator++() noexcept {
IdSetDenseIterator& operator++() noexcept {
if (m_value != m_last) {
++m_value;
next();
......@@ -151,17 +165,17 @@ namespace osmium {
return *this;
}
IdSetDenseIterator<T> operator++(int) noexcept {
IdSetDenseIterator<T> tmp{*this};
IdSetDenseIterator operator++(int) noexcept {
IdSetDenseIterator tmp{*this};
operator++();
return tmp;
}
bool operator==(const IdSetDenseIterator<T>& rhs) const noexcept {
bool operator==(const IdSetDenseIterator& rhs) const noexcept {
return m_set == rhs.m_set && m_value == rhs.m_value;
}
bool operator!=(const IdSetDenseIterator<T>& rhs) const noexcept {
bool operator!=(const IdSetDenseIterator& rhs) const noexcept {
return !(*this == rhs);
}
......@@ -179,20 +193,17 @@ namespace osmium {
* and larger Id sets. If it is not used, no memory is allocated at
* all.
*/
template <typename T>
template <typename T, std::size_t chunk_bits>
class IdSetDense : public IdSet<T> {
static_assert(std::is_unsigned<T>::value, "Needs unsigned type");
static_assert(sizeof(T) >= 4, "Needs at least 32bit type");
friend class IdSetDenseIterator<T>;
friend class IdSetDenseIterator<T, chunk_bits>;
// This value is a compromise. For node Ids it could be bigger
// which would mean less (but larger) memory allocations. For
// relations Ids it could be smaller, because they would all fit
// into a smaller allocation.
constexpr static const std::size_t chunk_bits = 22u;
constexpr static const std::size_t chunk_size = 1u << chunk_bits;
enum : std::size_t {
chunk_size = 1u << chunk_bits
};
std::vector<std::unique_ptr<unsigned char[]>> m_data;
T m_size = 0;
......@@ -230,7 +241,7 @@ namespace osmium {
public:
using const_iterator = IdSetDenseIterator<T>;
using const_iterator = IdSetDenseIterator<T, chunk_bits>;
IdSetDense() = default;
......@@ -284,7 +295,7 @@ namespace osmium {
if (chunk_id(id) >= m_data.size()) {
return false;
}
auto* r = m_data[chunk_id(id)].get();
const auto* r = m_data[chunk_id(id)].get();
if (!r) {
return false;
}
......@@ -317,11 +328,11 @@ namespace osmium {
return m_data.size() * chunk_size;
}
IdSetDenseIterator<T> begin() const {
const_iterator begin() const {
return {this, 0, last()};
}
IdSetDenseIterator<T> end() const {
const_iterator end() const {
return {this, last(), last()};
}
......
......@@ -118,7 +118,7 @@ namespace osmium {
virtual ~Map() noexcept = default;
virtual void reserve(const size_t /*size*/) {
virtual void reserve(const std::size_t /*size*/) {
// default implementation is empty
}
......@@ -151,7 +151,7 @@ namespace osmium {
* accurate. You can not use this to find out how much memory the
* storage uses. Use used_memory() for that.
*/
virtual size_t size() const = 0;
virtual std::size_t size() const = 0;
/**
* Get the memory used for this storage in bytes. Note that this
......@@ -160,7 +160,7 @@ namespace osmium {
* the main memory used, for storage classes storing data on disk
* this is the memory used on disk.
*/
virtual size_t used_memory() const = 0;
virtual std::size_t used_memory() const = 0;
/**
* Clear memory used for this storage. After this you can not
......@@ -210,8 +210,6 @@ namespace osmium {
MapFactory() = default;
~MapFactory() = default;
public:
MapFactory(const MapFactory&) = delete;
......@@ -220,6 +218,8 @@ namespace osmium {
MapFactory(MapFactory&&) = delete;
MapFactory& operator=(MapFactory&&) = delete;
~MapFactory() = default;
static MapFactory<id_type, value_type>& instance() {
static MapFactory<id_type, value_type> factory;
return factory;
......
......@@ -62,17 +62,17 @@ namespace osmium {
// This value is based on benchmarks with a planet file and
// some smaller files.
enum constant_bits {
enum {
bits = 16
};
enum constant_block_size : uint64_t {
enum : uint64_t {
block_size = 1ull << bits
};
// Minimum number of entries in the sparse index before we
// are considering switching to a dense index.
enum constant_min_dense_entries : int64_t {
enum : int64_t {
min_dense_entries = 0xffffff
};
......@@ -81,7 +81,7 @@ namespace osmium {
// the best memory efficiency (which we would get at a factor
// of 2) and the performance (dense index is much faster then
// the sparse index).
enum constant_density_factor {
enum {
density_factor = 3
};
......
......@@ -62,7 +62,9 @@ namespace osmium {
// element in the map (id + value + pointers to left, right,
// and parent plus some overhead for color of red-black-tree
// or similar).
static constexpr size_t element_size = sizeof(TId) + sizeof(TValue) + sizeof(void*) * 4;
enum {
element_size = sizeof(TId) + sizeof(TValue) + sizeof(void*) * 4u
};
std::map<TId, TValue> m_elements;
......
......@@ -87,7 +87,7 @@ namespace osmium {
}
HybridIterator<TId, TValue> operator++(int) {
auto tmp(*this);
const auto tmp{*this};
operator++();
return tmp;
}
......@@ -159,10 +159,10 @@ namespace osmium {
}
std::pair<iterator, iterator> get_all(const TId id) {
auto result_main = m_main.get_all(id);
auto result_extra = m_extra.get_all(id);
return std::make_pair(iterator(result_main.first, result_main.second, result_extra.first, result_extra.second),
iterator(result_main.second, result_main.second, result_extra.second, result_extra.second));
const auto result_main = m_main.get_all(id);
const auto result_extra = m_extra.get_all(id);
return std::make_pair(iterator{result_main.first, result_main.second, result_extra.first, result_extra.second},
iterator{result_main.second, result_main.second, result_extra.second, result_extra.second});
}
void remove(const TId id, const TValue value) {
......
......@@ -59,7 +59,9 @@ namespace osmium {
// element in the map (id + value + pointers to left, right,
// and parent plus some overhead for color of red-black-tree
// or similar).
static constexpr size_t element_size = sizeof(TId) + sizeof(TValue) + sizeof(void*) * 4;
enum {
element_size = sizeof(TId) + sizeof(TValue) + sizeof(void*) * 4u
};
public:
......
......@@ -44,11 +44,11 @@ namespace osmium {
public:
T& operator()(osmium::item_type type) noexcept {
T& operator()(const osmium::item_type type) noexcept {
return m_sets[osmium::item_type_to_nwr_index(type)];
}
const T& operator()(osmium::item_type type) const noexcept {
const T& operator()(const osmium::item_type type) const noexcept {
return m_sets[osmium::item_type_to_nwr_index(type)];
}
......
......@@ -66,12 +66,12 @@ namespace osmium {
TKeyInternal key;
TValueInternal value;
explicit kv_pair(key_type key_id) :
explicit kv_pair(const key_type key_id) :
key(static_cast<TKeyInternal>(key_id)),
value() {
}
kv_pair(key_type key_id, value_type value_id) :
kv_pair(const key_type key_id, const value_type value_id) :
key(static_cast<TKeyInternal>(key_id)),
value(static_cast<TValueInternal>(value_id)) {
}
......@@ -91,7 +91,7 @@ namespace osmium {
using const_iterator = typename std::vector<kv_pair>::const_iterator;
void set(key_type key, value_type value) {
void set(const key_type key, const value_type value) {
m_map.emplace_back(key, value);
}
......@@ -119,7 +119,7 @@ namespace osmium {
m_map.erase(last, m_map.end());
}
std::pair<const_iterator, const_iterator> get(key_type key) const noexcept {
std::pair<const_iterator, const_iterator> get(const key_type key) const noexcept {
return std::equal_range(m_map.begin(), m_map.end(), kv_pair{key}, [](const kv_pair& lhs, const kv_pair& rhs) {
return lhs.key < rhs.key;
});
......@@ -133,7 +133,7 @@ namespace osmium {
return m_map.size();
}
void reserve(std::size_t size) {
void reserve(const std::size_t size) {
m_map.reserve(size);
}
......@@ -209,7 +209,7 @@ namespace osmium {
* (Lookup uses binary search.)
*/
template <typename TFunc>
void for_each_parent(osmium::unsigned_object_id_type member_id, TFunc&& func) const {
void for_each_parent(const osmium::unsigned_object_id_type member_id, TFunc&& func) const {
const auto parents = m_map.get(member_id);
for (auto it = parents.first; it != parents.second; ++it) {
std::forward<TFunc>(func)(it->value);
......@@ -231,7 +231,7 @@ namespace osmium {
* (Lookup uses binary search.)
*/
template <typename TFunc>
void for_each(osmium::unsigned_object_id_type id, TFunc&& func) const {
void for_each(const osmium::unsigned_object_id_type id, TFunc&& func) const {
const auto parents = m_map.get(id);
for (auto it = parents.first; it != parents.second; ++it) {
std::forward<TFunc>(func)(it->value);
......@@ -336,7 +336,7 @@ namespace osmium {
/**
* Add mapping from member to parent relation in the stash.
*/
void add(osmium::unsigned_object_id_type member_id, osmium::unsigned_object_id_type relation_id) {
void add(const osmium::unsigned_object_id_type member_id, const osmium::unsigned_object_id_type relation_id) {
assert(m_valid && "You can't use the RelationsMap any more after calling build_index()");
m_map.set(member_id, relation_id);
}
......
This diff is collapsed.
......@@ -50,12 +50,6 @@ DEALINGS IN THE SOFTWARE.
#include <tuple>
#include <utility>
#ifndef _MSC_VER
# include <unistd.h>
#else
# include <io.h>
#endif
namespace osmium {
namespace io {
......@@ -66,13 +60,13 @@ namespace osmium {
protected:
bool do_fsync() const {
bool do_fsync() const noexcept {
return m_fsync == fsync::yes;
}
public:
explicit Compressor(fsync sync) :
explicit Compressor(const fsync sync) noexcept :
m_fsync(sync) {
}
......@@ -97,7 +91,9 @@ namespace osmium {
public:
static constexpr unsigned int input_buffer_size = 1024 * 1024;
enum {
input_buffer_size = 1024u * 1024u
};
Decompressor() = default;
......@@ -117,7 +113,7 @@ namespace osmium {
return m_file_size;
}
void set_file_size(std::size_t size) noexcept {
void set_file_size(const std::size_t size) noexcept {
m_file_size = size;
}
......@@ -125,7 +121,7 @@ namespace osmium {
return m_offset;
}
void set_offset(std::size_t offset) noexcept {
void set_offset(const std::size_t offset) noexcept {
m_offset = offset;
}
......@@ -158,7 +154,7 @@ namespace osmium {
CompressionFactory() = default;
const callbacks_type& find_callbacks(osmium::io::file_compression compression) const {
const callbacks_type& find_callbacks(const osmium::io::file_compression compression) const {
const auto it = m_callbacks.find(compression);
if (it != m_callbacks.end()) {
......@@ -201,19 +197,19 @@ namespace osmium {
}
template <typename... TArgs>
std::unique_ptr<osmium::io::Compressor> create_compressor(osmium::io::file_compression compression, TArgs&&... args) const {
std::unique_ptr<osmium::io::Compressor> create_compressor(const osmium::io::file_compression compression, TArgs&&... args) const {
const auto callbacks = find_callbacks(compression);
return std::unique_ptr<osmium::io::Compressor>(std::get<0>(callbacks)(std::forward<TArgs>(args)...));
}
std::unique_ptr<osmium::io::Decompressor> create_decompressor(osmium::io::file_compression compression, int fd) const {
std::unique_ptr<osmium::io::Decompressor> create_decompressor(const osmium::io::file_compression compression, const int fd) const {
const auto callbacks = find_callbacks(compression);
auto p = std::unique_ptr<osmium::io::Decompressor>(std::get<1>(callbacks)(fd));
p->set_file_size(osmium::file_size(fd));
return p;
}
std::unique_ptr<osmium::io::Decompressor> create_decompressor(osmium::io::file_compression compression, const char* buffer, std::size_t size) const {
std::unique_ptr<osmium::io::Decompressor> create_decompressor(const osmium::io::file_compression compression, const char* buffer, const std::size_t size) const {
const auto callbacks = find_callbacks(compression);
return std::unique_ptr<osmium::io::Decompressor>(std::get<2>(callbacks)(buffer, size));
}
......@@ -226,7 +222,7 @@ namespace osmium {
public:
NoCompressor(int fd, fsync sync) :
NoCompressor(const int fd, const fsync sync) :
Compressor(sync),
m_fd(fd) {
}
......@@ -271,11 +267,11 @@ namespace osmium {
public:
explicit NoDecompressor(int fd) :
explicit NoDecompressor(const int fd) :
m_fd(fd) {
}
NoDecompressor(const char* buffer, std::size_t size) :
NoDecompressor(const char* buffer, const std::size_t size) :
m_buffer(buffer),
m_buffer_size(size) {
}
......@@ -305,7 +301,7 @@ namespace osmium {
}
} else {
buffer.resize(osmium::io::Decompressor::input_buffer_size);
const auto nread = detail::reliable_read(m_fd, const_cast<char*>(buffer.data()), osmium::io::Decompressor::input_buffer_size);
const auto nread = detail::reliable_read(m_fd, &*buffer.begin(), osmium::io::Decompressor::input_buffer_size);
buffer.resize(std::string::size_type(nread));
}
......@@ -330,8 +326,8 @@ namespace osmium {
// we want the register_compression() function to run, setting
// the variable is only a side-effect, it will never be used
const bool registered_no_compression = osmium::io::CompressionFactory::instance().register_compression(osmium::io::file_compression::none,
[](int fd, fsync sync) { return new osmium::io::NoCompressor{fd, sync}; },
[](int fd) { return new osmium::io::NoDecompressor{fd}; },
[](const int fd, const fsync sync) { return new osmium::io::NoCompressor{fd, sync}; },
[](const int fd) { return new osmium::io::NoDecompressor{fd}; },
[](const char* buffer, std::size_t size) { return new osmium::io::NoDecompressor{buffer, size}; }
);
......
......@@ -60,7 +60,6 @@ DEALINGS IN THE SOFTWARE.
#include <osmium/util/minmax.hpp>
#include <osmium/visitor.hpp>
#include <cinttypes>
#include <cmath>
#include <cstring>
#include <iterator>
......@@ -392,7 +391,7 @@ namespace osmium {
for (const auto& node_ref : way.nodes()) {
write_diff();
write_counter(width, n++);
output_formatted("%10" PRId64, node_ref.ref());
output_formatted("%10lld", static_cast<long long>(node_ref.ref())); // NOLINT(google-runtime-int)
if (node_ref.location().valid()) {
*m_out += " (";
node_ref.location().as_string(std::back_inserter(*m_out));
......@@ -428,7 +427,7 @@ namespace osmium {
write_diff();
write_counter(width, n++);
*m_out += short_typename[item_type_to_nwr_index(member.type())];
output_formatted(" %10" PRId64 " ", member.ref());
output_formatted(" %10lld ", static_cast<long long>(member.ref())); // NOLINT(google-runtime-int)
write_string(member.role());
*m_out += '\n';
}
......
......@@ -97,14 +97,20 @@ namespace osmium {
// The following settings are from the o5m description:
// The maximum number of entries in this table.
const uint64_t number_of_entries = 15000;
enum {
number_of_entries = 15000u
};
// The size of one entry in the table.
const unsigned int entry_size = 256;
enum {
entry_size = 256u
};
// The maximum length of a string in the table including
// two \0 bytes.
const unsigned int max_length = 250 + 2;
enum {
max_length = 250u + 2u
};
// The data is stored in this string. It is default constructed
// and then resized on demand the first time something is added.
......@@ -145,11 +151,14 @@ namespace osmium {
class O5mParser : public Parser {
static constexpr std::size_t buffer_size = 2 * 1000 * 1000;
enum {
initial_buffer_size = 1024ul * 1024ul
};
osmium::io::Header m_header{};
osmium::memory::Buffer m_buffer;
osmium::memory::Buffer m_buffer{initial_buffer_size,
osmium::memory::Buffer::auto_grow::internal};
std::string m_input{};
......@@ -356,7 +365,7 @@ namespace osmium {
object.set_timestamp(timestamp);
object.set_changeset(m_delta_changeset.update(zvarint(dataptr</