-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix format strings #2561
Fix format strings #2561
Conversation
This pull request introduces 2 alerts when merging 1dce353 into c3d7db4 - view on lgtm.com new alerts:
Comment posted by lgtm.com |
No surprise CI found a number of issues I didn't spot for different configurations/etc. I'll try and fix these and update the PR. |
It seems travis builds spews out warnings about |
Thanks for your work!
Yeah, I was afraid exactly something like this would happen. The curl printf() code is not exactly like the C90 one.
I'm afraid I think that might be the only solution that doesn't force us to do other ugly things to avoid those warnings. Your work still identified a number of improvements thanks to that!
Nah, I'm fine with having "fixing printf() modifiers" being a single one etc. |
1dce353
to
658d496
Compare
thanks! |
This is a series of commits cleaning up format specifiers for the curl_*printf functions as a preparation for the last commit where an attribute is added to show which arguments are the format string, and which are the format specifiers.
A few comments on some of the commits:
tests: Fix format specifiers - In unit1323.c, the exact types for the members of the timeval struct is not specified, perhaps I should have added a cast to avoid protential problems on other platforms?
Make sure format length is int - Apparently, the standard says field precision specifiers should be of type int. I just added a cast to the variables. I have no idea if there's a risk it will overflow or wrap...
Add attribute to teach Gcc about printf-functions - A big bummer is that curl printf extensions (such as %.-2f) now gives warnings). I was not able to figure out if there was a way tell gcc about these extensions. It also means anyone using curl/mprintf.h with nonstandard extensions will get a warning.