kopia lustrzana https://gitlab.com/tomaszg/geostat
Cppcheck: add some consts
rodzic
6cbd0e6efa
commit
fdce7bc17c
|
@ -89,7 +89,7 @@ int main(int argc, char** argv) {
|
|||
std::cout << "</tr>\n";
|
||||
|
||||
short int n = 1;
|
||||
for (auto& i : cc) {
|
||||
for (const auto& i : cc) {
|
||||
std::cout << "<tr><th>" << n << "</th> ";
|
||||
std::cout << "<td>" << i.link_name() << "</td>";
|
||||
std::cout << "<td>" << i.type << "</td>";
|
||||
|
|
|
@ -458,7 +458,7 @@ int main(int argc, char** argv) {
|
|||
std::cout << "Number of caches that are now archived: <span class=\"value\">" << std::count_if(cc.begin(), cc.end(), [&](const auto& a) { return a.status == archived; }) << "</span><br>\n";
|
||||
std::cout << "<details class=\"days\"><summary>Best caching day: <span class=\"value\">" << best_day->first << "</span>, found <span class=\"value\">" << best_day->second << "</span> caches</summary>\n";
|
||||
std::cout << " <p>\n";
|
||||
for (auto& i : dates)
|
||||
for (const auto& i : dates)
|
||||
std::cout << i.first << ", found " << i.second << " caches<br>\n";
|
||||
std::cout << " </p>\n</details>\n";
|
||||
|
||||
|
|
16
ocdb.cpp
16
ocdb.cpp
|
@ -190,21 +190,21 @@ bool OCdb::update_cache(const json& j) {
|
|||
return 1;
|
||||
|
||||
sql = "INSERT INTO caches (code,";
|
||||
for (auto& i : fields)
|
||||
for (const auto& i : fields)
|
||||
sql += i.first + ',';
|
||||
for (auto& i : fields2)
|
||||
for (const auto& i : fields2)
|
||||
sql += i.first + ',';
|
||||
sql.pop_back();
|
||||
sql += ") VALUES ('" + code + "',";
|
||||
for (__attribute__((unused)) auto& i : fields)
|
||||
for (__attribute__((unused)) const auto& i : fields)
|
||||
sql += "?,";
|
||||
for (__attribute__((unused)) auto& i : fields2)
|
||||
for (__attribute__((unused)) const auto& i : fields2)
|
||||
sql += "?,";
|
||||
sql.pop_back();
|
||||
sql += ") ON CONFLICT(code) DO UPDATE SET ";
|
||||
for (auto& i : fields)
|
||||
for (const auto& i : fields)
|
||||
sql += i.first + "=excluded." + i.first + ',';
|
||||
for (auto& i : fields2)
|
||||
for (const auto& i : fields2)
|
||||
sql += i.first + "=excluded." + i.first + ',';
|
||||
sql.pop_back();
|
||||
sql += ';';
|
||||
|
@ -216,10 +216,10 @@ bool OCdb::update_cache(const json& j) {
|
|||
return 0;
|
||||
}
|
||||
int n = 1;
|
||||
for (auto& i : fields) {
|
||||
for (const auto& i : fields) {
|
||||
sqlite3_bind_text(stmt, n++, i.second.c_str(), -1, nullptr);
|
||||
}
|
||||
for (auto& i : fields2) {
|
||||
for (const auto& i : fields2) {
|
||||
sqlite3_bind_int(stmt, n++, i.second);
|
||||
}
|
||||
res = sqlite3_step(stmt);
|
||||
|
|
|
@ -248,7 +248,7 @@ Caches Okapi::get_user_caches(const std::string& uuid, int count) const {
|
|||
mcc.insert({ i.code, i });
|
||||
|
||||
// introduce extra data from the logs to Caches
|
||||
for (auto& el : tmp_data) {
|
||||
for (const auto& el : tmp_data) {
|
||||
auto& it = mcc.at(el.first);
|
||||
it.set_date(el.second.date);
|
||||
it.recommended = el.second.was_recommended;
|
||||
|
|
Ładowanie…
Reference in New Issue