Closed
Bug 652559
Opened 13 years ago
Closed 13 years ago
nsGlobalWindow.cpp:8812:93: warning: comparison between signed and unsigned integer expressions
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla6
People
(Reporter: dholbert, Assigned: dholbert)
References
Details
(Whiteboard: [build_warning])
Attachments
(1 file)
1.32 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
nsGlobalWindow.cpp currently has only one GCC warning, introduced a few weeks back in bug 646972: > nsGlobalWindow.cpp:8812:93: warning: comparison between signed and unsigned integer expressions Relevant chunk of code: > 8793 nsGlobalWindow::SetTimeoutOrInterval(nsIScriptTimeoutHandler *aHandler, > 8794 PRInt32 interval, > 8795 PRBool aIsInterval, PRInt32 *aReturn) > 8796 { [...] > 8806 // Disallow negative intervals. If aIsInterval also disallow 0, > 8807 // because we use that as a "don't repeat" flag. > 8808 interval = NS_MAX(aIsInterval ? 1 : 0, interval); > 8809 > 8810 // Make sure we don't proceed with an interval larger than our timer > 8811 // code can handle. > 8812 if (interval > PR_IntervalToMilliseconds(DOM_MAX_TIMEOUT_VALUE)) { > 8813 interval = PR_IntervalToMilliseconds(DOM_MAX_TIMEOUT_VALUE); > 8814 } http://mxr.mozilla.org/mozilla-central/source/dom/base/nsGlobalWindow.cpp#8793 GCC is warns about the comparison at line 8812 because |interval| is a signed int whereas PR_IntervalToMilliseconds returns an unsigned int. We've already clamped |interval| to be non-negative (at line 8808) so it's safe to just cast it to an unsigned value. This patch does that, along with nixing the second call to PR_IntervalToMilliseconds and removing an unnecessary null-check-after-new a few lines later.
Attachment #528120 -
Flags: review?(bzbarsky)
Comment 1•13 years ago
|
||
Comment on attachment 528120 [details] [diff] [review] fix r=me
Attachment #528120 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 2•13 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/63ef637c94bb
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla6
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•