From 81ffe0432e474d83a8a4d88421c18e47c09e3708 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 14 Mar 2013 08:27:57 +0400 Subject: [PATCH] msxml3: Use characters callback helper in one more place. --- dlls/msxml3/saxreader.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/dlls/msxml3/saxreader.c b/dlls/msxml3/saxreader.c index 5475e1a408..5a0b1c2874 100644 --- a/dlls/msxml3/saxreader.c +++ b/dlls/msxml3/saxreader.c @@ -349,6 +349,21 @@ static inline int saxreader_has_handler(const saxlocator *locator, enum saxhandl return (locator->vbInterface && iface->vbhandler) || (!locator->vbInterface && iface->handler); } +static HRESULT saxreader_saxcharacters(saxlocator *locator, BSTR chars) +{ + struct saxcontenthandler_iface *content = saxreader_get_contenthandler(locator->saxreader); + HRESULT hr; + + if (!saxreader_has_handler(locator, SAXContentHandler)) return S_OK; + + if (locator->vbInterface) + hr = IVBSAXContentHandler_characters(content->vbhandler, &chars); + else + hr = ISAXContentHandler_characters(content->handler, chars, SysStringLen(chars)); + + return hr; +} + /* property names */ static const WCHAR PropertyCharsetW[] = { 'c','h','a','r','s','e','t',0 @@ -1565,7 +1580,6 @@ static void libxmlCharacters( int len) { saxlocator *This = ctx; - struct saxcontenthandler_iface *handler = saxreader_get_contenthandler(This->saxreader); BSTR Chars; HRESULT hr; xmlChar *cur, *end; @@ -1624,10 +1638,7 @@ static void libxmlCharacters( } Chars = pooled_bstr_from_xmlCharN(&This->saxreader->pool, cur, end-cur); - if(This->vbInterface) - hr = IVBSAXContentHandler_characters(handler->vbhandler, &Chars); - else - hr = ISAXContentHandler_characters(handler->handler, Chars, SysStringLen(Chars)); + hr = saxreader_saxcharacters(This, Chars); if (sax_callback_failed(This, hr)) { @@ -1799,21 +1810,6 @@ static BSTR saxreader_get_cdata_chunk(const xmlChar *str, int len) return ret; } -static HRESULT saxreader_saxcharacters(saxlocator *locator, BSTR chars) -{ - struct saxcontenthandler_iface *content = saxreader_get_contenthandler(locator->saxreader); - HRESULT hr; - - if (!saxreader_has_handler(locator, SAXContentHandler)) return S_OK; - - if (locator->vbInterface) - hr = IVBSAXContentHandler_characters(content->vbhandler, &chars); - else - hr = ISAXContentHandler_characters(content->handler, chars, SysStringLen(chars)); - - return hr; -} - static void libxml_cdatablock(void *ctx, const xmlChar *value, int len) { const xmlChar *start, *end;