Bug 745272: Replace comparison of unsigned value >=0 with a useful comparison. r=humph r=cpearce
authorDaniel Holbert <dholbert@cs.stanford.edu>
Mon, 16 Apr 2012 14:29:14 -0700
changeset 95098 cfcd178b2f5fff1d81445c63fac335f2ec940530
parent 95097 a84bdeb378f6303335351dbf31ee020d29e8ec65
child 95099 f59dff115daa0729197a091d798f6aafe3bbd8cc
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershumph, cpearce
bugs745272
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 745272: Replace comparison of unsigned value >=0 with a useful comparison. r=humph r=cpearce
content/media/nsAudioAvailableEventManager.cpp
--- a/content/media/nsAudioAvailableEventManager.cpp
+++ b/content/media/nsAudioAvailableEventManager.cpp
@@ -160,16 +160,19 @@ void nsAudioAvailableEventManager::Queue
 
     // Fill the signalBuffer.
     PRUint32 i;
     float *signalBuffer = mSignalBuffer.get() + mSignalBufferPosition;
     for (i = 0; i < signalBufferTail; ++i) {
       signalBuffer[i] = MOZ_CONVERT_AUDIO_SAMPLE(audioData[i]);
     }
     audioData += signalBufferTail;
+
+    NS_ASSERTION(audioDataLength >= signalBufferTail,
+                 "audioDataLength about to wrap past zero to +infinity!");
     audioDataLength -= signalBufferTail;
 
     if (mPendingEvents.Length() > 0) {
       // Check last event timecode to make sure that all queued events
       // are in non-descending sequence.
       nsAudioAvailableEventRunner* lastPendingEvent =
         (nsAudioAvailableEventRunner*)mPendingEvents[mPendingEvents.Length() - 1].get();
       if (lastPendingEvent->mTime > time) {
@@ -187,17 +190,16 @@ void nsAudioAvailableEventManager::Queue
                                       mSignalBufferLength, time);
     mPendingEvents.AppendElement(event);
 
     // Reset the buffer
     mSignalBufferLength = currentBufferSize;
     mSignalBuffer = new float[currentBufferSize];
     mSignalBufferPosition = 0;
     signalBufferTail = currentBufferSize;
-    NS_ASSERTION(audioDataLength >= 0, "Past new signal data length.");
   }
 
   NS_ASSERTION(mSignalBufferPosition + audioDataLength < mSignalBufferLength,
                "Intermediate signal buffer must fit at least one more item.");
 
   if (audioDataLength > 0) {
     // Add data to the signalBuffer.
     PRUint32 i;