From 052141e9607cc6905525e1ca07fb7fbad0ea2421 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Tue, 21 Feb 2012 10:34:01 +0100 Subject: [PATCH] Bug 726416 - Fix some content/ build warnings; r=mounir --- content/base/src/nsDocument.cpp | 9 +++------ content/base/src/nsFrameMessageManager.cpp | 3 ++- content/media/nsBuiltinDecoder.cpp | 4 +++- content/media/nsBuiltinDecoderStateMachine.cpp | 16 ++++++++-------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 5e00410ff65a..2df760bea79f 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -8120,7 +8120,7 @@ nsIDocument::ScheduleFrameRequestCallback(nsIFrameRequestCallback* aCallback, PRInt32 newHandle = ++mFrameRequestCallbackCounter; bool alreadyRegistered = !mFrameRequestCallbacks.IsEmpty(); - FrameRequest *request = + DebugOnly request = mFrameRequestCallbacks.AppendElement(FrameRequest(aCallback, newHandle)); NS_ASSERTION(request, "This is supposed to be infallible!"); if (!alreadyRegistered && mPresShell && IsEventHandlingEnabled()) { @@ -8303,11 +8303,8 @@ nsDocument::RemoveImage(imgIRequest* aImage) NS_ENSURE_ARG_POINTER(aImage); // Get the old count. It should exist and be > 0. - PRUint32 count; -#ifdef DEBUG - bool found = -#endif - mImageTracker.Get(aImage, &count); + PRUint32 count = 0; + DebugOnly found = mImageTracker.Get(aImage, &count); NS_ABORT_IF_FALSE(found, "Removing image that wasn't in the tracker!"); NS_ABORT_IF_FALSE(count > 0, "Entry in the cache tracker with count 0!"); diff --git a/content/base/src/nsFrameMessageManager.cpp b/content/base/src/nsFrameMessageManager.cpp index 8c3c8fd81db5..62fb3f2b7df8 100644 --- a/content/base/src/nsFrameMessageManager.cpp +++ b/content/base/src/nsFrameMessageManager.cpp @@ -349,7 +349,8 @@ class MMListenerRemover { public: MMListenerRemover(nsFrameMessageManager* aMM) - : mMM(aMM), mWasHandlingMessage(aMM->mHandlingMessage) + : mWasHandlingMessage(aMM->mHandlingMessage) + , mMM(aMM) { mMM->mHandlingMessage = true; } diff --git a/content/media/nsBuiltinDecoder.cpp b/content/media/nsBuiltinDecoder.cpp index a0f40e5802f3..ba261462c5ea 100644 --- a/content/media/nsBuiltinDecoder.cpp +++ b/content/media/nsBuiltinDecoder.cpp @@ -327,7 +327,9 @@ nsresult nsBuiltinDecoder::Seek(double aTime) PRInt32 range = 0; if (!IsInRanges(seekable, aTime, range)) { if (range != -1) { - if (range + 1 < length) { + // |range + 1| can't be negative, because the only possible negative value + // for |range| is -1. + if (PRUint32(range + 1) < length) { double leftBound, rightBound; res = seekable.End(range, &leftBound); NS_ENSURE_SUCCESS(res, NS_OK); diff --git a/content/media/nsBuiltinDecoderStateMachine.cpp b/content/media/nsBuiltinDecoderStateMachine.cpp index 6650862289fb..8f03e5881bcd 100644 --- a/content/media/nsBuiltinDecoderStateMachine.cpp +++ b/content/media/nsBuiltinDecoderStateMachine.cpp @@ -49,6 +49,7 @@ #include "mozilla/Preferences.h" #include "mozilla/StdInt.h" +#include "mozilla/Util.h" using namespace mozilla; using namespace mozilla::layers; @@ -307,9 +308,8 @@ void StateMachineTracker::EnsureGlobalStateMachine() ReentrantMonitorAutoEnter mon(mMonitor); if (mStateMachineCount == 0) { NS_ASSERTION(!mStateMachineThread, "Should have null state machine thread!"); - nsresult res = NS_NewThread(&mStateMachineThread, - nsnull); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(res), "Can't create media state machine thread"); + DebugOnly rv = NS_NewThread(&mStateMachineThread, nsnull); + NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Can't create media state machine thread"); } mStateMachineCount++; } @@ -866,11 +866,11 @@ void nsBuiltinDecoderStateMachine::AudioLoop() ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); PRInt64 unplayedFrames = audioDuration % minWriteFrames; if (minWriteFrames > 1 && unplayedFrames > 0) { - // Sound is written by libsydneyaudio to the hardware in blocks of - // frames of size minWriteFrames. So if the number of frames we've - // written isn't an exact multiple of minWriteFrames, we'll have - // left over audio data which hasn't yet been written to the hardware, - // and so that audio will not start playing. Write silence to ensure + // Sound is written by libsydneyaudio to the hardware in blocks of + // frames of size minWriteFrames. So if the number of frames we've + // written isn't an exact multiple of minWriteFrames, we'll have + // left over audio data which hasn't yet been written to the hardware, + // and so that audio will not start playing. Write silence to ensure // the last block gets pushed to hardware, so that playback starts. PRInt64 framesToWrite = minWriteFrames - unplayedFrames; if (framesToWrite < PR_UINT32_MAX / channels) {