Fix incorrect use of CBufDescriptor that was causing persistence to flake.

This commit is contained in:
waterson%netscape.com 1999-10-06 06:42:27 +00:00
parent cd0fab49cb
commit 92d627b5e0
2 changed files with 8 additions and 4 deletions

View File

@ -4571,10 +4571,13 @@ XULDocumentImpl::ApplyPersistentAttributesToElements(nsIRDFResource* aResource,
rv = literal->GetValueConst(&value);
if (NS_FAILED(rv)) return rv;
PRInt32 len = nsCRT::strlen(value);
CBufDescriptor wrapper(value, PR_TRUE, len + 1, len);
PRUint32 cnt;
rv = aElements->Count(&cnt);
if (NS_FAILED(rv)) return rv;
for (PRInt32 i = PRInt32(cnt) - 1; i >= 0; --i) {
nsISupports* isupports2 = aElements->ElementAt(i);
if (! isupports2)
@ -4583,7 +4586,6 @@ XULDocumentImpl::ApplyPersistentAttributesToElements(nsIRDFResource* aResource,
nsCOMPtr<nsIContent> element = do_QueryInterface(isupports2);
NS_RELEASE(isupports2);
CBufDescriptor wrapper(value, PR_TRUE, 0, -1);
rv = element->SetAttribute(/* XXX */ kNameSpaceID_None,
attr,
nsAutoString(wrapper),

View File

@ -4571,10 +4571,13 @@ XULDocumentImpl::ApplyPersistentAttributesToElements(nsIRDFResource* aResource,
rv = literal->GetValueConst(&value);
if (NS_FAILED(rv)) return rv;
PRInt32 len = nsCRT::strlen(value);
CBufDescriptor wrapper(value, PR_TRUE, len + 1, len);
PRUint32 cnt;
rv = aElements->Count(&cnt);
if (NS_FAILED(rv)) return rv;
for (PRInt32 i = PRInt32(cnt) - 1; i >= 0; --i) {
nsISupports* isupports2 = aElements->ElementAt(i);
if (! isupports2)
@ -4583,7 +4586,6 @@ XULDocumentImpl::ApplyPersistentAttributesToElements(nsIRDFResource* aResource,
nsCOMPtr<nsIContent> element = do_QueryInterface(isupports2);
NS_RELEASE(isupports2);
CBufDescriptor wrapper(value, PR_TRUE, 0, -1);
rv = element->SetAttribute(/* XXX */ kNameSpaceID_None,
attr,
nsAutoString(wrapper),