From 021bbd8770fb4e9438d626562dcbec87b6febb19 Mon Sep 17 00:00:00 2001 From: "cls%seawood.org" Date: Wed, 12 Mar 2003 08:26:03 +0000 Subject: [PATCH] Move function prototypes into RDFContentSinkImpl class to appease mingw gcc. Make gContainerInfo struct local to the only function that uses it. Bug #134113 r=rjc sr=alecf git-svn-id: svn://10.0.0.236/trunk@139320 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/rdf/base/src/nsRDFContentSink.cpp | 57 +++++++++++------------ 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/mozilla/rdf/base/src/nsRDFContentSink.cpp b/mozilla/rdf/base/src/nsRDFContentSink.cpp index aab7f44aa60..ca22ed0dac4 100644 --- a/mozilla/rdf/base/src/nsRDFContentSink.cpp +++ b/mozilla/rdf/base/src/nsRDFContentSink.cpp @@ -193,6 +193,24 @@ public: static nsIAtom* kXMLNSAtom; static nsIAtom* kParseTypeAtom; + typedef nsresult + NS_STDCALL_FUNCPROTO(nsIRDFContainerUtils::*nsContainerTestFn, + (nsIRDFDataSource* aDataSource, + nsIRDFResource* aResource, + PRBool* aResult)); + + typedef nsresult + NS_STDCALL_FUNCPROTO(nsIRDFContainerUtils::*nsMakeContainerFn, + (nsIRDFDataSource* aDataSource, + nsIRDFResource* aContainer, + nsIRDFContainer** aResult)); + + typedef struct ContainerInfo { + nsIRDFResource** mType; + nsContainerTestFn mTestFn; + nsMakeContainerFn mMakeFn; + } ContainerInfo; + protected: // Text management void ParseText(nsIRDFNode **aResult); @@ -1498,36 +1516,6 @@ RDFContentSinkImpl::ParseAttributeString(const nsAString& aAttributeName, return NS_OK; } -// XXX Wish there was a better macro in nsCom.h... -#if defined(XP_WIN) -#define STDCALL __stdcall -#elif defined(XP_OS2) -#define STDCALL -#else -#define STDCALL -#endif - -typedef nsresult (STDCALL nsIRDFContainerUtils::*nsContainerTestFn)(nsIRDFDataSource* aDataSource, - nsIRDFResource* aResource, - PRBool* aResult); - -typedef nsresult (STDCALL nsIRDFContainerUtils::*nsMakeContainerFn)(nsIRDFDataSource* aDataSource, - nsIRDFResource* aContainer, - nsIRDFContainer** aResult); - -struct ContainerInfo { - nsIRDFResource** mType; - nsContainerTestFn mTestFn; - nsMakeContainerFn mMakeFn; -}; - -ContainerInfo gContainerInfo[] = { - { &RDFContentSinkImpl::kRDF_Alt, &nsIRDFContainerUtils::IsAlt, &nsIRDFContainerUtils::MakeAlt }, - { &RDFContentSinkImpl::kRDF_Bag, &nsIRDFContainerUtils::IsBag, &nsIRDFContainerUtils::MakeBag }, - { &RDFContentSinkImpl::kRDF_Seq, &nsIRDFContainerUtils::IsSeq, &nsIRDFContainerUtils::MakeSeq }, - { 0, 0, 0 }, -}; - nsresult RDFContentSinkImpl::InitContainer(nsIRDFResource* aContainerType, nsIRDFResource* aContainer) { @@ -1536,7 +1524,14 @@ RDFContentSinkImpl::InitContainer(nsIRDFResource* aContainerType, nsIRDFResource // new container vs. 'reinitialize' the container). nsresult rv; - for (ContainerInfo* info = gContainerInfo; info->mType != 0; ++info) { + static const ContainerInfo gContainerInfo[] = { + { &RDFContentSinkImpl::kRDF_Alt, &nsIRDFContainerUtils::IsAlt, &nsIRDFContainerUtils::MakeAlt }, + { &RDFContentSinkImpl::kRDF_Bag, &nsIRDFContainerUtils::IsBag, &nsIRDFContainerUtils::MakeBag }, + { &RDFContentSinkImpl::kRDF_Seq, &nsIRDFContainerUtils::IsSeq, &nsIRDFContainerUtils::MakeSeq }, + { 0, 0, 0 }, + }; + + for (const ContainerInfo* info = gContainerInfo; info->mType != 0; ++info) { if (*info->mType != aContainerType) continue;