Fixed GetTarget() to use new return codes.

This commit is contained in:
waterson%netscape.com 1999-03-30 03:58:24 +00:00
parent 33bca75da4
commit 99a0e395db
7 changed files with 51 additions and 0 deletions

View File

@ -184,6 +184,9 @@ ContainerCursorImpl::Advance(void)
if (NS_FAILED(rv = mDataSource->GetTarget(mContainer, kRDF_nextVal, PR_TRUE, &nextNode)))
goto done;
if (rv == NS_RDF_NO_VALUE)
goto done;
if (NS_FAILED(rv = nextNode->QueryInterface(kIRDFLiteralIID, (void**) &nextVal)))
goto done;

View File

@ -1214,6 +1214,10 @@ RDFXMLDataSourceImpl::SerializeMember(nsIOutputStream* aStream,
if (NS_FAILED(rv = cursor->GetTarget(&node)))
break;
NS_ASSERTION(rv != NS_RDF_NO_VALUE, "null item in cursor");
if (rv == NS_RDF_NO_VALUE)
continue;
// If it's a resource, then output a "<RDF:li resource=... />"
// tag, because we'll be dumping the resource separately. (We
// iterate thru all the resources in the datasource,

View File

@ -728,6 +728,9 @@ rdf_ContainerGetNextValue(nsIRDFDataSource* ds,
if (NS_FAILED(rv = ds->GetTarget(container, kRDF_nextVal, PR_TRUE, &nextValNode)))
goto done;
if (rv == NS_RDF_NO_VALUE)
goto done;
if (NS_FAILED(rv = nextValNode->QueryInterface(kIRDFLiteralIID, (void**) &nextValLiteral)))
goto done;
@ -841,6 +844,10 @@ rdf_ContainerRemoveElement(nsIRDFDataSource* aDataSource,
return rv;
}
NS_ASSERTION(rv != NS_RDF_NO_VALUE, "null item in cursor");
if (rv == NS_RDF_NO_VALUE)
continue;
PRBool eq;
if (NS_FAILED(rv = element->EqualsNode(aElement, &eq))) {
NS_ERROR("severe error on equality check");
@ -886,6 +893,10 @@ rdf_ContainerRemoveElement(nsIRDFDataSource* aDataSource,
return rv;
}
NS_ASSERTION(rv != NS_RDF_NO_VALUE, "null value in cursor");
if (rv == NS_RDF_NO_VALUE)
continue;
if (NS_FAILED(rv = elements->GetLabel(getter_AddRefs(ordinal)))) {
NS_ERROR("unable to get element's ordinal index");
return rv;
@ -1032,6 +1043,10 @@ rdf_ContainerInsertElementAt(nsIRDFDataSource* aDataSource,
return rv;
}
NS_ASSERTION(rv != NS_RDF_NO_VALUE, "null value in cursor");
if (rv == NS_RDF_NO_VALUE)
continue;
if (NS_FAILED(rv = aDataSource->Unassert(aContainer, ordinal, element))) {
NS_ERROR("unable to remove element from container");
return rv;
@ -1115,6 +1130,10 @@ rdf_ContainerIndexOf(nsIRDFDataSource* aDataSource,
return rv;
}
NS_ASSERTION(rv != NS_RDF_NO_VALUE, "null value in cursor");
if (rv == NS_RDF_NO_VALUE)
continue;
// Okay, we've found it.
nsCOMPtr<nsIRDFResource> ordinal;
if (NS_FAILED(rv = elements->GetLabel(getter_AddRefs(ordinal)))) {

View File

@ -277,6 +277,10 @@ RDFMenuBuilderImpl::AddWidgetItem(nsIContent* aElement,
return rv;
}
NS_ASSERTION(rv != NS_RDF_NO_VALUE, "arc-out with no target: fix your arcs-out cursor!");
if (rv == NS_RDF_NO_VALUE)
continue;
nsCOMPtr<nsIRDFResource> resource;
nsCOMPtr<nsIRDFLiteral> literal;

View File

@ -259,6 +259,10 @@ RDFToolbarBuilderImpl::AddWidgetItem(nsIContent* aElement,
return rv;
}
NS_ASSERTION(rv != NS_RDF_NO_VALUE, "arc-out with no target: fix your arcs out cursor");
if (rv == NS_RDF_NO_VALUE)
continue;
nsCOMPtr<nsIRDFResource> resource;
nsCOMPtr<nsIRDFLiteral> literal;

View File

@ -593,6 +593,10 @@ RDFTreeBuilderImpl::AddWidgetItem(nsIContent* aElement,
return rv;
}
NS_ASSERTION(rv != NS_RDF_NO_VALUE, "arc-out with no target: fix your arcs-out cursor");
if (rv == NS_RDF_NO_VALUE)
continue;
nsCOMPtr<nsIRDFResource> resource;
nsCOMPtr<nsIRDFLiteral> literal;

View File

@ -573,6 +573,10 @@ RDFXULBuilderImpl::CreateContents(nsIContent* aElement)
return rv;
}
NS_ASSERTION(rv != NS_RDF_NO_VALUE, "null value in cursor");
if (rv == NS_RDF_NO_VALUE)
continue;
if (NS_FAILED(AppendChild(aElement, child))) {
NS_ERROR("problem appending child to content model");
return rv;
@ -1446,6 +1450,11 @@ RDFXULBuilderImpl::CreateElement(nsIRDFResource* aResource,
return rv;
}
NS_ASSERTION(rv != NS_RDF_NO_VALUE, "no node type");
if (rv == NS_RDF_NO_VALUE)
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsIRDFResource> type;
if (NS_FAILED(rv = typeNode->QueryInterface(kIRDFResourceIID, getter_AddRefs(type)))) {
NS_ERROR("type wasn't a resource");
@ -1573,6 +1582,10 @@ RDFXULBuilderImpl::CreateHTMLElement(nsIRDFResource* aResource,
return rv;
}
NS_ASSERTION(rv != NS_RDF_NO_VALUE, "null value in cursor");
if (rv == NS_RDF_NO_VALUE)
continue;
// Add the attribute to the newly constructed element
if (NS_FAILED(rv = AddAttribute(element, property, value))) {
NS_ERROR("unable to add attribute to element");