Skip to content

Commit 8bda57b

Browse files
committed
Fix some clang-tidy constness warnings
1 parent 61d415b commit 8bda57b

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

include/osmium/io/detail/read_write.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,10 @@ namespace osmium {
106106
return 0; // stdin
107107
}
108108

109-
int flags = O_RDONLY;
110109
#ifdef _WIN32
111-
flags |= O_BINARY;
110+
const int flags = O_RDONLY | O_BINARY;
111+
#else
112+
const int flags = O_RDONLY;
112113
#endif
113114
const int fd = ::open(filename.c_str(), flags);
114115
if (fd < 0) {

include/osmium/osm/timestamp.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ namespace osmium {
149149

150150
void to_iso_str(std::string& s) const {
151151
std::tm tm; // NOLINT(cppcoreguidelines-pro-type-member-init,hicpp-member-init)
152-
std::time_t sse = seconds_since_epoch();
152+
const std::time_t sse = seconds_since_epoch();
153153
#ifndef NDEBUG
154154
auto result =
155155
#endif

include/osmium/util/timer.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ namespace osmium {
7979

8080
Timer() = default;
8181

82-
void start() const noexcept { // NOLINT(readability-convert-member-functions-to-static)
82+
void start() noexcept { // NOLINT(readability-convert-member-functions-to-static)
8383
}
8484

85-
void stop() const noexcept { // NOLINT(readability-convert-member-functions-to-static)
85+
void stop() noexcept { // NOLINT(readability-convert-member-functions-to-static)
8686
}
8787

8888
int64_t elapsed_microseconds() const noexcept { // NOLINT(readability-convert-member-functions-to-static)

test/data-tests/testdata-xml.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ TEST_CASE("Reading OSM XML 200: Using Reader asking for ways") {
553553
const osmium::io::Header header{reader.header()};
554554
REQUIRE(header.get("generator") == "testdata");
555555

556-
osmium::memory::Buffer buffer = reader.read();
556+
const osmium::memory::Buffer buffer = reader.read();
557557
REQUIRE(0 == buffer.committed());
558558
REQUIRE_FALSE(buffer);
559559
reader.close();

0 commit comments

Comments
 (0)