Commit 60b85d78 authored by Bas Couwenberg's avatar Bas Couwenberg

Merge tag 'debian/2.15.0-1' into stretch-backports

parents ec2fc9ea c177123c
......@@ -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) 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();