зеркало из https://github.com/mozilla/pjs.git
nsCOMArray should not use nsDerivedSafe. b=221525 r=bryner
This commit is contained in:
Родитель
fd88efa4f4
Коммит
770f0634e4
|
@ -37,6 +37,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
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
|
||||
PRInt32 count = aObjects.Count();
|
||||
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;
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
// See below for the definition of nsCOMArray<T>
|
||||
|
||||
|
@ -97,11 +96,11 @@ public:
|
|||
return mArray.Count();
|
||||
}
|
||||
|
||||
nsDerivedSafe<nsISupports>* ObjectAt(PRInt32 aIndex) const {
|
||||
return NS_REINTERPRET_CAST(nsDerivedSafe<nsISupports>*, mArray.ElementAt(aIndex));
|
||||
nsISupports* ObjectAt(PRInt32 aIndex) const {
|
||||
return NS_STATIC_CAST(nsISupports*, mArray.ElementAt(aIndex));
|
||||
}
|
||||
|
||||
nsDerivedSafe<nsISupports>* operator[](PRInt32 aIndex) const {
|
||||
nsISupports* operator[](PRInt32 aIndex) const {
|
||||
return ObjectAt(aIndex);
|
||||
}
|
||||
|
||||
|
@ -146,12 +145,12 @@ class nsCOMArray : public nsCOMArray_base
|
|||
~nsCOMArray() {}
|
||||
|
||||
// these do NOT refcount on the way out, for speed
|
||||
nsDerivedSafe<T>* ObjectAt(PRInt32 aIndex) const {
|
||||
return NS_REINTERPRET_CAST(nsDerivedSafe<T>*,nsCOMArray_base::ObjectAt(aIndex));
|
||||
T* ObjectAt(PRInt32 aIndex) const {
|
||||
return NS_STATIC_CAST(T*,nsCOMArray_base::ObjectAt(aIndex));
|
||||
}
|
||||
|
||||
// indexing operator for syntactic sugar
|
||||
nsDerivedSafe<T>* operator[](PRInt32 aIndex) const {
|
||||
T* operator[](PRInt32 aIndex) const {
|
||||
return ObjectAt(aIndex);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче