зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1308317 - Part 7: Remove nsSupportsArray::RemoveElementsAt. r=froydnj
MozReview-Commit-ID: H3A3gxckw5o
This commit is contained in:
Родитель
d4f6772880
Коммит
7292673607
|
@ -54,9 +54,6 @@ interface nsISupportsArray : nsICollection {
|
|||
|
||||
|
||||
nsISupportsArray clone();
|
||||
|
||||
[notxpcom] boolean RemoveElementsAt(in unsigned long aIndex,
|
||||
in unsigned long aCount);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
|
|
@ -283,16 +283,15 @@ nsSupportsArray::ReplaceElementAt(nsISupports* aElement, uint32_t aIndex)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
nsSupportsArray::RemoveElementsAt(uint32_t aIndex, uint32_t aCount)
|
||||
nsSupportsArray::RemoveElementAt(uint32_t aIndex)
|
||||
{
|
||||
if (aIndex + aCount <= mCount) {
|
||||
for (uint32_t i = 0; i < aCount; i++) {
|
||||
NS_IF_RELEASE(mArray[aIndex + i]);
|
||||
}
|
||||
mCount -= aCount;
|
||||
if (aIndex + 1 <= mCount) {
|
||||
NS_IF_RELEASE(mArray[aIndex]);
|
||||
|
||||
mCount -= 1;
|
||||
int32_t slide = (mCount - aIndex);
|
||||
if (0 < slide) {
|
||||
::memmove(mArray + aIndex, mArray + aIndex + aCount,
|
||||
::memmove(mArray + aIndex, mArray + aIndex + 1,
|
||||
slide * sizeof(nsISupports*));
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -82,10 +82,7 @@ public:
|
|||
ReplaceElementAt(nsISupports* aElement, uint32_t aIndex) override;
|
||||
|
||||
MOZ_MUST_USE NS_IMETHOD_(bool)
|
||||
RemoveElementAt(uint32_t aIndex) override
|
||||
{
|
||||
return RemoveElementsAt(aIndex, 1);
|
||||
}
|
||||
RemoveElementAt(uint32_t aIndex) override;
|
||||
|
||||
MOZ_MUST_USE NS_IMETHOD DeleteElementAt(uint32_t aIndex) override
|
||||
{
|
||||
|
@ -96,9 +93,6 @@ 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);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче