[Libreoffice-commits] .: l10ntools/source sax/source shell/source xmlhelp/source

Michael Stahl mst at kemper.freedesktop.org
Thu Jul 12 13:09:36 PDT 2012


 l10ntools/source/help/HelpLinker.cxx |    4 ++--
 sax/source/expatwrap/sax_expat.cxx   |    2 +-
 sax/source/fastparser/fastparser.cxx |    3 ++-
 shell/source/all/xml_parser.cxx      |    4 +++-
 xmlhelp/source/treeview/tvread.cxx   |    6 +++---
 5 files changed, 11 insertions(+), 8 deletions(-)

New commits:
commit 23e28754730f5b864fd0e7475ac2596b2b5899cf
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Jul 12 22:08:10 2012 +0200

    XML_Parse returns enum XML_Status
    
    Change-Id: Ie4dde5aa412dae05d2629ce5675356db70b2529b

diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx
index f61c5cd..dd1057a 100644
--- a/l10ntools/source/help/HelpLinker.cxx
+++ b/l10ntools/source/help/HelpLinker.cxx
@@ -1065,9 +1065,9 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp
         aFile.close();
 
         XML_Parser parser = XML_ParserCreate( 0 );
-        int parsed = XML_Parse( parser, s, int( len ), true );
+        XML_Status parsed = XML_Parse( parser, s, int( len ), true );
 
-        if( parsed == 0 )
+        if (XML_STATUS_ERROR == parsed)
         {
             XML_Error nError = XML_GetErrorCode( parser );
             o_rHelpProcessingErrorInfo.m_eErrorClass = HELPPROCESSING_XMLPARSING_ERROR;
diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx
index c4d214b..33707c4 100644
--- a/sax/source/expatwrap/sax_expat.cxx
+++ b/sax/source/expatwrap/sax_expat.cxx
@@ -740,7 +740,7 @@ void SaxExpatParser_Impl::parse( )
         sal_Bool bContinue = ( XML_Parse( getEntity().pParser ,
                                                 (const char *) seqOut.getArray(),
                                                 nRead,
-                                                0 ) != 0 );
+                                                0 ) != XML_STATUS_ERROR );
 
         if( ! bContinue || this->bExceptionWasThrown ) {
 
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 965a1a8..4f63130 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -658,7 +658,8 @@ void FastSaxParser::parse()
             break;
         }
 
-        bool bContinue = XML_Parse( rEntity.mpParser, (const char*) seqOut.getConstArray(), nRead, 0 ) != 0;
+        bool const bContinue = XML_STATUS_ERROR != XML_Parse(rEntity.mpParser,
+            reinterpret_cast<const char*>(seqOut.getConstArray()), nRead, 0);
         // callbacks used inside XML_Parse may have caught an exception
         if( !bContinue || rEntity.maSavedException.hasValue() )
         {
diff --git a/shell/source/all/xml_parser.cxx b/shell/source/all/xml_parser.cxx
index e7740d0..6c2daaa 100644
--- a/shell/source/all/xml_parser.cxx
+++ b/shell/source/all/xml_parser.cxx
@@ -177,13 +177,15 @@ void xml_parser::init()
 
 void xml_parser::parse(const char* XmlData, size_t Length, bool IsFinal)
 {
-    if (0 == XML_Parse(xml_parser_, XmlData, Length, IsFinal))
+    if (XML_STATUS_ERROR == XML_Parse(xml_parser_, XmlData, Length, IsFinal))
+    {
         throw xml_parser_exception(
             (char*)XML_ErrorString(XML_GetErrorCode(xml_parser_)),
             (int)XML_GetErrorCode(xml_parser_),
             XML_GetCurrentLineNumber(xml_parser_),
             XML_GetCurrentColumnNumber(xml_parser_),
             XML_GetCurrentByteIndex(xml_parser_));
+    }
 }
 
 void xml_parser::set_document_handler(
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index 0510ebf..8357a3b 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -528,9 +528,9 @@ TVChildTarget::TVChildTarget( const Reference< XMultiServiceFactory >& xMSF )
                                      data_handler);
         XML_SetUserData( parser,&pTVDom ); // does not return this
 
-        int parsed = XML_Parse( parser,s,int( len ),j==0 );
-        (void)parsed;
-        OSL_ENSURE( parsed, "TVChildTarget::TVChildTarget(): Tree file parsing failed" );
+        XML_Status const parsed = XML_Parse(parser, s, int(len), j==0);
+        SAL_WARN_IF(XML_STATUS_ERROR == parsed, "xmlhelp",
+                "TVChildTarget::TVChildTarget(): Tree file parsing failed");
 
         XML_ParserFree( parser );
         delete[] s;


More information about the Libreoffice-commits mailing list