From aaa2ad6e885e2b9c16829065d595658fdcc80a7e Mon Sep 17 00:00:00 2001 From: "putterman%netscape.com" Date: Tue, 20 Jul 1999 05:45:42 +0000 Subject: [PATCH] Write ArcLabelsIn so it doesn't crash. --- mailnews/base/src/nsMsgFolderDataSource.cpp | 3 +-- mailnews/base/src/nsMsgMessageDataSource.cpp | 3 +-- mailnews/base/src/nsMsgRDFDataSource.cpp | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/mailnews/base/src/nsMsgFolderDataSource.cpp b/mailnews/base/src/nsMsgFolderDataSource.cpp index d0148d5c826..1cc5fa8fff1 100644 --- a/mailnews/base/src/nsMsgFolderDataSource.cpp +++ b/mailnews/base/src/nsMsgFolderDataSource.cpp @@ -349,8 +349,7 @@ NS_IMETHODIMP nsMsgFolderDataSource::HasAssertion(nsIRDFResource* source, NS_IMETHODIMP nsMsgFolderDataSource::ArcLabelsIn(nsIRDFNode* node, nsISimpleEnumerator** labels) { - PR_ASSERT(0); - return NS_ERROR_NOT_IMPLEMENTED; + return nsMsgRDFDataSource::ArcLabelsIn(node, labels); } NS_IMETHODIMP nsMsgFolderDataSource::ArcLabelsOut(nsIRDFResource* source, diff --git a/mailnews/base/src/nsMsgMessageDataSource.cpp b/mailnews/base/src/nsMsgMessageDataSource.cpp index 8063d7a2d49..24cb2811af9 100644 --- a/mailnews/base/src/nsMsgMessageDataSource.cpp +++ b/mailnews/base/src/nsMsgMessageDataSource.cpp @@ -297,8 +297,7 @@ NS_IMETHODIMP nsMsgMessageDataSource::HasAssertion(nsIRDFResource* source, NS_IMETHODIMP nsMsgMessageDataSource::ArcLabelsIn(nsIRDFNode* node, nsISimpleEnumerator** labels) { - PR_ASSERT(0); - return NS_ERROR_NOT_IMPLEMENTED; + return nsMsgRDFDataSource::ArcLabelsIn(node, labels); } NS_IMETHODIMP nsMsgMessageDataSource::ArcLabelsOut(nsIRDFResource* source, diff --git a/mailnews/base/src/nsMsgRDFDataSource.cpp b/mailnews/base/src/nsMsgRDFDataSource.cpp index af8d9c0fa1b..30f42ceb7b6 100644 --- a/mailnews/base/src/nsMsgRDFDataSource.cpp +++ b/mailnews/base/src/nsMsgRDFDataSource.cpp @@ -22,6 +22,7 @@ #include "plstr.h" #include "nsXPIDLString.h" #include "nsMsgRDFUtils.h" +#include "nsEnumeratorUtils.h" static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); @@ -197,7 +198,23 @@ nsMsgRDFDataSource::RemoveObserver(nsIRDFObserver *aObserver) NS_IMETHODIMP nsMsgRDFDataSource::ArcLabelsIn(nsIRDFNode *aNode, nsISimpleEnumerator **_retval) { - return NS_RDF_NO_VALUE; + //return empty enumerator + nsCOMPtr arcs; + + nsresult rv = NS_NewISupportsArray(getter_AddRefs(arcs)); + if(NS_FAILED(rv)) + return rv; + + nsArrayEnumerator* arrayEnumerator = + new nsArrayEnumerator(arcs); + + if (arrayEnumerator == nsnull) + return NS_ERROR_OUT_OF_MEMORY; + + NS_ADDREF(arrayEnumerator); + *_retval = arrayEnumerator; + + return NS_OK; }