Adjust printf specifiers in examples code#5146
Adjust printf specifiers in examples code#5146pks-t merged 1 commit intolibgit2:masterfrom scottfurry:StaticFixesExamples
Conversation
|
Could you please rebase your PR to fix conflicts? There's been some changes to the examples code due to #5143, so it's possible that your fix has already been included via it |
|
PR rebased to latest master branch. There was one conflict in |
pks-t
left a comment
There was a problem hiding this comment.
Sorry that it took me so long to review :/ One conversion is unfortunately wrong and fails the build, but as soon as you've fixed up that one I'm happy to merge!
examples/clone.c
Outdated
| pd->fetch_progress.total_deltas); | ||
| } else { | ||
| printf("net %3d%% (%4"PRIuZ" kb, %5d/%5d) / idx %3d%% (%5d/%5d) / chk %3d%% (%4" PRIuZ "/%4" PRIuZ ") %s\n", | ||
| printf("net %3d%% (%4d kb, %5u/%5u) / idx %3d%% (%5u/%5u) / chk %3d%% (%4" PRIuZ "/%4" PRIuZ ") %s\n", |
There was a problem hiding this comment.
The %u conversions are the right thing to do, but the "PRIuZ" needs to stay as kbytes is of type size_t
There was a problem hiding this comment.
I think that I missed that when I reworked original after a source change. Will fix this residual.
examples/clone.c
Outdated
| pd->fetch_progress.total_deltas); | ||
| } else { | ||
| printf("net %3d%% (%4"PRIuZ" kb, %5d/%5d) / idx %3d%% (%5d/%5d) / chk %3d%% (%4" PRIuZ "/%4" PRIuZ ") %s\n", | ||
| printf("net %3d%% (%4"PRIuz" kb, %5u/%5u) / idx %3d%% (%5u/%5u) / chk %3d%% (%4" PRIuZ "/%4" PRIuZ ") |
There was a problem hiding this comment.
My error in not paying attention to detail.
pks-t
left a comment
There was a problem hiding this comment.
My error in not paying attention to detail.
Well, errors happen, we're all just human. That's why I'd recommend to compile the code previous to committing to keep your own frustration level low :) Immediate feedback is a hugely valuable thing!
examples/clone.c
Outdated
| printf("net %3d%% (%4"PRIuZ" kb, %5d/%5d) / idx %3d%% (%5d/%5d) / chk %3d%% (%4" PRIuZ "/%4" PRIuZ ") %s\n", | ||
| printf("net %3d%% (%4" PRIuZ " kb, %5u/%5u) / idx %3d%% (%5u/%5u) / chk %3d%% (%4" PRIuZ "/%4" PRIuZ | ||
| ") | ||
| %s\n", |
There was a problem hiding this comment.
Seems like you've now introduced some line breaks by accident that break compilation 🙄
There was a problem hiding this comment.
Because I did the change in the terminal(nano) and word wrap kicked in.
Static analysis of example code found multiple findings of `printf` usage where filling value is members of git_indexer_progress object. Specifier used was for signed int but git_indexer_progress members are typed as unsigned ints. `printf` specifiers were altered to match type.
pks-t
left a comment
There was a problem hiding this comment.
Now we're good to go! :) Thanks a lot, @scottfurry
|
Touchdown - crowd goes wild!!!! |
Static analysis of example code found multiple findings of
printfusagewhere filling value is members of git_indexer_progress object. Specifier
used was for signed int but git_indexer_progress members are typed as
unsigned int.
printfspecifiers were altered to match type.