From 0544e9d3a8cd8ff73aac35574c7b54df3c554ccd Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Mon, 25 Apr 2011 10:58:42 -0700 Subject: [PATCH] Bug 652559: Fix signed/unsigned comparison build warning in nsGlobalWindow.cpp. r=bz --- dom/base/nsGlobalWindow.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index a4912c349b10..6c0547a84185 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -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(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.