Module: wine Branch: refs/heads/master Commit: cce65b70b717f0edf43af62ceecf78a269250df4 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=cce65b70b717f0edf43af62c...
Author: Huw Davies huw@codeweavers.com Date: Tue Feb 21 11:52:25 2006 +0000
msxml3: Improve parse error handling a bit.
---
dlls/msxml3/domdoc.c | 23 +++++++++++++++++++++-- dlls/msxml3/parseerror.c | 12 ++++++++++-- 2 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c index bfccc1e..8f0604a 100644 --- a/dlls/msxml3/domdoc.c +++ b/dlls/msxml3/domdoc.c @@ -168,6 +168,7 @@ typedef struct _domdoc VARIANT_BOOL async; IUnknown *node_unk; IXMLDOMNode *node; + HRESULT error; } domdoc;
LONG xmldoc_add_ref(xmlDocPtr doc) @@ -978,8 +979,13 @@ static HRESULT WINAPI domdoc_load( return S_FALSE;
xmldoc = doread( filename ); - if ( !xmldoc ) return S_FALSE; + if ( !xmldoc ) + { + This->error = E_FAIL; + return S_FALSE; + }
+ This->error = S_OK; xmldoc->_private = 0; attach_xmlnode(This->node, (xmlNodePtr) xmldoc);
@@ -1001,8 +1007,16 @@ static HRESULT WINAPI domdoc_get_parseEr IXMLDOMDocument *iface, IXMLDOMParseError** errorObj ) { + BSTR error_string = NULL; + static const WCHAR err[] = {'e','r','r','o','r',0}; + domdoc *This = impl_from_IXMLDOMDocument( iface ); + FIXME("(%p)->(%p): creating a dummy parseError\n", iface, errorObj); - *errorObj = create_parseError(0, NULL, NULL, NULL, 0, 0, 0); + + if(This->error) + error_string = SysAllocString(err); + + *errorObj = create_parseError(This->error, NULL, error_string, NULL, 0, 0, 0); if(!*errorObj) return E_OUTOFMEMORY; return S_OK; } @@ -1094,8 +1108,12 @@ static HRESULT WINAPI domdoc_loadXML( xmldoc = doparse( str, len ); HeapFree( GetProcessHeap(), 0, str ); if ( !xmldoc ) + { + This->error = E_FAIL; return S_FALSE; + }
+ This->error = S_OK; xmldoc->_private = 0; attach_xmlnode( This->node, (xmlNodePtr) xmldoc );
@@ -1317,6 +1335,7 @@ HRESULT DOMDocument_create(IUnknown *pUn doc->lpVtbl = &domdoc_vtbl; doc->ref = 1; doc->async = 0; + doc->error = S_OK;
doc->node_unk = create_basic_node( NULL, (IUnknown*)&doc->lpVtbl ); if(!doc->node_unk) diff --git a/dlls/msxml3/parseerror.c b/dlls/msxml3/parseerror.c index acde7cc..240d1fe 100644 --- a/dlls/msxml3/parseerror.c +++ b/dlls/msxml3/parseerror.c @@ -173,8 +173,16 @@ static HRESULT WINAPI parseError_get_rea IXMLDOMParseError *iface, BSTR *reason ) { - FIXME("\n"); - return E_NOTIMPL; + parse_error_t *This = impl_from_IXMLDOMParseError( iface ); + TRACE("(%p)->(%p)\n", This, reason); + + if(!This->reason) + { + *reason = NULL; + return S_FALSE; + } + *reason = SysAllocString(This->reason); + return S_OK; }
static HRESULT WINAPI parseError_get_srcText(