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 35f4272
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cli/cli.cpp
Expand Up @@ -2,6 +2,7 @@
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <inttypes.h>
#include <string>
#include <vector>
#ifndef _WIN32
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 35f4272

Please sign in to comment.