Skip to content

Commit

Permalink
cli: Silence -Wformat warnings
Browse files Browse the repository at this point in the history
With GCC-13.1.1 and clang-16.0.4.

cli/cli.cpp:475:51: warning: format specifies type 'long long' but the argument has type 'int64_t' (aka 'long') [-Wformat]
                        sprintf(temp, "%lld -> %lld bytes (%.0f%%)\n", total, written, ratio);
                                       ~~~~                            ^~~~~
                                       %ld
cli/cli.cpp:475:58: warning: format specifies type 'long long' but the argument has type 'int64_t' (aka 'long') [-Wformat]
                        sprintf(temp, "%lld -> %lld bytes (%.0f%%)\n", total, written, ratio);
                                               ~~~~                           ^~~~~~~
                                               %ld
  • Loading branch information
orbea committed May 30, 2023
1 parent 528c69b commit 7400e91
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cli/cli.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <algorithm>
#include <cinttypes>
#include <cstring>
#include <cstdio>
#include <cstdlib>
Expand Down Expand Up @@ -472,7 +473,7 @@ int main(int argc, char *argv[]) {
} else if (status == maxcso::TASK_SUCCESS) {
double ratio = total == 0 ? 0.0 : (written * 100.0) / total;
char temp[128];
sprintf(temp, "%lld -> %lld bytes (%.0f%%)\n", total, written, ratio);
sprintf(temp, "%" PRId64 " -> %" PRId64 " bytes (%.0f%%)\n", total, written, ratio);
statusInfo = temp;
} else {
// This shouldn't happen.
Expand Down

0 comments on commit 7400e91

Please # to comment.