nsCOMArray should not use nsDerivedSafe. b=221525 r=bryner

This commit is contained in:
dbaron%dbaron.org 2003-10-07 23:17:58 +00:00
Родитель fd88efa4f4
Коммит 770f0634e4
2 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -37,6 +37,7 @@
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#include "nsCOMArray.h" #include "nsCOMArray.h"
#include "nsCOMPtr.h"
PR_STATIC_CALLBACK(PRBool) ReleaseObjects(void* aElement, void*); PR_STATIC_CALLBACK(PRBool) ReleaseObjects(void* aElement, void*);
@ -96,7 +97,7 @@ nsCOMArray_base::InsertObjectsAt(const nsCOMArray_base& aObjects, PRInt32 aIndex
// need to addref all these // need to addref all these
PRInt32 count = aObjects.Count(); PRInt32 count = aObjects.Count();
for (PRInt32 i = 0; i < count; ++i) { for (PRInt32 i = 0; i < count; ++i) {
NS_IF_ADDREF(NS_STATIC_CAST(nsISupports*, aObjects.mArray[i])); NS_IF_ADDREF(aObjects.ObjectAt(i));
} }
} }
return result; return result;

Просмотреть файл

@ -41,7 +41,6 @@
#include "nsVoidArray.h" #include "nsVoidArray.h"
#include "nsISupports.h" #include "nsISupports.h"
#include "nsCOMPtr.h"
// See below for the definition of nsCOMArray<T> // See below for the definition of nsCOMArray<T>
@ -97,11 +96,11 @@ public:
return mArray.Count(); return mArray.Count();
} }
nsDerivedSafe<nsISupports>* ObjectAt(PRInt32 aIndex) const { nsISupports* ObjectAt(PRInt32 aIndex) const {
return NS_REINTERPRET_CAST(nsDerivedSafe<nsISupports>*, mArray.ElementAt(aIndex)); return NS_STATIC_CAST(nsISupports*, mArray.ElementAt(aIndex));
} }
nsDerivedSafe<nsISupports>* operator[](PRInt32 aIndex) const { nsISupports* operator[](PRInt32 aIndex) const {
return ObjectAt(aIndex); return ObjectAt(aIndex);
} }
@ -146,12 +145,12 @@ class nsCOMArray : public nsCOMArray_base
~nsCOMArray() {} ~nsCOMArray() {}
// these do NOT refcount on the way out, for speed // these do NOT refcount on the way out, for speed
nsDerivedSafe<T>* ObjectAt(PRInt32 aIndex) const { T* ObjectAt(PRInt32 aIndex) const {
return NS_REINTERPRET_CAST(nsDerivedSafe<T>*,nsCOMArray_base::ObjectAt(aIndex)); return NS_STATIC_CAST(T*,nsCOMArray_base::ObjectAt(aIndex));
} }
// indexing operator for syntactic sugar // indexing operator for syntactic sugar
nsDerivedSafe<T>* operator[](PRInt32 aIndex) const { T* operator[](PRInt32 aIndex) const {
return ObjectAt(aIndex); return ObjectAt(aIndex);
} }