Skip to content

Commit

Permalink
Fix various formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
joto committed Dec 15, 2021
1 parent 9b94aa7 commit 55f2a94
Show file tree
Hide file tree
Showing 33 changed files with 90 additions and 114 deletions.
22 changes: 11 additions & 11 deletions include/osmium/area/detail/basic_assembler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ namespace osmium {
++m_stats.wrong_role;
if (debug()) {
std::cerr << " Segment " << *segment << " from way " << segment->way()->id() << " has role '" << segment->role_name()
<< "', but should have role '" << (ring.is_outer() ? "outer" : "inner") << "'\n";
<< "', but should have role '" << (ring.is_outer() ? "outer" : "inner") << "'\n";
}
if (m_config.problem_reporter) {
if (ring.is_outer()) {
Expand Down Expand Up @@ -326,7 +326,7 @@ namespace osmium {
const int64_t ay = a.y();
const int64_t by = b.y();
const int64_t ly = end_location.y();
const auto z = (bx - ax)*(ly - ay) - (by - ay)*(lx - ax);
const auto z = (bx - ax) * (ly - ay) - (by - ay) * (lx - ax);
if (debug()) {
std::cerr << " Segment z=" << z << '\n';
}
Expand All @@ -353,7 +353,7 @@ namespace osmium {
const int64_t ay = a.y();
const int64_t by = b.y();
const int64_t ly = location.y();
const auto z = (bx - ax)*(ly - ay) - (by - ay)*(lx - ax);
const auto z = (bx - ax) * (ly - ay) - (by - ay) * (lx - ax);

if (z >= 0) {
nesting += segment->is_reverse() ? -1 : 1;
Expand Down Expand Up @@ -593,7 +593,7 @@ namespace osmium {
}
++m_stats.open_rings;
} else {
if (loc == previous_location && (m_split_locations.empty() || m_split_locations.back() != previous_location )) {
if (loc == previous_location && (m_split_locations.empty() || m_split_locations.back() != previous_location)) {
m_split_locations.push_back(previous_location);
}
++it;
Expand Down Expand Up @@ -696,7 +696,7 @@ namespace osmium {
}

bool there_are_open_rings() const noexcept {
return std::any_of(m_rings.cbegin(), m_rings.cend(), [](const ProtoRing& ring){
return std::any_of(m_rings.cbegin(), m_rings.cend(), [](const ProtoRing& ring) {
return !ring.closed();
});
}
Expand Down Expand Up @@ -907,11 +907,11 @@ namespace osmium {
auto count_remaining = m_segment_list.size();
for (const osmium::Location& location : m_split_locations) {
const auto locs = make_range(std::equal_range(m_locations.begin(),
m_locations.end(),
slocation{},
[this, &location](const slocation& lhs, const slocation& rhs) {
return lhs.location(m_segment_list, location) < rhs.location(m_segment_list, location);
}));
m_locations.end(),
slocation{},
[this, &location](const slocation& lhs, const slocation& rhs) {
return lhs.location(m_segment_list, location) < rhs.location(m_segment_list, location);
}));
for (auto& loc : locs) {
if (!m_segment_list[loc.item].is_done()) {
count_remaining -= add_new_ring_complex(loc);
Expand Down Expand Up @@ -1152,7 +1152,7 @@ namespace osmium {
timer_roles.stop();
}

m_stats.outer_rings = std::count_if(m_rings.cbegin(), m_rings.cend(), [](const ProtoRing& ring){
m_stats.outer_rings = std::count_if(m_rings.cbegin(), m_rings.cend(), [](const ProtoRing& ring) {
return ring.is_outer();
});
m_stats.inner_rings = m_rings.size() - m_stats.outer_rings;
Expand Down
14 changes: 7 additions & 7 deletions include/osmium/area/detail/basic_assembler_with_tags.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ namespace osmium {
return false;
}
return stats().duplicate_nodes ||
stats().duplicate_segments ||
stats().intersections ||
stats().open_rings ||
stats().short_ways ||
stats().touching_rings ||
stats().ways_in_multiple_rings ||
stats().wrong_role;
stats().duplicate_segments ||
stats().intersections ||
stats().open_rings ||
stats().short_ways ||
stats().touching_rings ||
stats().ways_in_multiple_rings ||
stats().wrong_role;
}

static void copy_tags_without_type(osmium::builder::AreaBuilder& builder, const osmium::TagList& tags) {
Expand Down
8 changes: 4 additions & 4 deletions include/osmium/area/detail/node_ref_segment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ namespace osmium {
}

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

Expand All @@ -219,7 +219,7 @@ namespace osmium {
}

inline bool operator!=(const NodeRefSegment& lhs, const NodeRefSegment& rhs) noexcept {
return ! (lhs == rhs);
return !(lhs == rhs);
}

/**
Expand Down Expand Up @@ -346,9 +346,9 @@ namespace osmium {
};

std::array<seg_loc, 4> sl = {{
{0, s1.first().location() },
{0, s1.first().location()},
{0, s1.second().location()},
{1, s2.first().location() },
{1, s2.first().location()},
{1, s2.second().location()},
}};

Expand Down
6 changes: 3 additions & 3 deletions include/osmium/area/detail/segment_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,14 @@ namespace osmium {
}
}

if (it+2 != m_segments.end() && *it == *(it+2)) {
if (it + 2 != m_segments.end() && *it == *(it + 2)) {
++overlapping_segments;
if (problem_reporter) {
problem_reporter->report_overlapping_segment(it->first(), it->second());
}
}

m_segments.erase(it, it+2);
m_segments.erase(it, it + 2);
}
}

Expand All @@ -323,7 +323,7 @@ namespace osmium {

for (auto it1 = m_segments.cbegin(); it1 != m_segments.cend() - 1; ++it1) {
const NodeRefSegment& s1 = *it1;
for (auto it2 = it1+1; it2 != m_segments.end(); ++it2) {
for (auto it2 = it1 + 1; it2 != m_segments.end(); ++it2) {
const NodeRefSegment& s2 = *it2;

assert(s1 != s2); // erase_duplicate_segments() should have made sure of that
Expand Down
9 changes: 3 additions & 6 deletions include/osmium/area/problem_reporter_ogr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,24 +117,21 @@ namespace osmium {
.add_field("nodes", OFTInteger, 8)
.add_field("id1", OFTReal, 12, 1)
.add_field("id2", OFTReal, 12, 1)
.add_field("problem", OFTString, 30)
;
.add_field("problem", OFTString, 30);

m_layer_lerror
.add_field("obj_type", OFTString, 1)
.add_field("obj_id", OFTInteger, 10)
.add_field("nodes", OFTInteger, 8)
.add_field("id1", OFTReal, 12, 1)
.add_field("id2", OFTReal, 12, 1)
.add_field("problem", OFTString, 30)
;
.add_field("problem", OFTString, 30);

m_layer_ways
.add_field("obj_type", OFTString, 1)
.add_field("obj_id", OFTInteger, 10)
.add_field("way_id", OFTInteger, 10)
.add_field("nodes", OFTInteger, 8)
;
.add_field("nodes", OFTInteger, 8);
}

void report_duplicate_node(osmium::object_id_type node_id1, osmium::object_id_type node_id2, osmium::Location location) override {
Expand Down
6 changes: 2 additions & 4 deletions include/osmium/geom/tile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ namespace osmium {
inline constexpr uint32_t mercx_to_tilex(uint32_t zoom, double x) noexcept {
return static_cast<uint32_t>(detail::clamp<int32_t>(
static_cast<int32_t>((x + detail::max_coordinate_epsg3857) / tile_extent_in_zoom(zoom)),
0, num_tiles_in_zoom(zoom) -1
));
0, num_tiles_in_zoom(zoom) - 1));
}

/**
Expand All @@ -89,8 +88,7 @@ namespace osmium {
inline constexpr uint32_t mercy_to_tiley(uint32_t zoom, double y) noexcept {
return static_cast<uint32_t>(detail::clamp<int32_t>(
static_cast<int32_t>((detail::max_coordinate_epsg3857 - y) / tile_extent_in_zoom(zoom)),
0, num_tiles_in_zoom(zoom) -1
));
0, num_tiles_in_zoom(zoom) - 1));
}

/**
Expand Down
5 changes: 2 additions & 3 deletions include/osmium/index/detail/vector_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,9 @@ namespace osmium {
vector_type m_vector;

typename vector_type::const_iterator find_id(const TId id) const noexcept {
const element_type element {
const element_type element{
id,
osmium::index::empty_value<TValue>()
};
osmium::index::empty_value<TValue>()};
return std::lower_bound(m_vector.begin(), m_vector.end(), element, [](const element_type& a, const element_type& b) {
return a.first < b.first;
});
Expand Down
13 changes: 5 additions & 8 deletions include/osmium/index/detail/vector_multimap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,18 @@ namespace osmium {
}

std::pair<iterator, iterator> get_all(const TId id) {
const element_type element {
const element_type element{
id,
osmium::index::empty_value<TValue>()
};
osmium::index::empty_value<TValue>()};
return std::equal_range(m_vector.begin(), m_vector.end(), element, [](const element_type& a, const element_type& b) {
return a.first < b.first;
});
}

std::pair<const_iterator, const_iterator> get_all(const TId id) const {
const element_type element {
const element_type element{
id,
osmium::index::empty_value<TValue>()
};
osmium::index::empty_value<TValue>()};
return std::equal_range(m_vector.cbegin(), m_vector.cend(), element, [](const element_type& a, const element_type& b) {
return a.first < b.first;
});
Expand Down Expand Up @@ -149,8 +147,7 @@ namespace osmium {
void erase_removed() {
m_vector.erase(
std::remove_if(m_vector.begin(), m_vector.end(), is_removed),
m_vector.end()
);
m_vector.end());
}

void dump_as_list(const int fd) final {
Expand Down
2 changes: 1 addition & 1 deletion include/osmium/index/id_set.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ namespace osmium {
IdSet<T>(other),
m_size(other.m_size) {
m_data.reserve(other.m_data.size());
for (const auto& ptr: other.m_data) {
for (const auto& ptr : other.m_data) {
if (ptr) {
m_data.emplace_back(new unsigned char[chunk_size]);
::memcpy(m_data.back().get(), ptr.get(), chunk_size);
Expand Down
10 changes: 5 additions & 5 deletions include/osmium/index/multimap/hybrid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ namespace osmium {

public:

HybridIterator(typename main_map_type::iterator begin_main,
typename main_map_type::iterator end_main,
typename extra_map_type::iterator begin_extra,
typename extra_map_type::iterator end_extra) :
HybridIterator(typename main_map_type::iterator begin_main,
typename main_map_type::iterator end_main,
typename extra_map_type::iterator begin_extra,
typename extra_map_type::iterator end_extra) :
m_begin_main(begin_main),
m_end_main(end_main),
m_begin_extra(begin_extra),
Expand Down Expand Up @@ -100,7 +100,7 @@ namespace osmium {
}

bool operator!=(const HybridIterator& rhs) const {
return ! operator==(rhs);
return !operator==(rhs);
}

const element_type& operator*() {
Expand Down
2 changes: 1 addition & 1 deletion include/osmium/io/detail/debug_output_format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ namespace osmium {
}
}

void write_tags(const osmium::TagList& tags, const char* padding="") {
void write_tags(const osmium::TagList& tags, const char* padding = "") {
if (tags.empty()) {
return;
}
Expand Down
10 changes: 5 additions & 5 deletions include/osmium/io/detail/input_format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ namespace osmium {
return func;
}
throw unsupported_file_format_error{
std::string{"Can not open file '"} +
file.filename() +
"' with type '" +
as_string(file.format()) +
"'. No support for reading this format in this program."};
std::string{"Can not open file '"} +
file.filename() +
"' with type '" +
as_string(file.format()) +
"'. No support for reading this format in this program."};
}

}; // class ParserFactory
Expand Down
6 changes: 2 additions & 4 deletions include/osmium/io/detail/lz4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ namespace osmium {
&*output.begin(),
static_cast<int>(input.size()),
output_size,
compression_level
);
compression_level);

if (result == 0) {
throw io_error{"LZ4 compression failed"};
Expand Down Expand Up @@ -119,8 +118,7 @@ namespace osmium {
input,
&*output.begin(),
static_cast<int>(input_size),
static_cast<int>(raw_size)
);
static_cast<int>(raw_size));

if (result < 0) {
throw io_error{"LZ4 decompression failed: invalid block"};
Expand Down
8 changes: 4 additions & 4 deletions include/osmium/io/detail/o5m_input_format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ namespace osmium {
}

void check_header_magic() {
static const unsigned char header_magic[] = { 0xff, 0xe0, 0x04, 'o', '5' };
static const unsigned char header_magic[] = {0xff, 0xe0, 0x04, 'o', '5'};

if (std::strncmp(reinterpret_cast<const char*>(header_magic), m_data, sizeof(header_magic)) != 0) {
throw o5m_error{"wrong header magic"};
Expand Down Expand Up @@ -222,7 +222,7 @@ namespace osmium {
}

void decode_header() {
if (! ensure_bytes_available(7)) { // overall length of header
if (!ensure_bytes_available(7)) { // overall length of header
throw o5m_error{"file too short (incomplete header info)"};
}

Expand Down Expand Up @@ -550,7 +550,7 @@ namespace osmium {
throw o5m_error{"premature end of file"};
}

if (! ensure_bytes_available(length)) {
if (!ensure_bytes_available(length)) {
throw o5m_error{"premature end of file"};
}

Expand Down Expand Up @@ -635,7 +635,7 @@ namespace osmium {
file_format::o5m,
[](parser_arguments& args) {
return std::unique_ptr<Parser>(new O5mParser{args});
});
});

// dummy function to silence the unused variable warning from above
inline bool get_registered_o5m_parser() noexcept {
Expand Down
2 changes: 1 addition & 1 deletion include/osmium/io/detail/opl_input_format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ namespace osmium {
file_format::opl,
[](parser_arguments& args) {
return std::unique_ptr<Parser>(new OPLParser{args});
});
});

// dummy function to silence the unused variable warning from above
inline bool get_registered_opl_parser() noexcept {
Expand Down
2 changes: 1 addition & 1 deletion include/osmium/io/detail/opl_parser_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ namespace osmium {
* Check whether s points to something else than the end of the
* string or a space or tab.
*/
inline bool opl_non_empty(const char *s) {
inline bool opl_non_empty(const char* s) {
return *s != '\0' && *s != ' ' && *s != '\t';
}

Expand Down
Loading

0 comments on commit 55f2a94

Please sign in to comment.