-
Notifications
You must be signed in to change notification settings - Fork 91
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
Various signed / const / type / format fixes #11
Open
he32
wants to merge
33
commits into
ntp-project:master
Choose a base branch
from
he32:sign-format-cast-const-fixes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use const char* where appropriate to avoid discarding constness. Use size_t type where appropriate to avoid signedness warnings, adjust format accordingly. Add prototype to function pointer array declarations. Cast arguments to isxxxxx(): undefined outside of <-1,max(u_char)>
A couple of variables changed from int to size_t to avoid signedness warnings. Convert code to use a literal format. Cast arg to islower() to ensure safe value range of argument.
The VOIDP() replaces a complicated double cast.
This should avoid warnings about incompatible pointer types.
Actually, this was a bug of my own; NetBSD uses asprintf() and therefore avoids this particular problem. However, asprintf() isn't sufficiently standardized to use here, I suspect.
Gents, what's the status of this report? Can we please track any pending or new issues like this at bugs.ntp.org? |
Folks, I know we've made changes to the codebase since this was opened, and we've just fixed even more of these via http://bugs.ntp.org/show_bug.cgi?id=2821 Can we close this issue? |
Hi,
I finally updated my local tree and did a rebuild, and it looks a
lot better, but there's a pair of warnings about char subscripts
still:
ntpq.c: In function 'list_md_fn':
ntpq.c:3543:2: warning: array subscript has type 'char' [-Wchar-subscripts]
if( islower(*cp) )
^
ntpSnmpSubagentObject.c: In function 'ntpsnmpd_parse_string':
ntpSnmpSubagentObject.c:100:5: warning: array subscript has type 'char' [-Wchar-subscripts]
field[j++] = toupper(string[i]);
^
Regards,
- Håvard
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a set of changes mostly pulled from the NetBSD
repository, where ntp has been tweaked to build cleanly
with the set of warning flags we enable in our build.
There are a few additions which are of my own, which
came from trying to build the code after applying these
changes.
Ref. posting to [email protected], under the subject
"Patches for stricter compiler settings" of 29 Nov 2015.
Best regards,
Håvard