mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Backed out changeset 928ad5e93372 (bug 1308317)
This commit is contained in:
parent
b6187e2b2e
commit
3470d6dfe0
@ -54,6 +54,9 @@ interface nsISupportsArray : nsICollection {
|
||||
|
||||
|
||||
nsISupportsArray clone();
|
||||
|
||||
[notxpcom] boolean RemoveElementsAt(in unsigned long aIndex,
|
||||
in unsigned long aCount);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
@ -283,15 +283,16 @@ nsSupportsArray::ReplaceElementAt(nsISupports* aElement, uint32_t aIndex)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
nsSupportsArray::RemoveElementAt(uint32_t aIndex)
|
||||
nsSupportsArray::RemoveElementsAt(uint32_t aIndex, uint32_t aCount)
|
||||
{
|
||||
if (aIndex + 1 <= mCount) {
|
||||
NS_IF_RELEASE(mArray[aIndex]);
|
||||
|
||||
mCount -= 1;
|
||||
if (aIndex + aCount <= mCount) {
|
||||
for (uint32_t i = 0; i < aCount; i++) {
|
||||
NS_IF_RELEASE(mArray[aIndex + i]);
|
||||
}
|
||||
mCount -= aCount;
|
||||
int32_t slide = (mCount - aIndex);
|
||||
if (0 < slide) {
|
||||
::memmove(mArray + aIndex, mArray + aIndex + 1,
|
||||
::memmove(mArray + aIndex, mArray + aIndex + aCount,
|
||||
slide * sizeof(nsISupports*));
|
||||
}
|
||||
return true;
|
||||
|
@ -82,7 +82,10 @@ public:
|
||||
ReplaceElementAt(nsISupports* aElement, uint32_t aIndex) override;
|
||||
|
||||
MOZ_MUST_USE NS_IMETHOD_(bool)
|
||||
RemoveElementAt(uint32_t aIndex) override;
|
||||
RemoveElementAt(uint32_t aIndex) override
|
||||
{
|
||||
return RemoveElementsAt(aIndex, 1);
|
||||
}
|
||||
|
||||
MOZ_MUST_USE NS_IMETHOD DeleteElementAt(uint32_t aIndex) override
|
||||
{
|
||||
@ -93,6 +96,9 @@ public:
|
||||
|
||||
MOZ_MUST_USE NS_IMETHOD Clone(nsISupportsArray** aResult) override;
|
||||
|
||||
MOZ_MUST_USE NS_IMETHOD_(bool)
|
||||
RemoveElementsAt(uint32_t aIndex, uint32_t aCount) override;
|
||||
|
||||
protected:
|
||||
void DeleteArray(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user