Closed
Bug 929466
Opened 11 years ago
Closed 11 years ago
mar.c:177:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Categories
(Toolkit :: Application Update, defect)
Tracking
()
RESOLVED
FIXED
mozilla27
People
(Reporter: dholbert, Assigned: dholbert)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
1.09 KB,
patch
|
bbondy
:
review+
|
Details | Diff | Splinter Review |
Build warning: { modules/libmar/tool/mar.c: In function ‘main’: modules/libmar/tool/mar.c:177:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] (argv[1][2] == '0' + certCount || ^ } argv is a char**, so argv[1][2] is of type "char". (signed) certCount is of type uint32_t, so ('0' + certCount) is of type uint32_t. ('0' gets promoted for the purpose of the addition) So we end up comparing a signed expression on the left to an unsigned expression on the right. We can fix this by making certCount a signed variable (possibly type "char", so that the two sides of this equality-check actually match?)
Assignee | ||
Comment 1•11 years ago
|
||
Alternately, we can just cast '0' + certCount to be a char. Slightly hackier, but cleaner / more targeted, and it looks like that's essentially what the code is expecting to happen. (Note that the surrounding code prevents certCount from exceeding MAX_SIGNATURES, which is 8, so we're in no danger of actually wrapping past CHAR_MAX.)
Assignee | ||
Comment 2•11 years ago
|
||
This just adds a (char) cast, per prev comment.
Comment 3•11 years ago
|
||
Comment on attachment 820335 [details] [diff] [review] fix v1 Review of attachment 820335 [details] [diff] [review]: ----------------------------------------------------------------- Thanks!
Attachment #820335 -
Flags: review?(netzen) → review+
Assignee | ||
Comment 4•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/f87879d36aef
Flags: in-testsuite-
Comment 5•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/f87879d36aef
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
You need to log in
before you can comment on or make changes to this bug.
Description
•