зеркало из https://github.com/mozilla/pjs.git
Fixed outbound/inbound mixup for traversing the arcs in Open(). Fixed some bugs in Open() for adding kids to a node.
This commit is contained in:
Родитель
ab55fa80c5
Коммит
56d42e9356
|
@ -201,8 +201,8 @@ nsRDFDataModelItem::Open(void)
|
||||||
RDF_Cursor cursor;
|
RDF_Cursor cursor;
|
||||||
if (mDataModel.GetArcType() == eRDFArcType_Outbound) {
|
if (mDataModel.GetArcType() == eRDFArcType_Outbound) {
|
||||||
// Arcs are outbound, that is, from a parent to it's
|
// Arcs are outbound, that is, from a parent to it's
|
||||||
// child. Find all arcs whose source is "me".
|
// child. Find all targets whose source is "me".
|
||||||
cursor = RDF_GetSources(mDataModel.GetDB(),
|
cursor = RDF_GetTargets(mDataModel.GetDB(),
|
||||||
GetResource(),
|
GetResource(),
|
||||||
mDataModel.GetArcProperty(),
|
mDataModel.GetArcProperty(),
|
||||||
RDF_RESOURCE_TYPE,
|
RDF_RESOURCE_TYPE,
|
||||||
|
@ -210,8 +210,8 @@ nsRDFDataModelItem::Open(void)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Arcs are inbound, that is, from a child to it's
|
// Arcs are inbound, that is, from a child to it's
|
||||||
// parent. Find all arcs whose target is "me".
|
// parent. Find all sources whose target is "me".
|
||||||
cursor = RDF_GetTargets(mDataModel.GetDB(),
|
cursor = RDF_GetSources(mDataModel.GetDB(),
|
||||||
GetResource(),
|
GetResource(),
|
||||||
mDataModel.GetArcProperty(),
|
mDataModel.GetArcProperty(),
|
||||||
RDF_RESOURCE_TYPE,
|
RDF_RESOURCE_TYPE,
|
||||||
|
@ -219,14 +219,15 @@ nsRDFDataModelItem::Open(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
PRUint32 index = 0;
|
|
||||||
RDF_Resource r;
|
RDF_Resource r;
|
||||||
while ((r = static_cast<RDF_Resource>(RDF_NextValue(cursor))) != NULL) {
|
while ((r = static_cast<RDF_Resource>(RDF_NextValue(cursor))) != NULL) {
|
||||||
nsRDFDataModelItem* child;
|
nsRDFDataModelItem* child;
|
||||||
if (NS_FAILED(mDataModel.CreateItem(r, child)))
|
if (NS_FAILED(mDataModel.CreateItem(r, child)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mChildren[index++] = child;
|
// CreateItem() will have done an AddRef(), like a good
|
||||||
|
// COM citizen...
|
||||||
|
mChildren.Add(child);
|
||||||
child->mParent = this;
|
child->mParent = this;
|
||||||
}
|
}
|
||||||
RDF_DisposeCursor(cursor);
|
RDF_DisposeCursor(cursor);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче