Skip to content

Commit

Permalink
Merge pull request #2102 from joto/update-libosmium
Browse files Browse the repository at this point in the history
Update included libosmium to version 2.20.0
  • Loading branch information
lonvia authored Nov 2, 2023
2 parents 7a73d05 + 2f0df8d commit 7183a20
Show file tree
Hide file tree
Showing 31 changed files with 160 additions and 566 deletions.
2 changes: 1 addition & 1 deletion contrib/libosmium/README.contrib
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Source: https://github.com/osmcode/libosmium
Revision: v2.19.0
Revision: v2.20.0
16 changes: 3 additions & 13 deletions contrib/libosmium/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ A fast and flexible C++ library for working with OpenStreetMap data.
Libosmium works on Linux, macOS and Windows.

[![Github Build Status](https://github.com/osmcode/libosmium/workflows/CI/badge.svg?branch=master)](https://github.com/osmcode/libosmium/actions)
[![Appveyor Build status](https://ci.appveyor.com/api/projects/status/yy099a4vxcb604rn/branch/master?svg=true)](https://ci.appveyor.com/project/lonvia/libosmium-eq41p/branch/master)
[![Coverage Status](https://codecov.io/gh/osmcode/libosmium/branch/master/graph/badge.svg)](https://codecov.io/gh/osmcode/libosmium)
[![Packaging status](https://repology.org/badge/tiny-repos/libosmium.svg)](https://repology.org/metapackage/libosmium)

Please see the [Libosmium manual](https://osmcode.org/libosmium/manual.html)
Expand All @@ -17,9 +15,8 @@ for more details than this README can provide.

## Prerequisites

Because Libosmium uses many C++11 features you need a modern compiler and
standard C++ library. Osmium needs at least GCC 4.8 or clang (LLVM) 3.4.
(Some parts may work with older versions.)
You need a C++11 compiler and standard C++ library. Osmium needs at least GCC
4.8 or clang (LLVM) 3.4. (Some parts may work with older versions.)

Different parts of Libosmium (and the applications built on top of it) need
different libraries. You DO NOT NEED to install all of them, just install those
Expand Down Expand Up @@ -88,16 +85,9 @@ See the
for instructions.


## Switching from the old Osmium

If you have been using the old version of Osmium at
https://github.com/joto/osmium you might want to read about the [changes
needed](https://osmcode.org/libosmium/manual.html#changes-from-old-versions-of-osmium).


## License

Libosmium is available under the Boost Software License. See LICENSE.txt.
Libosmium is available under the Boost Software License. See LICENSE.


## Authors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ namespace osmium {

const char* role_name() const noexcept {
static const std::array<const char*, 4> names = {{"unknown", "outer", "inner", "empty"}};
return names[int(m_role)];
return names[static_cast<int>(m_role)];
}

const osmium::Way* way() const noexcept {
Expand Down Expand Up @@ -327,9 +327,9 @@ namespace osmium {

if ((d > 0 && na >= 0 && na <= d && nb >= 0 && nb <= d) ||
(d < 0 && na <= 0 && na >= d && nb <= 0 && nb >= d)) {
const double ua = double(na) / double(d);
const double ua = static_cast<double>(na) / static_cast<double>(d);
const vec i = p0 + ua * (p1 - p0);
return osmium::Location{int32_t(i.x), int32_t(i.y)};
return osmium::Location{static_cast<int32_t>(i.x), static_cast<int32_t>(i.y)};
}

return osmium::Location{};
Expand Down
8 changes: 4 additions & 4 deletions contrib/libosmium/include/osmium/area/detail/proto_ring.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ namespace osmium {
int64_t m_num;
#endif

int64_t m_sum;
int64_t m_sum = 0;

public:

explicit ProtoRing(NodeRefSegment* segment) noexcept :
m_min_segment(segment),
m_min_segment(segment)
#ifdef OSMIUM_DEBUG_RING_NO
m_num(next_num()),
, m_num(next_num())
#endif
m_sum(0) {
{
add_segment_back(segment);
}

Expand Down
4 changes: 2 additions & 2 deletions contrib/libosmium/include/osmium/area/detail/vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ namespace osmium {

// scale vector
constexpr inline vec operator*(double s, const vec& v) noexcept {
return vec{int64_t(s * double(v.x)), int64_t(s * double(v.y))};
return vec{static_cast<int64_t>(s * static_cast<double>(v.x)), static_cast<int64_t>(s * static_cast<double>(v.y))};
}

// scale vector
constexpr inline vec operator*(const vec& v, double s) noexcept {
return vec{int64_t(s * double(v.x)), int64_t(s * double(v.y))};
return vec{static_cast<int64_t>(s * static_cast<double>(v.x)), static_cast<int64_t>(s * static_cast<double>(v.y))};
}

// equality
Expand Down
16 changes: 8 additions & 8 deletions contrib/libosmium/include/osmium/area/problem_reporter_ogr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ namespace osmium {
void set_object(gdalcpp::Feature& feature) {
const char t[2] = {osmium::item_type_to_char(m_object_type), '\0'};
feature.set_field("obj_type", t);
feature.set_field("obj_id", int32_t(m_object_id));
feature.set_field("nodes", int32_t(m_nodes));
feature.set_field("obj_id", static_cast<int32_t>(m_object_id));
feature.set_field("nodes", static_cast<int32_t>(m_nodes));
}

void write_point(const char* problem_type, osmium::object_id_type id1, osmium::object_id_type id2, osmium::Location location) {
gdalcpp::Feature feature{m_layer_perror, m_ogr_factory.create_point(location)};
set_object(feature);
feature.set_field("id1", double(id1));
feature.set_field("id2", double(id2));
feature.set_field("id1", static_cast<double>(id1));
feature.set_field("id2", static_cast<double>(id2));
feature.set_field("problem", problem_type);
feature.add_to_layer();
}
Expand Down Expand Up @@ -176,7 +176,7 @@ namespace osmium {
try {
gdalcpp::Feature feature{m_layer_lerror, m_ogr_factory.create_linestring(way)};
set_object(feature);
feature.set_field("id1", int32_t(way.id()));
feature.set_field("id1", static_cast<int32_t>(way.id()));
feature.set_field("id2", 0);
feature.set_field("problem", "way_in_multiple_rings");
feature.add_to_layer();
Expand All @@ -192,7 +192,7 @@ namespace osmium {
try {
gdalcpp::Feature feature{m_layer_lerror, m_ogr_factory.create_linestring(way)};
set_object(feature);
feature.set_field("id1", int32_t(way.id()));
feature.set_field("id1", static_cast<int32_t>(way.id()));
feature.set_field("id2", 0);
feature.set_field("problem", "inner_with_same_tags");
feature.add_to_layer();
Expand All @@ -208,7 +208,7 @@ namespace osmium {
try {
gdalcpp::Feature feature{m_layer_lerror, m_ogr_factory.create_linestring(way)};
set_object(feature);
feature.set_field("id1", int32_t(way.id()));
feature.set_field("id1", static_cast<int32_t>(way.id()));
feature.set_field("id2", 0);
feature.set_field("problem", "duplicate_way");
feature.add_to_layer();
Expand All @@ -229,7 +229,7 @@ namespace osmium {
try {
gdalcpp::Feature feature{m_layer_ways, m_ogr_factory.create_linestring(way)};
set_object(feature);
feature.set_field("way_id", int32_t(way.id()));
feature.set_field("way_id", static_cast<int32_t>(way.id()));
feature.add_to_layer();
} catch (const osmium::geometry_error&) {
// XXX
Expand Down
120 changes: 0 additions & 120 deletions contrib/libosmium/include/osmium/builder/builder_helper.hpp

This file was deleted.

20 changes: 10 additions & 10 deletions contrib/libosmium/include/osmium/builder/osm_object_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ namespace osmium {
if (value_length > osmium::max_osm_string_length) {
throw std::length_error{"OSM tag value is too long"};
}
add_size(append_with_zero(key, osmium::memory::item_size_type(key_length)));
add_size(append_with_zero(value, osmium::memory::item_size_type(value_length)));
add_size(append_with_zero(key, static_cast<osmium::memory::item_size_type>(key_length)));
add_size(append_with_zero(value, static_cast<osmium::memory::item_size_type>(value_length)));
}

/**
Expand All @@ -142,8 +142,8 @@ namespace osmium {
if (value.size() > osmium::max_osm_string_length) {
throw std::length_error{"OSM tag value is too long"};
}
add_size(append(key.data(), osmium::memory::item_size_type(key.size()) + 1));
add_size(append(value.data(), osmium::memory::item_size_type(value.size()) + 1));
add_size(append(key.data(), static_cast<osmium::memory::item_size_type>(key.size()) + 1));
add_size(append(value.data(), static_cast<osmium::memory::item_size_type>(value.size()) + 1));
}

/**
Expand Down Expand Up @@ -240,8 +240,8 @@ namespace osmium {
if (length > osmium::max_osm_string_length) {
throw std::length_error{"OSM relation member role is too long"};
}
member.set_role_size(osmium::string_size_type(length) + 1);
add_size(append_with_zero(role, osmium::memory::item_size_type(length)));
member.set_role_size(static_cast<osmium::string_size_type>(length) + 1);
add_size(append_with_zero(role, static_cast<osmium::memory::item_size_type>(length)));
add_padding(true);
}

Expand Down Expand Up @@ -330,16 +330,16 @@ namespace osmium {
if (length > osmium::max_osm_string_length) {
throw std::length_error{"OSM user name is too long"};
}
comment.set_user_size(osmium::string_size_type(length) + 1);
add_size(append_with_zero(user, osmium::memory::item_size_type(length)));
comment.set_user_size(static_cast<osmium::string_size_type>(length) + 1);
add_size(append_with_zero(user, static_cast<osmium::memory::item_size_type>(length)));
}

void add_text(osmium::ChangesetComment& comment, const char* text, const std::size_t length) {
if (length > std::numeric_limits<osmium::changeset_comment_size_type>::max() - 1) {
throw std::length_error{"OSM changeset comment is too long"};
}
comment.set_text_size(osmium::changeset_comment_size_type(length) + 1);
add_size(append_with_zero(text, osmium::memory::item_size_type(length)));
comment.set_text_size(static_cast<osmium::changeset_comment_size_type>(length) + 1);
add_size(append_with_zero(text, static_cast<osmium::memory::item_size_type>(length)));
add_padding(true);
}

Expand Down
6 changes: 3 additions & 3 deletions contrib/libosmium/include/osmium/geom/factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ namespace osmium {

public:

GeometryFactory<TGeomImpl, TProjection>() :
GeometryFactory() :
m_projection(),
m_impl(m_projection.epsg()) {
}
Expand All @@ -175,7 +175,7 @@ namespace osmium {
* Constructor for default initialized projection.
*/
template <typename... TArgs>
explicit GeometryFactory<TGeomImpl, TProjection>(TArgs&&... args) :
explicit GeometryFactory(TArgs&&... args) :
m_projection(),
m_impl(m_projection.epsg(), std::forward<TArgs>(args)...) {
}
Expand All @@ -185,7 +185,7 @@ namespace osmium {
* projection is moved into the GeometryFactory.
*/
template <typename... TArgs>
explicit GeometryFactory<TGeomImpl, TProjection>(TProjection&& projection, TArgs&&... args) :
explicit GeometryFactory(TProjection&& projection, TArgs&&... args) :
m_projection(std::move(projection)),
m_impl(m_projection.epsg(), std::forward<TArgs>(args)...) {
}
Expand Down
Loading

0 comments on commit 7183a20

Please sign in to comment.