Bug 652559: Fix signed/unsigned comparison build warning in nsGlobalWindow.cpp. r=bz

This commit is contained in:
Daniel Holbert 2011-04-25 10:58:42 -07:00
parent 86080d0500
commit 0544e9d3a8

View File

@ -8808,14 +8808,14 @@ nsGlobalWindow::SetTimeoutOrInterval(nsIScriptTimeoutHandler *aHandler,
interval = NS_MAX(aIsInterval ? 1 : 0, interval);
// Make sure we don't proceed with an interval larger than our timer
// code can handle.
if (interval > PR_IntervalToMilliseconds(DOM_MAX_TIMEOUT_VALUE)) {
interval = PR_IntervalToMilliseconds(DOM_MAX_TIMEOUT_VALUE);
// code can handle. (Note: we already forced |interval| to be non-negative,
// so the PRUint32 cast (to avoid compiler warnings) is ok.)
PRUint32 maxTimeoutMs = PR_IntervalToMilliseconds(DOM_MAX_TIMEOUT_VALUE);
if (static_cast<PRUint32>(interval) > maxTimeoutMs) {
interval = maxTimeoutMs;
}
nsTimeout *timeout = new nsTimeout();
if (!timeout)
return NS_ERROR_OUT_OF_MEMORY;
// Increment the timeout's reference count to represent this function's hold
// on the timeout.