Bug 622142 - nsTArray class depends on invalid unqualified lookup into dependent bases of class templates; r,a=bsmedberg
authorRafael Ávila de Espíndola <respindola@mozilla.com>
Wed, 12 Jan 2011 16:37:20 -0500
changeset 60407 e4c5d72fca11d51f2a1196b4c99943a7eeb27a9d
parent 60406 57424c3ce816cf41d9cd866188c68a9f0a2b68af
child 60408 aa76da2d163e2aea86f3e66f95281069fa71be92
push id17973
push usereakhgari@mozilla.com
push dateWed, 12 Jan 2011 21:39:37 +0000
treeherdermozilla-central@aa76da2d163e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs622142
milestone2.0b10pre
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 622142 - nsTArray class depends on invalid unqualified lookup into dependent bases of class templates; r,a=bsmedberg
xpcom/glue/nsTArray.h
--- a/xpcom/glue/nsTArray.h
+++ b/xpcom/glue/nsTArray.h
@@ -621,20 +621,20 @@ public:
   //                  being modified.
   // @param arrayLen  The number of values to copy into this array.
   // @return          A pointer to the new elements in the array, or null if
   //                  the operation failed due to insufficient memory.
   template<class Item>
   elem_type *ReplaceElementsAt(index_type start, size_type count,
                                const Item* array, size_type arrayLen) {
     // Adjust memory allocation up-front to catch errors.
-    if (!EnsureCapacity(Length() + arrayLen - count, sizeof(elem_type)))
+    if (!this->EnsureCapacity(Length() + arrayLen - count, sizeof(elem_type)))
       return nsnull;
     DestructRange(start, count);
-    ShiftData(start, count, arrayLen, sizeof(elem_type));
+    this->ShiftData(start, count, arrayLen, sizeof(elem_type));
     AssignRange(start, arrayLen, array);
     return Elements() + start;
   }
 
   // A variation on the ReplaceElementsAt method defined above.
   template<class Item>
   elem_type *ReplaceElementsAt(index_type start, size_type count,
                                const nsTArray<Item>& array) {
@@ -666,19 +666,19 @@ public:
   elem_type *InsertElementAt(index_type index, const Item& item) {
     return ReplaceElementsAt(index, 0, &item, 1);
   }
 
   // Insert a new element without copy-constructing. This is useful to avoid
   // temporaries.
   // @return A pointer to the newly inserted element, or null on OOM.
   elem_type* InsertElementAt(index_type index) {
-    if (!EnsureCapacity(Length() + 1, sizeof(elem_type)))
+    if (!this->EnsureCapacity(Length() + 1, sizeof(elem_type)))
       return nsnull;
-    ShiftData(index, 0, 1, sizeof(elem_type));
+    this->ShiftData(index, 0, 1, sizeof(elem_type));
     elem_type *elem = Elements() + index;
     elem_traits::Construct(elem);
     return elem;
   }
 
   // This method searches for the least index of the greatest
   // element less than or equal to |item|.  If |item| is inserted at
   // this index, the array will remain sorted.  True is returned iff
@@ -762,21 +762,21 @@ public:
 
   // This method appends elements to the end of this array.
   // @param array     The elements to append to this array.
   // @param arrayLen  The number of elements to append to this array.
   // @return          A pointer to the new elements in the array, or null if
   //                  the operation failed due to insufficient memory.
   template<class Item>
   elem_type *AppendElements(const Item* array, size_type arrayLen) {
-    if (!EnsureCapacity(Length() + arrayLen, sizeof(elem_type)))
+    if (!this->EnsureCapacity(Length() + arrayLen, sizeof(elem_type)))
       return nsnull;
     index_type len = Length();
     AssignRange(len, arrayLen, array);
-    IncrementLength(arrayLen);
+    this->IncrementLength(arrayLen);
     return Elements() + len;
   }
 
   // A variation on the AppendElements method defined above.
   template<class Item, class Allocator>
   elem_type *AppendElements(const nsTArray<Item, Allocator>& array) {
     return AppendElements(array.Elements(), array.Length());
   }
@@ -786,24 +786,24 @@ public:
   elem_type *AppendElement(const Item& item) {
     return AppendElements(&item, 1);
   }
 
   // Append new elements without copy-constructing. This is useful to avoid
   // temporaries.
   // @return A pointer to the newly appended elements, or null on OOM.
   elem_type *AppendElements(size_type count) {
-    if (!EnsureCapacity(Length() + count, sizeof(elem_type)))
+    if (!this->EnsureCapacity(Length() + count, sizeof(elem_type)))
       return nsnull;
     elem_type *elems = Elements() + Length();
     size_type i;
     for (i = 0; i < count; ++i) {
       elem_traits::Construct(elems + i);
     }
-    IncrementLength(count);
+    this->IncrementLength(count);
     return elems;
   }
 
   // Append a new element without copy-constructing. This is useful to avoid
   // temporaries.
   // @return A pointer to the newly appended element, or null on OOM.
   elem_type *AppendElement() {
     return AppendElements(1);
@@ -812,32 +812,32 @@ public:
   // Move all elements from another array to the end of this array without 
   // calling copy constructors or destructors.
   // @return A pointer to the newly appended elements, or null on OOM.
   template<class Item, class Allocator>
   elem_type *MoveElementsFrom(nsTArray<Item, Allocator>& array) {
     NS_PRECONDITION(&array != this, "argument must be different array");
     index_type len = Length();
     index_type otherLen = array.Length();
-    if (!EnsureCapacity(len + otherLen, sizeof(elem_type)))
+    if (!this->EnsureCapacity(len + otherLen, sizeof(elem_type)))
       return nsnull;
     memcpy(Elements() + len, array.Elements(), otherLen * sizeof(elem_type));
-    IncrementLength(otherLen);      
+    this->IncrementLength(otherLen);      
     array.ShiftData(0, otherLen, 0, sizeof(elem_type));
     return Elements() + len;
   }
 
   // This method removes a range of elements from this array.
   // @param start  The starting index of the elements to remove.
   // @param count  The number of elements to remove.
   void RemoveElementsAt(index_type start, size_type count) {
     NS_ASSERTION(count == 0 || start < Length(), "Invalid start index");
     NS_ASSERTION(start + count <= Length(), "Invalid length");
     DestructRange(start, count);
-    ShiftData(start, count, 0, sizeof(elem_type));
+    this->ShiftData(start, count, 0, sizeof(elem_type));
   }
 
   // A variation on the RemoveElementsAt method defined above.
   void RemoveElementAt(index_type index) {
     RemoveElementsAt(index, 1);
   }
 
   // A variation on the RemoveElementsAt method defined above.
@@ -889,31 +889,31 @@ public:
   }
 
   // This method causes the elements contained in this array and the given
   // array to be swapped.
   // NOTE: This method isn't heavily optimized if either array is an
   // nsAutoTArray.
   template<class Allocator>
   PRBool SwapElements(nsTArray<E, Allocator>& other) {
-    return SwapArrayElements(other, sizeof(elem_type));
+    return this->SwapArrayElements(other, sizeof(elem_type));
   }
 
   //
   // Allocation
   //
 
   // This method may increase the capacity of this array object by the
   // specified amount.  This method may be called in advance of several
   // AppendElement operations to minimize heap re-allocations.  This method
   // will not reduce the number of elements in this array.
   // @param capacity  The desired capacity of this array.
   // @return True if the operation succeeded; false if we ran out of memory
   PRBool SetCapacity(size_type capacity) {
-    return EnsureCapacity(capacity, sizeof(elem_type));
+    return this->EnsureCapacity(capacity, sizeof(elem_type));
   }
 
   // This method modifies the length of the array.  If the new length is
   // larger than the existing length of the array, then new elements will be
   // constructed using elem_type's default constructor.  Otherwise, this call
   // removes elements from the array (see also RemoveElementsAt).
   // @param newLen  The desired length of this array.
   // @return        True if the operation succeeded; false otherwise.