Piotr Caban : msxml3: Prefer to report msxml error over libxml parsing error.

Alexandre Julliard julliard at winehq.org
Mon Oct 24 13:43:55 CDT 2011


Module: wine
Branch: master
Commit: 6927a11eabe50c911d4d7ac943fda5c797be555d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6927a11eabe50c911d4d7ac943fda5c797be555d

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Oct 24 12:55:13 2011 +0200

msxml3: Prefer to report msxml error over libxml parsing error.

---

 dlls/msxml3/saxreader.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/dlls/msxml3/saxreader.c b/dlls/msxml3/saxreader.c
index fe78375..45f7e909 100644
--- a/dlls/msxml3/saxreader.c
+++ b/dlls/msxml3/saxreader.c
@@ -1458,8 +1458,10 @@ static void libxmlFatalError(void *ctx, const char *msg, ...)
     DWORD len;
     va_list args;
 
-    if(This->ret != S_OK)
+    if(This->ret != S_OK) {
+        xmlStopParser(This->pParserCtxt);
         return;
+    }
 
     va_start(args, msg);
     vsprintf(message, msg, args);
@@ -1966,8 +1968,10 @@ static HRESULT internal_parseBuffer(saxreader *This, const char *buffer, int siz
     locator->pParserCtxt->userData = locator;
 
     This->isParsing = TRUE;
-    if(xmlParseDocument(locator->pParserCtxt) == -1) hr = E_FAIL;
-    else hr = locator->ret;
+    if(xmlParseDocument(locator->pParserCtxt)==-1 && locator->ret==S_OK)
+        hr = E_FAIL;
+    else
+        hr = locator->ret;
     This->isParsing = FALSE;
 
     if(locator->pParserCtxt)
@@ -2010,7 +2014,7 @@ static HRESULT internal_parseStream(saxreader *This, IStream *stream, BOOL vbInt
     if(dataRead != sizeof(data))
     {
         ret = xmlParseChunk(locator->pParserCtxt, data, 0, 1);
-        hr = ret != XML_ERR_OK ? E_FAIL : locator->ret;
+        hr = ret!=XML_ERR_OK && locator->ret==S_OK ? E_FAIL : locator->ret;
     }
     else
     {
@@ -2021,14 +2025,14 @@ static HRESULT internal_parseStream(saxreader *This, IStream *stream, BOOL vbInt
             if (FAILED(hr)) break;
 
             ret = xmlParseChunk(locator->pParserCtxt, data, dataRead, 0);
-            hr = ret != XML_ERR_OK ? E_FAIL : locator->ret;
+            hr = ret!=XML_ERR_OK && locator->ret==S_OK ? E_FAIL : locator->ret;
 
             if (hr != S_OK) break;
 
             if (dataRead != sizeof(data))
             {
                 ret = xmlParseChunk(locator->pParserCtxt, data, 0, 1);
-                hr = ret != XML_ERR_OK ? E_FAIL : locator->ret;
+                hr = ret!=XML_ERR_OK && locator->ret==S_OK ? E_FAIL : locator->ret;
                 break;
             }
         }




More information about the wine-cvs mailing list