diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-03-22 17:02:40 +0000 |
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-03-22 18:03:14 +0000 |
| commit | d92816a5f55cea9b67b7aab306eb1109af6dcbbe (patch) | |
| tree | 62e0ce096ad713cac22a70f26a401dc5dc9b2808 | |
| parent | 05c47ab65e73b16887b7c7a1eb31acf6d364ef41 (diff) | |
| download | webstat-d92816a5f55cea9b67b7aab306eb1109af6dcbbe.tar.bz2 webstat-d92816a5f55cea9b67b7aab306eb1109af6dcbbe.tar.xz webstat-d92816a5f55cea9b67b7aab306eb1109af6dcbbe.zip | |
Add missing -Wshadow
| -rw-r--r-- | Jamroot.jam | 1 | ||||
| -rw-r--r-- | src/curlOp.hpp | 2 | ||||
| -rw-r--r-- | src/ingestor.cpp | 26 | ||||
| -rw-r--r-- | src/ingestor.hpp | 2 | ||||
| -rw-r--r-- | src/uaLookup.cpp | 2 | ||||
| -rw-r--r-- | test/testing-util.cpp | 2 |
6 files changed, 18 insertions, 17 deletions
diff --git a/Jamroot.jam b/Jamroot.jam index accc9d1..2f38c94 100644 --- a/Jamroot.jam +++ b/Jamroot.jam @@ -31,6 +31,7 @@ project webstat : requirements <variant>debug:<cflags>-Wnull-dereference <variant>debug:<cflags>-Wdouble-promotion <variant>debug:<cflags>-Wformat=2 + <variant>debug:<cflags>-Wshadow <toolset>gcc,<variant>debug:<cflags>-Wold-style-cast <toolset>gcc,<variant>debug:<cflags>-Wduplicated-cond <toolset>gcc,<variant>debug:<cflags>-Wduplicated-branches diff --git a/src/curlOp.hpp b/src/curlOp.hpp index ce42fb4..4f3ef6e 100644 --- a/src/curlOp.hpp +++ b/src/curlOp.hpp @@ -10,7 +10,7 @@ namespace WebStat { class CurlError : public std::runtime_error { public: - explicit CurlError(CURLcode code, const char * msg) : std::runtime_error {msg}, code(code) { } + explicit CurlError(CURLcode errorCode, const char * msg) : std::runtime_error {msg}, code(errorCode) { } CURLcode code; }; diff --git a/src/ingestor.cpp b/src/ingestor.cpp index fb592d7..eb3be09 100644 --- a/src/ingestor.cpp +++ b/src/ingestor.cpp @@ -43,8 +43,8 @@ namespace WebStat { std::optional<Entity> operator()(const std::optional<T> & value) const { - return value.transform([this](auto && value) { - return (*this)(value); + return value.transform([this](auto && contained) { + return (*this)(contained); }); } }; @@ -69,18 +69,18 @@ namespace WebStat { Ingestor * Ingestor::currentIngestor = nullptr; - Ingestor::Ingestor(const utsname & host, IngestorSettings settings) : + Ingestor::Ingestor(const utsname & host, IngestorSettings givenSettings) : Ingestor {host, std::make_shared<DB::ConnectionPool>( - settings.dbMax, settings.dbKeep, settings.dbType, settings.dbConnStr), - std::move(settings)} + givenSettings.dbMax, givenSettings.dbKeep, givenSettings.dbType, givenSettings.dbConnStr), + std::move(givenSettings)} { } - Ingestor::Ingestor(const utsname & host, DB::ConnectionPoolPtr dbpl, IngestorSettings settings) : - settings {std::move(settings)}, dbpool {std::move(dbpl)}, ingestParkedLines {&Ingestor::jobIngestParkedLines}, - purgeOldLogs {&Ingestor::jobPurgeOldLogs}, hostnameId {crc32(host.nodename)}, curl {curl_multi_init()}, - mainThread {std::this_thread::get_id()} + Ingestor::Ingestor(const utsname & host, DB::ConnectionPoolPtr dbpl, IngestorSettings givenSettings) : + settings {std::move(givenSettings)}, dbpool {std::move(dbpl)}, + ingestParkedLines {&Ingestor::jobIngestParkedLines}, purgeOldLogs {&Ingestor::jobPurgeOldLogs}, + hostnameId {crc32(host.nodename)}, curl {curl_multi_init()}, mainThread {std::this_thread::get_id()} { auto dbconn = dbpool->get(); auto ins = dbconn->modify(SQL::HOST_UPSERT, SQL::HOST_UPSERT_OPTS); @@ -337,7 +337,7 @@ namespace WebStat { void Ingestor::jobIngestParkedLines(FILE * lines, size_t count) { - for (size_t line = 0; line < count; ++line) { + for (size_t lineNo = 0; lineNo < count; ++lineNo) { if (auto line = scn::scan<std::string>(lines, "{:[^\n]}\n")) { linesRead++; queuedLines.emplace_back(std::move(line->value())); @@ -376,9 +376,9 @@ namespace WebStat { auto next = rtn.begin(); visit( [this, &next]<typename X>(const X & entity) { - auto addNewIfReqd = [&next, this](auto && entity) mutable { - if (!existingEntities.contains(std::get<0>(entity))) { - *next++ = entity; + auto addNewIfReqd = [&next, this](auto && entityToAdd) mutable { + if (!existingEntities.contains(std::get<0>(entityToAdd))) { + *next++ = entityToAdd; } return 0; }; diff --git a/src/ingestor.hpp b/src/ingestor.hpp index e890bcf..8c4f4c1 100644 --- a/src/ingestor.hpp +++ b/src/ingestor.hpp @@ -81,7 +81,7 @@ namespace WebStat { using LastRunTime = std::chrono::system_clock::time_point; using Impl = unsigned int (Ingestor::*)(); - explicit Job(Impl impl) : impl(impl) { } + explicit Job(Impl jobImpl) : impl(jobImpl) { } const Impl impl; LastRunTime lastRun {LastRunTime::clock::now()}; diff --git a/src/uaLookup.cpp b/src/uaLookup.cpp index dbef015..8cd1cb2 100644 --- a/src/uaLookup.cpp +++ b/src/uaLookup.cpp @@ -5,7 +5,7 @@ #include <modifycommand.h> namespace WebStat { - UserAgentLookupOperation::UserAgentLookupOperation(Crc32Value entityId) : entityId {entityId} { } + UserAgentLookupOperation::UserAgentLookupOperation(Crc32Value userAgentEntityId) : entityId {userAgentEntityId} { } void UserAgentLookupOperation::whenComplete(DB::Connection * dbconn) const diff --git a/test/testing-util.cpp b/test/testing-util.cpp index 6e75354..9e5a6af 100644 --- a/test/testing-util.cpp +++ b/test/testing-util.cpp @@ -6,7 +6,7 @@ namespace WebStat { MockDB::MockDB() : DB::PluginMock<PQ::Mock>("webstat", {SRC_DIR / "schema.sql"}, "user=postgres dbname=postgres") { } - MockDBPool::MockDBPool(std::string name) : DB::BasicConnectionPool(1, 1), name {std::move(name)} { } + MockDBPool::MockDBPool(std::string poolName) : DB::BasicConnectionPool(1, 1), name {std::move(poolName)} { } DB::ConnectionPtr MockDBPool::createResource() const |
