Bug 660694 - Fix comparisons between signed and unsigned integer expressions in nsDOMBlobBuilder.cpp by using unsigned integers consistently; r=sicking
authorMs2ger <ms2ger@gmail.com>
Thu, 02 Jun 2011 14:56:46 +0200
changeset 70460 0ad16300542f69d7e7f93d05c2ba78016248f189
parent 70459 25508c9bd01ca596dd650ab51917e95b7d3b5eb3
child 70461 5e556151026ca87fbc1fbcce9f79a540e8ab66a4
push id20326
push userMs2ger@gmail.com
push dateThu, 02 Jun 2011 13:07:28 +0000
treeherdermozilla-central@e3f863f8bf4a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs660694
milestone7.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 660694 - Fix comparisons between signed and unsigned integer expressions in nsDOMBlobBuilder.cpp by using unsigned integers consistently; r=sicking
content/base/src/nsDOMBlobBuilder.cpp
--- a/content/base/src/nsDOMBlobBuilder.cpp
+++ b/content/base/src/nsDOMBlobBuilder.cpp
@@ -146,38 +146,38 @@ nsDOMMultipartBlob::MozSlice(PRInt64 aSt
   PRUint64 thisLength;
   rv = GetSize(&thisLength);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!optional_argc) {
     aEnd = (PRInt64)thisLength;
   }
 
+  // Modifies aStart and aEnd.
   ParseSize((PRInt64)thisLength, aStart, aEnd);
 
   // If we clamped to nothing we create an empty blob
   nsTArray<nsCOMPtr<nsIDOMBlob> > blobs;
 
-  PRInt64 length = aEnd - aStart;
-  PRUint64 finalLength = length;
+  PRUint64 length = aEnd - aStart;
   PRUint64 skipStart = aStart;
 
-  NS_ABORT_IF_FALSE(aStart + length <= thisLength, "Er, what?");
+  NS_ABORT_IF_FALSE(PRUint64(aStart) + length <= thisLength, "Er, what?");
 
   // Prune the list of blobs if we can
   PRUint32 i;
   for (i = 0; length && skipStart && i < mBlobs.Length(); i++) {
     nsIDOMBlob* blob = mBlobs[i].get();
 
     PRUint64 l;
     rv = blob->GetSize(&l);
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (skipStart < l) {
-      PRInt64 upperBound = NS_MIN<PRInt64>(l - skipStart, length);
+      PRUint64 upperBound = NS_MIN<PRUint64>(l - skipStart, length);
 
       nsCOMPtr<nsIDOMBlob> firstBlob;
       rv = mBlobs.ElementAt(i)->MozSlice(skipStart, skipStart + upperBound,
                                          aContentType, 2,
                                          getter_AddRefs(firstBlob));
       NS_ENSURE_SUCCESS(rv, rv);
 
       // Avoid wrapping a single blob inside an nsDOMMultipartBlob
@@ -207,17 +207,17 @@ nsDOMMultipartBlob::MozSlice(PRInt64 aSt
       rv = mBlobs.ElementAt(i)->MozSlice(0, length, aContentType, 2,
                                          getter_AddRefs(lastBlob));
       NS_ENSURE_SUCCESS(rv, rv);
 
       blobs.AppendElement(lastBlob);
     } else {
       blobs.AppendElement(blob);
     }
-    length -= NS_MIN<PRInt64>(l, length);
+    length -= NS_MIN<PRUint64>(l, length);
   }
 
   // we can create our blob now
   nsCOMPtr<nsIDOMBlob> blob = new nsDOMMultipartBlob(blobs, aContentType);
   blob.forget(aBlob);
   return NS_OK;
 }