Upgrade libosmium to v2.15.6

This commit is contained in:
Desone Burns II
2020-11-17 14:59:06 -07:00
parent 98fd17589d
commit dfc1bfc27e
319 changed files with 6268 additions and 3946 deletions
+11 -9
View File
@@ -3,9 +3,9 @@
/*
This file is part of Osmium (http://osmcode.org/libosmium).
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -33,6 +33,8 @@ DEALINGS IN THE SOFTWARE.
*/
#include <osmium/util/compatibility.hpp>
#ifndef assert
# include <cassert>
#endif
@@ -60,40 +62,40 @@ namespace osmium {
};
template <typename T, typename F, typename std::enable_if<are_real_integers<T, F>::value && std::is_same<T, F>::value, int>::type = 0>
inline T static_cast_with_assert(const F value) {
OSMIUM_DEPRECATED inline T static_cast_with_assert(const F value) {
return value;
}
template <typename T, typename F, typename std::enable_if<are_real_integers<T, F>::value && !std::is_same<T, F>::value && (sizeof(T) > sizeof(F)), int>::type = 0>
inline T static_cast_with_assert(const F value) {
OSMIUM_DEPRECATED inline T static_cast_with_assert(const F value) {
return static_cast<T>(value);
}
template <typename T, typename F, typename std::enable_if<are_real_integers<T, F>::value && !std::is_same<T, F>::value && std::is_signed<T>::value == std::is_signed<F>::value && (sizeof(T) == sizeof(F)), int>::type = 0>
inline T static_cast_with_assert(const F value) {
OSMIUM_DEPRECATED inline T static_cast_with_assert(const F value) {
return static_cast<T>(value);
}
template <typename T, typename F, typename std::enable_if<are_real_integers<T, F>::value && !std::is_same<T, F>::value && (sizeof(T) < sizeof(F)) && std::is_signed<T>::value && std::is_signed<F>::value, int>::type = 0>
inline T static_cast_with_assert(const F value) {
OSMIUM_DEPRECATED inline T static_cast_with_assert(const F value) {
assert(value >= std::numeric_limits<T>::min() && value <= std::numeric_limits<T>::max());
return static_cast<T>(value);
}
template <typename T, typename F, typename std::enable_if<are_real_integers<T, F>::value && !std::is_same<T, F>::value && (sizeof(T) <= sizeof(F)) && std::is_unsigned<T>::value && std::is_signed<F>::value, int>::type = 0>
inline T static_cast_with_assert(const F value) {
OSMIUM_DEPRECATED inline T static_cast_with_assert(const F value) {
assert(value >= 0 && static_cast<typename std::make_unsigned<F>::type>(value) <= std::numeric_limits<T>::max());
return static_cast<T>(value);
}
template <typename T, typename F, typename std::enable_if<are_real_integers<T, F>::value && !std::is_same<T, F>::value && (sizeof(T) < sizeof(F)) && std::is_unsigned<T>::value && std::is_unsigned<F>::value, int>::type = 0>
inline T static_cast_with_assert(const F value) {
OSMIUM_DEPRECATED inline T static_cast_with_assert(const F value) {
assert(value <= std::numeric_limits<T>::max());
return static_cast<T>(value);
}
template <typename T, typename F, typename std::enable_if<are_real_integers<T, F>::value && !std::is_same<T, F>::value && (sizeof(T) <= sizeof(F)) && std::is_signed<T>::value && std::is_unsigned<F>::value, int>::type = 0>
inline T static_cast_with_assert(const F value) {
OSMIUM_DEPRECATED inline T static_cast_with_assert(const F value) {
assert(static_cast<int64_t>(value) <= static_cast<int64_t>(std::numeric_limits<T>::max()));
return static_cast<T>(value);
}
@@ -3,9 +3,9 @@
/*
This file is part of Osmium (http://osmcode.org/libosmium).
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -33,8 +33,9 @@ DEALINGS IN THE SOFTWARE.
*/
// Workarounds for MSVC which doesn't support
// * [[noreturn]]
// Workarounds for MSVC which doesn't support [[noreturn]]
// This is not needed any more, but kept here for the time being, because
// older versions of osmium-tool need it.
#ifdef _MSC_VER
# define OSMIUM_NORETURN __declspec(noreturn)
#else
+17 -7
View File
@@ -3,9 +3,9 @@
/*
This file is part of Osmium (http://osmcode.org/libosmium).
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -80,17 +80,27 @@ namespace osmium {
return true;
}
inline std::size_t get_max_queue_size(const char* queue_name, std::size_t default_value) noexcept {
inline std::size_t get_max_queue_size(const char* queue_name, const std::size_t default_value) noexcept {
assert(queue_name);
std::string name{"OSMIUM_MAX_"};
name += queue_name;
name += "_QUEUE_SIZE";
auto env = osmium::detail::getenv_wrapper(name.c_str());
const auto env = osmium::detail::getenv_wrapper(name.c_str());
std::size_t value = default_value;
if (env) {
const auto value = osmium::detail::str_to_int<std::size_t>(env);
return value == 0 ? default_value : value;
const auto new_value = osmium::detail::str_to_int<std::size_t>(env);
if (new_value != 0) {
value = new_value;
}
}
return default_value;
if (value < 2) {
value = 2;
}
return value;
}
} // namespace config
+13 -4
View File
@@ -3,9 +3,9 @@
/*
This file is part of Osmium (http://osmcode.org/libosmium).
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -35,6 +35,7 @@ DEALINGS IN THE SOFTWARE.
#include <osmium/util/cast.hpp>
#include <cassert>
#include <cstdint>
#include <type_traits>
#include <utility>
@@ -55,6 +56,11 @@ namespace osmium {
static_assert(std::is_integral<TDelta>::value && std::is_signed<TDelta>::value,
"DeltaEncode delta type must be some signed integer");
// Not a perfect check, because of signed vs. unsigned, but
// might find some problems.
static_assert(sizeof(TDelta) >= sizeof(TValue),
"Delta type size should be larger or equal to value type size");
TValue m_value;
public:
@@ -77,8 +83,11 @@ namespace osmium {
TDelta update(TValue new_value) noexcept {
using std::swap;
swap(m_value, new_value);
return static_cast_with_assert<TDelta>(m_value) -
static_cast_with_assert<TDelta>(new_value);
// Checking the static_cast here doesn't help much, because
// the substraction can still lead to an overflow. This is
// dependend on the input data being "reasonable". XXX
return static_cast<TDelta>(m_value) -
static_cast<TDelta>(new_value);
}
}; // class DeltaEncode
+6 -4
View File
@@ -3,9 +3,9 @@
/*
This file is part of Osmium (http://osmcode.org/libosmium).
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -43,8 +43,6 @@ namespace osmium {
inline namespace util {
constexpr const int max_double_length = 20; // should fit any double
/**
* Write double to iterator, removing superfluous '0' characters at
* the end. The decimal dot will also be removed if necessary.
@@ -58,6 +56,10 @@ namespace osmium {
inline T double2string(T iterator, double value, int precision) {
assert(precision <= 17);
enum {
max_double_length = 20 // should fit decimal representation of any double
};
char buffer[max_double_length];
#ifndef _MSC_VER
+2 -2
View File
@@ -3,9 +3,9 @@
/*
This file is part of Osmium (http://osmcode.org/libosmium).
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
+8 -6
View File
@@ -3,9 +3,9 @@
/*
This file is part of Osmium (http://osmcode.org/libosmium).
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -33,11 +33,11 @@ DEALINGS IN THE SOFTWARE.
*/
#include <osmium/util/cast.hpp>
#include <cassert>
#include <cerrno>
#include <cstddef>
#include <cstdio>
#include <limits>
#include <string>
#include <sys/stat.h>
#include <sys/types.h>
@@ -138,6 +138,7 @@ namespace osmium {
inline std::size_t file_size(const char* name) {
#ifdef _MSC_VER
// Windows implementation
osmium::detail::disable_invalid_parameter_handler diph;
// https://msdn.microsoft.com/en-us/library/14h5k7ff.aspx
struct _stat64 s{};
if (::_stati64(name, &s) != 0) {
@@ -176,10 +177,11 @@ namespace osmium {
inline void resize_file(int fd, std::size_t new_size) {
#ifdef _MSC_VER
osmium::detail::disable_invalid_parameter_handler diph;
assert(new_size <= static_cast<std::size_t>(std::numeric_limits<__int64>::max()));
// https://msdn.microsoft.com/en-us/library/whx354w1.aspx
if (::_chsize_s(fd, static_cast_with_assert<__int64>(new_size)) != 0) {
if (::_chsize_s(fd, static_cast<__int64>(new_size)) != 0) {
#else
if (::ftruncate(fd, static_cast_with_assert<off_t>(new_size)) != 0) {
if (::ftruncate(fd, static_cast<off_t>(new_size)) != 0) {
#endif
throw std::system_error{errno, std::system_category(), "Could not resize file"};
}
+2 -2
View File
@@ -3,9 +3,9 @@
/*
This file is part of Osmium (http://osmcode.org/libosmium).
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
+3 -3
View File
@@ -3,9 +3,9 @@
/*
This file is part of Osmium (http://osmcode.org/libosmium).
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -47,7 +47,7 @@ namespace osmium {
int64_t m_peak = 0;
#ifdef __linux__
static int parse_number(const std::string& line) {
static int64_t parse_number(const std::string& line) {
const auto f = line.find_first_of("0123456789");
const auto l = line.find_last_of("0123456789");
return osmium::detail::str_to_int<int64_t>(line.substr(f, l - f + 1).c_str());
+86 -42
View File
@@ -3,9 +3,9 @@
/*
This file is part of Osmium (http://osmcode.org/libosmium).
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -44,6 +44,7 @@ DEALINGS IN THE SOFTWARE.
#ifndef _WIN32
# include <sys/mman.h>
# include <sys/statvfs.h>
#else
# include <fcntl.h>
# include <io.h>
@@ -60,7 +61,7 @@ namespace osmium {
*
* Usage for anonymous mapping:
* @code
* MemoryMapping mapping(1024); // create anonymous mapping with size
* MemoryMapping mapping{1024}; // create anonymous mapping with size
* auto ptr = mapping.get_addr<char*>(); // get pointer to memory
* mapping.unmap(); // release mapping by calling unmap() (or at end of scope)
* @endcode
@@ -69,7 +70,7 @@ namespace osmium {
* @code
* int fd = ::open(...);
* {
* MemoryMapping mapping(1024, MemoryMapping::mapping_mode::write_shared, fd, offset);
* MemoryMapping mapping{1024, MemoryMapping::mapping_mode::write_shared, fd, offset};
* // use mapping
* }
* ::close(fd);
@@ -150,6 +151,21 @@ namespace osmium {
void* map_view_of_file() const noexcept;
#endif
// Get the available space on the file system where the file
// behind fd is on. Return 0 if it can't be determined.
static std::size_t available_space(int fd) {
#ifdef _WIN32
return 0;
#else
struct statvfs stat;
const int result = ::fstatvfs(fd, &stat);
if (result != 0) {
return 0;
}
return stat.f_bsize * stat.f_bavail;
#endif
}
int resize_fd(int fd) {
// Anonymous mapping doesn't need resizing.
if (fd == -1) {
@@ -157,7 +173,13 @@ namespace osmium {
}
// Make sure the file backing this mapping is large enough.
if (osmium::file_size(fd) < m_size + m_offset) {
auto const current_file_size = osmium::file_size(fd);
if (current_file_size < m_size + m_offset) {
const auto available = available_space(fd);
if (available > 0 && current_file_size + available <= m_size) {
throw std::system_error{ENOSPC, std::system_category(), "Could not resize file: Not enough space on filesystem"};
}
osmium::resize_file(fd, m_size + m_offset);
}
return fd;
@@ -278,14 +300,11 @@ namespace osmium {
/**
* Get the address of the mapping as any pointer type you like.
*
* @throws std::runtime_error if the mapping is invalid
* @pre is_valid()
*/
template <typename T = void>
T* get_addr() const {
if (is_valid()) {
return reinterpret_cast<T*>(m_addr);
}
throw std::runtime_error{"invalid memory mapping"};
T* get_addr() const noexcept {
return reinterpret_cast<T*>(m_addr);
}
}; // class MemoryMapping
@@ -295,7 +314,7 @@ namespace osmium {
*
* Usage for anonymous mapping:
* @code
* AnonymousMemoryMapping mapping(1024); // create anonymous mapping with size
* AnonymousMemoryMapping mapping{1024}; // create anonymous mapping with size
* auto ptr = mapping.get_addr<char*>(); // get pointer to memory
* mapping.unmap(); // release mapping by calling unmap() (or at end of scope)
* @endcode
@@ -454,34 +473,54 @@ namespace osmium {
/**
* Get the address of the beginning of the mapping.
*
* @throws std::runtime_error if the mapping is invalid
* @pre is_valid()
*/
T* begin() {
T* begin() noexcept {
return m_mapping.get_addr<T>();
}
/**
* Get the address one past the end of the mapping.
*
* @throws std::runtime_error if the mapping is invalid
* @pre is_valid()
*/
T* end() {
T* end() noexcept {
return m_mapping.get_addr<T>() + size();
}
const T* cbegin() const {
/**
* Get the address of the beginning of the mapping.
*
* @pre is_valid()
*/
const T* cbegin() const noexcept {
return m_mapping.get_addr<T>();
}
const T* cend() const {
/**
* Get the address one past the end of the mapping.
*
* @pre is_valid()
*/
const T* cend() const noexcept {
return m_mapping.get_addr<T>() + size();
}
const T* begin() const {
/**
* Get the address of the beginning of the mapping.
*
* @pre is_valid()
*/
const T* begin() const noexcept {
return m_mapping.get_addr<T>();
}
const T* end() const {
/**
* Get the address one past the end of the mapping.
*
* @pre is_valid()
*/
const T* end() const noexcept {
return m_mapping.get_addr<T>() + size();
}
@@ -518,11 +557,11 @@ namespace osmium {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
inline bool osmium::MemoryMapping::is_valid() const noexcept {
inline bool osmium::util::MemoryMapping::is_valid() const noexcept {
return m_addr != MAP_FAILED; // NOLINT(cppcoreguidelines-pro-type-cstyle-cast)
}
inline void osmium::MemoryMapping::make_invalid() noexcept {
inline void osmium::util::MemoryMapping::make_invalid() noexcept {
m_addr = MAP_FAILED; // NOLINT(cppcoreguidelines-pro-type-cstyle-cast)
}
@@ -533,14 +572,14 @@ inline void osmium::MemoryMapping::make_invalid() noexcept {
# define MAP_ANONYMOUS MAP_ANON
#endif
inline int osmium::MemoryMapping::get_protection() const noexcept {
inline int osmium::util::MemoryMapping::get_protection() const noexcept {
if (m_mapping_mode == mapping_mode::readonly) {
return PROT_READ;
}
return PROT_READ | PROT_WRITE; // NOLINT(hicpp-signed-bitwise)
}
inline int osmium::MemoryMapping::get_flags() const noexcept {
inline int osmium::util::MemoryMapping::get_flags() const noexcept {
if (m_fd == -1) {
return MAP_PRIVATE | MAP_ANONYMOUS; // NOLINT(hicpp-signed-bitwise)
}
@@ -550,7 +589,7 @@ inline int osmium::MemoryMapping::get_flags() const noexcept {
return MAP_PRIVATE;
}
inline osmium::MemoryMapping::MemoryMapping(std::size_t size, mapping_mode mode, int fd, off_t offset) :
inline osmium::util::MemoryMapping::MemoryMapping(std::size_t size, mapping_mode mode, int fd, off_t offset) :
m_size(check_size(size)),
m_offset(offset),
m_fd(resize_fd(fd)),
@@ -562,7 +601,7 @@ inline osmium::MemoryMapping::MemoryMapping(std::size_t size, mapping_mode mode,
}
}
inline osmium::MemoryMapping::MemoryMapping(MemoryMapping&& other) noexcept :
inline osmium::util::MemoryMapping::MemoryMapping(MemoryMapping&& other) noexcept :
m_size(other.m_size),
m_offset(other.m_offset),
m_fd(other.m_fd),
@@ -571,8 +610,13 @@ inline osmium::MemoryMapping::MemoryMapping(MemoryMapping&& other) noexcept :
other.make_invalid();
}
inline osmium::MemoryMapping& osmium::MemoryMapping::operator=(osmium::MemoryMapping&& other) noexcept {
unmap();
inline osmium::util::MemoryMapping& osmium::util::MemoryMapping::operator=(osmium::util::MemoryMapping&& other) noexcept {
try {
unmap();
} catch (const std::system_error&) {
// Ignore unmap error. It should never happen anyway and we can't do
// anything about it here.
}
m_size = other.m_size;
m_offset = other.m_offset;
m_fd = other.m_fd;
@@ -582,7 +626,7 @@ inline osmium::MemoryMapping& osmium::MemoryMapping::operator=(osmium::MemoryMap
return *this;
}
inline void osmium::MemoryMapping::unmap() {
inline void osmium::util::MemoryMapping::unmap() {
if (is_valid()) {
if (::munmap(m_addr, m_size) != 0) {
throw std::system_error{errno, std::system_category(), "munmap failed"};
@@ -591,7 +635,7 @@ inline void osmium::MemoryMapping::unmap() {
}
}
inline void osmium::MemoryMapping::resize(std::size_t new_size) {
inline void osmium::util::MemoryMapping::resize(std::size_t new_size) {
assert(new_size > 0 && "can not resize to zero size");
if (m_fd == -1) { // anonymous mapping
#ifdef __linux__
@@ -641,7 +685,7 @@ namespace osmium {
} // namespace osmium
inline DWORD osmium::MemoryMapping::get_protection() const noexcept {
inline DWORD osmium::util::MemoryMapping::get_protection() const noexcept {
switch (m_mapping_mode) {
case mapping_mode::readonly:
return PAGE_READONLY;
@@ -653,7 +697,7 @@ inline DWORD osmium::MemoryMapping::get_protection() const noexcept {
return PAGE_READWRITE;
}
inline DWORD osmium::MemoryMapping::get_flags() const noexcept {
inline DWORD osmium::util::MemoryMapping::get_flags() const noexcept {
switch (m_mapping_mode) {
case mapping_mode::readonly:
return FILE_MAP_READ;
@@ -665,14 +709,14 @@ inline DWORD osmium::MemoryMapping::get_flags() const noexcept {
return FILE_MAP_WRITE;
}
inline HANDLE osmium::MemoryMapping::get_handle() const noexcept {
inline HANDLE osmium::util::MemoryMapping::get_handle() const noexcept {
if (m_fd == -1) {
return INVALID_HANDLE_VALUE;
}
return reinterpret_cast<HANDLE>(_get_osfhandle(m_fd));
}
inline HANDLE osmium::MemoryMapping::create_file_mapping() const noexcept {
inline HANDLE osmium::util::MemoryMapping::create_file_mapping() const noexcept {
if (m_fd != -1) {
_setmode(m_fd, _O_BINARY);
}
@@ -684,7 +728,7 @@ inline HANDLE osmium::MemoryMapping::create_file_mapping() const noexcept {
nullptr);
}
inline void* osmium::MemoryMapping::map_view_of_file() const noexcept {
inline void* osmium::util::MemoryMapping::map_view_of_file() const noexcept {
return MapViewOfFile(m_handle,
get_flags(),
osmium::dword_hi(m_offset),
@@ -692,11 +736,11 @@ inline void* osmium::MemoryMapping::map_view_of_file() const noexcept {
m_size);
}
inline bool osmium::MemoryMapping::is_valid() const noexcept {
inline bool osmium::util::MemoryMapping::is_valid() const noexcept {
return m_addr != nullptr;
}
inline void osmium::MemoryMapping::make_invalid() noexcept {
inline void osmium::util::MemoryMapping::make_invalid() noexcept {
m_addr = nullptr;
}
@@ -707,7 +751,7 @@ inline int last_error() noexcept {
return static_cast<int>(GetLastError());
}
inline osmium::MemoryMapping::MemoryMapping(std::size_t size, MemoryMapping::mapping_mode mode, int fd, off_t offset) :
inline osmium::util::MemoryMapping::MemoryMapping(std::size_t size, MemoryMapping::mapping_mode mode, int fd, off_t offset) :
m_size(check_size(size)),
m_offset(offset),
m_fd(resize_fd(fd)),
@@ -725,7 +769,7 @@ inline osmium::MemoryMapping::MemoryMapping(std::size_t size, MemoryMapping::map
}
}
inline osmium::MemoryMapping::MemoryMapping(MemoryMapping&& other) noexcept :
inline osmium::util::MemoryMapping::MemoryMapping(MemoryMapping&& other) noexcept :
m_size(other.m_size),
m_offset(other.m_offset),
m_fd(other.m_fd),
@@ -736,7 +780,7 @@ inline osmium::MemoryMapping::MemoryMapping(MemoryMapping&& other) noexcept :
other.m_handle = nullptr;
}
inline osmium::MemoryMapping& osmium::MemoryMapping::operator=(osmium::MemoryMapping&& other) noexcept {
inline osmium::util::MemoryMapping& osmium::util::MemoryMapping::operator=(osmium::util::MemoryMapping&& other) noexcept {
unmap();
m_size = other.m_size;
m_offset = other.m_offset;
@@ -749,7 +793,7 @@ inline osmium::MemoryMapping& osmium::MemoryMapping::operator=(osmium::MemoryMap
return *this;
}
inline void osmium::MemoryMapping::unmap() {
inline void osmium::util::MemoryMapping::unmap() {
if (is_valid()) {
if (!UnmapViewOfFile(m_addr)) {
throw std::system_error{last_error(), std::system_category(), "UnmapViewOfFile failed"};
@@ -765,7 +809,7 @@ inline void osmium::MemoryMapping::unmap() {
}
}
inline void osmium::MemoryMapping::resize(std::size_t new_size) {
inline void osmium::util::MemoryMapping::resize(std::size_t new_size) {
unmap();
m_size = new_size;
+2 -2
View File
@@ -3,9 +3,9 @@
/*
This file is part of Osmium (http://osmcode.org/libosmium).
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
+2 -2
View File
@@ -3,9 +3,9 @@
/*
This file is part of Osmium (http://osmcode.org/libosmium).
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
+9 -2
View File
@@ -3,9 +3,9 @@
/*
This file is part of Osmium (http://osmcode.org/libosmium).
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -147,6 +147,13 @@ namespace osmium {
return !(value == "false" || value == "no");
}
/**
* Is the set of options empty?
*/
bool empty() const noexcept {
return m_options.empty();
}
/**
* The number of options set.
*/
+9 -7
View File
@@ -3,9 +3,9 @@
/*
This file is part of Osmium (http://osmcode.org/libosmium).
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -45,18 +45,20 @@ namespace osmium {
*/
class ProgressBar {
static constexpr const std::size_t full_length = 70;
enum {
full_length = 70
};
static const char* bar(std::size_t len = full_length) noexcept {
static const char* s = "======================================================================";
assert(len <= full_length);
return "======================================================================"
+ full_length - len;
return s + full_length - len;
}
static const char* spc(std::size_t len = full_length) noexcept {
static const char* s = " ";
assert(len >= 1 && len <= full_length);
return " "
+ full_length - len;
return s + full_length - len;
}
// The max size is the file size if there is a single file and the
+2 -2
View File
@@ -3,9 +3,9 @@
/*
This file is part of Osmium (http://osmcode.org/libosmium).
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -3,9 +3,9 @@
/*
This file is part of Osmium (http://osmcode.org/libosmium).
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -389,9 +389,9 @@ namespace osmium {
* osmium::StringMatcher::always_false, always_true,
* equal, prefix, substring, regex or list.
*/
template <typename TMatcher, typename std::enable_if<
std::is_base_of<matcher, TMatcher>::value, int>::type = 0>
StringMatcher(TMatcher&& matcher) : // NOLINT(google-explicit-constructor, hicpp-explicit-conversions, misc-forwarding-reference-overload)
template <typename TMatcher, typename X = typename std::enable_if<
std::is_base_of<matcher, TMatcher>::value, void>::type>
StringMatcher(TMatcher&& matcher) : // NOLINT(google-explicit-constructor, hicpp-explicit-conversions)
m_matcher(std::forward<TMatcher>(matcher)) {
}
+3 -3
View File
@@ -3,9 +3,9 @@
/*
This file is part of Osmium (http://osmcode.org/libosmium).
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -85,7 +85,7 @@ namespace osmium {
void stop() {
}
int64_t elapsed_microseconds() const {
int64_t elapsed_microseconds() {
return 0;
}
@@ -3,9 +3,9 @@
/*
This file is part of Osmium (http://osmcode.org/libosmium).
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003