From c027b7a38d3637af69423a513b14f97c098ecd24 Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Tue, 12 Oct 2021 19:05:22 +0200 Subject: [PATCH] Fix some clang-tidy warnings --- src/zmbenchmark.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/zmbenchmark.cpp b/src/zmbenchmark.cpp index 2e9bd7678..926e073a7 100644 --- a/src/zmbenchmark.cpp +++ b/src/zmbenchmark.cpp @@ -60,7 +60,7 @@ class TimingsTable { // void Print(const int column_pad = 5) { // Figure out column widths. - std::vector widths(columns_.size() + 1); + std::vector widths(columns_.size() + 1); // The first width is the max of the row labels. auto result = std::max_element(rows_.begin(), @@ -91,8 +91,7 @@ class TimingsTable { PrintColStr(0, row.label); for (size_t i = 0 ; i < row.timings.size() ; i++) { - char num[128]; - sprintf(num, "%.2f", row.timings[i].count() / 1000.0); + std::string num = stringtf("%.2f", std::chrono::duration_cast(row.timings[i]).count()); PrintColStr(i + 1, num); } @@ -101,7 +100,7 @@ class TimingsTable { } private: - static void PrintPadding(int count) { + static void PrintPadding(size_t count) { std::string str(count, ' '); printf("%s", str.c_str()); } @@ -232,7 +231,7 @@ class TestMonitor : public Monitor { // The average time taken for each DetectMotion call. // Microseconds RunDetectMotionBenchmark(const std::string &label, - std::shared_ptr image, + const std::shared_ptr& image, const Vector2 &p_filter_box) { // Create a monitor to use for the benchmark. Give it 1 zone that uses // a 5x5 filter.