From c77848b7413871c83bea988398761ffad79a147e Mon Sep 17 00:00:00 2001 From: "axel%pike.org" Date: Sun, 18 Jan 2004 16:57:34 +0000 Subject: [PATCH] bug 192139, integrate latest expat, npob, fix transformiix standalone bustage on win, r=sicking, sr=peterv --- .../source/xml/parser/txXMLParser.cpp | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/extensions/transformiix/source/xml/parser/txXMLParser.cpp b/extensions/transformiix/source/xml/parser/txXMLParser.cpp index da056196ff3c..0a909ff14bb9 100644 --- a/extensions/transformiix/source/xml/parser/txXMLParser.cpp +++ b/extensions/transformiix/source/xml/parser/txXMLParser.cpp @@ -153,45 +153,46 @@ txParseFromStream(istream& aInputStream, const nsAString& aUri, // shortcut macro for redirection into txXMLParser method calls #define TX_XMLPARSER(_userData) NS_STATIC_CAST(txXMLParser*, _userData) +#define TX_ENSURE_DATA(_userData) \ + PR_BEGIN_MACRO \ + if (!aUserData) { \ + NS_WARNING("no userData in comment handler"); \ + return; \ + } \ + PR_END_MACRO PR_STATIC_CALLBACK(void) startElement(void *aUserData, const XML_Char *aName, const XML_Char **aAtts) { - NS_ENSURE_TRUE(aUserData, XML_ERROR_NONE); + TX_ENSURE_DATA(aUserData); TX_XMLPARSER(aUserData)->StartElement(aName, aAtts); } PR_STATIC_CALLBACK(void) endElement(void *aUserData, const XML_Char* aName) { - NS_ENSURE_TRUE(aUserData, XML_ERROR_NONE); + TX_ENSURE_DATA(aUserData); TX_XMLPARSER(aUserData)->EndElement(aName); } PR_STATIC_CALLBACK(void) charData(void* aUserData, const XML_Char* aChars, int aLength) { - if (!aUserData) { - NS_WARNING("no userData in charData handler"); - return; - } + TX_ENSURE_DATA(aUserData); TX_XMLPARSER(aUserData)->CharacterData(aChars, aLength); } PR_STATIC_CALLBACK(void) commentHandler(void* aUserData, const XML_Char* aChars) { - if (!aUserData) { - NS_WARNING("no userData in comment handler"); - return; - } + TX_ENSURE_DATA(aUserData); TX_XMLPARSER(aUserData)->Comment(aChars); } PR_STATIC_CALLBACK(void) piHandler(void *aUserData, const XML_Char *aTarget, const XML_Char *aData) { - NS_ENSURE_TRUE(aUserData, XML_ERROR_NONE); + TX_ENSURE_DATA(aUserData); TX_XMLPARSER(aUserData)->ProcessingInstruction(aTarget, aData); }