Checking in Scott Putterman's changes to use nsISupportsArray instead of a void array.

This commit is contained in:
rjc%netscape.com 1999-04-23 08:32:42 +00:00
Родитель 762ee5f039
Коммит c7b6bca33d
3 изменённых файлов: 39 добавлений и 9 удалений

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

@ -484,8 +484,9 @@ RDFGenericBuilderImpl::CreateContents(nsIContent* aElement)
return rv; return rv;
// rjc - sort // rjc - sort
nsVoidArray *tempArray; nsISupportsArray *tempArray;
if ((tempArray = new nsVoidArray()) == nsnull) return (NS_ERROR_OUT_OF_MEMORY); if (NS_FAILED(rv = NS_NewISupportsArray(&tempArray)))
return(rv);
while (1) { while (1) {
rv = properties->Advance(); rv = properties->Advance();
@ -573,10 +574,19 @@ RDFGenericBuilderImpl::CreateContents(nsIContent* aElement)
NS_ERROR("unable to create widget item"); NS_ERROR("unable to create widget item");
} }
} }
for (int i = numElements - 1; i >=0; i--)
{
NS_IF_RELEASE(flatArray[i]);
}
delete [] flatArray; delete [] flatArray;
} }
} }
delete tempArray; for (int i = numElements - 1; i >= 0; i--)
{
tempArray->RemoveElementAt(i);
}
NS_IF_RELEASE(tempArray);
return NS_OK; return NS_OK;
} }

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

@ -484,8 +484,9 @@ RDFGenericBuilderImpl::CreateContents(nsIContent* aElement)
return rv; return rv;
// rjc - sort // rjc - sort
nsVoidArray *tempArray; nsISupportsArray *tempArray;
if ((tempArray = new nsVoidArray()) == nsnull) return (NS_ERROR_OUT_OF_MEMORY); if (NS_FAILED(rv = NS_NewISupportsArray(&tempArray)))
return(rv);
while (1) { while (1) {
rv = properties->Advance(); rv = properties->Advance();
@ -573,10 +574,19 @@ RDFGenericBuilderImpl::CreateContents(nsIContent* aElement)
NS_ERROR("unable to create widget item"); NS_ERROR("unable to create widget item");
} }
} }
for (int i = numElements - 1; i >=0; i--)
{
NS_IF_RELEASE(flatArray[i]);
}
delete [] flatArray; delete [] flatArray;
} }
} }
delete tempArray; for (int i = numElements - 1; i >= 0; i--)
{
tempArray->RemoveElementAt(i);
}
NS_IF_RELEASE(tempArray);
return NS_OK; return NS_OK;
} }

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

@ -484,8 +484,9 @@ RDFGenericBuilderImpl::CreateContents(nsIContent* aElement)
return rv; return rv;
// rjc - sort // rjc - sort
nsVoidArray *tempArray; nsISupportsArray *tempArray;
if ((tempArray = new nsVoidArray()) == nsnull) return (NS_ERROR_OUT_OF_MEMORY); if (NS_FAILED(rv = NS_NewISupportsArray(&tempArray)))
return(rv);
while (1) { while (1) {
rv = properties->Advance(); rv = properties->Advance();
@ -573,10 +574,19 @@ RDFGenericBuilderImpl::CreateContents(nsIContent* aElement)
NS_ERROR("unable to create widget item"); NS_ERROR("unable to create widget item");
} }
} }
for (int i = numElements - 1; i >=0; i--)
{
NS_IF_RELEASE(flatArray[i]);
}
delete [] flatArray; delete [] flatArray;
} }
} }
delete tempArray; for (int i = numElements - 1; i >= 0; i--)
{
tempArray->RemoveElementAt(i);
}
NS_IF_RELEASE(tempArray);
return NS_OK; return NS_OK;
} }