Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

cli: Silence -Wformat warnings #79

Merged
merged 1 commit into from
Jun 4, 2023
Merged

Conversation

orbea
Copy link
Contributor

@orbea orbea commented May 30, 2023

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

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
Copy link
Owner

@unknownbrackets unknownbrackets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair, I probably would've cast to long long, I find the PRId64 things ugly. If long long ever does become longer than 64 bits, it would presumably be on a platform where registers and sprintf() arguments are promoted to that alignment and size anyway. Oh well.

Thanks for the warning fix.

-[Unknown]

@unknownbrackets unknownbrackets merged commit e4bdee1 into unknownbrackets:master Jun 4, 2023
@orbea orbea deleted the cli branch June 5, 2023 12:44
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants