Closed
Bug 1446100
Opened 6 years ago
Closed 6 years ago
build warning: "shlibsign.c:151:22: warning: comparison of integers of different signs: 'int' and 'CK_ULONG' (aka 'unsigned long') [-Wsign-compare]"
Categories
(NSS :: Tools, enhancement)
NSS
Tools
Tracking
(Not tracked)
RESOLVED
FIXED
3.37
People
(Reporter: dholbert, Assigned: dholbert)
Details
Attachments
(1 file, 1 obsolete file)
2.26 KB,
patch
|
KaiE
:
review+
|
Details | Diff | Splinter Review |
Build warning (which I encountered while compiling mozilla-central, but it affects standalone NSS, too): ===== security/nss/cmd/shlibsign/shlibsign.c:151:22: warning: comparison of integers of different signs: 'int' and 'CK_ULONG' (aka 'unsigned long') [-Wsign-compare] if (bytesWritten != ulValueLen) { ~~~~~~~~~~~~ ^ ~~~~~~~~~~ ===== This is checking the return value from PR_Write. Here's a bit more context: static PRStatus writeItem(PRFileDesc *fd, CK_VOID_PTR pValue, CK_ULONG ulValueLen, char *file) { int bytesWritten; [...] bytesWritten = PR_Write(fd, pValue, ulValueLen); if (bytesWritten != ulValueLen) { lperror(file); return PR_FAILURE; } return PR_SUCCESS; } https://hg.mozilla.org/projects/nss/file/tip/cmd/shlibsign/shlibsign.c#l151 Technically we should be testing whether bytesWritten is negative (to see if it failed), and then casting it to be unsigned & and comparing it to see if it's as much as the unsigned-int that we expected to write. See documentation here: https://dxr.mozilla.org/mozilla-central/source/nsprpub/pr/include/prio.h#724-727 ...and this reference callsite in mozilla-central that seems to be doing the right thing: https://dxr.mozilla.org/mozilla-central/rev/6ff60a083701d08c52702daf50f28e8f46ae3a1c/dom/media/gmp/GMPServiceParent.cpp#1049-1052
Assignee | ||
Comment 1•6 years ago
|
||
Assignee | ||
Comment 2•6 years ago
|
||
Attachment #8959267 -
Attachment is obsolete: true
Attachment #8959267 -
Flags: review?(kaie)
Assignee | ||
Updated•6 years ago
|
Attachment #8959278 -
Flags: review?(kaie)
Comment 3•6 years ago
|
||
Comment on attachment 8959278 [details] [diff] [review] fix v1 (now with more lines of context) makes sense, thanks for identifying the fix!
Attachment #8959278 -
Flags: review?(kaie) → review+
Comment 4•6 years ago
|
||
https://hg.mozilla.org/projects/nss/rev/35f951089cbc
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.37
Assignee | ||
Comment 5•6 years ago
|
||
Thanks!
You need to log in
before you can comment on or make changes to this bug.
Description
•