Minor cppcheck fixes

sql-rework
Tomasz Golinski 2020-08-07 00:02:11 +02:00
rodzic 72dc1292da
commit 70d6da5747
2 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -50,10 +50,10 @@ static std::string string_mangle(const std::string& str) {
return tmp;
}
void show_histogram(const pCaches& fcc, std::string Cache::*ptr, const std::string& caption, bool html, bool sort_by_val) {
void show_histogram(const pCaches& cc, std::string Cache::*ptr, const std::string& caption, bool html, bool sort_by_val) {
std::map<std::string, int> histogram;
for (auto el : fcc)
for (auto el : cc)
histogram[el->*ptr]++;
show_histogram(histogram, caption, html, sort_by_val);

Wyświetl plik

@ -440,12 +440,12 @@ int main(int argc, char** argv) {
for (int i = y_min; i <= y_max; i++) { // i -> years in rows
std::cout << "<tr><th>" << i + 1900 << "</th> ";
for (int j = 1; j <= 12; j++) { // j -> months in cols
std::map<int, int> dates;
std::map<int, int> days_count;
for (auto el : cc) {
if (el.date_tm.tm_mon == j - 1 && el.date_tm.tm_year == i)
dates[el.date_tm.tm_mday]++;
days_count[el.date_tm.tm_mday]++;
}
std::cout << "<td style=\"--percent: " << dates.size() * 100 / max << "%\"><span>" << dates.size() << "</span></td>";
std::cout << "<td style=\"--percent: " << days_count.size() * 100 / max << "%\"><span>" << days_count.size() << "</span></td>";
}
std::cout << "</tr>\n";
}