Skip to content

Commit 65ca936

Browse files
committed
clang-tidy links for parentheses
1 parent 3f6742a commit 65ca936

10 files changed

Lines changed: 17 additions & 17 deletions

File tree

include/osmium/area/detail/basic_assembler.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ namespace osmium {
326326
const int64_t ay = a.y();
327327
const int64_t by = b.y();
328328
const int64_t ly = end_location.y();
329-
const auto z = (bx - ax) * (ly - ay) - (by - ay) * (lx - ax);
329+
const auto z = ((bx - ax) * (ly - ay)) - ((by - ay) * (lx - ax));
330330
if (debug()) {
331331
std::cerr << " Segment z=" << z << '\n';
332332
}
@@ -353,7 +353,7 @@ namespace osmium {
353353
const int64_t ay = a.y();
354354
const int64_t by = b.y();
355355
const int64_t ly = location.y();
356-
const auto z = (bx - ax) * (ly - ay) - (by - ay) * (lx - ax);
356+
const auto z = ((bx - ax) * (ly - ay)) - ((by - ay) * (lx - ax));
357357

358358
if (z >= 0) {
359359
nesting += segment->is_reverse() ? -1 : 1;
@@ -362,7 +362,7 @@ namespace osmium {
362362
}
363363
if (segment->ring()->is_outer()) {
364364
const double y = static_cast<double>(ay) +
365-
static_cast<double>((by - ay) * (lx - ax)) / static_cast<double>(bx - ax);
365+
(static_cast<double>((by - ay) * (lx - ax)) / static_cast<double>(bx - ax));
366366
if (debug()) {
367367
std::cerr << " Segment belongs to outer ring (y=" << y << " ring=" << *segment->ring() << ")\n";
368368
}

include/osmium/area/detail/node_ref_segment.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,11 @@ namespace osmium {
319319

320320
// intersection in a point
321321

322-
const int64_t na = (q1.x - q0.x) * (p0.y - q0.y) -
323-
(q1.y - q0.y) * (p0.x - q0.x);
322+
const int64_t na = ((q1.x - q0.x) * (p0.y - q0.y)) -
323+
((q1.y - q0.y) * (p0.x - q0.x));
324324

325-
const int64_t nb = (p1.x - p0.x) * (p0.y - q0.y) -
326-
(p1.y - p0.y) * (p0.x - q0.x);
325+
const int64_t nb = ((p1.x - p0.x) * (p0.y - q0.y)) -
326+
((p1.y - p0.y) * (p0.x - q0.x));
327327

328328
if ((d > 0 && na >= 0 && na <= d && nb >= 0 && nb <= d) ||
329329
(d < 0 && na <= 0 && na >= d && nb <= 0 && nb >= d)) {

include/osmium/geom/haversine.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ namespace osmium {
6969
double lath = std::sin(deg_to_rad(c1.y - c2.y) * 0.5);
7070
lath *= lath;
7171
const double tmp = std::cos(deg_to_rad(c1.y)) * std::cos(deg_to_rad(c2.y));
72-
return 2.0 * EARTH_RADIUS_IN_METERS * std::asin(std::sqrt(lath + tmp * lonh));
72+
return 2.0 * EARTH_RADIUS_IN_METERS * std::asin(std::sqrt(lath + (tmp * lonh)));
7373
}
7474

7575
/**

include/osmium/geom/mercator_projection.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ namespace osmium {
5454
}
5555

5656
inline double lat_to_y_with_tan(double lat) { // not constexpr because math functions aren't
57-
return earth_radius_for_epsg3857 * std::log(std::tan(osmium::geom::PI / 4 + deg_to_rad(lat) / 2));
57+
return earth_radius_for_epsg3857 * std::log(std::tan((osmium::geom::PI / 4) + (deg_to_rad(lat) / 2)));
5858
}
5959

6060
#ifdef OSMIUM_USE_SLOW_MERCATOR_PROJECTION
@@ -101,7 +101,7 @@ namespace osmium {
101101
}
102102

103103
inline double y_to_lat(double y) { // not constexpr because math functions aren't
104-
return rad_to_deg(2 * std::atan(std::exp(y / earth_radius_for_epsg3857)) - osmium::geom::PI / 2);
104+
return rad_to_deg((2 * std::atan(std::exp(y / earth_radius_for_epsg3857))) - (osmium::geom::PI / 2));
105105
}
106106

107107
} // namespace detail

include/osmium/index/map/flex_mem.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ namespace osmium {
192192

193193
std::size_t used_memory() const noexcept final {
194194
return sizeof(FlexMem) +
195-
m_sparse_entries.size() * sizeof(entry) +
196-
m_dense_blocks.size() * (block_size * sizeof(TValue) + sizeof(std::vector<TValue>));
195+
(m_sparse_entries.size() * sizeof(entry)) +
196+
(m_dense_blocks.size() * (block_size * sizeof(TValue) + sizeof(std::vector<TValue>)));
197197
}
198198

199199
void set(const TId id, const TValue value) final {

include/osmium/index/map/sparse_mem_map.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ namespace osmium {
6363
// and parent plus some overhead for color of red-black-tree
6464
// or similar).
6565
enum {
66-
element_size = sizeof(TId) + sizeof(TValue) + sizeof(void*) * 4U
66+
element_size = sizeof(TId) + sizeof(TValue) + (sizeof(void*) * 4U)
6767
};
6868

6969
std::map<TId, TValue> m_elements;

include/osmium/index/multimap/sparse_mem_multimap.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace osmium {
6060
// and parent plus some overhead for color of red-black-tree
6161
// or similar).
6262
enum {
63-
element_size = sizeof(TId) + sizeof(TValue) + sizeof(void*) * 4U
63+
element_size = sizeof(TId) + sizeof(TValue) + (sizeof(void*) * 4U)
6464
};
6565

6666
public:

include/osmium/relations/members_database.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ namespace osmium {
185185
* in the stash. Used for debugging.
186186
*/
187187
std::size_t used_memory() const noexcept {
188-
return sizeof(element) * m_elements.capacity() +
188+
return (sizeof(element) * m_elements.capacity()) +
189189
sizeof(MembersDatabaseCommon);
190190
}
191191

include/osmium/relations/relations_database.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ namespace osmium {
142142
* Complexity: Constant.
143143
*/
144144
std::size_t used_memory() const noexcept {
145-
return sizeof(element) * m_elements.capacity() +
145+
return (sizeof(element) * m_elements.capacity()) +
146146
sizeof(RelationsDatabase);
147147
}
148148

include/osmium/storage/item_stash.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ namespace osmium {
208208
std::size_t used_memory() const noexcept {
209209
return sizeof(ItemStash) +
210210
m_buffer.capacity() +
211-
m_index.capacity() * sizeof(std::size_t);
211+
(m_index.capacity() * sizeof(std::size_t));
212212
}
213213

214214
/**

0 commit comments

Comments
 (0)