Closed Bug 771819 Opened 13 years ago Closed 13 years ago

IdentityCryptoService.cpp:547:64: warning: narrowing conversion of ‘((hashAlg == (SECOidTag)4u) ? 20 : 32)’ from ‘int’ to ‘unsigned int’ inside { } [-Werror=narrowing]

Categories

(Core Graveyard :: Identity, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

New GCC 4.7 build warning: { toolkit/identity/IdentityCryptoService.cpp:547:64: warning: narrowing conversion of ‘((hashAlg == (SECOidTag)4u) ? 20 : 32)’ from ‘int’ to ‘unsigned int’ inside { } [-Werror=narrowing] } For this chunk of code: http://hg.mozilla.org/integration/mozilla-inbound/diff/88070ff09ccd/toolkit/identity/IdentityCryptoService.cpp#l1.550 > SECItem hashItem = { siBuffer, hash, > hashAlg == SEC_OID_SHA1 ? 20 : 32 }; Looks like the compiler is treating the result of "bool ? 20 : 32" as a signed int, and then has to jam that into an unsigned int (for some member-var in SECItem) Simple fix -- just add a "u" suffix to the raw numbers.
Attached patch fixSplinter Review
(forgot to mention: this warning is only on inbound so far, since the cset hasn't made it over to mozilla-central yet.)
Attachment #639973 - Flags: review?(dolske)
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: