Bug 738740 - Fix handling of parameters in nsTArray::ReplaceElementAt. r=bz
authorChris Lord <chrislord.net@gmail.com>
Fri, 23 Mar 2012 19:27:25 +0000
changeset 90169 73db7a5e57f7c07ba490f87f5232b0e95d19c07e
parent 90168 1b05e9751f3477275a7bb566fc20f3941411af1d
child 90170 b05d102a640685567cb3761facd71306be15d1f5
push id7511
push userchrislord.net@gmail.com
push dateFri, 23 Mar 2012 19:27:34 +0000
treeherdermozilla-inbound@73db7a5e57f7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs738740
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 738740 - Fix handling of parameters in nsTArray::ReplaceElementAt. r=bz Handle the parameters given to ReplaceElementAt the same way as those given to other methods in the class. This allows removal of the & in GLContext.cpp that was taking the address of a temporary, and causing a build error when using clang, or when using GCC with particular parameters.
gfx/gl/GLContext.cpp
xpcom/glue/nsTArray.h
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -1180,17 +1180,17 @@ void TiledTextureImage::Resize(const nsI
                     continue;
                 }
             }
 
             // Create a new tile.
             nsRefPtr<TextureImage> teximg =
                     mGL->TileGenFunc(size, mContentType, mUseNearestFilter);
             if (replace)
-                mImages.ReplaceElementAt(i, &teximg.forget());
+                mImages.ReplaceElementAt(i, teximg.forget());
             else
                 mImages.InsertElementAt(i, teximg.forget());
             i++;
         }
 
         // Prune any unused tiles on the end of the column.
         if (row < (int)mRows) {
             for (col = (int)mColumns - col; col > 0; col--) {
--- a/xpcom/glue/nsTArray.h
+++ b/xpcom/glue/nsTArray.h
@@ -749,17 +749,17 @@ public:
   elem_type *ReplaceElementsAt(index_type start, size_type count,
                                const Item& item) {
     return ReplaceElementsAt(start, count, &item, 1);
   }
 
   // A variation on the ReplaceElementsAt method defined above.
   template<class Item>
   elem_type *ReplaceElementAt(index_type index, const Item& item) {
-    return ReplaceElementsAt(index, 1, item, 1);
+    return ReplaceElementsAt(index, 1, &item, 1);
   }
 
   // A variation on the ReplaceElementsAt method defined above.
   template<class Item>
   elem_type *InsertElementsAt(index_type index, const Item* array,
                               size_type arrayLen) {
     return ReplaceElementsAt(index, 0, array, arrayLen);
   }