PRBool hasMoreArcsIn; rv = arcsIn->HasMoreElements(&hasMoreArcsIn); if (NS_FAILED(rv)) return rv;
return(rv); } PRBool		hasMoreArcsIn = PR_TRUE; while(hasMoreArcsIn == PR_TRUE) { if (NS_FAILED(rv = arcsIn->HasMoreElements(&hasMoreArcsIn))) break; if (hasMoreArcsIn == PR_FALSE)	break;  nsCOMPtr<nsISupports>	aArc; if (NS_FAILED(rv = arcsIn->GetNext(getter_AddRefs(aArc)))) break; nsCOMPtr<nsIRDFResource>	aProperty = do_QueryInterface(aArc); if (!aProperty)	continue;
nsBookmarksService::ChangeURL(nsIRDFResource* aOldURL,			      nsIRDFResource* aNewURL){	nsresult rv;	// Make all arcs coming out of aOldURL also come out of	// aNewURL.  Wallop any previous values.		nsCOMPtr<nsISimpleEnumerator>	arcsOut;	rv = mInner->ArcLabelsOut(aOldURL, getter_AddRefs(arcsOut));	if (NS_FAILED(rv)) return(rv);	while (1)	{		PRBool hasMoreArcsOut;		rv = arcsOut->HasMoreElements(&hasMoreArcsOut);		if (NS_FAILED(rv)) return rv;		if (! hasMoreArcsOut)			break;		nsCOMPtr<nsISupports> arc;		rv = arcsOut->GetNext(getter_AddRefs(arc));		if (NS_FAILED(rv)) return rv;		nsCOMPtr<nsIRDFResource> property = do_QueryInterface(arc);		NS_ASSERTION(property != nsnull, "arc is not a property");		if (!property)			return NS_ERROR_UNEXPECTED;		// don't copy URL property as it is special		if (property.get() == kNC_URL)			continue;		// XXX What if more than one target?		nsCOMPtr<nsIRDFNode> oldvalue;		rv = mInner->GetTarget(aNewURL, property, PR_TRUE, getter_AddRefs(oldvalue));		if (NS_FAILED(rv)) return rv;		nsCOMPtr<nsIRDFNode> newvalue;		rv = mInner->GetTarget(aOldURL, property, PR_TRUE, getter_AddRefs(newvalue));		if (NS_FAILED(rv)) return rv;		if (oldvalue) {			if (newvalue) {				rv = mInner->Change(aNewURL, property, oldvalue, newvalue);			}			else {				rv = mInner->Unassert(aNewURL, property, oldvalue);			}		}		else if (newvalue) {			rv = mInner->Assert(aNewURL, property, newvalue, PR_TRUE);		}		else {			// do nothing			rv = NS_OK;		}		if (NS_FAILED(rv)) return rv;	}		// Make all arcs pointing to aOldURL now point to aNewURL	nsCOMPtr<nsISimpleEnumerator> arcsIn;	rv = mInner->ArcLabelsIn(aOldURL, getter_AddRefs(arcsIn));	if (NS_FAILED(rv)) return rv;	while (1)	{		PRBool hasMoreArcsIn;		rv = arcsIn->HasMoreElements(&hasMoreArcsIn);		if (NS_FAILED(rv)) return rv;		if (! hasMoreArcsIn)			break;				nsCOMPtr<nsIRDFResource> property;		{			nsCOMPtr<nsISupports> isupports;			rv = arcsIn->GetNext(getter_AddRefs(isupports));			if (NS_FAILED(rv)) return rv;			property = do_QueryInterface(isupports);			NS_ASSERTION(property != nsnull, "arc is not a property");			if (! property)				return NS_ERROR_UNEXPECTED;		}		nsCOMPtr<nsISimpleEnumerator> sources;		rv = GetSources(property, aOldURL, PR_TRUE, getter_AddRefs(sources));		if (NS_FAILED(rv)) return rv;				while (1)		{			PRBool hasMoreSrcs;			rv = sources->HasMoreElements(&hasMoreSrcs);			if (NS_FAILED(rv)) return rv;			if (! hasMoreSrcs)				break;			nsCOMPtr<nsISupports> isupports;			rv = sources->GetNext(getter_AddRefs(isupports));			if (NS_FAILED(rv)) return rv;			nsCOMPtr<nsIRDFResource> source = do_QueryInterface(isupports);			NS_ASSERTION(source != nsnull, "source is not a resource");			if (! source)				return NS_ERROR_UNEXPECTED;			rv = mInner->Change(source, property, aOldURL, aNewURL);			if (NS_FAILED(rv)) return rv;		}	}	// Set a notification that the URL property changed, so that	// anyone observing it'll update correctly.	{		const char* uri;		rv = aNewURL->GetValueConst(&uri);		if (NS_FAILED(rv)) return rv;		nsCOMPtr<nsIRDFLiteral> literal;		rv = gRDF->GetLiteral(NS_ConvertASCIItoUCS2(uri).get(), getter_AddRefs(literal));		if (NS_FAILED(rv)) return rv;		// XXX rjc: was just aNewURL. Don't both aOldURL as well as aNewURL need to be pinged?		rv = OnAssert(this, aOldURL, kNC_URL, literal);		if (NS_FAILED(rv)) return rv;		rv = OnAssert(this, aNewURL, kNC_URL, literal);		if (NS_FAILED(rv)) return rv;	}	return NS_OK;}