[MSXML3] Sync with wine-10.0

This commit is contained in:
Timo Kreuzer
2026-01-10 19:03:40 +02:00
parent 8b7ade14ef
commit 02185fb226
46 changed files with 2221 additions and 2516 deletions
+8 -2
View File
@@ -32,6 +32,7 @@ list(APPEND SOURCE
nodemap.c
parseerror.c
pi.c
reactos.c
saxreader.c
schema.c
selection.c
@@ -70,20 +71,25 @@ add_library(msxml3 MODULE
add_idl_headers(xmlparser_idlheader xmlparser.idl)
set_module_type(msxml3 win32dll)
target_link_libraries(msxml3 libxml2 iconv-static uuid wine zlib)
target_link_libraries(msxml3 libxml2 iconv-static uuid wine wine_dll_register zlib)
if(MSVC)
target_compile_options(msxml3 PRIVATE /FIwine/typeof.h /FImsvc.h)
# Disable warning C4090: 'function': different 'const' qualifiers
target_compile_options(msxml3 PRIVATE /wd4090)
if(ARCH STREQUAL "amd64" OR ARCH STREQUAL "arm64")
# Disable warning C4267: 'function': conversion from 'size_t' to 'UINT', possible loss of data
target_compile_options(msxml3 PRIVATE "/wd4267")
endif()
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(msxml3 PRIVATE -Wno-incompatible-function-pointer-types)
endif()
add_importlibs(msxml3 urlmon ws2_32 shlwapi oleaut32 ole32 user32 msvcrt kernel32 ntdll)
add_importlibs(msxml3 libxslt urlmon ws2_32 shlwapi oleaut32 ole32 user32 msvcrt kernel32 ntdll)
add_dependencies(msxml3 xmlparser_idlheader stdole2) # msxml3_v1.tlb needs stdole2.tlb
add_pch(msxml3 precomp.h "${PCH_SKIP_SOURCE}")
add_cd_file(TARGET msxml3 DESTINATION reactos/system32 FOR all)
+43 -40
View File
@@ -20,14 +20,10 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
# include <libxml/HTMLtree.h>
#endif
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include <libxml/HTMLtree.h>
#include "windef.h"
#include "winbase.h"
@@ -39,8 +35,6 @@
#include "wine/debug.h"
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
static const xmlChar xmlns[] = "xmlns";
@@ -101,9 +95,9 @@ static HRESULT WINAPI domattr_QueryInterface(
static ULONG WINAPI domattr_AddRef(
IXMLDOMAttribute *iface )
{
domattr *This = impl_from_IXMLDOMAttribute( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
domattr *attr = impl_from_IXMLDOMAttribute( iface );
ULONG ref = InterlockedIncrement( &attr->ref );
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -113,7 +107,7 @@ static ULONG WINAPI domattr_Release(
domattr *This = impl_from_IXMLDOMAttribute( iface );
ULONG ref = InterlockedDecrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
if ( ref == 0 )
{
destroy_xmlnode(&This->node);
@@ -122,7 +116,7 @@ static ULONG WINAPI domattr_Release(
xmlFreeNs( This->node.node->ns );
xmlFreeNode( This->node.node );
}
heap_free( This );
free( This );
}
return ref;
@@ -549,10 +543,11 @@ static HRESULT WINAPI domattr_get_namespaceURI(
IXMLDOMAttribute *iface,
BSTR* p)
{
static const WCHAR w3xmlns[] = { 'h','t','t','p',':','/','/', 'w','w','w','.','w','3','.',
'o','r','g','/','2','0','0','0','/','x','m','l','n','s','/',0 };
domattr *This = impl_from_IXMLDOMAttribute( iface );
xmlNsPtr ns = This->node.node->ns;
BSTR nodename, pfx;
BOOL is6, isdefault;
HRESULT hr;
TRACE("(%p)->(%p)\n", This, p);
@@ -560,23 +555,36 @@ static HRESULT WINAPI domattr_get_namespaceURI(
return E_INVALIDARG;
*p = NULL;
nodename = NULL;
hr = IXMLDOMAttribute_get_nodeName(iface, &nodename);
if (FAILED(hr))
return hr;
if (ns)
pfx = NULL;
hr = IXMLDOMAttribute_get_prefix(iface, &pfx);
if (FAILED(hr))
{
/* special case for default namespace definition */
if (xmlStrEqual(This->node.node->name, xmlns))
*p = bstr_from_xmlChar(xmlns);
else if (xmlStrEqual(ns->prefix, xmlns))
{
if (xmldoc_version(This->node.node->doc) == MSXML6)
*p = SysAllocString(w3xmlns);
else
*p = SysAllocStringLen(NULL, 0);
}
else if (ns->href)
*p = bstr_from_xmlChar(ns->href);
SysFreeString(nodename);
return hr;
}
is6 = xmldoc_version(This->node.node->doc) == MSXML6;
isdefault = !wcscmp(nodename, L"xmlns");
if (isdefault || (pfx && !wcscmp(L"xmlns", pfx)))
{
if (is6)
*p = SysAllocString(L"http://www.w3.org/2000/xmlns/");
else if (!ns || !isdefault)
*p = SysAllocStringLen(NULL, 0);
else
*p = SysAllocString(L"xmlns");
}
else if (ns && ns->href)
*p = bstr_from_xmlChar(ns->href);
SysFreeString(nodename);
SysFreeString(pfx);
TRACE("uri: %s\n", debugstr_w(*p));
return *p ? S_OK : S_FALSE;
@@ -595,14 +603,11 @@ static HRESULT WINAPI domattr_get_prefix(
*prefix = NULL;
if (ns)
{
/* special case for default namespace definition */
if (xmlStrEqual(This->node.node->name, xmlns))
*prefix = bstr_from_xmlChar(xmlns);
else if (ns->prefix)
*prefix = bstr_from_xmlChar(ns->prefix);
}
if (xmldoc_version(This->node.node->doc) != MSXML6 &&
xmlStrEqual(This->node.node->name, xmlns))
*prefix = bstr_from_xmlChar(xmlns);
else if (ns && ns->prefix)
*prefix = bstr_from_xmlChar(ns->prefix);
TRACE("prefix: %s\n", debugstr_w(*prefix));
@@ -726,7 +731,7 @@ IUnknown* create_attribute( xmlNodePtr attribute, BOOL floating )
{
domattr *This;
This = heap_alloc( sizeof *This );
This = malloc(sizeof(*This));
if ( !This )
return NULL;
@@ -738,5 +743,3 @@ IUnknown* create_attribute( xmlNodePtr attribute, BOOL floating )
return (IUnknown*)&This->IXMLDOMAttribute_iface;
}
#endif
+42 -31
View File
@@ -17,15 +17,8 @@
*/
#define COBJMACROS
#define NONAMELESSUNION
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
#endif
#include "windef.h"
#include "winbase.h"
@@ -39,7 +32,7 @@
#include "wine/debug.h"
#include "msxml_private.h"
#include "msxml_dispex.h"
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
@@ -82,10 +75,10 @@ static HRESULT WINAPI bsc_QueryInterface(
static ULONG WINAPI bsc_AddRef(
IBindStatusCallback *iface )
{
bsc_t *This = impl_from_IBindStatusCallback(iface);
LONG ref = InterlockedIncrement(&This->ref);
bsc_t *bsc = impl_from_IBindStatusCallback(iface);
LONG ref = InterlockedIncrement(&bsc->ref);
TRACE("(%p) ref=%d\n", This, ref);
TRACE("%p, refcount %ld.\n", iface, ref);
return ref;
}
@@ -93,15 +86,18 @@ static ULONG WINAPI bsc_AddRef(
static ULONG WINAPI bsc_Release(
IBindStatusCallback *iface )
{
bsc_t *This = impl_from_IBindStatusCallback(iface);
LONG ref = InterlockedDecrement(&This->ref);
bsc_t *bsc = impl_from_IBindStatusCallback(iface);
LONG ref = InterlockedDecrement(&bsc->ref);
TRACE("(%p) ref=%d\n", This, ref);
TRACE("%p, refcount %ld.\n", iface, ref);
if(!ref) {
if (This->binding) IBinding_Release(This->binding);
if (This->memstream) IStream_Release(This->memstream);
heap_free(This);
if (!ref)
{
if (bsc->binding)
IBinding_Release(bsc->binding);
if (bsc->memstream)
IStream_Release(bsc->memstream);
free(bsc);
}
return ref;
@@ -115,7 +111,7 @@ static HRESULT WINAPI bsc_OnStartBinding(
bsc_t *This = impl_from_IBindStatusCallback(iface);
HRESULT hr;
TRACE("(%p)->(%x %p)\n", This, dwReserved, pib);
TRACE("%p, %lx, %p.\n", iface, dwReserved, pib);
This->binding = pib;
IBinding_AddRef(pib);
@@ -159,7 +155,7 @@ static HRESULT WINAPI bsc_OnStopBinding(
bsc_t *This = impl_from_IBindStatusCallback(iface);
HRESULT hr = S_OK;
TRACE("(%p)->(%08x %s)\n", This, hresult, debugstr_w(szError));
TRACE("%p, %#lx, %s.\n", iface, hresult, debugstr_w(szError));
if(This->binding) {
IBinding_Release(This->binding);
@@ -200,20 +196,20 @@ static HRESULT WINAPI bsc_OnDataAvailable(
FORMATETC* pformatetc,
STGMEDIUM* pstgmed)
{
bsc_t *This = impl_from_IBindStatusCallback(iface);
bsc_t *bsc = impl_from_IBindStatusCallback(iface);
BYTE buf[4096];
DWORD read, written;
HRESULT hr;
TRACE("(%p)->(%x %d %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed);
TRACE("%p, %lx, %lu, %p, %p.\n", iface, grfBSCF, dwSize, pformatetc, pstgmed);
do
{
hr = IStream_Read(pstgmed->u.pstm, buf, sizeof(buf), &read);
hr = IStream_Read(pstgmed->pstm, buf, sizeof(buf), &read);
if(FAILED(hr))
break;
hr = IStream_Write(This->memstream, buf, read, &written);
hr = IStream_Write(bsc->memstream, buf, read, &written);
} while(SUCCEEDED(hr) && written != 0 && read != 0);
return S_OK;
@@ -242,9 +238,10 @@ static const struct IBindStatusCallbackVtbl bsc_vtbl =
bsc_OnObjectAvailable
};
HRESULT create_uri(const WCHAR *url, IUri **uri)
HRESULT create_uri(IUri *base, const WCHAR *url, IUri **uri)
{
WCHAR fileUrl[INTERNET_MAX_URL_LENGTH];
HRESULT hr;
TRACE("%s\n", debugstr_w(url));
@@ -253,21 +250,35 @@ HRESULT create_uri(const WCHAR *url, IUri **uri)
WCHAR fullpath[MAX_PATH];
DWORD needed = ARRAY_SIZE(fileUrl);
if (!PathSearchAndQualifyW(url, fullpath, ARRAY_SIZE(fullpath)))
lstrcpynW(fileUrl, url, ARRAY_SIZE(fileUrl));
UrlUnescapeW(fileUrl, NULL, NULL, URL_UNESCAPE_INPLACE);
if (!PathSearchAndQualifyW(fileUrl, fullpath, ARRAY_SIZE(fullpath)))
{
WARN("can't find path\n");
return E_FAIL;
}
if (FAILED(UrlCreateFromPathW(fullpath, fileUrl, &needed, 0)))
if (FAILED(UrlApplySchemeW(fullpath, fileUrl, &needed, URL_APPLY_GUESSSCHEME | URL_APPLY_GUESSFILE |
URL_APPLY_DEFAULT)))
{
ERR("can't create url from path\n");
ERR("Failed to apply url scheme.\n");
return E_FAIL;
}
url = fileUrl;
}
return CreateUri(url, Uri_CREATE_ALLOW_RELATIVE | Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, 0, uri);
hr = CreateUri(url, Uri_CREATE_ALLOW_RELATIVE | Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, 0, uri);
if (hr == S_OK && base)
{
IUri *rebased_uri;
hr = CoInternetCombineIUri(base, *uri, 0, &rebased_uri, 0);
IUri_Release(*uri);
*uri = rebased_uri;
}
return hr;
}
HRESULT create_moniker_from_url(LPCWSTR url, IMoniker **mon)
@@ -277,7 +288,7 @@ HRESULT create_moniker_from_url(LPCWSTR url, IMoniker **mon)
TRACE("%s\n", debugstr_w(url));
if (FAILED(hr = create_uri(url, &uri)))
if (FAILED(hr = create_uri(NULL, url, &uri)))
return hr;
hr = CreateURLMonikerEx2(NULL, uri, mon, 0);
@@ -298,7 +309,7 @@ HRESULT bind_url(IMoniker *mon, HRESULT (*onDataAvailable)(void*,char*,DWORD),
if(FAILED(hr))
return hr;
bsc = heap_alloc(sizeof(bsc_t));
bsc = malloc(sizeof(bsc_t));
bsc->IBindStatusCallback_iface.lpVtbl = &bsc_vtbl;
bsc->ref = 1;
+20 -34
View File
@@ -20,13 +20,9 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
#endif
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include "windef.h"
#include "winbase.h"
@@ -38,8 +34,6 @@
#include "wine/debug.h"
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
typedef struct
@@ -95,26 +89,25 @@ static HRESULT WINAPI domcdata_QueryInterface(
return S_OK;
}
static ULONG WINAPI domcdata_AddRef(
IXMLDOMCDATASection *iface )
static ULONG WINAPI domcdata_AddRef(IXMLDOMCDATASection *iface)
{
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
domcdata *cdata = impl_from_IXMLDOMCDATASection(iface);
ULONG ref = InterlockedIncrement(&cdata->ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
static ULONG WINAPI domcdata_Release(
IXMLDOMCDATASection *iface )
static ULONG WINAPI domcdata_Release(IXMLDOMCDATASection *iface)
{
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
ULONG ref = InterlockedDecrement( &This->ref );
domcdata *cdata = impl_from_IXMLDOMCDATASection(iface);
ULONG ref = InterlockedDecrement(&cdata->ref);
TRACE("(%p)->(%d)\n", This, ref);
if ( ref == 0 )
TRACE("%p, refcount %lu.\n", iface, ref);
if (!ref)
{
destroy_xmlnode(&This->node);
heap_free( This );
destroy_xmlnode(&cdata->node);
free(cdata);
}
return ref;
@@ -583,11 +576,10 @@ static HRESULT WINAPI domcdata_substringData(
IXMLDOMCDATASection *iface,
LONG offset, LONG count, BSTR *p)
{
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
HRESULT hr;
BSTR data;
TRACE("(%p)->(%d %d %p)\n", This, offset, count, p);
TRACE("%p, %ld, %ld, %p.\n", iface, offset, count, p);
if(!p)
return E_INVALIDARG;
@@ -657,12 +649,11 @@ static HRESULT WINAPI domcdata_insertData(
IXMLDOMCDATASection *iface,
LONG offset, BSTR p)
{
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
HRESULT hr;
BSTR data;
LONG p_len;
TRACE("(%p)->(%d %s)\n", This, offset, debugstr_w(p));
TRACE("%p, %ld, %s.\n", iface, offset, debugstr_w(p));
/* If have a NULL or empty string, don't do anything. */
if((p_len = SysStringLen(p)) == 0)
@@ -705,12 +696,11 @@ static HRESULT WINAPI domcdata_deleteData(
IXMLDOMCDATASection *iface,
LONG offset, LONG count)
{
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
HRESULT hr;
LONG len = -1;
BSTR str;
TRACE("(%p)->(%d %d)\n", This, offset, count);
TRACE("%p, %ld, %ld.\n", iface, offset, count);
hr = IXMLDOMCDATASection_get_length(iface, &len);
if(hr != S_OK) return hr;
@@ -753,10 +743,9 @@ static HRESULT WINAPI domcdata_replaceData(
IXMLDOMCDATASection *iface,
LONG offset, LONG count, BSTR p)
{
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
HRESULT hr;
TRACE("(%p)->(%d %d %s)\n", This, offset, count, debugstr_w(p));
TRACE("%p, %ld, %ld, %s.\n", iface, offset, count, debugstr_w(p));
hr = IXMLDOMCDATASection_deleteData(iface, offset, count);
@@ -770,12 +759,11 @@ static HRESULT WINAPI domcdata_splitText(
IXMLDOMCDATASection *iface,
LONG offset, IXMLDOMText **txtNode)
{
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
IXMLDOMDocument *doc;
LONG length = 0;
HRESULT hr;
TRACE("(%p)->(%d %p)\n", This, offset, txtNode);
TRACE("%p, %ld, %p.\n", iface, offset, txtNode);
if (!txtNode || offset < 0) return E_INVALIDARG;
@@ -887,7 +875,7 @@ IUnknown* create_cdata( xmlNodePtr text )
{
domcdata *This;
This = heap_alloc( sizeof *This );
This = malloc(sizeof(*This));
if ( !This )
return NULL;
@@ -898,5 +886,3 @@ IUnknown* create_cdata( xmlNodePtr text )
return (IUnknown*)&This->IXMLDOMCDATASection_iface;
}
#endif
+20 -34
View File
@@ -20,13 +20,9 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
#endif
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include "windef.h"
#include "winbase.h"
@@ -38,8 +34,6 @@
#include "wine/debug.h"
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
typedef struct _domcomment
@@ -95,26 +89,25 @@ static HRESULT WINAPI domcomment_QueryInterface(
return S_OK;
}
static ULONG WINAPI domcomment_AddRef(
IXMLDOMComment *iface )
static ULONG WINAPI domcomment_AddRef(IXMLDOMComment *iface)
{
domcomment *This = impl_from_IXMLDOMComment( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
domcomment *comment = impl_from_IXMLDOMComment(iface);
ULONG ref = InterlockedIncrement(&comment->ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
static ULONG WINAPI domcomment_Release(
IXMLDOMComment *iface )
static ULONG WINAPI domcomment_Release(IXMLDOMComment *iface)
{
domcomment *This = impl_from_IXMLDOMComment( iface );
ULONG ref = InterlockedDecrement( &This->ref );
domcomment *comment = impl_from_IXMLDOMComment(iface);
ULONG ref = InterlockedDecrement(&comment->ref);
TRACE("(%p)->(%d)\n", This, ref);
if ( ref == 0 )
TRACE("%p, refcount %lu.\n", iface, ref);
if (!ref)
{
destroy_xmlnode(&This->node);
heap_free( This );
destroy_xmlnode(&comment->node);
free(comment);
}
return ref;
@@ -581,15 +574,12 @@ static HRESULT WINAPI domcomment_get_length(
return hr;
}
static HRESULT WINAPI domcomment_substringData(
IXMLDOMComment *iface,
LONG offset, LONG count, BSTR *p)
static HRESULT WINAPI domcomment_substringData(IXMLDOMComment *iface, LONG offset, LONG count, BSTR *p)
{
domcomment *This = impl_from_IXMLDOMComment( iface );
HRESULT hr;
BSTR data;
TRACE("(%p)->(%d %d %p)\n", This, offset, count, p);
TRACE("%p, %ld, %ld, %p.\n", iface, offset, count, p);
if(!p)
return E_INVALIDARG;
@@ -659,12 +649,11 @@ static HRESULT WINAPI domcomment_insertData(
IXMLDOMComment *iface,
LONG offset, BSTR p)
{
domcomment *This = impl_from_IXMLDOMComment( iface );
HRESULT hr;
BSTR data;
LONG p_len;
TRACE("(%p)->(%d %s)\n", This, offset, debugstr_w(p));
TRACE("%p, %ld, %s.\n", iface, offset, debugstr_w(p));
/* If have a NULL or empty string, don't do anything. */
if((p_len = SysStringLen(p)) == 0)
@@ -711,7 +700,7 @@ static HRESULT WINAPI domcomment_deleteData(
LONG len = -1;
BSTR str;
TRACE("(%p)->(%d %d)\n", iface, offset, count);
TRACE("%p, %ld, %ld.\n", iface, offset, count);
hr = IXMLDOMComment_get_length(iface, &len);
if(hr != S_OK) return hr;
@@ -754,10 +743,9 @@ static HRESULT WINAPI domcomment_replaceData(
IXMLDOMComment *iface,
LONG offset, LONG count, BSTR p)
{
domcomment *This = impl_from_IXMLDOMComment( iface );
HRESULT hr;
TRACE("(%p)->(%d %d %s)\n", This, offset, count, debugstr_w(p));
TRACE("%p, %ld, %ld, %s.\n", iface, offset, count, debugstr_w(p));
hr = IXMLDOMComment_deleteData(iface, offset, count);
@@ -838,7 +826,7 @@ IUnknown* create_comment( xmlNodePtr comment )
{
domcomment *This;
This = heap_alloc( sizeof *This );
This = malloc(sizeof(*This));
if ( !This )
return NULL;
@@ -849,5 +837,3 @@ IUnknown* create_comment( xmlNodePtr comment )
return (IUnknown*)&This->IXMLDOMComment_iface;
}
#endif
+2 -2
View File
@@ -200,7 +200,7 @@
</xsd:annotation>
<xsd:restriction base="xsd:decimal">
<xsd:pattern value="([0-9]{,14})([.][0-9]{,4})?"/>
<xsd:pattern value="([0-9]{0,14})([.][0-9]{0,4})?"/>
</xsd:restriction>
</xsd:simpleType>
@@ -539,7 +539,7 @@
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:pattern value="([0-9A-Fa-f]{4})([-]{,1}[0-9A-Fa-f]{4})*"/>
<xsd:pattern value="([0-9A-Fa-f]{4})([-]{0,1}[0-9A-Fa-f]{4})*"/>
</xsd:restriction>
</xsd:simpleType>
+46 -69
View File
@@ -18,30 +18,18 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
#endif
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
#include "ole2.h"
#include "msxml6.h"
#include "msxml6did.h"
#include "wininet.h"
#include "urlmon.h"
#include "winreg.h"
#include "shlwapi.h"
#ifdef __REACTOS__
#include <ole2.h>
#endif
#include "msxml2.h"
#include "msxml2did.h"
#include "dispex.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "msxml_private.h"
#include "msxml_dispex.h"
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
@@ -54,7 +42,6 @@ static CRITICAL_SECTION_DEBUG cs_dispex_static_data_dbg =
};
static CRITICAL_SECTION cs_dispex_static_data = { &cs_dispex_static_data_dbg, -1, 0, 0, 0, 0 };
enum lib_version_t
{
LibXml = 0,
@@ -97,7 +84,7 @@ static lib_id_t lib_ids[] = {
};
static tid_id_t tid_ids[] = {
{ &IID_NULL, LibXml_Last },
{ &IID_NULL, LibXml2 },
{ &IID_IXMLDOMAttribute, LibXml2 },
{ &IID_IXMLDOMCDATASection, LibXml2 },
{ &IID_IXMLDOMComment, LibXml2 },
@@ -157,7 +144,7 @@ static HRESULT get_typelib(unsigned lib, ITypeLib **tl)
if(!typelib[lib]) {
hres = LoadRegTypeLib(lib_ids[lib].iid, lib_ids[lib].major, 0, LOCALE_SYSTEM_DEFAULT, tl);
if(FAILED(hres)) {
ERR("LoadRegTypeLib failed: %08x\n", hres);
ERR("LoadRegTypeLib failed, hr %#lx.\n", hres);
return hres;
}
@@ -188,7 +175,7 @@ HRESULT get_typeinfo(enum tid_t tid, ITypeInfo **typeinfo)
return hres;
hres = ITypeLib_GetTypeInfoOfGuid(typelib, get_riid_from_tid(tid), &ti);
if(FAILED(hres)) {
ERR("GetTypeInfoOfGuid failed: %08x\n", hres);
ERR("GetTypeInfoOfGuid failed, hr %#lx.\n", hres);
return hres;
}
}
@@ -215,9 +202,9 @@ void release_typelib(void)
for(i=0; i < iter->func_cnt; i++)
SysFreeString(iter->funcs[i].name);
heap_free(iter->funcs);
heap_free(iter->name_table);
heap_free(iter);
free(iter->funcs);
free(iter->name_table);
free(iter);
}
for(i=0; i < ARRAY_SIZE(typeinfos); i++)
@@ -239,7 +226,7 @@ static void add_func_info(dispex_data_t *data, DWORD *size, tid_t tid, DISPID id
return;
if(data->func_cnt == *size)
data->funcs = heap_realloc(data->funcs, (*size <<= 1)*sizeof(func_info_t));
data->funcs = realloc(data->funcs, (*size <<= 1) * sizeof(func_info_t));
hres = ITypeInfo_GetDocumentation(dti, id, &data->funcs[data->func_cnt].name, NULL, NULL, NULL);
if(FAILED(hres))
@@ -251,14 +238,14 @@ static void add_func_info(dispex_data_t *data, DWORD *size, tid_t tid, DISPID id
data->func_cnt++;
}
static int dispid_cmp(const void *p1, const void *p2)
static int __cdecl dispid_cmp(const void *p1, const void *p2)
{
return ((const func_info_t*)p1)->id - ((const func_info_t*)p2)->id;
}
static int func_name_cmp(const void *p1, const void *p2)
static int __cdecl func_name_cmp(const void *p1, const void *p2)
{
return strcmpiW((*(func_info_t* const*)p1)->name, (*(func_info_t* const*)p2)->name);
return lstrcmpiW((*(func_info_t* const*)p1)->name, (*(func_info_t* const*)p2)->name);
}
static dispex_data_t *preprocess_dispex_data(DispatchEx *This)
@@ -274,13 +261,13 @@ static dispex_data_t *preprocess_dispex_data(DispatchEx *This)
hres = get_typeinfo(This->data->disp_tid, &dti);
if(FAILED(hres)) {
ERR("Could not get disp type info: %08x\n", hres);
ERR("Could not get disp type info, hr %#lx.\n", hres);
return NULL;
}
data = heap_alloc(sizeof(dispex_data_t));
data = malloc(sizeof(dispex_data_t));
data->func_cnt = 0;
data->funcs = heap_alloc(size*sizeof(func_info_t));
data->funcs = malloc(size * sizeof(func_info_t));
list_add_tail(&dispex_data_list, &data->entry);
while(*tid) {
@@ -303,16 +290,16 @@ static dispex_data_t *preprocess_dispex_data(DispatchEx *This)
}
if(!data->func_cnt) {
heap_free(data->funcs);
free(data->funcs);
data->funcs = NULL;
}else if(data->func_cnt != size) {
data->funcs = heap_realloc(data->funcs, data->func_cnt * sizeof(func_info_t));
data->funcs = realloc(data->funcs, data->func_cnt * sizeof(func_info_t));
}
qsort(data->funcs, data->func_cnt, sizeof(func_info_t), dispid_cmp);
if(data->funcs) {
data->name_table = heap_alloc(data->func_cnt * sizeof(func_info_t*));
qsort(data->funcs, data->func_cnt, sizeof(func_info_t), dispid_cmp);
data->name_table = malloc(data->func_cnt * sizeof(func_info_t*));
for(i=0; i < data->func_cnt; i++)
data->name_table[i] = data->funcs+i;
qsort(data->name_table, data->func_cnt, sizeof(func_info_t*), func_name_cmp);
@@ -378,26 +365,25 @@ static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pcti
static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
LCID lcid, ITypeInfo **ppTInfo)
{
DispatchEx *This = impl_from_IDispatchEx(iface);
DispatchEx *dispex = impl_from_IDispatchEx(iface);
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
TRACE("%p, %u, %lx, %p.\n", iface, iTInfo, lcid, ppTInfo);
return get_typeinfo(This->data->disp_tid, ppTInfo);
return get_typeinfo(dispex->data->disp_tid, ppTInfo);
}
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
LPOLESTR *rgszNames, UINT cNames,
LCID lcid, DISPID *rgDispId)
{
DispatchEx *This = impl_from_IDispatchEx(iface);
UINT i;
HRESULT hres;
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
TRACE("%p, %s, %p, %u, %lx, %p.\n", iface, debugstr_guid(riid), rgszNames, cNames,
lcid, rgDispId);
for(i=0; i < cNames; i++) {
hres = IDispatchEx_GetDispID(&This->IDispatchEx_iface, rgszNames[i], 0, rgDispId+i);
hres = IDispatchEx_GetDispID(iface, rgszNames[i], 0, rgDispId+i);
if(FAILED(hres))
return hres;
}
@@ -409,13 +395,10 @@ static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
DispatchEx *This = impl_from_IDispatchEx(iface);
TRACE("(%p)->(%x %s %x %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
TRACE("%p, %ld, %s, %lx, %x, %p, %p, %p, %p.\n", iface, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
return IDispatchEx_InvokeEx(&This->IDispatchEx_iface, dispIdMember, lcid, wFlags,
pDispParams, pVarResult, pExcepInfo, NULL);
return IDispatchEx_InvokeEx(iface, dispIdMember, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, NULL);
}
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
@@ -424,10 +407,10 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW
dispex_data_t *data;
int min, max, n, c;
TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid);
TRACE("%p, %s, %lx, %p.\n", iface, debugstr_w(bstrName), grfdex, pid);
if(grfdex & ~(fdexNameCaseSensitive|fdexNameEnsure|fdexNameImplicit))
FIXME("Unsupported grfdex %x\n", grfdex);
FIXME("Unsupported grfdex %lx.\n", grfdex);
data = get_dispex_data(This);
if(!data)
@@ -439,9 +422,9 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW
while(min <= max) {
n = (min+max)/2;
c = strcmpiW(data->name_table[n]->name, bstrName);
c = lstrcmpiW(data->name_table[n]->name, bstrName);
if(!c) {
if((grfdex & fdexNameCaseSensitive) && strcmpW(data->name_table[n]->name, bstrName))
if((grfdex & fdexNameCaseSensitive) && wcscmp(data->name_table[n]->name, bstrName))
break;
*pid = data->name_table[n]->id;
@@ -501,7 +484,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
int min, max, n;
HRESULT hres;
TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
TRACE("%p, %ld, %lx, %x, %p, %p, %p, %p.\n", iface, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
if(This->data->vtbl && This->data->vtbl->invoke) {
hres = This->data->vtbl->invoke(This->outer, id, lcid, wFlags, pdp, pvarRes, pei);
@@ -533,19 +516,19 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
}
if(min > max) {
WARN("invalid id %x\n", id);
WARN("invalid id %lx.\n", id);
return DISP_E_UNKNOWNNAME;
}
hres = get_typeinfo(data->funcs[n].tid, &ti);
if(FAILED(hres)) {
ERR("Could not get type info: %08x\n", hres);
ERR("Could not get type info, hr %#lx.\n", hres);
return hres;
}
hres = IUnknown_QueryInterface(This->outer, get_riid_from_tid(data->funcs[n].tid), (void**)&unk);
if(FAILED(hres)) {
ERR("Could not get iface: %08x\n", hres);
ERR("Could not get interface, hr %#lx.\n", hres);
ITypeInfo_Release(ti);
return E_FAIL;
}
@@ -561,43 +544,37 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
{
DispatchEx *This = impl_from_IDispatchEx(iface);
TRACE("Not implemented in native msxml3 (%p)->(%s %x)\n", This, debugstr_w(bstrName), grfdex);
TRACE("%p, %s, %lx.\n", iface, debugstr_w(bstrName), grfdex);
return E_NOTIMPL;
}
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
{
DispatchEx *This = impl_from_IDispatchEx(iface);
TRACE("Not implemented in native msxml3 (%p)->(%x)\n", This, id);
TRACE("%p, %ld.\n", iface, id);
return E_NOTIMPL;
}
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
{
DispatchEx *This = impl_from_IDispatchEx(iface);
TRACE("Not implemented in native msxml3 (%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex);
TRACE("%p, %ld, %lx, %p.\n", iface, id, grfdexFetch, pgrfdex);
return E_NOTIMPL;
}
static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
{
DispatchEx *This = impl_from_IDispatchEx(iface);
TRACE("Not implemented in native msxml3 (%p)->(%x %p)\n", This, id, pbstrName);
TRACE("%p, %ld, %p.\n", iface, id, pbstrName);
return E_NOTIMPL;
}
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
{
DispatchEx *This = impl_from_IDispatchEx(iface);
TRACE(" Not implemented in native msxml3 (%p)->(%x %x %p)\n", This, grfdex, id, pid);
TRACE("%p, %lx, %ld, %p.\n", iface, grfdex, id, pid);
return E_NOTIMPL;
}
static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
{
DispatchEx *This = impl_from_IDispatchEx(iface);
TRACE("Not implemented in native msxml3 (%p)->(%p)\n", This, ppunk);
TRACE("%p, %p.\n", iface, ppunk);
return E_NOTIMPL;
}
+15 -24
View File
@@ -20,13 +20,9 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
#endif
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include "windef.h"
#include "winbase.h"
@@ -38,8 +34,6 @@
#include "wine/debug.h"
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
typedef struct _domfrag
@@ -94,26 +88,25 @@ static HRESULT WINAPI domfrag_QueryInterface(
return S_OK;
}
static ULONG WINAPI domfrag_AddRef(
IXMLDOMDocumentFragment *iface )
static ULONG WINAPI domfrag_AddRef(IXMLDOMDocumentFragment *iface)
{
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
domfrag *domfrag = impl_from_IXMLDOMDocumentFragment(iface);
ULONG ref = InterlockedIncrement(&domfrag->ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
static ULONG WINAPI domfrag_Release(
IXMLDOMDocumentFragment *iface )
static ULONG WINAPI domfrag_Release(IXMLDOMDocumentFragment *iface)
{
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
ULONG ref = InterlockedDecrement( &This->ref );
domfrag *domfrag = impl_from_IXMLDOMDocumentFragment(iface);
ULONG ref = InterlockedDecrement(&domfrag->ref);
TRACE("(%p)->(%d)\n", This, ref);
if ( ref == 0 )
TRACE("%p, refcount %lu.\n", iface, ref);
if (!ref)
{
destroy_xmlnode(&This->node);
heap_free( This );
destroy_xmlnode(&domfrag->node);
free(domfrag);
}
return ref;
@@ -588,7 +581,7 @@ IUnknown* create_doc_fragment( xmlNodePtr fragment )
{
domfrag *This;
This = heap_alloc( sizeof *This );
This = malloc(sizeof(*This));
if ( !This )
return NULL;
@@ -599,5 +592,3 @@ IUnknown* create_doc_fragment( xmlNodePtr fragment )
return (IUnknown*)&This->IXMLDOMDocumentFragment_iface;
}
#endif
+15 -24
View File
@@ -20,13 +20,9 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
#endif
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include "windef.h"
#include "winbase.h"
@@ -39,8 +35,6 @@
#include "wine/debug.h"
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
typedef struct _domdoctype
@@ -86,26 +80,25 @@ static HRESULT WINAPI domdoctype_QueryInterface(
return S_OK;
}
static ULONG WINAPI domdoctype_AddRef(
IXMLDOMDocumentType *iface )
static ULONG WINAPI domdoctype_AddRef(IXMLDOMDocumentType *iface)
{
domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
domdoctype *doctype = impl_from_IXMLDOMDocumentType(iface);
LONG ref = InterlockedIncrement(&doctype->ref);
TRACE("%p, refcount %ld.\n", iface, ref);
return ref;
}
static ULONG WINAPI domdoctype_Release(
IXMLDOMDocumentType *iface )
static ULONG WINAPI domdoctype_Release(IXMLDOMDocumentType *iface)
{
domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
ULONG ref = InterlockedDecrement(&This->ref);
domdoctype *doctype = impl_from_IXMLDOMDocumentType(iface);
ULONG ref = InterlockedDecrement(&doctype->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %ld.\n", iface, ref);
if(!ref) {
destroy_xmlnode(&This->node);
heap_free(This);
if (!ref)
{
destroy_xmlnode(&doctype->node);
free(doctype);
}
return ref;
@@ -577,7 +570,7 @@ IUnknown* create_doc_type( xmlNodePtr doctype )
{
domdoctype *This;
This = heap_alloc( sizeof *This );
This = malloc(sizeof(*This));
if ( !This )
return NULL;
@@ -589,5 +582,3 @@ IUnknown* create_doc_type( xmlNodePtr doctype )
return (IUnknown*)&This->IXMLDOMDocumentType_iface;
}
#endif
+236 -145
View File
@@ -21,18 +21,14 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#include <assert.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
# include <libxml/xpathInternals.h>
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include <libxml/xpathInternals.h>
# include <libxml/xmlsave.h>
# include <libxml/SAX2.h>
# include <libxml/parserInternals.h>
#endif
#include <libxml/SAX2.h>
#include <libxml/parserInternals.h>
#include "windef.h"
#include "winbase.h"
@@ -51,19 +47,8 @@
#include "msxml_private.h"
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
/* not defined in older versions */
#define XML_SAVE_FORMAT 1
#define XML_SAVE_NO_DECL 2
#define XML_SAVE_NO_EMPTY 4
#define XML_SAVE_NO_XHTML 8
#define XML_SAVE_XHTML 16
#define XML_SAVE_AS_XML 32
#define XML_SAVE_AS_HTML 64
static const WCHAR PropertySelectionLanguageW[] = {'S','e','l','e','c','t','i','o','n','L','a','n','g','u','a','g','e',0};
static const WCHAR PropertySelectionNamespacesW[] = {'S','e','l','e','c','t','i','o','n','N','a','m','e','s','p','a','c','e','s',0};
static const WCHAR PropertyProhibitDTDW[] = {'P','r','o','h','i','b','i','t','D','T','D',0};
@@ -74,14 +59,18 @@ static const WCHAR PropertyResolveExternalsW[] = {'R','e','s','o','l','v','e','E
static const WCHAR PropertyAllowXsltScriptW[] = {'A','l','l','o','w','X','s','l','t','S','c','r','i','p','t',0};
static const WCHAR PropertyAllowDocumentFunctionW[] = {'A','l','l','o','w','D','o','c','u','m','e','n','t','F','u','n','c','t','i','o','n',0};
static const WCHAR PropertyNormalizeAttributeValuesW[] = {'N','o','r','m','a','l','i','z','e','A','t','t','r','i','b','u','t','e','V','a','l','u','e','s',0};
static const WCHAR PropertyValidateOnParse[] = L"ValidateOnParse";
static const WCHAR PropertyMaxElementDepth[] = L"MaxElementDepth";
/* Anything that passes the test_get_ownerDocument()
* tests can go here (data shared between all instances).
* We need to preserve this when reloading a document,
* and also need access to it from the libxml backend. */
typedef struct {
LONG refs;
MSXML_VERSION version;
VARIANT_BOOL preserving;
VARIANT_BOOL validating;
IXMLDOMSchemaCollection2* schemaCache;
struct list selectNsList;
xmlChar const* selectNsStr;
@@ -128,13 +117,13 @@ struct domdoc
IConnectionPointContainer IConnectionPointContainer_iface;
LONG ref;
VARIANT_BOOL async;
VARIANT_BOOL validating;
VARIANT_BOOL resolving;
domdoc_properties* properties;
HRESULT error;
/* IObjectWithSite */
IUnknown *site;
IUri *base_uri;
/* IObjectSafety */
DWORD safeopt;
@@ -265,7 +254,7 @@ static inline void clear_selectNsList(struct list* pNsList)
select_ns_entry *ns, *ns2;
LIST_FOR_EACH_ENTRY_SAFE( ns, ns2, pNsList, select_ns_entry, entry )
{
heap_free( ns );
free(ns);
}
list_init(pNsList);
}
@@ -273,7 +262,7 @@ static inline void clear_selectNsList(struct list* pNsList)
static xmldoc_priv * create_priv(void)
{
xmldoc_priv *priv;
priv = heap_alloc( sizeof (*priv) );
priv = malloc(sizeof(*priv));
if (priv)
{
@@ -287,12 +276,14 @@ static xmldoc_priv * create_priv(void)
static domdoc_properties *create_properties(MSXML_VERSION version)
{
domdoc_properties *properties = heap_alloc(sizeof(domdoc_properties));
domdoc_properties *properties = malloc(sizeof(domdoc_properties));
properties->refs = 1;
list_init(&properties->selectNsList);
properties->preserving = VARIANT_FALSE;
properties->validating = VARIANT_TRUE;
properties->schemaCache = NULL;
properties->selectNsStr = heap_alloc_zero(sizeof(xmlChar));
properties->selectNsStr = calloc(1, sizeof(xmlChar));
properties->selectNsStr_len = 0;
/* properties that are dependent on object versions */
@@ -307,7 +298,7 @@ static domdoc_properties *create_properties(MSXML_VERSION version)
static domdoc_properties* copy_properties(domdoc_properties const* properties)
{
domdoc_properties* pcopy = heap_alloc(sizeof(domdoc_properties));
domdoc_properties* pcopy = malloc(sizeof(domdoc_properties));
select_ns_entry const* ns = NULL;
select_ns_entry* new_ns = NULL;
int len = (properties->selectNsStr_len+1)*sizeof(xmlChar);
@@ -315,21 +306,23 @@ static domdoc_properties* copy_properties(domdoc_properties const* properties)
if (pcopy)
{
pcopy->refs = 1;
pcopy->version = properties->version;
pcopy->preserving = properties->preserving;
pcopy->validating = properties->validating;
pcopy->schemaCache = properties->schemaCache;
if (pcopy->schemaCache)
IXMLDOMSchemaCollection2_AddRef(pcopy->schemaCache);
pcopy->XPath = properties->XPath;
pcopy->selectNsStr_len = properties->selectNsStr_len;
list_init( &pcopy->selectNsList );
pcopy->selectNsStr = heap_alloc(len);
pcopy->selectNsStr = malloc(len);
memcpy((xmlChar*)pcopy->selectNsStr, properties->selectNsStr, len);
offset = pcopy->selectNsStr - properties->selectNsStr;
LIST_FOR_EACH_ENTRY( ns, (&properties->selectNsList), select_ns_entry, entry )
{
new_ns = heap_alloc(sizeof(select_ns_entry));
new_ns = malloc(sizeof(select_ns_entry));
memcpy(new_ns, ns, sizeof(select_ns_entry));
new_ns->href += offset;
new_ns->prefix += offset;
@@ -344,17 +337,39 @@ static domdoc_properties* copy_properties(domdoc_properties const* properties)
return pcopy;
}
static void free_properties(domdoc_properties* properties)
static domdoc_properties * properties_add_ref(domdoc_properties *properties)
{
if (properties)
LONG ref;
if (!properties) return NULL;
ref = InterlockedIncrement(&properties->refs);
TRACE("%p, %ld.\n", properties, ref);
return properties;
}
static void properties_release(domdoc_properties *properties)
{
LONG ref;
if (!properties) return;
ref = InterlockedDecrement(&properties->refs);
TRACE("%p, %ld.\n", properties, ref);
if (ref < 0)
WARN("negative refcount, expect troubles\n");
if (ref == 0)
{
if (properties->schemaCache)
IXMLDOMSchemaCollection2_Release(properties->schemaCache);
clear_selectNsList(&properties->selectNsList);
heap_free((xmlChar*)properties->selectNsStr);
free((xmlChar*)properties->selectNsStr);
if (properties->uri)
IUri_Release(properties->uri);
heap_free(properties);
free(properties);
}
}
@@ -479,13 +494,14 @@ static void LIBXML2_LOG_CALLBACK sax_warning(void* ctx, char const* msg, ...)
va_end(ap);
}
static void sax_serror(void* ctx, xmlErrorPtr err)
static void sax_serror(void* ctx, const xmlError* err)
{
LIBXML2_CALLBACK_SERROR(doparse, err);
}
static xmlDocPtr doparse(domdoc* This, char const* ptr, int len, xmlCharEncoding encoding)
{
char *ctx_encoding;
xmlDocPtr doc = NULL;
xmlParserCtxtPtr pctx;
static xmlSAXHandler sax_handler = {
@@ -550,6 +566,8 @@ static xmlDocPtr doparse(domdoc* This, char const* ptr, int len, xmlCharEncoding
pctx->myDoc = NULL;
}
pctx->sax = NULL;
ctx_encoding = (char *)pctx->encoding;
pctx->encoding = NULL;
xmlFreeParserCtxt(pctx);
/* TODO: put this in one of the SAX callbacks */
@@ -566,9 +584,9 @@ static xmlDocPtr doparse(domdoc* This, char const* ptr, int len, xmlCharEncoding
sprintf(buff, "version=\"%s\"", doc->version ? (char*)doc->version : "1.0");
xmlNodeAddContent( node, xmlbuff );
if (doc->encoding)
if (ctx_encoding)
{
sprintf(buff, " encoding=\"%s\"", doc->encoding);
sprintf(buff, " encoding=\"%s\"", ctx_encoding);
xmlNodeAddContent( node, xmlbuff );
}
@@ -581,6 +599,7 @@ static xmlDocPtr doparse(domdoc* This, char const* ptr, int len, xmlCharEncoding
xmldoc_link_xmldecl( doc, node );
}
xmlFree( ctx_encoding );
return doc;
}
@@ -593,7 +612,7 @@ void xmldoc_init(xmlDocPtr doc, MSXML_VERSION version)
LONG xmldoc_add_refs(xmlDocPtr doc, LONG refs)
{
LONG ref = InterlockedExchangeAdd(&priv_from_xmlDocPtr(doc)->refs, refs) + refs;
TRACE("(%p)->(%d)\n", doc, ref);
TRACE("%p, refcount %ld.\n", doc, ref);
return ref;
}
@@ -606,7 +625,8 @@ LONG xmldoc_release_refs(xmlDocPtr doc, LONG refs)
{
xmldoc_priv *priv = priv_from_xmlDocPtr(doc);
LONG ref = InterlockedExchangeAdd(&priv->refs, -refs) - refs;
TRACE("(%p)->(%d)\n", doc, ref);
TRACE("%p, refcount %ld.\n", doc, ref);
if (ref < 0)
WARN("negative refcount, expect troubles\n");
@@ -619,10 +639,10 @@ LONG xmldoc_release_refs(xmlDocPtr doc, LONG refs)
LIST_FOR_EACH_ENTRY_SAFE( orphan, orphan2, &priv->orphans, orphan_entry, entry )
{
xmlFreeNode( orphan->node );
heap_free( orphan );
free( orphan );
}
free_properties(priv->properties);
heap_free(doc->_private);
properties_release(priv->properties);
free(doc->_private);
xmlFreeDoc(doc);
}
@@ -640,7 +660,7 @@ HRESULT xmldoc_add_orphan(xmlDocPtr doc, xmlNodePtr node)
xmldoc_priv *priv = priv_from_xmlDocPtr(doc);
orphan_entry *entry;
entry = heap_alloc( sizeof (*entry) );
entry = malloc(sizeof(*entry));
if(!entry)
return E_OUTOFMEMORY;
@@ -659,7 +679,7 @@ HRESULT xmldoc_remove_orphan(xmlDocPtr doc, xmlNodePtr node)
if( entry->node == node )
{
list_remove( &entry->entry );
heap_free( entry );
free( entry );
return S_OK;
}
}
@@ -678,10 +698,16 @@ static HRESULT attach_xmldoc(domdoc *This, xmlDocPtr xml )
if(This->node.node)
{
properties_release(properties_from_xmlDocPtr(get_doc(This)));
priv_from_xmlDocPtr(get_doc(This))->properties = NULL;
if (xmldoc_release(get_doc(This)) != 0)
{
/* The xmlDocPtr object can no longer use the properties of this
* domdoc object. So give it its own copy.
*/
priv_from_xmlDocPtr(get_doc(This))->properties =
copy_properties(This->properties);
}
}
This->node.node = (xmlNodePtr) xml;
@@ -689,7 +715,10 @@ static HRESULT attach_xmldoc(domdoc *This, xmlDocPtr xml )
if(This->node.node)
{
xmldoc_add_ref(get_doc(This));
priv_from_xmlDocPtr(get_doc(This))->properties = This->properties;
/* Only attach new xmlDocPtr objects, i.e. ones for which properties
* is still NULL.
*/
priv_from_xmlDocPtr(get_doc(This))->properties = properties_add_ref(This->properties);
}
return S_OK;
@@ -789,20 +818,24 @@ static HRESULT domdoc_load_from_stream(domdoc *doc, ISequentialStream *stream)
if (FAILED(hr))
{
ERR("failed to copy stream 0x%08x\n", hr);
ERR("failed to copy stream, hr %#lx.\n", hr);
IStream_Release(hstream);
return hr;
}
hr = GetHGlobalFromStream(hstream, &hglobal);
if (FAILED(hr))
{
IStream_Release(hstream);
return hr;
}
len = GlobalSize(hglobal);
ptr = GlobalLock(hglobal);
if (len)
xmldoc = doparse(doc, ptr, len, XML_CHAR_ENCODING_NONE);
GlobalUnlock(hglobal);
IStream_Release(hstream);
if (!xmldoc)
{
@@ -824,7 +857,7 @@ static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, IStream
if (!stream)
return E_INVALIDARG;
return domdoc_load_from_stream(This, (ISequentialStream*)stream);
return This->error = domdoc_load_from_stream(This, (ISequentialStream*)stream);
}
static HRESULT WINAPI PersistStreamInit_Save(
@@ -845,7 +878,7 @@ static HRESULT WINAPI PersistStreamInit_Save(
SysFreeString(xmlString);
}
TRACE("ret 0x%08x\n", hr);
TRACE("hr %#lx.\n", hr);
return hr;
}
@@ -944,9 +977,9 @@ static HRESULT WINAPI domdoc_QueryInterface( IXMLDOMDocument3 *iface, REFIID rii
static ULONG WINAPI domdoc_AddRef( IXMLDOMDocument3 *iface )
{
domdoc *This = impl_from_IXMLDOMDocument3( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref );
domdoc *doc = impl_from_IXMLDOMDocument3(iface);
ULONG ref = InterlockedIncrement(&doc->ref);
TRACE("%p, refcount %ld.\n", iface, ref);
return ref;
}
@@ -955,21 +988,24 @@ static ULONG WINAPI domdoc_Release( IXMLDOMDocument3 *iface )
domdoc *This = impl_from_IXMLDOMDocument3( iface );
LONG ref = InterlockedDecrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref );
TRACE("%p, refcount %ld.\n", iface, ref);
if ( ref == 0 )
if (!ref)
{
int eid;
if (This->site)
IUnknown_Release( This->site );
if (This->base_uri)
IUri_Release( This->base_uri );
destroy_xmlnode(&This->node);
for (eid = 0; eid < EVENTID_LAST; eid++)
if (This->events[eid]) IDispatch_Release(This->events[eid]);
properties_release(This->properties);
release_namespaces(This);
heap_free(This);
free(This);
}
return ref;
@@ -1168,6 +1204,8 @@ static HRESULT WINAPI domdoc_insertBefore(
TRACE("(%p)->(%p %s %p)\n", This, newChild, debugstr_variant(&refChild), outNewChild);
if (!newChild) return E_INVALIDARG;
hr = IXMLDOMNode_get_nodeType(newChild, &type);
if (hr != S_OK) return hr;
@@ -1517,8 +1555,10 @@ static HRESULT WINAPI domdoc_transformNodeToObject(
case VT_UNKNOWN:
case VT_DISPATCH:
{
ISequentialStream *stream;
IXMLDOMDocument *doc;
HRESULT hr;
BSTR str;
if (!V_UNKNOWN(&output))
return E_INVALIDARG;
@@ -1528,7 +1568,6 @@ static HRESULT WINAPI domdoc_transformNodeToObject(
if (IUnknown_QueryInterface(V_UNKNOWN(&output), &IID_IXMLDOMDocument, (void **)&doc) == S_OK)
{
VARIANT_BOOL b;
BSTR str;
if (FAILED(hr = node_transform_node(&This->node, stylesheet, &str)))
return hr;
@@ -1537,6 +1576,12 @@ static HRESULT WINAPI domdoc_transformNodeToObject(
SysFreeString(str);
return hr;
}
else if (IUnknown_QueryInterface(V_UNKNOWN(&output), &IID_ISequentialStream, (void**)&stream) == S_OK)
{
hr = node_transform_node_params(&This->node, stylesheet, NULL, stream, NULL);
ISequentialStream_Release(stream);
return hr;
}
else
{
FIXME("Unsupported destination type.\n");
@@ -1591,9 +1636,7 @@ static HRESULT WINAPI domdoc_get_implementation(
if(!impl)
return E_INVALIDARG;
*impl = (IXMLDOMImplementation*)create_doc_Implementation();
return S_OK;
return create_dom_implementation(impl);
}
static HRESULT WINAPI domdoc_get_documentElement(
@@ -1841,13 +1884,10 @@ static HRESULT WINAPI domdoc_createProcessingInstruction(
hr = IXMLDOMDocument3_createNode(iface, type, target, NULL, &node);
if (hr == S_OK)
{
xmlnode *node_obj;
/* this is to bypass check in ::put_data() that blocks "<?xml" PIs */
node_obj = get_node_obj(node);
hr = node_set_content(node_obj, data);
IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMProcessingInstruction, (void**)pi);
hr = dom_pi_put_xml_decl(node, data);
if (SUCCEEDED(hr))
hr = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMProcessingInstruction, (void**)pi);
IXMLDOMNode_Release(node);
}
@@ -2091,12 +2131,7 @@ static HRESULT WINAPI domdoc_createNode(
xmlnode = xmlNewReference(get_doc(This), xml_name);
break;
case NODE_PROCESSING_INSTRUCTION:
#ifdef HAVE_XMLNEWDOCPI
xmlnode = xmlNewDocPI(get_doc(This), xml_name, NULL);
#else
FIXME("xmlNewDocPI() not supported, use libxml2 2.6.15 or greater\n");
xmlnode = NULL;
#endif
break;
case NODE_COMMENT:
xmlnode = xmlNewDocComment(get_doc(This), NULL);
@@ -2109,7 +2144,7 @@ static HRESULT WINAPI domdoc_createNode(
case NODE_DOCUMENT_TYPE:
case NODE_ENTITY:
case NODE_NOTATION:
heap_free(xml_name);
free(xml_name);
return E_INVALIDARG;
default:
FIXME("unhandled node type %d\n", node_type);
@@ -2118,8 +2153,8 @@ static HRESULT WINAPI domdoc_createNode(
}
*node = create_node(xmlnode);
heap_free(xml_name);
heap_free(href);
free(xml_name);
free(href);
if(*node)
{
@@ -2214,7 +2249,7 @@ static HRESULT WINAPI domdoc_load(
if (FAILED(hr))
{
This->error = hr;
WARN("failed to access array data, 0x%08x\n", hr);
WARN("failed to access array data, hr %#lx.\n", hr);
break;
}
SafeArrayGetUBound(psa, 1, &len);
@@ -2276,14 +2311,14 @@ static HRESULT WINAPI domdoc_load(
if (hr == S_OK)
{
hr = domdoc_load_from_stream(This, stream);
hr = This->error = domdoc_load_from_stream(This, stream);
if (hr == S_OK)
*isSuccessful = VARIANT_TRUE;
ISequentialStream_Release(stream);
return hr;
}
FIXME("unsupported IUnknown type (0x%08x) (%p)\n", hr, V_UNKNOWN(&source)->lpVtbl);
FIXME("unsupported IUnknown type (%#lx) (%p)\n", hr, V_UNKNOWN(&source)->lpVtbl);
break;
}
default:
@@ -2301,7 +2336,7 @@ static HRESULT WINAPI domdoc_load(
This->properties->uri = NULL;
}
hr = create_uri(filename, &uri);
hr = create_uri(This->base_uri, filename, &uri);
if (SUCCEEDED(hr))
hr = CreateURLMonikerEx2(NULL, uri, &mon, 0);
if ( SUCCEEDED(hr) )
@@ -2333,7 +2368,7 @@ static HRESULT WINAPI domdoc_load(
hr = S_FALSE;
}
TRACE("ret (%d)\n", hr);
TRACE("hr %#lx.\n", hr);
return hr;
}
@@ -2447,9 +2482,9 @@ static HRESULT WINAPI domdoc_loadXML(
/* skip leading spaces if needed */
if (This->properties->version == MSXML_DEFAULT || This->properties->version == MSXML26)
while (*ptr && isspaceW(*ptr)) ptr++;
while (*ptr && iswspace(*ptr)) ptr++;
xmldoc = doparse(This, (char*)ptr, strlenW(ptr)*sizeof(WCHAR), XML_CHAR_ENCODING_UTF16LE);
xmldoc = doparse(This, (char*)ptr, lstrlenW(ptr)*sizeof(WCHAR), XML_CHAR_ENCODING_UTF16LE);
if ( !xmldoc )
{
This->error = E_FAIL;
@@ -2498,10 +2533,10 @@ static int XMLCALL domdoc_stream_save_writecallback(void *ctx, const char *buffe
HRESULT hr;
hr = IStream_Write((IStream*)ctx, buffer, len, &written);
TRACE("0x%08x %p %d %u\n", hr, buffer, len, written);
TRACE("hr %#lx, %p, %d, %lu.\n", hr, buffer, len, written);
if (hr != S_OK)
{
WARN("stream write error: 0x%08x\n", hr);
WARN("stream write error, hr %#lx.\n", hr);
return -1;
}
else
@@ -2514,13 +2549,72 @@ static int XMLCALL domdoc_stream_save_closecallback(void *ctx)
return 0;
}
static char *xmldoc_encoding(IXMLDOMDocument3 *doc)
{
HRESULT hr;
IXMLDOMNode *node;
char *encoding = NULL;
hr = IXMLDOMDocument3_get_firstChild(doc, &node);
if (hr == S_OK)
{
DOMNodeType type;
hr = IXMLDOMNode_get_nodeType(node, &type);
if (hr == S_OK && type == NODE_PROCESSING_INSTRUCTION)
{
IXMLDOMProcessingInstruction *pi;
IXMLDOMNode *item;
IXMLDOMNamedNodeMap *node_map;
hr = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMProcessingInstruction, (void **)&pi);
if (hr == S_OK)
{
hr = IXMLDOMNode_get_attributes(node, &node_map);
if (hr == S_OK)
{
static const WCHAR encodingW[] = {'e','n','c','o','d','i','n','g',0};
BSTR bstr;
bstr = SysAllocString(encodingW);
hr = IXMLDOMNamedNodeMap_getNamedItem(node_map, bstr, &item);
SysFreeString(bstr);
if (hr == S_OK)
{
VARIANT var;
hr = IXMLDOMNode_get_nodeValue(item, &var);
if (hr == S_OK)
{
if (V_VT(&var) == VT_BSTR)
encoding = (char *)xmlchar_from_wchar(V_BSTR(&var));
VariantClear(&var);
}
}
IXMLDOMNamedNodeMap_Release(node_map);
}
IXMLDOMProcessingInstruction_Release(pi);
}
}
IXMLDOMNode_Release(node);
}
if (!encoding && (encoding = malloc(sizeof("UTF-8"))))
strcpy(encoding, "UTF-8");
return encoding;
}
static HRESULT WINAPI domdoc_save(
IXMLDOMDocument3 *iface,
VARIANT destination )
{
domdoc *This = impl_from_IXMLDOMDocument3( iface );
xmlSaveCtxtPtr ctx = NULL;
xmlNodePtr xmldecl;
HRESULT ret = S_OK;
TRACE("(%p)->(%s)\n", This, debugstr_variant(&destination));
@@ -2553,9 +2647,12 @@ static HRESULT WINAPI domdoc_save(
ret = IUnknown_QueryInterface(pUnk, &IID_IStream, (void**)&stream);
if(ret == S_OK)
{
int options = get_doc(This)->standalone == -1 ? XML_SAVE_NO_DECL : 0;
char *encoding = xmldoc_encoding(iface);
TRACE("using encoding %s\n", encoding ? debugstr_a(encoding) : "default");
ctx = xmlSaveToIO(domdoc_stream_save_writecallback,
domdoc_stream_save_closecallback, stream, NULL, options);
domdoc_stream_save_closecallback, stream, encoding, XML_SAVE_NO_DECL);
free(encoding);
if(!ctx)
{
@@ -2569,8 +2666,7 @@ static HRESULT WINAPI domdoc_save(
case VT_BSTR:
case VT_BSTR | VT_BYREF:
{
int options = get_doc(This)->standalone == -1 ? XML_SAVE_NO_DECL : 0;
char *encoding;
/* save with file path */
HANDLE handle = CreateFileW( (V_VT(&destination) & VT_BYREF)? *V_BSTRREF(&destination) : V_BSTR(&destination),
GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
@@ -2580,9 +2676,12 @@ static HRESULT WINAPI domdoc_save(
return E_FAIL;
}
/* disable top XML declaration */
encoding = xmldoc_encoding(iface);
TRACE("using encoding %s\n", encoding ? debugstr_a(encoding) : "default");
ctx = xmlSaveToIO(domdoc_save_writecallback, domdoc_save_closecallback,
handle, NULL, options);
handle, encoding, XML_SAVE_NO_DECL);
free(encoding);
if (!ctx)
{
CloseHandle(handle);
@@ -2596,9 +2695,7 @@ static HRESULT WINAPI domdoc_save(
return S_FALSE;
}
xmldecl = xmldoc_unlink_xmldecl(get_doc(This));
if (xmlSaveDoc(ctx, get_doc(This)) == -1) ret = S_FALSE;
xmldoc_link_xmldecl(get_doc(This), xmldecl);
/* will release resources through close callback */
xmlSaveClose(ctx);
@@ -2611,8 +2708,8 @@ static HRESULT WINAPI domdoc_get_validateOnParse(
VARIANT_BOOL* isValidating )
{
domdoc *This = impl_from_IXMLDOMDocument3( iface );
TRACE("(%p)->(%p: %d)\n", This, isValidating, This->validating);
*isValidating = This->validating;
TRACE("(%p)->(%p: %d)\n", This, isValidating, This->properties->validating);
*isValidating = This->properties->validating;
return S_OK;
}
@@ -2623,7 +2720,7 @@ static HRESULT WINAPI domdoc_put_validateOnParse(
{
domdoc *This = impl_from_IXMLDOMDocument3( iface );
TRACE("(%p)->(%d)\n", This, isValidating);
This->validating = isValidating;
This->properties->validating = isValidating;
return S_OK;
}
@@ -2793,32 +2890,7 @@ static HRESULT WINAPI domdoc_putref_schemas(
static inline BOOL is_wellformed(xmlDocPtr doc)
{
#ifdef HAVE_XMLDOC_PROPERTIES
return doc->properties & XML_DOC_WELLFORMED;
#else
/* Not a full check, but catches the worst violations */
xmlNodePtr child;
int root = 0;
for (child = doc->children; child != NULL; child = child->next)
{
switch (child->type)
{
case XML_ELEMENT_NODE:
if (++root > 1)
return FALSE;
break;
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
return FALSE;
break;
default:
break;
}
}
return root == 1;
#endif
}
static void LIBXML2_LOG_CALLBACK validate_error(void* ctx, char const* msg, ...)
@@ -3004,7 +3076,7 @@ static HRESULT WINAPI domdoc_setProperty(
pNsList = &(This->properties->selectNsList);
clear_selectNsList(pNsList);
heap_free(nsStr);
free(nsStr);
nsStr = xmlchar_from_wchar(bstr);
TRACE("property value: \"%s\"\n", debugstr_w(bstr));
@@ -3030,7 +3102,7 @@ static HRESULT WINAPI domdoc_setProperty(
if (ns_entry)
memset(ns_entry, 0, sizeof(select_ns_entry));
else
ns_entry = heap_alloc_zero(sizeof(select_ns_entry));
ns_entry = calloc(1, sizeof(select_ns_entry));
while (*pTokBegin == ' ')
++pTokBegin;
@@ -3107,19 +3179,30 @@ static HRESULT WINAPI domdoc_setProperty(
continue;
}
}
heap_free(ns_entry);
free(ns_entry);
xmlXPathFreeContext(ctx);
}
VariantClear(&varStr);
return hr;
}
else if (lstrcmpiW(p, PropertyValidateOnParse) == 0)
{
if (This->properties->version < MSXML4)
return E_FAIL;
else
{
This->properties->validating = V_BOOL(&value);
return S_OK;
}
}
else if (lstrcmpiW(p, PropertyProhibitDTDW) == 0 ||
lstrcmpiW(p, PropertyNewParserW) == 0 ||
lstrcmpiW(p, PropertyResolveExternalsW) == 0 ||
lstrcmpiW(p, PropertyAllowXsltScriptW) == 0 ||
lstrcmpiW(p, PropertyNormalizeAttributeValuesW) == 0 ||
lstrcmpiW(p, PropertyAllowDocumentFunctionW) == 0)
lstrcmpiW(p, PropertyAllowDocumentFunctionW) == 0 ||
lstrcmpiW(p, PropertyMaxElementDepth) == 0)
{
/* Ignore */
FIXME("Ignoring property %s, value %s\n", debugstr_w(p), debugstr_variant(&value));
@@ -3163,7 +3246,7 @@ static HRESULT WINAPI domdoc_getProperty(
pNsList = &This->properties->selectNsList;
lenA = This->properties->selectNsStr_len;
lenW = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)nsStr, lenA+1, NULL, 0);
rebuiltStr = heap_alloc(lenW*sizeof(WCHAR));
rebuiltStr = malloc(lenW * sizeof(WCHAR));
MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)nsStr, lenA+1, rebuiltStr, lenW);
cur = rebuiltStr;
/* this is fine because all of the chars that end tokens are ASCII*/
@@ -3182,9 +3265,20 @@ static HRESULT WINAPI domdoc_getProperty(
}
}
V_BSTR(var) = SysAllocString(rebuiltStr);
heap_free(rebuiltStr);
free(rebuiltStr);
return S_OK;
}
else if (lstrcmpiW(p, PropertyValidateOnParse) == 0)
{
if (This->properties->version < MSXML4)
return E_FAIL;
else
{
V_VT(var) = VT_BOOL;
V_BOOL(var) = This->properties->validating;
return S_OK;
}
}
FIXME("Unknown property %s\n", debugstr_w(p));
return E_FAIL;
@@ -3440,11 +3534,11 @@ static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *
break;
if (i == This->sinks_size)
This->sinks = heap_realloc(This->sinks,(++This->sinks_size)*sizeof(*This->sinks));
This->sinks = realloc(This->sinks, (++This->sinks_size) * sizeof(*This->sinks));
}
else
{
This->sinks = heap_alloc(sizeof(*This->sinks));
This->sinks = malloc(sizeof(*This->sinks));
This->sinks_size = 1;
i = 0;
}
@@ -3460,7 +3554,7 @@ static HRESULT WINAPI ConnectionPoint_Unadvise(IConnectionPoint *iface, DWORD co
{
ConnectionPoint *This = impl_from_IConnectionPoint(iface);
TRACE("(%p)->(%d)\n", This, cookie);
TRACE("%p, %ld.\n", iface, cookie);
if (cookie == 0 || cookie > This->sinks_size || !This->sinks[cookie-1].unk)
return CONNECT_E_NOCONNECTION;
@@ -3551,6 +3645,12 @@ static HRESULT WINAPI domdoc_ObjectWithSite_SetSite( IObjectWithSite *iface, IUn
This->site = NULL;
}
if(This->base_uri)
{
IUri_Release(This->base_uri);
This->base_uri = NULL;
}
return S_OK;
}
@@ -3560,6 +3660,7 @@ static HRESULT WINAPI domdoc_ObjectWithSite_SetSite( IObjectWithSite *iface, IUn
IUnknown_Release( This->site );
This->site = punk;
This->base_uri = get_base_uri(This->site);
return S_OK;
}
@@ -3611,13 +3712,14 @@ static HRESULT WINAPI domdoc_Safety_GetInterfaceSafetyOptions(IObjectSafety *ifa
static HRESULT WINAPI domdoc_Safety_SetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid,
DWORD mask, DWORD enabled)
{
domdoc *This = impl_from_IObjectSafety(iface);
TRACE("(%p)->(%s %x %x)\n", This, debugstr_guid(riid), mask, enabled);
domdoc *doc = impl_from_IObjectSafety(iface);
TRACE("%p, %s, %lx, %lx.\n", iface, debugstr_guid(riid), mask, enabled);
if ((mask & ~SAFETY_SUPPORTED_OPTIONS) != 0)
return E_FAIL;
This->safeopt = (This->safeopt & ~mask) | (mask & enabled);
doc->safeopt = (doc->safeopt & ~mask) | (mask & enabled);
return S_OK;
}
@@ -3648,7 +3750,7 @@ HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document)
{
domdoc *doc;
doc = heap_alloc( sizeof (*doc) );
doc = malloc(sizeof(*doc));
if( !doc )
return E_OUTOFMEMORY;
@@ -3659,11 +3761,11 @@ HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document)
doc->IConnectionPointContainer_iface.lpVtbl = &ConnectionPointContainerVtbl;
doc->ref = 1;
doc->async = VARIANT_TRUE;
doc->validating = 0;
doc->resolving = 0;
doc->properties = properties_from_xmlDocPtr(xmldoc);
doc->properties = properties_add_ref(properties_from_xmlDocPtr(xmldoc));
doc->error = S_OK;
doc->site = NULL;
doc->base_uri = NULL;
doc->safeopt = 0;
doc->cp_list = NULL;
doc->namespaces = NULL;
@@ -3683,7 +3785,7 @@ HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document)
return S_OK;
}
HRESULT DOMDocument_create(MSXML_VERSION version, void **ppObj)
HRESULT dom_document_create(MSXML_VERSION version, void **ppObj)
{
xmlDocPtr xmldoc;
HRESULT hr;
@@ -3699,8 +3801,8 @@ HRESULT DOMDocument_create(MSXML_VERSION version, void **ppObj)
hr = get_domdoc_from_xmldoc(xmldoc, (IXMLDOMDocument3**)ppObj);
if(FAILED(hr))
{
free_properties(properties_from_xmlDocPtr(xmldoc));
heap_free(xmldoc->_private);
properties_release(properties_from_xmlDocPtr(xmldoc));
free(xmldoc->_private);
xmlFreeDoc(xmldoc);
return hr;
}
@@ -3721,14 +3823,3 @@ IUnknown* create_domdoc( xmlNodePtr document )
return obj;
}
#else
HRESULT DOMDocument_create(MSXML_VERSION version, void **ppObj)
{
MESSAGE("This program tried to use a DOMDocument object, but\n"
"libxml2 support was not present at compile time.\n");
return E_NOTIMPL;
}
#endif
+42 -50
View File
@@ -20,13 +20,7 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
#endif
#include "windef.h"
#include "winbase.h"
@@ -34,12 +28,10 @@
#include "ole2.h"
#include "msxml6.h"
#include "msxml_private.h"
#include "msxml_dispex.h"
#include "wine/debug.h"
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
typedef struct _domimpl
@@ -54,7 +46,7 @@ static inline domimpl *impl_from_IXMLDOMImplementation( IXMLDOMImplementation *i
return CONTAINING_RECORD(iface, domimpl, IXMLDOMImplementation_iface);
}
static HRESULT WINAPI dimimpl_QueryInterface(
static HRESULT WINAPI domimpl_QueryInterface(
IXMLDOMImplementation *iface,
REFIID riid,
void** ppvObject )
@@ -84,29 +76,28 @@ static HRESULT WINAPI dimimpl_QueryInterface(
return S_OK;
}
static ULONG WINAPI dimimpl_AddRef(
IXMLDOMImplementation *iface )
static ULONG WINAPI domimpl_AddRef(IXMLDOMImplementation *iface)
{
domimpl *This = impl_from_IXMLDOMImplementation( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
domimpl *domimpl = impl_from_IXMLDOMImplementation(iface);
ULONG ref = InterlockedIncrement(&domimpl->ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
static ULONG WINAPI dimimpl_Release(
IXMLDOMImplementation *iface )
static ULONG WINAPI domimpl_Release(IXMLDOMImplementation *iface)
{
domimpl *This = impl_from_IXMLDOMImplementation( iface );
ULONG ref = InterlockedDecrement( &This->ref );
domimpl *domimpl = impl_from_IXMLDOMImplementation(iface);
ULONG ref = InterlockedDecrement(&domimpl->ref);
TRACE("(%p)->(%d)\n", This, ref);
if ( ref == 0 )
heap_free( This );
TRACE("%p, refcount %lu.\n", iface, ref);
if (!ref)
free(domimpl);
return ref;
}
static HRESULT WINAPI dimimpl_GetTypeInfoCount(
static HRESULT WINAPI domimpl_GetTypeInfoCount(
IXMLDOMImplementation *iface,
UINT* pctinfo )
{
@@ -114,7 +105,7 @@ static HRESULT WINAPI dimimpl_GetTypeInfoCount(
return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
}
static HRESULT WINAPI dimimpl_GetTypeInfo(
static HRESULT WINAPI domimpl_GetTypeInfo(
IXMLDOMImplementation *iface,
UINT iTInfo, LCID lcid,
ITypeInfo** ppTInfo )
@@ -124,7 +115,7 @@ static HRESULT WINAPI dimimpl_GetTypeInfo(
iTInfo, lcid, ppTInfo);
}
static HRESULT WINAPI dimimpl_GetIDsOfNames(
static HRESULT WINAPI domimpl_GetIDsOfNames(
IXMLDOMImplementation *iface,
REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispId )
@@ -134,7 +125,7 @@ static HRESULT WINAPI dimimpl_GetIDsOfNames(
riid, rgszNames, cNames, lcid, rgDispId);
}
static HRESULT WINAPI dimimpl_Invoke(
static HRESULT WINAPI domimpl_Invoke(
IXMLDOMImplementation *iface,
DISPID dispIdMember, REFIID riid, LCID lcid,
WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
@@ -145,7 +136,7 @@ static HRESULT WINAPI dimimpl_Invoke(
dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
}
static HRESULT WINAPI dimimpl_hasFeature(IXMLDOMImplementation* This, BSTR feature, BSTR version, VARIANT_BOOL *hasFeature)
static HRESULT WINAPI domimpl_hasFeature(IXMLDOMImplementation* This, BSTR feature, BSTR version, VARIANT_BOOL *hasFeature)
{
static const WCHAR bVersion[] = {'1','.','0',0};
static const WCHAR bXML[] = {'X','M','L',0};
@@ -173,43 +164,44 @@ static HRESULT WINAPI dimimpl_hasFeature(IXMLDOMImplementation* This, BSTR featu
return S_OK;
}
static const struct IXMLDOMImplementationVtbl dimimpl_vtbl =
static const struct IXMLDOMImplementationVtbl domimpl_vtbl =
{
dimimpl_QueryInterface,
dimimpl_AddRef,
dimimpl_Release,
dimimpl_GetTypeInfoCount,
dimimpl_GetTypeInfo,
dimimpl_GetIDsOfNames,
dimimpl_Invoke,
dimimpl_hasFeature
domimpl_QueryInterface,
domimpl_AddRef,
domimpl_Release,
domimpl_GetTypeInfoCount,
domimpl_GetTypeInfo,
domimpl_GetIDsOfNames,
domimpl_Invoke,
domimpl_hasFeature
};
static const tid_t dimimpl_iface_tids[] = {
static const tid_t domimpl_iface_tids[] =
{
IXMLDOMImplementation_tid,
0
};
static dispex_static_data_t dimimpl_dispex = {
static dispex_static_data_t domimpl_dispex =
{
NULL,
IXMLDOMImplementation_tid,
NULL,
dimimpl_iface_tids
domimpl_iface_tids
};
IUnknown* create_doc_Implementation(void)
HRESULT create_dom_implementation(IXMLDOMImplementation **ret)
{
domimpl *This;
domimpl *object;
This = heap_alloc( sizeof *This );
if ( !This )
return NULL;
if (!(object = malloc(sizeof(*object))))
return E_OUTOFMEMORY;
This->IXMLDOMImplementation_iface.lpVtbl = &dimimpl_vtbl;
This->ref = 1;
init_dispex(&This->dispex, (IUnknown*)&This->IXMLDOMImplementation_iface, &dimimpl_dispex);
object->IXMLDOMImplementation_iface.lpVtbl = &domimpl_vtbl;
object->ref = 1;
init_dispex(&object->dispex, (IUnknown *)&object->IXMLDOMImplementation_iface, &domimpl_dispex);
return (IUnknown*)&This->IXMLDOMImplementation_iface;
*ret = &object->IXMLDOMImplementation_iface;
return S_OK;
}
#endif
+111 -63
View File
@@ -20,13 +20,9 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
#endif
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include "windef.h"
#include "winbase.h"
@@ -39,8 +35,6 @@
#include "wine/debug.h"
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
static const xmlChar DT_prefix[] = "dt";
@@ -106,28 +100,27 @@ static HRESULT WINAPI domelem_QueryInterface(
return S_OK;
}
static ULONG WINAPI domelem_AddRef(
IXMLDOMElement *iface )
static ULONG WINAPI domelem_AddRef(IXMLDOMElement *iface)
{
domelem *This = impl_from_IXMLDOMElement( iface );
LONG ref = InterlockedIncrement(&This->ref);
domelem *element = impl_from_IXMLDOMElement(iface);
LONG ref = InterlockedIncrement(&element->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %ld.\n", iface, ref);
return ref;
}
static ULONG WINAPI domelem_Release(
IXMLDOMElement *iface )
static ULONG WINAPI domelem_Release(IXMLDOMElement *iface)
{
domelem *This = impl_from_IXMLDOMElement( iface );
ULONG ref = InterlockedDecrement(&This->ref);
domelem *element = impl_from_IXMLDOMElement(iface);
ULONG ref = InterlockedDecrement(&element->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
if(!ref) {
destroy_xmlnode(&This->node);
heap_free(This);
if (!ref)
{
destroy_xmlnode(&element->node);
free(element);
}
return ref;
@@ -309,6 +302,8 @@ static HRESULT WINAPI domelem_insertBefore(
TRACE("(%p)->(%p %s %p)\n", This, newNode, debugstr_variant(&refChild), old_node);
if (!newNode) return E_INVALIDARG;
hr = IXMLDOMNode_get_nodeType(newNode, &type);
if (hr != S_OK) return hr;
@@ -459,7 +454,6 @@ static inline HRESULT variant_from_dt(XDR_DT dt, xmlChar* str, VARIANT* v)
switch (dt)
{
case DT_INVALID:
case DT_STRING:
case DT_NMTOKEN:
case DT_NMTOKENS:
@@ -502,9 +496,9 @@ static inline HRESULT variant_from_dt(XDR_DT dt, xmlChar* str, VARIANT* v)
if(p+4<e && *(p+4)=='-') /* parse date (yyyy-mm-dd) */
{
st.wYear = atoiW(p);
st.wMonth = atoiW(p+5);
st.wDay = atoiW(p+8);
st.wYear = wcstol(p, NULL, 10);
st.wMonth = wcstol(p+5, NULL, 10);
st.wDay = wcstol(p+8, NULL, 10);
p += 10;
if(*p == 'T') p++;
@@ -512,15 +506,15 @@ static inline HRESULT variant_from_dt(XDR_DT dt, xmlChar* str, VARIANT* v)
if(p+2<e && *(p+2)==':') /* parse time (hh:mm:ss.?) */
{
st.wHour = atoiW(p);
st.wMinute = atoiW(p+3);
st.wSecond = atoiW(p+6);
st.wHour = wcstol(p, NULL, 10);
st.wMinute = wcstol(p+3, NULL, 10);
st.wSecond = wcstol(p+6, NULL, 10);
p += 8;
if(*p == '.')
{
p++;
while(isdigitW(*p)) p++;
while (*p >= '0' && *p <= '9') p++;
}
}
@@ -529,9 +523,9 @@ static inline HRESULT variant_from_dt(XDR_DT dt, xmlChar* str, VARIANT* v)
V_DATE(v) = date;
if(*p == '+') /* parse timezone offset (+hh:mm) */
V_DATE(v) += (DOUBLE)atoiW(p+1)/24 + (DOUBLE)atoiW(p+4)/1440;
V_DATE(v) += (DOUBLE)wcstol(p+1, NULL, 10)/24 + (DOUBLE)wcstol(p+4, NULL, 10)/1440;
else if(*p == '-') /* parse timezone offset (-hh:mm) */
V_DATE(v) -= (DOUBLE)atoiW(p+1)/24 + (DOUBLE)atoiW(p+4)/1440;
V_DATE(v) -= (DOUBLE)wcstol(p+1, NULL, 10)/24 + (DOUBLE)wcstol(p+4, NULL, 10)/1440;
VariantClear(&src);
handled = TRUE;
@@ -741,6 +735,13 @@ static HRESULT WINAPI domelem_get_nodeTypedValue(
V_VT(v) = VT_NULL;
dt = element_get_dt(get_element(This));
if (dt == DT_INVALID)
{
if (SUCCEEDED(hr = node_get_text(&This->node, &V_BSTR(v))))
V_VT(v) = VT_BSTR;
return hr;
}
content = xmlNodeGetContent(get_element(This));
hr = variant_from_dt(dt, content, v);
xmlFree(content);
@@ -847,6 +848,7 @@ static HRESULT WINAPI domelem_put_nodeTypedValue(
{
/* for untyped node coerce to BSTR and set */
case DT_INVALID:
case DT_INT:
if (V_VT(&value) != VT_BSTR)
{
VARIANT content;
@@ -1247,7 +1249,7 @@ static HRESULT WINAPI domelem_getAttribute(
xml_value = xmlGetNsProp(element, xml_name, NULL);
}
heap_free(xml_name);
free(xml_name);
if(xml_value)
{
V_VT(value) = VT_BSTR;
@@ -1309,8 +1311,8 @@ static HRESULT WINAPI domelem_setAttribute(
if (ns)
{
int cmp = xmlStrEqual(ns->href, xml_value);
heap_free(xml_value);
heap_free(xml_name);
free(xml_value);
free(xml_name);
return cmp ? S_OK : E_INVALIDARG;
}
}
@@ -1318,8 +1320,8 @@ static HRESULT WINAPI domelem_setAttribute(
if (!xmlSetNsProp(element, NULL, xml_name, xml_value))
hr = E_FAIL;
heap_free(xml_value);
heap_free(xml_name);
free(xml_value);
free(xml_name);
return hr;
}
@@ -1363,13 +1365,13 @@ static HRESULT WINAPI domelem_getAttributeNode(
nameA = xmlchar_from_wchar(p);
if (!xmlValidateNameValue(nameA))
{
heap_free(nameA);
free(nameA);
return E_FAIL;
}
if (!attributeNode)
{
heap_free(nameA);
free(nameA);
return S_FALSE;
}
@@ -1394,7 +1396,7 @@ static HRESULT WINAPI domelem_getAttributeNode(
if (attr && attr->ns) attr = NULL;
}
heap_free(nameA);
free(nameA);
if (attr)
{
@@ -1437,7 +1439,7 @@ static HRESULT WINAPI domelem_setAttributeNode(
if (hr != S_OK) return hr;
/* adding xmlns attribute doesn't change a tree or existing namespace definition */
if (!strcmpW(nameW, xmlnsW))
if (!wcscmp(nameW, xmlnsW))
{
SysFreeString(nameW);
return DISP_E_UNKNOWNNAME;
@@ -1468,8 +1470,8 @@ static HRESULT WINAPI domelem_setAttributeNode(
{
SysFreeString(nameW);
VariantClear(&valueW);
heap_free(name);
heap_free(value);
free(name);
free(value);
return E_OUTOFMEMORY;
}
@@ -1479,8 +1481,8 @@ static HRESULT WINAPI domelem_setAttributeNode(
SysFreeString(nameW);
VariantClear(&valueW);
heap_free(name);
heap_free(value);
free(name);
free(value);
return attr ? S_OK : E_FAIL;
}
@@ -1604,14 +1606,14 @@ static HRESULT domelem_get_qualified_item(const xmlNodePtr node, BSTR name, BSTR
nameA = xmlchar_from_wchar(name);
if (!nameA)
{
heap_free(href);
free(href);
return E_OUTOFMEMORY;
}
attr = xmlHasNsProp(node, nameA, href);
heap_free(nameA);
heap_free(href);
free(nameA);
free(href);
if (!attr)
{
@@ -1635,7 +1637,7 @@ static HRESULT domelem_get_named_item(const xmlNodePtr node, BSTR name, IXMLDOMN
nameA = xmlchar_from_wchar(name);
local = xmlSplitQName2(nameA, &prefix);
heap_free(nameA);
free(nameA);
if (!local)
return domelem_get_qualified_item(node, name, NULL, item);
@@ -1716,14 +1718,14 @@ static HRESULT domelem_remove_qualified_item(xmlNodePtr node, BSTR name, BSTR ur
nameA = xmlchar_from_wchar(name);
if (!nameA)
{
heap_free(href);
free(href);
return E_OUTOFMEMORY;
}
attr = xmlHasNsProp(node, nameA, href);
heap_free(nameA);
heap_free(href);
free(nameA);
free(href);
if (!attr)
{
@@ -1748,8 +1750,43 @@ static HRESULT domelem_remove_qualified_item(xmlNodePtr node, BSTR name, BSTR ur
static HRESULT domelem_remove_named_item(xmlNodePtr node, BSTR name, IXMLDOMNode **item)
{
xmlChar *nameA, *local, *prefix;
BSTR uriW, localW;
xmlNsPtr ns;
HRESULT hr;
TRACE("(%p)->(%s %p)\n", node, debugstr_w(name), item);
return domelem_remove_qualified_item(node, name, NULL, item);
nameA = xmlchar_from_wchar(name);
local = xmlSplitQName2(nameA, &prefix);
free(nameA);
if (!local)
return domelem_remove_qualified_item(node, name, NULL, item);
ns = xmlSearchNs(node->doc, node, prefix);
xmlFree(prefix);
if (!ns)
{
xmlFree(local);
if (item) *item = NULL;
return item ? S_FALSE : E_INVALIDARG;
}
uriW = bstr_from_xmlChar(ns->href);
localW = bstr_from_xmlChar(local);
xmlFree(local);
TRACE("removing qualified node %s, uri=%s\n", debugstr_w(localW), debugstr_w(uriW));
hr = domelem_remove_qualified_item(node, localW, uriW, item);
SysFreeString(localW);
SysFreeString(uriW);
return hr;
}
static HRESULT domelem_get_item(const xmlNodePtr node, LONG index, IXMLDOMNode **item)
@@ -1760,7 +1797,7 @@ static HRESULT domelem_get_item(const xmlNodePtr node, LONG index, IXMLDOMNode *
IUnknown *unk;
HRESULT hr;
TRACE("(%p)->(%d %p)\n", node, index, item);
TRACE("%p, %ld, %p.\n", node, index, item);
*item = NULL;
@@ -1782,19 +1819,30 @@ static HRESULT domelem_get_item(const xmlNodePtr node, LONG index, IXMLDOMNode *
if (!node->nsDef)
return S_FALSE;
attrIndex++;
ns = node->nsDef;
for (; attrIndex < index && ns->next != NULL; attrIndex++)
while (attrIndex < index)
{
attrIndex++;
if (!ns->next)
break;
ns = ns->next;
}
if (attrIndex < index)
return S_FALSE;
xmlns = xmlNewNs(NULL, BAD_CAST "http://www.w3.org/2000/xmlns/", BAD_CAST "xmlns");
if (!xmlns)
return E_OUTOFMEMORY;
if (!ns->prefix) {
xmlns = NULL;
curr = xmlNewProp(NULL, BAD_CAST "xmlns", ns->href);
} else {
xmlns = xmlNewNs(NULL, BAD_CAST "http://www.w3.org/2000/xmlns/", BAD_CAST "xmlns");
if (!xmlns)
return E_OUTOFMEMORY;
curr = xmlNewNsProp(NULL, xmlns, ns->prefix, ns->href);
curr = xmlNewNsProp(NULL, xmlns, ns->prefix, ns->href);
}
if (!curr) {
xmlFreeNs(xmlns);
return E_OUTOFMEMORY;
@@ -1847,11 +1895,13 @@ static HRESULT domelem_next_node(const xmlNodePtr node, LONG *iter, IXMLDOMNode
xmlAttrPtr curr;
LONG i;
TRACE("(%p)->(%d: %p)\n", node, *iter, nextNode);
TRACE("%p, %ld, %p.\n", node, *iter, nextNode);
*nextNode = NULL;
curr = node->properties;
if (curr == NULL)
return S_FALSE;
for (i = 0; i < *iter; i++) {
if (curr->next == NULL)
@@ -1893,7 +1943,7 @@ IUnknown* create_element( xmlNodePtr element )
{
domelem *This;
This = heap_alloc( sizeof *This );
This = malloc(sizeof *This);
if ( !This )
return NULL;
@@ -1904,5 +1954,3 @@ IUnknown* create_element( xmlNodePtr element )
return (IUnknown*)&This->IXMLDOMElement_iface;
}
#endif
+8 -15
View File
@@ -20,13 +20,9 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
#endif
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include "windef.h"
#include "winbase.h"
@@ -38,8 +34,6 @@
#include "wine/debug.h"
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
typedef struct _entityref
@@ -99,7 +93,7 @@ static ULONG WINAPI entityref_AddRef(
{
entityref *This = impl_from_IXMLDOMEntityReference( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -109,11 +103,12 @@ static ULONG WINAPI entityref_Release(
entityref *This = impl_from_IXMLDOMEntityReference( iface );
ULONG ref = InterlockedDecrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
if ( ref == 0 )
TRACE("%p, refcount %lu.\n", iface, ref);
if (!ref)
{
destroy_xmlnode(&This->node);
heap_free( This );
free(This);
}
return ref;
@@ -583,7 +578,7 @@ IUnknown* create_doc_entity_ref( xmlNodePtr entity )
{
entityref *This;
This = heap_alloc( sizeof *This );
This = malloc(sizeof(*This));
if ( !This )
return NULL;
@@ -594,5 +589,3 @@ IUnknown* create_doc_entity_ref( xmlNodePtr entity )
return (IUnknown*)&This->IXMLDOMEntityReference_iface;
}
#endif
+21 -19
View File
@@ -21,13 +21,9 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
#endif
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include "windef.h"
#include "winbase.h"
@@ -47,6 +43,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
#ifndef __REACTOS__
extern GUID CLSID_XMLSchemaCache60;
#endif
typedef HRESULT (*ClassFactoryCreateInstanceFunc)(void**);
typedef HRESULT (*DOMFactoryCreateInstanceFunc)(MSXML_VERSION, void**);
@@ -199,20 +199,22 @@ static inline DOMFactory *DOMFactory_from_IClassFactory(IClassFactory *iface)
static ULONG WINAPI DOMClassFactory_AddRef(IClassFactory *iface )
{
DOMFactory *This = DOMFactory_from_IClassFactory(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref = %u\n", This, ref);
DOMFactory *factory = DOMFactory_from_IClassFactory(iface);
ULONG ref = InterlockedIncrement(&factory->ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
static ULONG WINAPI DOMClassFactory_Release(IClassFactory *iface )
{
DOMFactory *This = DOMFactory_from_IClassFactory(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref = %u\n", This, ref);
if(!ref) {
heap_free(This);
}
DOMFactory *factory = DOMFactory_from_IClassFactory(iface);
ULONG ref = InterlockedDecrement(&factory->ref);
TRACE("%p, refcount %lu.\n", iface, ref);
if (!ref)
free(factory);
return ref;
}
@@ -262,7 +264,7 @@ static const struct IClassFactoryVtbl DOMClassFactoryVtbl =
static HRESULT DOMClassFactory_Create(const GUID *clsid, REFIID riid, void **ppv, DOMFactoryCreateInstanceFunc fnCreateInstance)
{
DOMFactory *ret = heap_alloc(sizeof(DOMFactory));
DOMFactory *ret = malloc(sizeof(DOMFactory));
HRESULT hres;
ret->IClassFactory_iface.lpVtbl = &DOMClassFactoryVtbl;
@@ -272,7 +274,7 @@ static HRESULT DOMClassFactory_Create(const GUID *clsid, REFIID riid, void **ppv
hres = IClassFactory_QueryInterface(&ret->IClassFactory_iface, riid, ppv);
if(FAILED(hres)) {
heap_free(ret);
free(ret);
*ppv = NULL;
}
return hres;
@@ -302,7 +304,7 @@ HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID riid, void **ppv )
IsEqualCLSID( rclsid, &CLSID_DOMDocument40 )|| /* Version dep. v 4.0 */
IsEqualCLSID( rclsid, &CLSID_DOMDocument60 )) /* Version dep. v 6.0 */
{
return DOMClassFactory_Create(rclsid, riid, ppv, DOMDocument_create);
return DOMClassFactory_Create(rclsid, riid, ppv, dom_document_create);
}
else if( IsEqualCLSID( rclsid, &CLSID_XMLSchemaCache ) ||
IsEqualCLSID( rclsid, &CLSID_XMLSchemaCache26 ) ||
@@ -323,7 +325,7 @@ HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID riid, void **ppv )
IsEqualCLSID( rclsid, &CLSID_FreeThreadedDOMDocument40 ) ||
IsEqualCLSID( rclsid, &CLSID_FreeThreadedDOMDocument60 ))
{
return DOMClassFactory_Create(rclsid, riid, ppv, DOMDocument_create);
return DOMClassFactory_Create(rclsid, riid, ppv, dom_document_create);
}
else if( IsEqualCLSID( rclsid, &CLSID_SAXXMLReader) ||
IsEqualCLSID( rclsid, &CLSID_SAXXMLReader30 ) ||
+159 -154
View File
@@ -20,16 +20,8 @@
*/
#define COBJMACROS
#define NONAMELESSUNION
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
# include <libxml/encoding.h>
#endif
#include "windef.h"
#include "winbase.h"
@@ -44,12 +36,10 @@
#include "docobj.h"
#include "shlwapi.h"
#include "msxml_private.h"
#include "msxml_dispex.h"
#include "wine/debug.h"
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
static const WCHAR colspaceW[] = {':',' ',0};
@@ -174,7 +164,7 @@ static void free_response_headers(httprequest *This)
list_remove(&header->entry);
SysFreeString(header->header);
SysFreeString(header->value);
heap_free(header);
free(header);
}
SysFreeString(This->raw_respheaders);
@@ -190,7 +180,7 @@ static void free_request_headers(httprequest *This)
list_remove(&header->entry);
SysFreeString(header->header);
SysFreeString(header->value);
heap_free(header);
free(header);
}
}
@@ -283,7 +273,7 @@ static ULONG WINAPI BindStatusCallback_AddRef(IBindStatusCallback *iface)
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref = %d\n", This, ref);
TRACE("%p, refcount %ld.\n", iface, ref);
return ref;
}
@@ -293,14 +283,14 @@ static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface)
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref = %d\n", This, ref);
TRACE("%p, refcount %ld.\n", iface, ref);
if (!ref)
{
if (This->binding) IBinding_Release(This->binding);
if (This->stream) IStream_Release(This->stream);
if (This->body) GlobalFree(This->body);
heap_free(This);
free(This);
}
return ref;
@@ -311,7 +301,7 @@ static HRESULT WINAPI BindStatusCallback_OnStartBinding(IBindStatusCallback *ifa
{
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
TRACE("(%p)->(%d %p)\n", This, reserved, pbind);
TRACE("%p, %ld, %p.\n", iface, reserved, pbind);
if (!pbind) return E_INVALIDARG;
@@ -334,9 +324,7 @@ static HRESULT WINAPI BindStatusCallback_GetPriority(IBindStatusCallback *iface,
static HRESULT WINAPI BindStatusCallback_OnLowResource(IBindStatusCallback *iface, DWORD reserved)
{
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
TRACE("(%p)->(%d)\n", This, reserved);
TRACE("%p, %ld.\n", iface, reserved);
return E_NOTIMPL;
}
@@ -344,9 +332,7 @@ static HRESULT WINAPI BindStatusCallback_OnLowResource(IBindStatusCallback *ifac
static HRESULT WINAPI BindStatusCallback_OnProgress(IBindStatusCallback *iface, ULONG ulProgress,
ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
{
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
TRACE("(%p)->(%u %u %u %s)\n", This, ulProgress, ulProgressMax, ulStatusCode,
TRACE("%p, %lu, %lu, %lu, %s.\n", iface, ulProgress, ulProgressMax, ulStatusCode,
debugstr_w(szStatusText));
return S_OK;
@@ -357,7 +343,7 @@ static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *ifac
{
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
TRACE("(%p)->(0x%08x %s)\n", This, hr, debugstr_w(error));
TRACE("%p, %#lx, %s.\n", iface, hr, debugstr_w(error));
if (This->binding)
{
@@ -388,7 +374,7 @@ static HRESULT WINAPI BindStatusCallback_GetBindInfo(IBindStatusCallback *iface,
if (This->request->verb != BINDVERB_GET && This->body)
{
pbindinfo->stgmedData.tymed = TYMED_HGLOBAL;
pbindinfo->stgmedData.u.hGlobal = This->body;
pbindinfo->stgmedData.hGlobal = This->body;
pbindinfo->cbstgmedData = GlobalSize(This->body);
/* callback owns passed body pointer */
IBindStatusCallback_QueryInterface(iface, &IID_IUnknown, (void**)&pbindinfo->stgmedData.pUnkForRelease);
@@ -398,7 +384,7 @@ static HRESULT WINAPI BindStatusCallback_GetBindInfo(IBindStatusCallback *iface,
if (This->request->verb == BINDVERB_CUSTOM)
{
pbindinfo->szCustomVerb = CoTaskMemAlloc(SysStringByteLen(This->request->custom)+sizeof(WCHAR));
strcpyW(pbindinfo->szCustomVerb, This->request->custom);
lstrcpyW(pbindinfo->szCustomVerb, This->request->custom);
}
return S_OK;
@@ -412,11 +398,11 @@ static HRESULT WINAPI BindStatusCallback_OnDataAvailable(IBindStatusCallback *if
BYTE buf[4096];
HRESULT hr;
TRACE("(%p)->(%08x %d %p %p)\n", This, flags, size, format, stgmed);
TRACE("%p, %#lx, %lu, %p, %p.\n", iface, flags, size, format, stgmed);
do
{
hr = IStream_Read(stgmed->u.pstm, buf, sizeof(buf), &read);
hr = IStream_Read(stgmed->pstm, buf, sizeof(buf), &read);
if (hr != S_OK) break;
hr = IStream_Write(This->stream, buf, read, &written);
@@ -483,7 +469,7 @@ static HRESULT WINAPI BSCHttpNegotiate_BeginningTransaction(IHttpNegotiate *ifac
WCHAR *buff, *ptr;
int size = 0;
TRACE("(%p)->(%s %s %d %p)\n", This, debugstr_w(url), debugstr_w(headers), reserved, add_headers);
TRACE("%p, %s, %s, %ld, %p.\n", iface, debugstr_w(url), debugstr_w(headers), reserved, add_headers);
*add_headers = NULL;
@@ -521,10 +507,10 @@ static HRESULT WINAPI BSCHttpNegotiate_BeginningTransaction(IHttpNegotiate *ifac
if (base_uri)
{
strcpyW(ptr, refererW);
strcatW(ptr, base_uri);
strcatW(ptr, crlfW);
ptr += strlenW(refererW) + SysStringLen(base_uri) + strlenW(crlfW);
lstrcpyW(ptr, refererW);
lstrcatW(ptr, base_uri);
lstrcatW(ptr, crlfW);
ptr += lstrlenW(refererW) + SysStringLen(base_uri) + lstrlenW(crlfW);
SysFreeString(base_uri);
}
@@ -574,7 +560,7 @@ static void add_response_header(httprequest *This, const WCHAR *data, int len)
/* new header */
TRACE("got header %s:%s\n", debugstr_w(header), debugstr_w(value));
entry = heap_alloc(sizeof(*entry));
entry = malloc(sizeof(*entry));
entry->header = header;
entry->value = value;
list_add_head(&This->respheaders, &entry->entry);
@@ -585,7 +571,7 @@ static HRESULT WINAPI BSCHttpNegotiate_OnResponse(IHttpNegotiate *iface, DWORD c
{
BindStatusCallback *This = impl_from_IHttpNegotiate(iface);
TRACE("(%p)->(%d %s %s %p)\n", This, code, debugstr_w(resp_headers),
TRACE("%p, %ld, %s, %s, %p.\n", iface, code, debugstr_w(resp_headers),
debugstr_w(req_headers), add_reqheaders);
This->request->status = code;
@@ -600,11 +586,11 @@ static HRESULT WINAPI BSCHttpNegotiate_OnResponse(IHttpNegotiate *iface, DWORD c
ptr = line = resp_headers;
/* skip HTTP-Version */
ptr = strchrW(ptr, ' ');
ptr = wcschr(ptr, ' ');
if (ptr)
{
/* skip Status-Code */
ptr = strchrW(++ptr, ' ');
ptr = wcschr(++ptr, ' ');
if (ptr)
{
status_text = ++ptr;
@@ -694,19 +680,12 @@ static const IAuthenticateVtbl AuthenticateVtbl = {
static HRESULT BindStatusCallback_create(httprequest* This, BindStatusCallback **obj, const VARIANT *body)
{
BindStatusCallback *bsc;
IBindCtx *pbc;
IBindCtx *pbc = NULL;
HRESULT hr;
int size;
LONG size;
hr = CreateBindCtx(0, &pbc);
if (hr != S_OK) return hr;
bsc = heap_alloc(sizeof(*bsc));
if (!bsc)
{
IBindCtx_Release(pbc);
if (!(bsc = malloc(sizeof(*bsc))))
return E_OUTOFMEMORY;
}
bsc->IBindStatusCallback_iface.lpVtbl = &BindStatusCallbackVtbl;
bsc->IHttpNegotiate_iface.lpVtbl = &BSCHttpNegotiateVtbl;
@@ -747,9 +726,9 @@ static HRESULT BindStatusCallback_create(httprequest* This, BindStatusCallback *
}
size = WideCharToMultiByte(cp, 0, str, len, NULL, 0, NULL, NULL);
if (!(ptr = heap_alloc(size)))
if (!(ptr = malloc(size)))
{
heap_free(bsc);
free(bsc);
return E_OUTOFMEMORY;
}
WideCharToMultiByte(cp, 0, str, len, ptr, size, NULL, NULL);
@@ -761,13 +740,13 @@ static HRESULT BindStatusCallback_create(httprequest* This, BindStatusCallback *
sa = V_ARRAY(body);
if ((hr = SafeArrayAccessData(sa, &ptr)) != S_OK)
{
heap_free(bsc);
free(bsc);
return hr;
}
if ((hr = SafeArrayGetUBound(sa, 1, &size)) != S_OK)
{
SafeArrayUnaccessData(sa);
heap_free(bsc);
free(bsc);
return hr;
}
size++;
@@ -790,11 +769,11 @@ static HRESULT BindStatusCallback_create(httprequest* This, BindStatusCallback *
if (!bsc->body)
{
if (V_VT(body) == VT_BSTR)
heap_free(ptr);
free(ptr);
else if (V_VT(body) == (VT_ARRAY|VT_UI1))
SafeArrayUnaccessData(sa);
heap_free(bsc);
free(bsc);
return E_OUTOFMEMORY;
}
@@ -804,12 +783,14 @@ static HRESULT BindStatusCallback_create(httprequest* This, BindStatusCallback *
}
if (V_VT(body) == VT_BSTR)
heap_free(ptr);
free(ptr);
else if (V_VT(body) == (VT_ARRAY|VT_UI1))
SafeArrayUnaccessData(sa);
}
hr = RegisterBindStatusCallback(pbc, &bsc->IBindStatusCallback_iface, NULL, 0);
hr = CreateBindCtx(0, &pbc);
if (hr == S_OK)
hr = RegisterBindStatusCallback(pbc, &bsc->IBindStatusCallback_iface, NULL, 0);
if (hr == S_OK)
{
IMoniker *moniker;
@@ -823,9 +804,11 @@ static HRESULT BindStatusCallback_create(httprequest* This, BindStatusCallback *
IMoniker_Release(moniker);
if (stream) IStream_Release(stream);
}
IBindCtx_Release(pbc);
}
if (pbc)
IBindCtx_Release(pbc);
if (FAILED(hr))
{
IBindStatusCallback_Release(&bsc->IBindStatusCallback_iface);
@@ -872,7 +855,7 @@ static HRESULT verify_uri(httprequest *This, IUri *uri)
hr = IUri_GetHost(This->base_uri, &base_host);
if(SUCCEEDED(hr)) {
if(strcmpiW(host, base_host)) {
if(wcsicmp(host, base_host)) {
WARN("Hosts don't match\n");
hr = E_ACCESSDENIED;
}
@@ -909,21 +892,21 @@ static HRESULT httprequest_open(httprequest *This, BSTR method, BSTR url,
This->user = This->password = NULL;
free_request_headers(This);
if (!strcmpiW(method, MethodGetW))
if (!wcsicmp(method, MethodGetW))
{
This->verb = BINDVERB_GET;
}
else if (!strcmpiW(method, MethodPutW))
else if (!wcsicmp(method, MethodPutW))
{
This->verb = BINDVERB_PUT;
}
else if (!strcmpiW(method, MethodPostW))
else if (!wcsicmp(method, MethodPostW))
{
This->verb = BINDVERB_POST;
}
else if (!strcmpiW(method, MethodDeleteW) ||
!strcmpiW(method, MethodHeadW) ||
!strcmpiW(method, MethodPropFindW))
else if (!wcsicmp(method, MethodDeleteW) ||
!wcsicmp(method, MethodHeadW) ||
!wcsicmp(method, MethodPropFindW))
{
This->verb = BINDVERB_CUSTOM;
SysReAllocString(&This->custom, method);
@@ -940,7 +923,7 @@ static HRESULT httprequest_open(httprequest *This, BSTR method, BSTR url,
else
hr = CreateUri(url, 0, 0, &uri);
if(FAILED(hr)) {
WARN("Could not create IUri object: %08x\n", hr);
WARN("Could not create IUri object, hr %#lx.\n", hr);
return hr;
}
@@ -979,11 +962,11 @@ static HRESULT httprequest_open(httprequest *This, BSTR method, BSTR url,
uri = full_uri;
}
else
WARN("failed to create modified uri, 0x%08x\n", hr);
WARN("failed to create modified uri, hr %#lx.\n", hr);
IUriBuilder_Release(builder);
}
else
WARN("IUriBuilder creation failed, 0x%08x\n", hr);
WARN("IUriBuilder creation failed, hr %#lx.\n", hr);
}
This->uri = uri;
@@ -1008,7 +991,7 @@ static HRESULT httprequest_setRequestHeader(httprequest *This, BSTR header, BSTR
/* replace existing header value if already added */
LIST_FOR_EACH_ENTRY(entry, &This->reqheaders, struct httpheader, entry)
{
if (lstrcmpW(entry->header, header) == 0)
if (wcscmp(entry->header, header) == 0)
{
LONG length = SysStringLen(entry->value);
HRESULT hr;
@@ -1022,7 +1005,7 @@ static HRESULT httprequest_setRequestHeader(httprequest *This, BSTR header, BSTR
}
}
entry = heap_alloc(sizeof(*entry));
entry = malloc(sizeof(*entry));
if (!entry) return E_OUTOFMEMORY;
/* new header */
@@ -1064,7 +1047,7 @@ static HRESULT httprequest_getResponseHeader(httprequest *This, BSTR header, BST
LIST_FOR_EACH_ENTRY(entry, &This->respheaders, struct httpheader, entry)
{
if (!strcmpiW(entry->header, header))
if (!wcsicmp(entry->header, header))
{
*value = SysAllocString(entry->value);
TRACE("header value %s\n", debugstr_w(*value));
@@ -1127,6 +1110,58 @@ static HRESULT httprequest_get_statusText(httprequest *This, BSTR *status)
return S_OK;
}
enum response_encoding
{
RESPONSE_ENCODING_NONE,
RESPONSE_ENCODING_UCS4BE,
RESPONSE_ENCODING_UCS4LE,
RESPONSE_ENCODING_UCS4_2143,
RESPONSE_ENCODING_UCS4_3412,
RESPONSE_ENCODING_EBCDIC,
RESPONSE_ENCODING_UTF8,
RESPONSE_ENCODING_UTF16LE,
RESPONSE_ENCODING_UTF16BE,
};
static unsigned int detect_response_encoding(const BYTE *in, unsigned int len)
{
if (len >= 4)
{
if (in[0] == 0 && in[1] == 0 && in[2] == 0 && in[3] == 0x3c)
return RESPONSE_ENCODING_UCS4BE;
if (in[0] == 0x3c && in[1] == 0 && in[2] == 0 && in[3] == 0)
return RESPONSE_ENCODING_UCS4LE;
if (in[0] == 0 && in[1] == 0 && in[2] == 0x3c && in[3] == 0)
return RESPONSE_ENCODING_UCS4_2143;
if (in[0] == 0 && in[1] == 0x3c && in[2] == 0 && in[3] == 0)
return RESPONSE_ENCODING_UCS4_3412;
if (in[0] == 0x4c && in[1] == 0x6f && in[2] == 0xa7 && in[3] == 0x94)
return RESPONSE_ENCODING_EBCDIC;
if (in[0] == 0x3c && in[1] == 0x3f && in[2] == 0x78 && in[3] == 0x6d)
return RESPONSE_ENCODING_UTF8;
if (in[0] == 0x3c && in[1] == 0 && in[2] == 0x3f && in[3] == 0)
return RESPONSE_ENCODING_UTF16LE;
if (in[0] == 0 && in[1] == 0x3c && in[2] == 0 && in[3] == 0x3f)
return RESPONSE_ENCODING_UTF16BE;
}
if (len >= 3)
{
if (in[0] == 0xef && in[1] == 0xbb && in[2] == 0xbf)
return RESPONSE_ENCODING_UTF8;
}
if (len >= 2)
{
if (in[0] == 0xfe && in[1] == 0xff)
return RESPONSE_ENCODING_UTF16BE;
if (in[0] == 0xff && in[1] == 0xfe)
return RESPONSE_ENCODING_UTF16LE;
}
return RESPONSE_ENCODING_NONE;
}
static HRESULT httprequest_get_responseText(httprequest *This, BSTR *body)
{
HGLOBAL hglobal;
@@ -1138,34 +1173,34 @@ static HRESULT httprequest_get_responseText(httprequest *This, BSTR *body)
hr = GetHGlobalFromStream(This->bsc->stream, &hglobal);
if (hr == S_OK)
{
xmlChar *ptr = GlobalLock(hglobal);
const char *ptr = GlobalLock(hglobal);
DWORD size = GlobalSize(hglobal);
xmlCharEncoding encoding = XML_CHAR_ENCODING_UTF8;
unsigned int encoding = RESPONSE_ENCODING_NONE;
/* try to determine data encoding */
if (size >= 4)
{
encoding = xmlDetectCharEncoding(ptr, 4);
TRACE("detected encoding: %s\n", debugstr_a(xmlGetCharEncodingName(encoding)));
if ( encoding != XML_CHAR_ENCODING_UTF8 &&
encoding != XML_CHAR_ENCODING_UTF16LE &&
encoding != XML_CHAR_ENCODING_NONE )
encoding = detect_response_encoding((const BYTE *)ptr, 4);
TRACE("detected encoding: %u.\n", encoding);
if (encoding != RESPONSE_ENCODING_UTF8 &&
encoding != RESPONSE_ENCODING_UTF16LE &&
encoding != RESPONSE_ENCODING_NONE )
{
FIXME("unsupported encoding: %s\n", debugstr_a(xmlGetCharEncodingName(encoding)));
FIXME("unsupported response encoding: %u.\n", encoding);
GlobalUnlock(hglobal);
return E_FAIL;
}
}
/* without BOM assume UTF-8 */
if (encoding == XML_CHAR_ENCODING_UTF8 ||
encoding == XML_CHAR_ENCODING_NONE )
if (encoding == RESPONSE_ENCODING_UTF8 || encoding == RESPONSE_ENCODING_NONE)
{
DWORD length = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)ptr, size, NULL, 0);
DWORD length = MultiByteToWideChar(CP_UTF8, 0, ptr, size, NULL, 0);
*body = SysAllocStringLen(NULL, length);
if (*body)
MultiByteToWideChar( CP_UTF8, 0, (LPCSTR)ptr, size, *body, length);
MultiByteToWideChar( CP_UTF8, 0, ptr, size, *body, length);
}
else
*body = SysAllocStringByteLen((LPCSTR)ptr, size);
@@ -1186,7 +1221,7 @@ static HRESULT httprequest_get_responseXML(httprequest *This, IDispatch **body)
if (!body) return E_INVALIDARG;
if (This->state != READYSTATE_COMPLETE) return E_FAIL;
hr = DOMDocument_create(MSXML_DEFAULT, (void**)&doc);
hr = dom_document_create(MSXML_DEFAULT, (void**)&doc);
if (hr != S_OK) return hr;
hr = httprequest_get_responseText(This, &str);
@@ -1353,23 +1388,23 @@ static HRESULT WINAPI XMLHTTPRequest_QueryInterface(IXMLHTTPRequest *iface, REFI
static ULONG WINAPI XMLHTTPRequest_AddRef(IXMLHTTPRequest *iface)
{
httprequest *This = impl_from_IXMLHTTPRequest( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%u)\n", This, ref );
httprequest *request = impl_from_IXMLHTTPRequest(iface);
ULONG ref = InterlockedIncrement(&request->ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
static ULONG WINAPI XMLHTTPRequest_Release(IXMLHTTPRequest *iface)
{
httprequest *This = impl_from_IXMLHTTPRequest( iface );
ULONG ref = InterlockedDecrement( &This->ref );
httprequest *request = impl_from_IXMLHTTPRequest(iface);
ULONG ref = InterlockedDecrement(&request->ref);
TRACE("(%p)->(%u)\n", This, ref );
TRACE("%p, refcount %lu.\n", iface, ref);
if ( ref == 0 )
if (!ref)
{
httprequest_release( This );
heap_free( This );
httprequest_release(request);
free(request);
}
return ref;
@@ -1377,9 +1412,7 @@ static ULONG WINAPI XMLHTTPRequest_Release(IXMLHTTPRequest *iface)
static HRESULT WINAPI XMLHTTPRequest_GetTypeInfoCount(IXMLHTTPRequest *iface, UINT *pctinfo)
{
httprequest *This = impl_from_IXMLHTTPRequest( iface );
TRACE("(%p)->(%p)\n", This, pctinfo);
TRACE("%p, %p.\n", iface, pctinfo);
*pctinfo = 1;
@@ -1389,9 +1422,7 @@ static HRESULT WINAPI XMLHTTPRequest_GetTypeInfoCount(IXMLHTTPRequest *iface, UI
static HRESULT WINAPI XMLHTTPRequest_GetTypeInfo(IXMLHTTPRequest *iface, UINT iTInfo,
LCID lcid, ITypeInfo **ppTInfo)
{
httprequest *This = impl_from_IXMLHTTPRequest( iface );
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
TRACE("%p, %u, %lx,%p.\n", iface, iTInfo, lcid, ppTInfo);
return get_typeinfo(IXMLHTTPRequest_tid, ppTInfo);
}
@@ -1399,11 +1430,10 @@ static HRESULT WINAPI XMLHTTPRequest_GetTypeInfo(IXMLHTTPRequest *iface, UINT iT
static HRESULT WINAPI XMLHTTPRequest_GetIDsOfNames(IXMLHTTPRequest *iface, REFIID riid,
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
{
httprequest *This = impl_from_IXMLHTTPRequest( iface );
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
TRACE("%p, %s, %p, %u, %lx, %p.\n", iface, debugstr_guid(riid), rgszNames, cNames,
lcid, rgDispId);
if(!rgszNames || cNames == 0 || !rgDispId)
@@ -1423,18 +1453,16 @@ static HRESULT WINAPI XMLHTTPRequest_Invoke(IXMLHTTPRequest *iface, DISPID dispI
LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
httprequest *This = impl_from_IXMLHTTPRequest( iface );
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
TRACE("%p, %ld, %s, %lx, %d, %p, %p, %p, %p.\n", iface, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
hr = get_typeinfo(IXMLHTTPRequest_tid, &typeinfo);
if(SUCCEEDED(hr))
{
hr = ITypeInfo_Invoke(typeinfo, &This->IXMLHTTPRequest_iface, dispIdMember, wFlags,
pDispParams, pVarResult, pExcepInfo, puArgErr);
hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
ITypeInfo_Release(typeinfo);
}
@@ -1598,7 +1626,7 @@ static HRESULT WINAPI httprequest_ObjectWithSite_GetSite( IObjectWithSite *iface
return IUnknown_QueryInterface( This->site, iid, ppvSite );
}
static void get_base_uri(httprequest *This)
IUri *get_base_uri(IUnknown *site)
{
IServiceProvider *provider;
IHTMLDocument2 *doc;
@@ -1606,30 +1634,30 @@ static void get_base_uri(httprequest *This)
BSTR url;
HRESULT hr;
hr = IUnknown_QueryInterface(This->site, &IID_IServiceProvider, (void**)&provider);
hr = IUnknown_QueryInterface(site, &IID_IServiceProvider, (void**)&provider);
if(FAILED(hr))
return;
return NULL;
hr = IServiceProvider_QueryService(provider, &SID_SContainerDispatch, &IID_IHTMLDocument2, (void**)&doc);
if(FAILED(hr))
hr = IServiceProvider_QueryService(provider, &SID_SInternetHostSecurityManager, &IID_IHTMLDocument2, (void**)&doc);
IServiceProvider_Release(provider);
if(FAILED(hr))
return;
return NULL;
hr = IHTMLDocument2_get_URL(doc, &url);
IHTMLDocument2_Release(doc);
if(FAILED(hr) || !url || !*url)
return;
return NULL;
TRACE("host url %s\n", debugstr_w(url));
hr = CreateUri(url, 0, 0, &uri);
SysFreeString(url);
if(FAILED(hr))
return;
return NULL;
This->base_uri = uri;
return uri;
}
static HRESULT WINAPI httprequest_ObjectWithSite_SetSite( IObjectWithSite *iface, IUnknown *punk )
@@ -1648,7 +1676,7 @@ static HRESULT WINAPI httprequest_ObjectWithSite_SetSite( IObjectWithSite *iface
if (punk)
{
IUnknown_AddRef( punk );
get_base_uri(This);
This->base_uri = get_base_uri(This->site);
}
return S_OK;
@@ -1700,13 +1728,14 @@ static HRESULT WINAPI httprequest_Safety_GetInterfaceSafetyOptions(IObjectSafety
static HRESULT WINAPI httprequest_Safety_SetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid,
DWORD mask, DWORD enabled)
{
httprequest *This = impl_from_IObjectSafety(iface);
TRACE("(%p)->(%s %x %x)\n", This, debugstr_guid(riid), mask, enabled);
httprequest *request = impl_from_IObjectSafety(iface);
TRACE("%p, %s, %lx, %lx.\n", iface, debugstr_guid(riid), mask, enabled);
if ((mask & ~safety_supported_options))
return E_FAIL;
This->safeopt = (This->safeopt & ~mask) | (mask & enabled);
request->safeopt = (request->safeopt & ~mask) | (mask & enabled);
return S_OK;
}
@@ -1786,23 +1815,23 @@ static HRESULT WINAPI ServerXMLHTTPRequest_QueryInterface(IServerXMLHTTPRequest
static ULONG WINAPI ServerXMLHTTPRequest_AddRef(IServerXMLHTTPRequest *iface)
{
serverhttp *This = impl_from_IServerXMLHTTPRequest( iface );
ULONG ref = InterlockedIncrement( &This->req.ref );
TRACE("(%p)->(%u)\n", This, ref );
serverhttp *request = impl_from_IServerXMLHTTPRequest(iface);
ULONG ref = InterlockedIncrement(&request->req.ref);
TRACE("%p, refcount %lu.\n", iface, ref );
return ref;
}
static ULONG WINAPI ServerXMLHTTPRequest_Release(IServerXMLHTTPRequest *iface)
{
serverhttp *This = impl_from_IServerXMLHTTPRequest( iface );
ULONG ref = InterlockedDecrement( &This->req.ref );
serverhttp *request = impl_from_IServerXMLHTTPRequest(iface);
ULONG ref = InterlockedDecrement(&request->req.ref);
TRACE("(%p)->(%u)\n", This, ref );
TRACE("%p, refcount %lu.\n", iface, ref );
if ( ref == 0 )
if (!ref)
{
httprequest_release( &This->req );
heap_free( This );
httprequest_release(&request->req);
free(request);
}
return ref;
@@ -1821,9 +1850,7 @@ static HRESULT WINAPI ServerXMLHTTPRequest_GetTypeInfoCount(IServerXMLHTTPReques
static HRESULT WINAPI ServerXMLHTTPRequest_GetTypeInfo(IServerXMLHTTPRequest *iface, UINT iTInfo,
LCID lcid, ITypeInfo **ppTInfo)
{
serverhttp *This = impl_from_IServerXMLHTTPRequest( iface );
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
TRACE("%p, %u, %lx, %p.\n", iface, iTInfo, lcid, ppTInfo);
return get_typeinfo(IServerXMLHTTPRequest_tid, ppTInfo);
}
@@ -1831,11 +1858,10 @@ static HRESULT WINAPI ServerXMLHTTPRequest_GetTypeInfo(IServerXMLHTTPRequest *if
static HRESULT WINAPI ServerXMLHTTPRequest_GetIDsOfNames(IServerXMLHTTPRequest *iface, REFIID riid,
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
{
serverhttp *This = impl_from_IServerXMLHTTPRequest( iface );
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
TRACE("%p, %s, %p, %u, %lx, %p.\n", iface, debugstr_guid(riid), rgszNames, cNames,
lcid, rgDispId);
if(!rgszNames || cNames == 0 || !rgDispId)
@@ -1855,18 +1881,16 @@ static HRESULT WINAPI ServerXMLHTTPRequest_Invoke(IServerXMLHTTPRequest *iface,
LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
serverhttp *This = impl_from_IServerXMLHTTPRequest( iface );
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
TRACE("%p, %ld, %s %lx, %d, %p, %p, %p, %p.\n", iface, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
hr = get_typeinfo(IServerXMLHTTPRequest_tid, &typeinfo);
if(SUCCEEDED(hr))
{
hr = ITypeInfo_Invoke(typeinfo, &This->IServerXMLHTTPRequest_iface, dispIdMember, wFlags,
pDispParams, pVarResult, pExcepInfo, puArgErr);
hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
ITypeInfo_Release(typeinfo);
}
@@ -1976,8 +2000,7 @@ static HRESULT WINAPI ServerXMLHTTPRequest_put_onreadystatechange(IServerXMLHTTP
static HRESULT WINAPI ServerXMLHTTPRequest_setTimeouts(IServerXMLHTTPRequest *iface, LONG resolveTimeout, LONG connectTimeout,
LONG sendTimeout, LONG receiveTimeout)
{
serverhttp *This = impl_from_IServerXMLHTTPRequest( iface );
FIXME("(%p)->(%d %d %d %d): stub\n", This, resolveTimeout, connectTimeout, sendTimeout, receiveTimeout);
FIXME("%p, %ld, %ld, %ld, %ld: stub\n", iface, resolveTimeout, connectTimeout, sendTimeout, receiveTimeout);
return S_OK;
}
@@ -2068,7 +2091,7 @@ HRESULT XMLHTTPRequest_create(void **obj)
TRACE("(%p)\n", obj);
req = heap_alloc( sizeof (*req) );
req = malloc(sizeof(*req));
if( !req )
return E_OUTOFMEMORY;
@@ -2086,7 +2109,7 @@ HRESULT ServerXMLHTTP_create(void **obj)
TRACE("(%p)\n", obj);
req = heap_alloc( sizeof (*req) );
req = malloc(sizeof(*req));
if( !req )
return E_OUTOFMEMORY;
@@ -2099,21 +2122,3 @@ HRESULT ServerXMLHTTP_create(void **obj)
return S_OK;
}
#else
HRESULT XMLHTTPRequest_create(void **ppObj)
{
MESSAGE("This program tried to use a XMLHTTPRequest object, but\n"
"libxml2 support was not present at compile time.\n");
return E_NOTIMPL;
}
HRESULT ServerXMLHTTP_create(void **obj)
{
MESSAGE("This program tried to use a ServerXMLHTTP object, but\n"
"libxml2 support was not present at compile time.\n");
return E_NOTIMPL;
}
#endif
+70 -138
View File
@@ -19,31 +19,21 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#define COBJMACROS
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
# ifdef SONAME_LIBXSLT
# ifdef HAVE_LIBXSLT_PATTERN_H
# include <libxslt/pattern.h>
# endif
# ifdef HAVE_LIBXSLT_TRANSFORM_H
# include <libxslt/transform.h>
# endif
# include <libxslt/imports.h>
# include <libxslt/xsltutils.h>
# include <libxslt/variables.h>
# include <libxslt/xsltInternals.h>
# include <libxslt/documents.h>
# include <libxslt/extensions.h>
# include <libxslt/extra.h>
# endif
#endif
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include <libxml/xmlsave.h>
#include <libxslt/pattern.h>
#include <libxslt/transform.h>
#include <libxslt/imports.h>
#include <libxslt/xsltutils.h>
#include <libxslt/variables.h>
#include <libxslt/xsltInternals.h>
#include <libxslt/documents.h>
#include <libxslt/extensions.h>
#include <libxslt/extra.h>
#include "windef.h"
#include "winbase.h"
@@ -51,18 +41,15 @@
#include "ole2.h"
#include "rpcproxy.h"
#include "msxml.h"
#include "msxml2.h"
#include "msxml6.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/library.h"
#include "msxml_private.h"
HINSTANCE MSXML_hInstance = NULL;
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
void wineXmlCallbackLog(char const* caller, xmlErrorLevel lvl, char const* msg, va_list ap)
@@ -91,7 +78,7 @@ void wineXmlCallbackLog(char const* caller, xmlErrorLevel lvl, char const* msg,
wine_dbg_log(dbcl, &__wine_dbch_msxml, caller, "%s", buff);
}
void wineXmlCallbackError(char const* caller, xmlErrorPtr err)
void wineXmlCallbackError(char const* caller, const xmlError* err)
{
enum __wine_debug_class dbcl;
@@ -156,7 +143,7 @@ static int wineXmlReadCallback(void * context, char * buffer, int len)
return -1;
}
TRACE("Read %d\n", dwBytesRead);
TRACE("Read %ld bytes.\n", dwBytesRead);
return dwBytesRead;
}
@@ -166,86 +153,32 @@ static int wineXmlFileCloseCallback (void * context)
return CloseHandle(context) ? 0 : -1;
}
void* libxslt_handle = NULL;
#ifdef SONAME_LIBXSLT
# define DECL_FUNCPTR(f) typeof(f) * p##f = NULL
DECL_FUNCPTR(xsltApplyStylesheet);
DECL_FUNCPTR(xsltApplyStylesheetUser);
DECL_FUNCPTR(xsltCleanupGlobals);
DECL_FUNCPTR(xsltFreeStylesheet);
DECL_FUNCPTR(xsltFreeTransformContext);
DECL_FUNCPTR(xsltFunctionNodeSet);
DECL_FUNCPTR(xsltNewTransformContext);
DECL_FUNCPTR(xsltNextImport);
DECL_FUNCPTR(xsltParseStylesheetDoc);
DECL_FUNCPTR(xsltQuoteUserParams);
DECL_FUNCPTR(xsltRegisterExtModuleFunction);
DECL_FUNCPTR(xsltSaveResultTo);
DECL_FUNCPTR(xsltSetLoaderFunc);
# undef DECL_FUNCPTR
#endif
static void init_libxslt(void)
{
#ifdef SONAME_LIBXSLT
void (*pxsltInit)(void); /* Missing in libxslt <= 1.1.14 */
libxslt_handle = wine_dlopen(SONAME_LIBXSLT, RTLD_NOW, NULL, 0);
if (!libxslt_handle)
return;
#define LOAD_FUNCPTR(f, needed) \
if ((p##f = wine_dlsym(libxslt_handle, #f, NULL, 0)) == NULL) \
if (needed) { WARN("Can't find symbol %s\n", #f); goto sym_not_found; }
LOAD_FUNCPTR(xsltInit, 0);
LOAD_FUNCPTR(xsltApplyStylesheet, 1);
LOAD_FUNCPTR(xsltApplyStylesheetUser, 1);
LOAD_FUNCPTR(xsltCleanupGlobals, 1);
LOAD_FUNCPTR(xsltFreeStylesheet, 1);
LOAD_FUNCPTR(xsltFreeTransformContext, 1);
LOAD_FUNCPTR(xsltFunctionNodeSet, 1);
LOAD_FUNCPTR(xsltNewTransformContext, 1);
LOAD_FUNCPTR(xsltNextImport, 1);
LOAD_FUNCPTR(xsltParseStylesheetDoc, 1);
LOAD_FUNCPTR(xsltQuoteUserParams, 1);
LOAD_FUNCPTR(xsltRegisterExtModuleFunction, 1);
LOAD_FUNCPTR(xsltSaveResultTo, 1);
LOAD_FUNCPTR(xsltSetLoaderFunc, 1);
#undef LOAD_FUNCPTR
if (pxsltInit)
pxsltInit();
pxsltSetLoaderFunc(xslt_doc_default_loader);
pxsltRegisterExtModuleFunction(
xsltInit();
xsltSetLoaderFunc(xslt_doc_default_loader);
xsltRegisterExtModuleFunction(
(const xmlChar *)"node-set",
(const xmlChar *)"urn:schemas-microsoft-com:xslt",
pxsltFunctionNodeSet);
return;
sym_not_found:
wine_dlclose(libxslt_handle, NULL, 0);
libxslt_handle = NULL;
#endif
xsltFunctionNodeSet);
}
static int to_utf8(int cp, unsigned char *out, int *outlen, const unsigned char *in, int *inlen)
{
WCHAR *tmp;
int len;
int len = 0;
if (!in || !inlen) return 0;
if (!in || !inlen || !*inlen) goto done;
len = MultiByteToWideChar(cp, 0, (const char *)in, *inlen, NULL, 0);
tmp = heap_alloc(len * sizeof(WCHAR));
tmp = malloc(len * sizeof(WCHAR));
if (!tmp) return -1;
MultiByteToWideChar(cp, 0, (const char *)in, *inlen, tmp, len);
len = WideCharToMultiByte(CP_UTF8, 0, tmp, len, (char *)out, *outlen, NULL, NULL);
heap_free(tmp);
free(tmp);
if (!len) return -1;
done:
*outlen = len;
return len;
}
@@ -253,23 +186,43 @@ static int to_utf8(int cp, unsigned char *out, int *outlen, const unsigned char
static int from_utf8(int cp, unsigned char *out, int *outlen, const unsigned char *in, int *inlen)
{
WCHAR *tmp;
int len;
int len = 0;
if (!in || !inlen) return 0;
if (!in || !inlen || !*inlen) goto done;
len = MultiByteToWideChar(CP_UTF8, 0, (const char *)in, *inlen, NULL, 0);
tmp = heap_alloc(len * sizeof(WCHAR));
tmp = malloc(len * sizeof(WCHAR));
if (!tmp) return -1;
MultiByteToWideChar(CP_UTF8, 0, (const char *)in, *inlen, tmp, len);
len = WideCharToMultiByte(cp, 0, tmp, len, (char *)out, *outlen, NULL, NULL);
heap_free(tmp);
free(tmp);
if (!len) return -1;
done:
*outlen = len;
return len;
}
static int gbk_to_utf8(unsigned char *out, int *outlen, const unsigned char *in, int *inlen)
{
return to_utf8(936, out, outlen, in, inlen);
}
static int utf8_to_gbk(unsigned char *out, int *outlen, const unsigned char *in, int *inlen)
{
return from_utf8(936, out, outlen, in, inlen);
}
static int iso8859_1_to_utf8(unsigned char *out, int *outlen, const unsigned char *in, int *inlen)
{
return to_utf8(28591, out, outlen, in, inlen);
}
static int utf8_to_iso8859_1(unsigned char *out, int *outlen, const unsigned char *in, int *inlen)
{
return from_utf8(28591, out, outlen, in, inlen);
}
static int win1250_to_utf8(unsigned char *out, int *outlen, const unsigned char *in, int *inlen)
{
return to_utf8(1250, out, outlen, in, inlen);
@@ -368,15 +321,17 @@ static void init_char_encoders(void)
xmlCharEncodingOutputFunc output;
} encoder[] =
{
{ "windows-1250", win1250_to_utf8, utf8_to_win1250 },
{ "windows-1251", win1251_to_utf8, utf8_to_win1251 },
{ "windows-1252", win1252_to_utf8, utf8_to_win1252 },
{ "windows-1253", win1253_to_utf8, utf8_to_win1253 },
{ "windows-1254", win1254_to_utf8, utf8_to_win1254 },
{ "windows-1255", win1255_to_utf8, utf8_to_win1255 },
{ "windows-1256", win1256_to_utf8, utf8_to_win1256 },
{ "windows-1257", win1257_to_utf8, utf8_to_win1257 },
{ "windows-1258", win1258_to_utf8, utf8_to_win1258 }
{ "gbk", gbk_to_utf8, utf8_to_gbk },
{ "iso8859-1", iso8859_1_to_utf8, utf8_to_iso8859_1 },
{ "windows-1250", win1250_to_utf8, utf8_to_win1250 },
{ "windows-1251", win1251_to_utf8, utf8_to_win1251 },
{ "windows-1252", win1252_to_utf8, utf8_to_win1252 },
{ "windows-1253", win1253_to_utf8, utf8_to_win1253 },
{ "windows-1254", win1254_to_utf8, utf8_to_win1254 },
{ "windows-1255", win1255_to_utf8, utf8_to_win1255 },
{ "windows-1256", win1256_to_utf8, utf8_to_win1256 },
{ "windows-1257", win1257_to_utf8, utf8_to_win1257 },
{ "windows-1258", win1258_to_utf8, utf8_to_win1258 }
};
int i;
@@ -390,15 +345,18 @@ static void init_char_encoders(void)
}
}
#endif /* HAVE_LIBXML2 */
HRESULT WINAPI DllCanUnloadNow(void)
const CLSID* DOMDocument_version(MSXML_VERSION v)
{
return S_FALSE;
switch (v)
{
default:
case MSXML_DEFAULT: return &CLSID_DOMDocument;
case MSXML3: return &CLSID_DOMDocument30;
case MSXML4: return &CLSID_DOMDocument40;
case MSXML6: return &CLSID_DOMDocument60;
}
}
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID reserved)
{
MSXML_hInstance = hInstDLL;
@@ -406,7 +364,6 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID reserved)
switch(fdwReason)
{
case DLL_PROCESS_ATTACH:
#ifdef HAVE_LIBXML2
xmlInitParser();
/* Set the default indent character to a single tab,
@@ -423,44 +380,19 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID reserved)
schemasInit();
init_libxslt();
#endif
DisableThreadLibraryCalls(hInstDLL);
break;
case DLL_PROCESS_DETACH:
if (reserved) break;
#ifdef HAVE_LIBXML2
#ifdef SONAME_LIBXSLT
if (libxslt_handle)
{
pxsltCleanupGlobals();
wine_dlclose(libxslt_handle, NULL, 0);
}
#endif
xsltCleanupGlobals();
/* Restore default Callbacks */
xmlCleanupInputCallbacks();
xmlRegisterDefaultInputCallbacks();
xmlCleanupParser();
schemasCleanup();
#endif
release_typelib();
break;
}
return TRUE;
}
/***********************************************************************
* DllRegisterServer (MSXML3.@)
*/
HRESULT WINAPI DllRegisterServer(void)
{
return __wine_register_resources( MSXML_hInstance );
}
/***********************************************************************
* DllUnregisterServer (MSXML3.@)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
return __wine_unregister_resources( MSXML_hInstance );
}
+1 -1
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" name="Microsoft-Windows-MSXML30" version="6.0.6000.16386" processorArchitecture="*" publicKeyToken="31bf3856ad364e35"/>
<assemblyIdentity type="win32" name="Microsoft-Windows-MSXML30" version="6.0.6000.16386" processorArchitecture="" publicKeyToken="31bf3856ad364e35"/>
<file name="msxml3.dll"/>
</assembly>
+156
View File
@@ -0,0 +1,156 @@
/*
* Copyright 2005 Mike McCormack
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __MSXML_DISPEX__
#define __MSXML_DISPEX__
#include "dispex.h"
#include "wine/list.h"
typedef enum
{
MSXML_DEFAULT = 0,
MSXML2 = 20,
MSXML26 = 26,
MSXML3 = 30,
MSXML4 = 40,
MSXML6 = 60
} MSXML_VERSION;
typedef enum tid_t
{
NULL_tid,
IXMLDOMAttribute_tid,
IXMLDOMCDATASection_tid,
IXMLDOMComment_tid,
IXMLDOMDocument_tid,
IXMLDOMDocument2_tid,
IXMLDOMDocument3_tid,
IXMLDOMDocumentFragment_tid,
IXMLDOMDocumentType_tid,
IXMLDOMElement_tid,
IXMLDOMEntityReference_tid,
IXMLDOMImplementation_tid,
IXMLDOMNamedNodeMap_tid,
IXMLDOMNode_tid,
IXMLDOMNodeList_tid,
IXMLDOMParseError2_tid,
IXMLDOMProcessingInstruction_tid,
IXMLDOMSchemaCollection_tid,
IXMLDOMSchemaCollection2_tid,
IXMLDOMSelection_tid,
IXMLDOMText_tid,
IXMLElement_tid,
IXMLDocument_tid,
IXMLHTTPRequest_tid,
IXSLProcessor_tid,
IXSLTemplate_tid,
IVBSAXAttributes_tid,
IVBSAXContentHandler_tid,
IVBSAXDeclHandler_tid,
IVBSAXDTDHandler_tid,
IVBSAXEntityResolver_tid,
IVBSAXErrorHandler_tid,
IVBSAXLexicalHandler_tid,
IVBSAXLocator_tid,
IVBSAXXMLFilter_tid,
IVBSAXXMLReader_tid,
IMXAttributes_tid,
IMXReaderControl_tid,
IMXWriter_tid,
IVBMXNamespaceManager_tid,
IServerXMLHTTPRequest_tid,
LAST_tid
} tid_t;
extern HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo);
extern void release_typelib(void);
typedef struct dispex_data_t dispex_data_t;
typedef struct
{
HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*);
} dispex_static_data_vtbl_t;
typedef struct
{
const dispex_static_data_vtbl_t *vtbl;
const tid_t disp_tid;
dispex_data_t *data;
const tid_t* const iface_tids;
} dispex_static_data_t;
typedef struct
{
IDispatchEx IDispatchEx_iface;
IUnknown *outer;
dispex_static_data_t *data;
} DispatchEx;
void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
void release_dispex(DispatchEx*);
BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
const IID *get_riid_from_tid(enum tid_t tid);
static inline HRESULT return_bstr(const WCHAR *value, BSTR *p)
{
if (!p)
return E_INVALIDARG;
if (value)
{
*p = SysAllocString(value);
if (!*p)
return E_OUTOFMEMORY;
}
else
*p = NULL;
return S_OK;
}
static inline HRESULT return_bstrn(const WCHAR *value, int len, BSTR *p)
{
if (value)
{
*p = SysAllocStringLen(value, len);
if (!*p)
return E_OUTOFMEMORY;
}
else
*p = NULL;
return S_OK;
}
extern HRESULT dom_document_create(MSXML_VERSION class_version, void **document);
typedef struct bsc_t bsc_t;
HRESULT create_moniker_from_url(LPCWSTR, IMoniker**);
HRESULT create_uri(IUri *base, const WCHAR *, IUri **);
HRESULT bind_url(IMoniker*, HRESULT (*onDataAvailable)(void*,char*,DWORD), void*, bsc_t**);
HRESULT detach_bsc(bsc_t*);
IUri *get_base_uri(IUnknown *site);
#endif /* __MSXML_DISPEX__ */
+111 -294
View File
@@ -23,68 +23,15 @@
#include "dispex.h"
#include "wine/unicode.h"
#include "wine/heap.h"
#include "wine/list.h"
#ifndef __WINE_CONFIG_H
# error You must include config.h to use this header
#ifdef __REACTOS__
#include "wine/unicode.h"
#endif
typedef enum {
MSXML_DEFAULT = 0,
MSXML2 = 20,
MSXML26 = 26,
MSXML3 = 30,
MSXML4 = 40,
MSXML6 = 60
} MSXML_VERSION;
#include "msxml_dispex.h"
extern const CLSID * DOMDocument_version(MSXML_VERSION v);
/* typelibs */
typedef enum tid_t {
NULL_tid,
IXMLDOMAttribute_tid,
IXMLDOMCDATASection_tid,
IXMLDOMComment_tid,
IXMLDOMDocument_tid,
IXMLDOMDocument2_tid,
IXMLDOMDocument3_tid,
IXMLDOMDocumentFragment_tid,
IXMLDOMDocumentType_tid,
IXMLDOMElement_tid,
IXMLDOMEntityReference_tid,
IXMLDOMImplementation_tid,
IXMLDOMNamedNodeMap_tid,
IXMLDOMNode_tid,
IXMLDOMNodeList_tid,
IXMLDOMParseError2_tid,
IXMLDOMProcessingInstruction_tid,
IXMLDOMSchemaCollection_tid,
IXMLDOMSchemaCollection2_tid,
IXMLDOMSelection_tid,
IXMLDOMText_tid,
IXMLElement_tid,
IXMLDocument_tid,
IXMLHTTPRequest_tid,
IXSLProcessor_tid,
IXSLTemplate_tid,
IVBSAXAttributes_tid,
IVBSAXContentHandler_tid,
IVBSAXDeclHandler_tid,
IVBSAXDTDHandler_tid,
IVBSAXEntityResolver_tid,
IVBSAXErrorHandler_tid,
IVBSAXLexicalHandler_tid,
IVBSAXLocator_tid,
IVBSAXXMLFilter_tid,
IVBSAXXMLReader_tid,
IMXAttributes_tid,
IMXReaderControl_tid,
IMXWriter_tid,
IVBMXNamespaceManager_tid,
IServerXMLHTTPRequest_tid,
LAST_tid
} tid_t;
/* The XDR datatypes (urn:schemas-microsoft-com:datatypes)
* These are actually valid for XSD schemas as well
@@ -131,60 +78,7 @@ typedef enum _XDR_DT {
LAST_DT
} XDR_DT;
extern HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
extern void release_typelib(void) DECLSPEC_HIDDEN;
typedef struct dispex_data_t dispex_data_t;
typedef struct {
HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*);
} dispex_static_data_vtbl_t;
typedef struct {
const dispex_static_data_vtbl_t *vtbl;
const tid_t disp_tid;
dispex_data_t *data;
const tid_t* const iface_tids;
} dispex_static_data_t;
typedef struct {
IDispatchEx IDispatchEx_iface;
IUnknown *outer;
dispex_static_data_t *data;
} DispatchEx;
extern HINSTANCE MSXML_hInstance DECLSPEC_HIDDEN;
void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*) DECLSPEC_HIDDEN;
void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
const IID *get_riid_from_tid(enum tid_t tid) DECLSPEC_HIDDEN;
/* memory allocation functions */
static inline void* __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t size)
{
return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, size);
}
static inline LPWSTR heap_strdupW(LPCWSTR str)
{
LPWSTR ret = NULL;
if(str) {
DWORD size;
size = (strlenW(str)+1)*sizeof(WCHAR);
ret = heap_alloc(size);
if(ret)
memcpy(ret, str, size);
}
return ret;
}
extern HINSTANCE MSXML_hInstance;
/* XSLProcessor parameter list */
struct xslprocessor_par
@@ -200,23 +94,8 @@ struct xslprocessor_params
unsigned int count;
};
#ifdef HAVE_LIBXML2
extern void schemasInit(void) DECLSPEC_HIDDEN;
extern void schemasCleanup(void) DECLSPEC_HIDDEN;
#ifndef HAVE_XMLFIRSTELEMENTCHILD
static inline xmlNodePtr wine_xmlFirstElementChild(xmlNodePtr parent)
{
xmlNodePtr child;
for (child = parent->children; child != NULL; child = child->next)
if (child->type == XML_ELEMENT_NODE)
break;
return child;
}
#define xmlFirstElementChild wine_xmlFirstElementChild
#endif
extern void schemasInit(void);
extern void schemasCleanup(void);
/* IXMLDOMNode Internal Structure */
typedef struct _xmlnode
@@ -248,50 +127,50 @@ struct enumvariant_funcs
};
/* constructors */
extern IUnknown *create_domdoc( xmlNodePtr ) DECLSPEC_HIDDEN;
extern IUnknown *create_xmldoc( void ) DECLSPEC_HIDDEN;
extern IXMLDOMNode *create_node( xmlNodePtr ) DECLSPEC_HIDDEN;
extern IUnknown *create_element( xmlNodePtr ) DECLSPEC_HIDDEN;
extern IUnknown *create_attribute( xmlNodePtr, BOOL ) DECLSPEC_HIDDEN;
extern IUnknown *create_text( xmlNodePtr ) DECLSPEC_HIDDEN;
extern IUnknown *create_pi( xmlNodePtr ) DECLSPEC_HIDDEN;
extern IUnknown *create_comment( xmlNodePtr ) DECLSPEC_HIDDEN;
extern IUnknown *create_cdata( xmlNodePtr ) DECLSPEC_HIDDEN;
extern IXMLDOMNodeList *create_children_nodelist( xmlNodePtr ) DECLSPEC_HIDDEN;
extern IXMLDOMNamedNodeMap *create_nodemap( xmlNodePtr, const struct nodemap_funcs* ) DECLSPEC_HIDDEN;
extern IUnknown *create_doc_Implementation(void) DECLSPEC_HIDDEN;
extern IUnknown *create_doc_fragment( xmlNodePtr ) DECLSPEC_HIDDEN;
extern IUnknown *create_doc_entity_ref( xmlNodePtr ) DECLSPEC_HIDDEN;
extern IUnknown *create_doc_type( xmlNodePtr ) DECLSPEC_HIDDEN;
extern HRESULT create_selection( xmlNodePtr, xmlChar*, IXMLDOMNodeList** ) DECLSPEC_HIDDEN;
extern HRESULT create_enumvariant( IUnknown*, BOOL, const struct enumvariant_funcs*, IEnumVARIANT**) DECLSPEC_HIDDEN;
extern IUnknown *create_domdoc( xmlNodePtr );
extern IUnknown *create_xmldoc( void );
extern IXMLDOMNode *create_node( xmlNodePtr );
extern IUnknown *create_element( xmlNodePtr );
extern IUnknown *create_attribute( xmlNodePtr, BOOL );
extern IUnknown *create_text( xmlNodePtr );
extern IUnknown *create_pi( xmlNodePtr );
extern IUnknown *create_comment( xmlNodePtr );
extern IUnknown *create_cdata( xmlNodePtr );
extern IXMLDOMNodeList *create_children_nodelist( xmlNodePtr );
extern IXMLDOMNamedNodeMap *create_nodemap( xmlNodePtr, const struct nodemap_funcs* );
extern IUnknown *create_doc_fragment( xmlNodePtr );
extern IUnknown *create_doc_entity_ref( xmlNodePtr );
extern IUnknown *create_doc_type( xmlNodePtr );
extern HRESULT create_selection( xmlNodePtr, xmlChar*, IXMLDOMNodeList** );
extern HRESULT create_enumvariant( IUnknown*, BOOL, const struct enumvariant_funcs*, IEnumVARIANT**);
extern HRESULT create_dom_implementation(IXMLDOMImplementation **obj);
/* data accessors */
xmlNodePtr xmlNodePtr_from_domnode( IXMLDOMNode *iface, xmlElementType type ) DECLSPEC_HIDDEN;
xmlNodePtr xmlNodePtr_from_domnode( IXMLDOMNode *iface, xmlElementType type );
/* helpers */
extern xmlChar *xmlChar_from_wchar( LPCWSTR str ) DECLSPEC_HIDDEN;
extern xmlChar *xmlChar_from_wchar( LPCWSTR str );
extern void xmldoc_init( xmlDocPtr doc, MSXML_VERSION version ) DECLSPEC_HIDDEN;
extern LONG xmldoc_add_ref( xmlDocPtr doc ) DECLSPEC_HIDDEN;
extern LONG xmldoc_release( xmlDocPtr doc ) DECLSPEC_HIDDEN;
extern LONG xmldoc_add_refs( xmlDocPtr doc, LONG refs ) DECLSPEC_HIDDEN;
extern LONG xmldoc_release_refs ( xmlDocPtr doc, LONG refs ) DECLSPEC_HIDDEN;
extern void xmlnode_add_ref(xmlNodePtr node) DECLSPEC_HIDDEN;
extern void xmlnode_release(xmlNodePtr node) DECLSPEC_HIDDEN;
extern int xmlnode_get_inst_cnt( xmlnode *node ) DECLSPEC_HIDDEN;
extern HRESULT xmldoc_add_orphan( xmlDocPtr doc, xmlNodePtr node ) DECLSPEC_HIDDEN;
extern HRESULT xmldoc_remove_orphan( xmlDocPtr doc, xmlNodePtr node ) DECLSPEC_HIDDEN;
extern void xmldoc_link_xmldecl(xmlDocPtr doc, xmlNodePtr node) DECLSPEC_HIDDEN;
extern xmlNodePtr xmldoc_unlink_xmldecl(xmlDocPtr doc) DECLSPEC_HIDDEN;
extern MSXML_VERSION xmldoc_version( xmlDocPtr doc ) DECLSPEC_HIDDEN;
extern void xmldoc_init( xmlDocPtr doc, MSXML_VERSION version );
extern LONG xmldoc_add_ref( xmlDocPtr doc );
extern LONG xmldoc_release( xmlDocPtr doc );
extern LONG xmldoc_add_refs( xmlDocPtr doc, LONG refs );
extern LONG xmldoc_release_refs ( xmlDocPtr doc, LONG refs );
extern void xmlnode_add_ref(xmlNodePtr node);
extern void xmlnode_release(xmlNodePtr node);
extern int xmlnode_get_inst_cnt( xmlnode *node );
extern HRESULT xmldoc_add_orphan( xmlDocPtr doc, xmlNodePtr node );
extern HRESULT xmldoc_remove_orphan( xmlDocPtr doc, xmlNodePtr node );
extern void xmldoc_link_xmldecl(xmlDocPtr doc, xmlNodePtr node);
extern xmlNodePtr xmldoc_unlink_xmldecl(xmlDocPtr doc);
extern MSXML_VERSION xmldoc_version( xmlDocPtr doc );
extern HRESULT XMLElement_create( xmlNodePtr node, LPVOID *ppObj, BOOL own ) DECLSPEC_HIDDEN;
extern HRESULT XMLElement_create( xmlNodePtr node, LPVOID *ppObj, BOOL own );
extern void wineXmlCallbackLog(char const* caller, xmlErrorLevel lvl, char const* msg, va_list ap) DECLSPEC_HIDDEN;
extern void wineXmlCallbackError(char const* caller, xmlErrorPtr err) DECLSPEC_HIDDEN;
extern void wineXmlCallbackLog(char const* caller, xmlErrorLevel lvl, char const* msg, va_list ap);
extern void wineXmlCallbackError(char const* caller, const xmlError* err);
#define LIBXML2_LOG_CALLBACK __WINE_PRINTF_ATTR(2,3)
#define LIBXML2_LOG_CALLBACK WINAPIV __WINE_PRINTF_ATTR(2,3)
#define LIBXML2_CALLBACK_TRACE(caller, msg, ap) \
wineXmlCallbackLog(#caller, XML_ERR_NONE, msg, ap)
@@ -304,68 +183,68 @@ extern void wineXmlCallbackError(char const* caller, xmlErrorPtr err) DECLSPEC_H
#define LIBXML2_CALLBACK_SERROR(caller, err) wineXmlCallbackError(#caller, err)
extern BOOL is_preserving_whitespace(xmlNodePtr node) DECLSPEC_HIDDEN;
extern BOOL is_xpathmode(const xmlDocPtr doc) DECLSPEC_HIDDEN;
extern void set_xpathmode(xmlDocPtr doc, BOOL xpath) DECLSPEC_HIDDEN;
extern BOOL is_preserving_whitespace(xmlNodePtr node);
extern BOOL is_xpathmode(const xmlDocPtr doc);
extern void set_xpathmode(xmlDocPtr doc, BOOL xpath);
extern void init_xmlnode(xmlnode*,xmlNodePtr,IXMLDOMNode*,dispex_static_data_t*) DECLSPEC_HIDDEN;
extern void destroy_xmlnode(xmlnode*) DECLSPEC_HIDDEN;
extern BOOL node_query_interface(xmlnode*,REFIID,void**) DECLSPEC_HIDDEN;
extern xmlnode *get_node_obj(IXMLDOMNode*) DECLSPEC_HIDDEN;
extern void init_xmlnode(xmlnode*,xmlNodePtr,IXMLDOMNode*,dispex_static_data_t*);
extern void destroy_xmlnode(xmlnode*);
extern BOOL node_query_interface(xmlnode*,REFIID,void**);
extern xmlnode *get_node_obj(IXMLDOMNode*);
extern HRESULT node_append_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_get_nodeName(xmlnode*,BSTR*) DECLSPEC_HIDDEN;
extern HRESULT node_get_content(xmlnode*,VARIANT*) DECLSPEC_HIDDEN;
extern HRESULT node_set_content(xmlnode*,LPCWSTR) DECLSPEC_HIDDEN;
extern HRESULT node_put_value(xmlnode*,VARIANT*) DECLSPEC_HIDDEN;
extern HRESULT node_put_value_escaped(xmlnode*,VARIANT*) DECLSPEC_HIDDEN;
extern HRESULT node_get_parent(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_get_child_nodes(xmlnode*,IXMLDOMNodeList**) DECLSPEC_HIDDEN;
extern HRESULT node_get_first_child(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_get_last_child(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_get_previous_sibling(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_get_next_sibling(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_insert_before(xmlnode*,IXMLDOMNode*,const VARIANT*,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_replace_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_put_text(xmlnode*,BSTR) DECLSPEC_HIDDEN;
extern HRESULT node_get_xml(xmlnode*,BOOL,BSTR*) DECLSPEC_HIDDEN;
extern HRESULT node_clone(xmlnode*,VARIANT_BOOL,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_get_prefix(xmlnode*,BSTR*) DECLSPEC_HIDDEN;
extern HRESULT node_get_base_name(xmlnode*,BSTR*) DECLSPEC_HIDDEN;
extern HRESULT node_get_namespaceURI(xmlnode*,BSTR*) DECLSPEC_HIDDEN;
extern HRESULT node_remove_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_has_childnodes(const xmlnode*,VARIANT_BOOL*) DECLSPEC_HIDDEN;
extern HRESULT node_get_owner_doc(const xmlnode*,IXMLDOMDocument**) DECLSPEC_HIDDEN;
extern HRESULT node_get_text(const xmlnode*,BSTR*) DECLSPEC_HIDDEN;
extern HRESULT node_select_nodes(const xmlnode*,BSTR,IXMLDOMNodeList**) DECLSPEC_HIDDEN;
extern HRESULT node_select_singlenode(const xmlnode*,BSTR,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_transform_node(const xmlnode*,IXMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
extern HRESULT node_append_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode**);
extern HRESULT node_get_nodeName(xmlnode*,BSTR*);
extern HRESULT node_get_content(xmlnode*,VARIANT*);
extern HRESULT node_set_content(xmlnode*,LPCWSTR);
extern HRESULT node_put_value(xmlnode*,VARIANT*);
extern HRESULT node_put_value_escaped(xmlnode*,VARIANT*);
extern HRESULT node_get_parent(xmlnode*,IXMLDOMNode**);
extern HRESULT node_get_child_nodes(xmlnode*,IXMLDOMNodeList**);
extern HRESULT node_get_first_child(xmlnode*,IXMLDOMNode**);
extern HRESULT node_get_last_child(xmlnode*,IXMLDOMNode**);
extern HRESULT node_get_previous_sibling(xmlnode*,IXMLDOMNode**);
extern HRESULT node_get_next_sibling(xmlnode*,IXMLDOMNode**);
extern HRESULT node_insert_before(xmlnode*,IXMLDOMNode*,const VARIANT*,IXMLDOMNode**);
extern HRESULT node_replace_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode*,IXMLDOMNode**);
extern HRESULT node_put_text(xmlnode*,BSTR);
extern HRESULT node_get_xml(xmlnode*,BOOL,BSTR*);
extern HRESULT node_clone(xmlnode*,VARIANT_BOOL,IXMLDOMNode**);
extern HRESULT node_get_prefix(xmlnode*,BSTR*);
extern HRESULT node_get_base_name(xmlnode*,BSTR*);
extern HRESULT node_get_namespaceURI(xmlnode*,BSTR*);
extern HRESULT node_remove_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode**);
extern HRESULT node_has_childnodes(const xmlnode*,VARIANT_BOOL*);
extern HRESULT node_get_owner_doc(const xmlnode*,IXMLDOMDocument**);
extern HRESULT node_get_text(const xmlnode*,BSTR*);
extern HRESULT node_select_nodes(const xmlnode*,BSTR,IXMLDOMNodeList**);
extern HRESULT node_select_singlenode(const xmlnode*,BSTR,IXMLDOMNode**);
extern HRESULT node_transform_node(const xmlnode*,IXMLDOMNode*,BSTR*);
extern HRESULT node_transform_node_params(const xmlnode*,IXMLDOMNode*,BSTR*,ISequentialStream*,
const struct xslprocessor_params*) DECLSPEC_HIDDEN;
extern HRESULT node_create_supporterrorinfo(const tid_t*,void**) DECLSPEC_HIDDEN;
const struct xslprocessor_params*);
extern HRESULT node_create_supporterrorinfo(const tid_t*,void**);
extern HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document) DECLSPEC_HIDDEN;
extern HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document);
extern HRESULT SchemaCache_validate_tree(IXMLDOMSchemaCollection2*, xmlNodePtr) DECLSPEC_HIDDEN;
extern XDR_DT SchemaCache_get_node_dt(IXMLDOMSchemaCollection2*, xmlNodePtr) DECLSPEC_HIDDEN;
extern HRESULT cache_from_doc_ns(IXMLDOMSchemaCollection2*, xmlnode*) DECLSPEC_HIDDEN;
extern HRESULT SchemaCache_validate_tree(IXMLDOMSchemaCollection2*, xmlNodePtr);
extern XDR_DT SchemaCache_get_node_dt(IXMLDOMSchemaCollection2*, xmlNodePtr);
extern HRESULT cache_from_doc_ns(IXMLDOMSchemaCollection2*, xmlnode*);
extern XDR_DT str_to_dt(xmlChar const* str, int len /* calculated if -1 */) DECLSPEC_HIDDEN;
extern XDR_DT bstr_to_dt(OLECHAR const* bstr, int len /* calculated if -1 */) DECLSPEC_HIDDEN;
extern xmlChar const* dt_to_str(XDR_DT dt) DECLSPEC_HIDDEN;
extern const char* debugstr_dt(XDR_DT dt) DECLSPEC_HIDDEN;
extern OLECHAR const* dt_to_bstr(XDR_DT dt) DECLSPEC_HIDDEN;
extern HRESULT dt_validate(XDR_DT dt, xmlChar const* content) DECLSPEC_HIDDEN;
extern XDR_DT str_to_dt(xmlChar const* str, int len /* calculated if -1 */);
extern XDR_DT bstr_to_dt(OLECHAR const* bstr, int len /* calculated if -1 */);
extern xmlChar const* dt_to_str(XDR_DT dt);
extern const char* debugstr_dt(XDR_DT dt);
extern OLECHAR const* dt_to_bstr(XDR_DT dt);
extern HRESULT dt_validate(XDR_DT dt, xmlChar const* content);
extern BSTR EnsureCorrectEOL(BSTR) DECLSPEC_HIDDEN;
extern BSTR EnsureCorrectEOL(BSTR);
extern xmlChar* tagName_to_XPath(const BSTR tagName) DECLSPEC_HIDDEN;
extern xmlChar* tagName_to_XPath(const BSTR tagName);
#ifdef SONAME_LIBXSLT
# include <libxslt/documents.h>
extern HRESULT dom_pi_put_xml_decl(IXMLDOMNode *node, BSTR data);
#include <libxslt/documents.h>
extern xmlDocPtr xslt_doc_default_loader(const xmlChar *uri, xmlDictPtr dict, int options,
void *_ctxt, xsltLoadType type) DECLSPEC_HIDDEN;
#endif /* SONAME_LIBXSLT */
void *_ctxt, xsltLoadType type);
static inline BSTR bstr_from_xmlChar(const xmlChar *str)
{
@@ -388,7 +267,7 @@ static inline xmlChar *xmlchar_from_wcharn(const WCHAR *str, int nchars, BOOL us
xmlChar *xmlstr;
DWORD len = WideCharToMultiByte( CP_UTF8, 0, str, nchars, NULL, 0, NULL, NULL );
xmlstr = use_xml_alloc ? xmlMalloc( len + 1 ) : heap_alloc( len + 1 );
xmlstr = use_xml_alloc ? xmlMalloc( len + 1 ) : malloc( len + 1 );
if ( xmlstr )
{
WideCharToMultiByte( CP_UTF8, 0, str, nchars, (LPSTR) xmlstr, len+1, NULL, NULL );
@@ -402,7 +281,7 @@ static inline xmlChar *xmlchar_from_wchar( const WCHAR *str )
return xmlchar_from_wcharn(str, -1, FALSE);
}
static inline xmlChar *heap_strdupxmlChar(const xmlChar *str)
static inline xmlChar *strdupxmlChar(const xmlChar *str)
{
xmlChar *ret = NULL;
@@ -410,43 +289,13 @@ static inline xmlChar *heap_strdupxmlChar(const xmlChar *str)
DWORD size;
size = (xmlStrlen(str)+1)*sizeof(xmlChar);
ret = heap_alloc(size);
ret = malloc(size);
memcpy(ret, str, size);
}
return ret;
}
#endif
static inline HRESULT return_bstr(const WCHAR *value, BSTR *p)
{
if(!p)
return E_INVALIDARG;
if(value) {
*p = SysAllocString(value);
if(!*p)
return E_OUTOFMEMORY;
}else {
*p = NULL;
}
return S_OK;
}
static inline HRESULT return_bstrn(const WCHAR *value, int len, BSTR *p)
{
if(value) {
*p = SysAllocStringLen(value, len);
if(!*p)
return E_OUTOFMEMORY;
}else
*p = NULL;
return S_OK;
}
static inline HRESULT return_null_node(IXMLDOMNode **p)
{
if(!p)
@@ -491,50 +340,18 @@ static inline HRESULT return_var_false(VARIANT_BOOL *p)
}
extern IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText,
LONG line, LONG linepos, LONG filepos ) DECLSPEC_HIDDEN;
extern HRESULT DOMDocument_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN;
extern HRESULT SchemaCache_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN;
extern HRESULT XMLDocument_create(void**) DECLSPEC_HIDDEN;
extern HRESULT SAXXMLReader_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN;
extern HRESULT SAXAttributes_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN;
extern HRESULT XMLHTTPRequest_create(void **) DECLSPEC_HIDDEN;
extern HRESULT ServerXMLHTTP_create(void **) DECLSPEC_HIDDEN;
extern HRESULT XSLTemplate_create(void**) DECLSPEC_HIDDEN;
extern HRESULT MXWriter_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN;
extern HRESULT MXNamespaceManager_create(void**) DECLSPEC_HIDDEN;
extern HRESULT XMLParser_create(void**) DECLSPEC_HIDDEN;
extern HRESULT XMLView_create(void**) DECLSPEC_HIDDEN;
static inline const CLSID* DOMDocument_version(MSXML_VERSION v)
{
switch (v)
{
default:
case MSXML_DEFAULT: return &CLSID_DOMDocument;
case MSXML3: return &CLSID_DOMDocument30;
case MSXML4: return &CLSID_DOMDocument40;
case MSXML6: return &CLSID_DOMDocument60;
}
}
static inline const CLSID* SchemaCache_version(MSXML_VERSION v)
{
switch (v)
{
default:
case MSXML_DEFAULT: return &CLSID_XMLSchemaCache;
case MSXML3: return &CLSID_XMLSchemaCache30;
case MSXML4: return &CLSID_XMLSchemaCache40;
case MSXML6: return &CLSID_XMLSchemaCache60;
}
}
typedef struct bsc_t bsc_t;
HRESULT create_moniker_from_url(LPCWSTR, IMoniker**) DECLSPEC_HIDDEN;
HRESULT create_uri(const WCHAR *, IUri **) DECLSPEC_HIDDEN;
HRESULT bind_url(IMoniker*, HRESULT (*onDataAvailable)(void*,char*,DWORD), void*, bsc_t**) DECLSPEC_HIDDEN;
HRESULT detach_bsc(bsc_t*) DECLSPEC_HIDDEN;
LONG line, LONG linepos, LONG filepos );
extern HRESULT SchemaCache_create(MSXML_VERSION, void**);
extern HRESULT XMLDocument_create(void**);
extern HRESULT SAXXMLReader_create(MSXML_VERSION, void**);
extern HRESULT SAXAttributes_create(MSXML_VERSION, void**);
extern HRESULT XMLHTTPRequest_create(void **);
extern HRESULT ServerXMLHTTP_create(void **);
extern HRESULT XSLTemplate_create(void**);
extern HRESULT MXWriter_create(MSXML_VERSION, void**);
extern HRESULT MXNamespaceManager_create(void**);
extern HRESULT XMLParser_create(void**);
extern HRESULT XMLView_create(void**);
/* Error Codes - not defined anywhere in the public headers */
#define E_XML_ELEMENT_UNDECLARED 0xC00CE00D
+28 -35
View File
@@ -20,14 +20,7 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
# include <libxml/encoding.h>
#endif
#include "windef.h"
#include "winbase.h"
@@ -35,7 +28,7 @@
#include "ole2.h"
#include "msxml6.h"
#include "msxml_private.h"
#include "msxml_dispex.h"
#include "wine/debug.h"
@@ -94,14 +87,14 @@ static HRESULT declare_prefix(namespacemanager *This, const WCHAR *prefix, const
if (ctxt->count == ctxt->max_alloc)
{
ctxt->max_alloc *= 2;
ctxt->ns = heap_realloc(ctxt->ns, ctxt->max_alloc*sizeof(*ctxt->ns));
ctxt->ns = realloc(ctxt->ns, ctxt->max_alloc * sizeof(*ctxt->ns));
}
if (!prefix) prefix = emptyW;
ns = NULL;
for (i = 0; i < ctxt->count; i++)
if (!strcmpW(ctxt->ns[i].prefix, prefix))
if (!wcscmp(ctxt->ns[i].prefix, prefix))
{
ns = &ctxt->ns[i];
break;
@@ -150,7 +143,7 @@ static HRESULT get_declared_prefix_uri(const struct list *ctxts, const WCHAR *ur
{
int i;
for (i = 0; i < ctxt->count; i++)
if (!strcmpW(ctxt->ns[i].uri, uri))
if (!wcscmp(ctxt->ns[i].uri, uri))
{
*prefix = ctxt->ns[i].prefix;
return S_OK;
@@ -166,7 +159,7 @@ static HRESULT get_uri_from_prefix(const struct nscontext *ctxt, const WCHAR *pr
int i;
for (i = 0; i < ctxt->count; i++)
if (!strcmpW(ctxt->ns[i].prefix, prefix))
if (!wcscmp(ctxt->ns[i].prefix, prefix))
{
*uri = ctxt->ns[i].uri;
return S_OK;
@@ -180,15 +173,15 @@ static struct nscontext* alloc_ns_context(void)
{
struct nscontext *ctxt;
ctxt = heap_alloc(sizeof(*ctxt));
ctxt = malloc(sizeof(*ctxt));
if (!ctxt) return NULL;
ctxt->count = 0;
ctxt->max_alloc = DEFAULT_PREFIX_ALLOC_COUNT;
ctxt->ns = heap_alloc(ctxt->max_alloc*sizeof(*ctxt->ns));
ctxt->ns = malloc(ctxt->max_alloc * sizeof(*ctxt->ns));
if (!ctxt->ns)
{
heap_free(ctxt);
free(ctxt);
return NULL;
}
@@ -198,8 +191,8 @@ static struct nscontext* alloc_ns_context(void)
ctxt->count++;
if (!ctxt->ns[0].prefix || !ctxt->ns[0].uri)
{
heap_free(ctxt->ns);
heap_free(ctxt);
free(ctxt->ns);
free(ctxt);
return NULL;
}
@@ -216,8 +209,8 @@ static void free_ns_context(struct nscontext *ctxt)
SysFreeString(ctxt->ns[i].uri);
}
heap_free(ctxt->ns);
heap_free(ctxt);
free(ctxt->ns);
free(ctxt);
}
static HRESULT WINAPI namespacemanager_QueryInterface(IMXNamespaceManager *iface, REFIID riid, void **ppvObject)
@@ -286,7 +279,7 @@ static HRESULT WINAPI namespacemanager_declarePrefix(IMXNamespaceManager *iface,
TRACE("(%p)->(%s %s)\n", This, debugstr_w(prefix), debugstr_w(namespaceURI));
if (prefix && (!strcmpW(prefix, xmlW) || !strcmpW(prefix, xmlnsW) || !namespaceURI))
if (prefix && (!wcscmp(prefix, xmlW) || !wcscmp(prefix, xmlnsW) || !namespaceURI))
return E_INVALIDARG;
return declare_prefix(This, prefix, namespaceURI);
@@ -300,7 +293,7 @@ static HRESULT WINAPI namespacemanager_getDeclaredPrefix(IMXNamespaceManager *if
HRESULT hr;
BSTR prfx;
TRACE("(%p)->(%d %p %p)\n", This, index, prefix, prefix_len);
TRACE("%p, %ld, %p, %p.\n", This, index, prefix, prefix_len);
if (!prefix_len) return E_POINTER;
@@ -311,7 +304,7 @@ static HRESULT WINAPI namespacemanager_getDeclaredPrefix(IMXNamespaceManager *if
if (prefix)
{
if (*prefix_len < (INT)SysStringLen(prfx)) return E_XML_BUFFERTOOSMALL;
strcpyW(prefix, prfx);
lstrcpyW(prefix, prfx);
}
*prefix_len = SysStringLen(prfx);
@@ -322,15 +315,15 @@ static HRESULT WINAPI namespacemanager_getDeclaredPrefix(IMXNamespaceManager *if
static HRESULT WINAPI namespacemanager_getPrefix(IMXNamespaceManager *iface,
const WCHAR *uri, LONG index, WCHAR *prefix, int *prefix_len)
{
namespacemanager *This = impl_from_IMXNamespaceManager( iface );
namespacemanager *manager = impl_from_IMXNamespaceManager(iface);
HRESULT hr;
BSTR prfx;
TRACE("(%p)->(%s %d %p %p)\n", This, debugstr_w(uri), index, prefix, prefix_len);
TRACE("%p, %s, %ld, %p, %p.\n", iface, debugstr_w(uri), index, prefix, prefix_len);
if (!uri || !*uri || !prefix_len) return E_INVALIDARG;
hr = get_declared_prefix_uri(&This->ctxts, uri, &prfx);
hr = get_declared_prefix_uri(&manager->ctxts, uri, &prfx);
if (hr == S_OK)
{
/* TODO: figure out what index argument is for */
@@ -339,7 +332,7 @@ static HRESULT WINAPI namespacemanager_getPrefix(IMXNamespaceManager *iface,
if (prefix)
{
if (*prefix_len < (INT)SysStringLen(prfx)) return E_XML_BUFFERTOOSMALL;
strcpyW(prefix, prfx);
lstrcpyW(prefix, prfx);
}
*prefix_len = SysStringLen(prfx);
@@ -375,7 +368,7 @@ static HRESULT WINAPI namespacemanager_getURI(IMXNamespaceManager *iface,
if (uri)
{
if (*uri_len < (INT)SysStringLen(urib)) return E_XML_BUFFERTOOSMALL;
strcpyW(uri, urib);
lstrcpyW(uri, urib);
}
}
else
@@ -436,9 +429,9 @@ static HRESULT WINAPI vbnamespacemanager_QueryInterface(IVBMXNamespaceManager *i
static ULONG WINAPI vbnamespacemanager_AddRef(IVBMXNamespaceManager *iface)
{
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%u)\n", This, ref );
namespacemanager *manager = impl_from_IVBMXNamespaceManager(iface);
ULONG ref = InterlockedIncrement(&manager->ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -447,9 +440,9 @@ static ULONG WINAPI vbnamespacemanager_Release(IVBMXNamespaceManager *iface)
namespacemanager *This = impl_from_IVBMXNamespaceManager( iface );
ULONG ref = InterlockedDecrement( &This->ref );
TRACE("(%p)->(%u)\n", This, ref );
TRACE("%p, refcount %lu.\n", iface, ref);
if ( ref == 0 )
if (!ref)
{
struct nscontext *ctxt, *ctxt2;
@@ -459,7 +452,7 @@ static ULONG WINAPI vbnamespacemanager_Release(IVBMXNamespaceManager *iface)
free_ns_context(ctxt);
}
heap_free( This );
free(This);
}
return ref;
@@ -649,7 +642,7 @@ HRESULT MXNamespaceManager_create(void **obj)
TRACE("(%p)\n", obj);
This = heap_alloc( sizeof (*This) );
This = malloc(sizeof(*This));
if( !This )
return E_OUTOFMEMORY;
@@ -662,7 +655,7 @@ HRESULT MXNamespaceManager_create(void **obj)
ctxt = alloc_ns_context();
if (!ctxt)
{
heap_free(This);
free(This);
return E_OUTOFMEMORY;
}
+82 -80
View File
@@ -20,12 +20,8 @@
*/
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
#endif
#include "windef.h"
#include "winbase.h"
@@ -34,9 +30,8 @@
#include "msxml6.h"
#include "wine/debug.h"
#include "wine/list.h"
#include "msxml_private.h"
#include "msxml_dispex.h"
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
@@ -63,6 +58,15 @@ typedef enum
XmlEncoding_ISO_8859_9,
XmlEncoding_UTF16,
XmlEncoding_UTF8,
XmlEncoding_windows_1250,
XmlEncoding_windows_1251,
XmlEncoding_windows_1252,
XmlEncoding_windows_1253,
XmlEncoding_windows_1254,
XmlEncoding_windows_1255,
XmlEncoding_windows_1256,
XmlEncoding_windows_1257,
XmlEncoding_windows_1258,
XmlEncoding_Unknown
} xml_encoding;
@@ -84,6 +88,15 @@ static const WCHAR iso_8859_13W[] = {'i','s','o','-','8','8','5','9','-','1','3'
static const WCHAR iso_8859_15W[] = {'i','s','o','-','8','8','5','9','-','1','5',0};
static const WCHAR utf16W[] = {'U','T','F','-','1','6',0};
static const WCHAR utf8W[] = {'U','T','F','-','8',0};
static const WCHAR windows_1250W[] = {'w','i','n','d','o','w','s','-','1','2','5','0',0};
static const WCHAR windows_1251W[] = {'w','i','n','d','o','w','s','-','1','2','5','1',0};
static const WCHAR windows_1252W[] = {'w','i','n','d','o','w','s','-','1','2','5','2',0};
static const WCHAR windows_1253W[] = {'w','i','n','d','o','w','s','-','1','2','5','3',0};
static const WCHAR windows_1254W[] = {'w','i','n','d','o','w','s','-','1','2','5','4',0};
static const WCHAR windows_1255W[] = {'w','i','n','d','o','w','s','-','1','2','5','5',0};
static const WCHAR windows_1256W[] = {'w','i','n','d','o','w','s','-','1','2','5','6',0};
static const WCHAR windows_1257W[] = {'w','i','n','d','o','w','s','-','1','2','5','7',0};
static const WCHAR windows_1258W[] = {'w','i','n','d','o','w','s','-','1','2','5','8',0};
static const struct xml_encoding_data xml_encoding_map[] = {
{ iso_8859_1W, XmlEncoding_ISO_8859_1, 28591 },
@@ -96,7 +109,16 @@ static const struct xml_encoding_data xml_encoding_map[] = {
{ iso_8859_7W, XmlEncoding_ISO_8859_7, 28597 },
{ iso_8859_9W, XmlEncoding_ISO_8859_9, 28599 },
{ utf16W, XmlEncoding_UTF16, ~0 },
{ utf8W, XmlEncoding_UTF8, CP_UTF8 }
{ utf8W, XmlEncoding_UTF8, CP_UTF8 },
{ windows_1250W,XmlEncoding_windows_1250, 1250 },
{ windows_1251W,XmlEncoding_windows_1251, 1251 },
{ windows_1252W,XmlEncoding_windows_1252, 1252 },
{ windows_1253W,XmlEncoding_windows_1253, 1253 },
{ windows_1254W,XmlEncoding_windows_1254, 1254 },
{ windows_1255W,XmlEncoding_windows_1255, 1255 },
{ windows_1256W,XmlEncoding_windows_1256, 1256 },
{ windows_1257W,XmlEncoding_windows_1257, 1257 },
{ windows_1258W,XmlEncoding_windows_1258, 1258 }
};
typedef enum
@@ -215,7 +237,7 @@ static HRESULT mxattributes_grow(mxattributes *This)
if (This->length < This->allocated) return S_OK;
This->allocated *= 2;
This->attr = heap_realloc(This->attr, This->allocated*sizeof(mxattribute));
This->attr = realloc(This->attr, This->allocated * sizeof(mxattribute));
return This->attr ? S_OK : E_OUTOFMEMORY;
}
@@ -231,7 +253,7 @@ static xml_encoding parse_encoding_name(const WCHAR *encoding)
{
n = (min+max)/2;
c = strcmpiW(xml_encoding_map[n].encoding, encoding);
c = lstrcmpiW(xml_encoding_map[n].encoding, encoding);
if (!c)
return xml_encoding_map[n].enc;
@@ -247,7 +269,7 @@ static xml_encoding parse_encoding_name(const WCHAR *encoding)
static HRESULT init_encoded_buffer(encoded_buffer *buffer)
{
const int initial_len = 0x1000;
buffer->data = heap_alloc(initial_len);
buffer->data = malloc(initial_len);
if (!buffer->data) return E_OUTOFMEMORY;
memset(buffer->data, 0, 4);
@@ -259,7 +281,7 @@ static HRESULT init_encoded_buffer(encoded_buffer *buffer)
static void free_encoded_buffer(encoded_buffer *buffer)
{
heap_free(buffer->data);
free(buffer->data);
}
static HRESULT get_code_page(xml_encoding encoding, UINT *cp)
@@ -306,7 +328,7 @@ static void free_output_buffer(output_buffer *buffer)
{
list_remove(&cur->entry);
free_encoded_buffer(cur);
heap_free(cur);
free(cur);
}
}
@@ -314,13 +336,13 @@ static HRESULT write_output_buffer(mxwriter *writer, const WCHAR *data, int len)
{
output_buffer *buffer = &writer->buffer;
encoded_buffer *buff;
unsigned int written;
ULONG written;
int src_len;
if (!len || !*data)
return S_OK;
src_len = len == -1 ? strlenW(data) : len;
src_len = len == -1 ? lstrlenW(data) : len;
if (writer->dest)
{
buff = &buffer->encoded;
@@ -386,13 +408,13 @@ static HRESULT write_output_buffer(mxwriter *writer, const WCHAR *data, int len)
char *mb;
/* if current chunk is larger than total buffer size, convert it at once using temporary allocated buffer */
mb = heap_alloc(length);
mb = malloc(length);
if (!mb)
return E_OUTOFMEMORY;
length = WideCharToMultiByte(buffer->code_page, 0, data, src_len, mb, length, NULL, NULL);
IStream_Write(writer->dest, mb, length, &written);
heap_free(mb);
free(mb);
}
}
}
@@ -430,11 +452,11 @@ static HRESULT write_output_buffer(mxwriter *writer, const WCHAR *data, int len)
/* alloc new block if needed and retry */
if (src_len)
{
encoded_buffer *next = heap_alloc(sizeof(*next));
encoded_buffer *next = malloc(sizeof(*next));
HRESULT hr;
if (FAILED(hr = init_encoded_buffer(next))) {
heap_free(next);
free(next);
return hr;
}
@@ -461,13 +483,13 @@ static void close_output_buffer(mxwriter *writer)
{
encoded_buffer *cur, *cur2;
heap_free(writer->buffer.encoded.data);
free(writer->buffer.encoded.data);
LIST_FOR_EACH_ENTRY_SAFE(cur, cur2, &writer->buffer.blocks, encoded_buffer, entry)
{
list_remove(&cur->entry);
free_encoded_buffer(cur);
heap_free(cur);
free(cur);
}
init_encoded_buffer(&writer->buffer.encoded);
@@ -499,7 +521,7 @@ static WCHAR *get_escaped_string(const WCHAR *str, escape_mode mode, int *len)
/* default buffer size to something if length is unknown */
conv_len = max(2**len, default_alloc);
ptr = ret = heap_alloc(conv_len*sizeof(WCHAR));
ptr = ret = malloc(conv_len * sizeof(WCHAR));
while (p)
{
@@ -507,7 +529,7 @@ static WCHAR *get_escaped_string(const WCHAR *str, escape_mode mode, int *len)
{
int written = ptr - ret;
conv_len *= 2;
ptr = ret = heap_realloc(ret, conv_len*sizeof(WCHAR));
ptr = ret = realloc(ret, conv_len * sizeof(WCHAR));
ptr += written;
}
@@ -666,14 +688,6 @@ static inline HRESULT flush_output_buffer(mxwriter *This)
return write_data_to_stream(This);
}
/* Resets the mxwriter's output buffer by closing it, then creating a new
* output buffer using the given encoding.
*/
static inline void reset_output_buffer(mxwriter *This)
{
close_output_buffer(This);
}
static HRESULT writer_set_property(mxwriter *writer, mxwriter_prop property, VARIANT_BOOL value)
{
writer->props[property] = value;
@@ -814,10 +828,10 @@ static HRESULT WINAPI mxwriter_QueryInterface(IMXWriter *iface, REFIID riid, voi
static ULONG WINAPI mxwriter_AddRef(IMXWriter *iface)
{
mxwriter *This = impl_from_IMXWriter( iface );
LONG ref = InterlockedIncrement(&This->ref);
mxwriter *writer = impl_from_IMXWriter(iface);
LONG ref = InterlockedIncrement(&writer->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -827,9 +841,9 @@ static ULONG WINAPI mxwriter_Release(IMXWriter *iface)
mxwriter *This = impl_from_IMXWriter( iface );
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
if(!ref)
if (!ref)
{
/* Windows flushes the buffer when the interface is destroyed. */
flush_output_buffer(This);
@@ -840,7 +854,7 @@ static ULONG WINAPI mxwriter_Release(IMXWriter *iface)
SysFreeString(This->encoding);
SysFreeString(This->element);
heap_free(This);
free(This);
}
return ref;
@@ -900,7 +914,7 @@ static HRESULT WINAPI mxwriter_put_output(IMXWriter *iface, VARIANT dest)
{
if (This->dest) IStream_Release(This->dest);
This->dest = NULL;
reset_output_buffer(This);
close_output_buffer(This);
break;
}
case VT_UNKNOWN:
@@ -911,7 +925,7 @@ static HRESULT WINAPI mxwriter_put_output(IMXWriter *iface, VARIANT dest)
if (hr == S_OK)
{
/* Recreate the output buffer to make sure it's using the correct encoding. */
reset_output_buffer(This);
close_output_buffer(This);
if (This->dest) IStream_Release(This->dest);
This->dest = stream;
@@ -1001,7 +1015,7 @@ static HRESULT WINAPI mxwriter_put_encoding(IMXWriter *iface, BSTR encoding)
This->xml_enc = enc;
TRACE("got encoding %d\n", This->xml_enc);
reset_output_buffer(This);
close_output_buffer(This);
return S_OK;
}
@@ -1202,7 +1216,7 @@ static HRESULT WINAPI SAXContentHandler_startDocument(ISAXContentHandler *iface)
* be how Windows works.
*/
if (This->prop_changed) {
reset_output_buffer(This);
close_output_buffer(This);
This->prop_changed = FALSE;
}
@@ -1267,7 +1281,7 @@ static void mxwriter_write_attribute(mxwriter *writer, const WCHAR *qname, int q
{
WCHAR *escaped = get_escaped_string(value, EscapeValue, &value_len);
write_output_buffer_quoted(writer, escaped, value_len);
heap_free(escaped);
free(escaped);
}
else
write_output_buffer_quoted(writer, value, value_len);
@@ -1406,7 +1420,7 @@ static HRESULT WINAPI SAXContentHandler_characters(
escaped = get_escaped_string(chars, EscapeText, &len);
write_output_buffer(This, escaped, len);
heap_free(escaped);
free(escaped);
}
}
@@ -2140,8 +2154,8 @@ static HRESULT WINAPI VBSAXContentHandler_startElement(IVBSAXContentHandler *ifa
TRACE("(%p)->(%p %p %p %p)\n", This, namespaceURI, localName, QName, attrs);
if (!namespaceURI || !localName || !QName)
return E_POINTER;
if (!namespaceURI || !*namespaceURI || !localName || !QName)
return E_INVALIDARG;
TRACE("(%s %s %s)\n", debugstr_w(*namespaceURI), debugstr_w(*localName), debugstr_w(*QName));
@@ -2454,9 +2468,7 @@ static ULONG WINAPI SAXErrorHandler_Release(ISAXErrorHandler *iface)
static HRESULT WINAPI SAXErrorHandler_error(ISAXErrorHandler *iface,
ISAXLocator *locator, const WCHAR *message, HRESULT hr)
{
mxwriter *This = impl_from_ISAXErrorHandler( iface );
FIXME("(%p)->(%p %s 0x%08x)\n", This, locator, debugstr_w(message), hr);
FIXME("%p, %p, %s, %#lx.\n", iface, locator, debugstr_w(message), hr);
return E_NOTIMPL;
}
@@ -2464,9 +2476,7 @@ static HRESULT WINAPI SAXErrorHandler_error(ISAXErrorHandler *iface,
static HRESULT WINAPI SAXErrorHandler_fatalError(ISAXErrorHandler *iface,
ISAXLocator *locator, const WCHAR *message, HRESULT hr)
{
mxwriter *This = impl_from_ISAXErrorHandler( iface );
FIXME("(%p)->(%p %s 0x%08x)\n", This, locator, debugstr_w(message), hr);
FIXME("%p, %p, %s, %#lx.\n", iface, locator, debugstr_w(message), hr);
return E_NOTIMPL;
}
@@ -2474,9 +2484,7 @@ static HRESULT WINAPI SAXErrorHandler_fatalError(ISAXErrorHandler *iface,
static HRESULT WINAPI SAXErrorHandler_ignorableWarning(ISAXErrorHandler *iface,
ISAXLocator *locator, const WCHAR *message, HRESULT hr)
{
mxwriter *This = impl_from_ISAXErrorHandler( iface );
FIXME("(%p)->(%p %s 0x%08x)\n", This, locator, debugstr_w(message), hr);
FIXME("%p, %p, %s, %#lx.\n", iface, locator, debugstr_w(message), hr);
return E_NOTIMPL;
}
@@ -2538,22 +2546,19 @@ static HRESULT WINAPI VBSAXErrorHandler_Invoke(IVBSAXErrorHandler *iface, DISPID
static HRESULT WINAPI VBSAXErrorHandler_error(IVBSAXErrorHandler *iface, IVBSAXLocator *locator, BSTR *message, LONG code)
{
mxwriter *This = impl_from_IVBSAXErrorHandler( iface );
FIXME("(%p)->(%p %p %x): stub\n", This, locator, message, code);
FIXME("%p, %p, %p, %lx: stub\n", iface, locator, message, code);
return E_NOTIMPL;
}
static HRESULT WINAPI VBSAXErrorHandler_fatalError(IVBSAXErrorHandler *iface, IVBSAXLocator *locator, BSTR *message, LONG code)
{
mxwriter *This = impl_from_IVBSAXErrorHandler( iface );
FIXME("(%p)->(%p %p %x): stub\n", This, locator, message, code);
FIXME("%p, %p, %p, %lx: stub\n", iface, locator, message, code);
return E_NOTIMPL;
}
static HRESULT WINAPI VBSAXErrorHandler_ignorableWarning(IVBSAXErrorHandler *iface, IVBSAXLocator *locator, BSTR *message, LONG code)
{
mxwriter *This = impl_from_IVBSAXErrorHandler( iface );
FIXME("(%p)->(%p %p %x): stub\n", This, locator, message, code);
FIXME("%p, %p, %p, %lx: stub\n", iface, locator, message, code);
return E_NOTIMPL;
}
@@ -2590,7 +2595,7 @@ HRESULT MXWriter_create(MSXML_VERSION version, void **ppObj)
TRACE("(%p)\n", ppObj);
This = heap_alloc( sizeof (*This) );
This = malloc(sizeof(*This));
if(!This)
return E_OUTOFMEMORY;
@@ -2630,7 +2635,7 @@ HRESULT MXWriter_create(MSXML_VERSION version, void **ppObj)
if (hr != S_OK) {
SysFreeString(This->encoding);
SysFreeString(This->version);
heap_free(This);
free(This);
return hr;
}
@@ -2684,18 +2689,18 @@ static ULONG WINAPI MXAttributes_AddRef(IMXAttributes *iface)
{
mxattributes *This = impl_from_IMXAttributes( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref );
TRACE("%p, refcount %lu.\n", iface, ref );
return ref;
}
static ULONG WINAPI MXAttributes_Release(IMXAttributes *iface)
{
mxattributes *This = impl_from_IMXAttributes( iface );
LONG ref = InterlockedDecrement( &This->ref );
ULONG ref = InterlockedDecrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
if (ref == 0)
if (!ref)
{
int i;
@@ -2708,8 +2713,8 @@ static ULONG WINAPI MXAttributes_Release(IMXAttributes *iface)
SysFreeString(This->attr[i].value);
}
heap_free(This->attr);
heap_free(This);
free(This->attr);
free(This);
}
return ref;
@@ -3062,10 +3067,10 @@ static HRESULT WINAPI SAXAttributes_getIndexFromName(ISAXAttributes *iface, cons
for (i = 0; i < This->length; i++)
{
if (uri_len != SysStringLen(This->attr[i].uri)) continue;
if (strncmpW(uri, This->attr[i].uri, uri_len)) continue;
if (wcsncmp(uri, This->attr[i].uri, uri_len)) continue;
if (len != SysStringLen(This->attr[i].local)) continue;
if (strncmpW(name, This->attr[i].local, len)) continue;
if (wcsncmp(name, This->attr[i].local, len)) continue;
*index = i;
return S_OK;
@@ -3090,7 +3095,7 @@ static HRESULT WINAPI SAXAttributes_getIndexFromQName(ISAXAttributes *iface, con
for (i = 0; i < This->length; i++)
{
if (len != SysStringLen(This->attr[i].qname)) continue;
if (strncmpW(qname, This->attr[i].qname, len)) continue;
if (wcsncmp(qname, This->attr[i].qname, len)) continue;
*index = i;
return S_OK;
@@ -3247,8 +3252,8 @@ static HRESULT WINAPI VBSAXAttributes_GetTypeInfo(
IVBSAXAttributes *iface,
UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo )
{
mxattributes *This = impl_from_IVBSAXAttributes( iface );
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
TRACE("%p, %u, %lx, %p.\n", iface, iTInfo, lcid, ppTInfo);
return get_typeinfo(IVBSAXAttributes_tid, ppTInfo);
}
@@ -3260,11 +3265,10 @@ static HRESULT WINAPI VBSAXAttributes_GetIDsOfNames(
LCID lcid,
DISPID* rgDispId)
{
mxattributes *This = impl_from_IVBSAXAttributes( iface );
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
TRACE("%p, %s, %p, %u, %lx, %p.\n", iface, debugstr_guid(riid), rgszNames, cNames,
lcid, rgDispId);
if(!rgszNames || cNames == 0 || !rgDispId)
@@ -3291,18 +3295,16 @@ static HRESULT WINAPI VBSAXAttributes_Invoke(
EXCEPINFO* pExcepInfo,
UINT* puArgErr)
{
mxattributes *This = impl_from_IVBSAXAttributes( iface );
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
TRACE("%p, %ld, %s, %lx, %d, %p, %p, %p, %p.\n", iface, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
hr = get_typeinfo(IVBSAXAttributes_tid, &typeinfo);
if(SUCCEEDED(hr))
{
hr = ITypeInfo_Invoke(typeinfo, &This->IVBSAXAttributes_iface, dispIdMember, wFlags,
pDispParams, pVarResult, pExcepInfo, puArgErr);
hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
ITypeInfo_Release(typeinfo);
}
@@ -3557,7 +3559,7 @@ HRESULT SAXAttributes_create(MSXML_VERSION version, void **ppObj)
TRACE("(%p)\n", ppObj);
This = heap_alloc( sizeof (*This) );
This = malloc(sizeof(*This));
if( !This )
return E_OUTOFMEMORY;
@@ -3568,7 +3570,7 @@ HRESULT SAXAttributes_create(MSXML_VERSION version, void **ppObj)
This->class_version = version;
This->attr = heap_alloc(default_count*sizeof(mxattribute));
This->attr = malloc(default_count * sizeof(mxattribute));
This->length = 0;
This->allocated = default_count;
+78 -112
View File
@@ -18,31 +18,21 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#define COBJMACROS
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/parserInternals.h>
# include <libxml/xmlerror.h>
# include <libxml/HTMLtree.h>
# ifdef SONAME_LIBXSLT
# ifdef HAVE_LIBXSLT_PATTERN_H
# include <libxslt/pattern.h>
# endif
# ifdef HAVE_LIBXSLT_TRANSFORM_H
# include <libxslt/transform.h>
# endif
# include <libxslt/imports.h>
# include <libxslt/variables.h>
# include <libxslt/xsltutils.h>
# include <libxslt/xsltInternals.h>
# include <libxslt/documents.h>
# endif
#endif
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#include <libxml/xmlerror.h>
#include <libxml/HTMLtree.h>
#include <libxslt/pattern.h>
#include <libxslt/transform.h>
#include <libxslt/imports.h>
#include <libxslt/variables.h>
#include <libxslt/xsltutils.h>
#include <libxslt/xsltInternals.h>
#include <libxslt/documents.h>
#include "windef.h"
#include "winbase.h"
@@ -55,28 +45,8 @@
#include "wine/debug.h"
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
#ifdef SONAME_LIBXSLT
extern void* libxslt_handle;
# define MAKE_FUNCPTR(f) extern typeof(f) * p##f
MAKE_FUNCPTR(xsltApplyStylesheet);
MAKE_FUNCPTR(xsltApplyStylesheetUser);
MAKE_FUNCPTR(xsltCleanupGlobals);
MAKE_FUNCPTR(xsltFreeStylesheet);
MAKE_FUNCPTR(xsltFreeTransformContext);
MAKE_FUNCPTR(xsltNewTransformContext);
MAKE_FUNCPTR(xsltNextImport);
MAKE_FUNCPTR(xsltParseStylesheetDoc);
MAKE_FUNCPTR(xsltQuoteUserParams);
MAKE_FUNCPTR(xsltSaveResultTo);
# undef MAKE_FUNCPTR
#else
WINE_DECLARE_DEBUG_CHANNEL(winediag);
#endif
static const IID IID_xmlnode = {0x4f2f4ba2,0xb822,0x11df,{0x8b,0x8a,0x68,0x50,0xdf,0xd7,0x20,0x85}};
xmlNodePtr xmlNodePtr_from_domnode( IXMLDOMNode *iface, xmlElementType type )
@@ -137,7 +107,7 @@ static ULONG WINAPI SupportErrorInfo_AddRef(ISupportErrorInfo *iface)
{
SupportErrorInfo *This = impl_from_ISupportErrorInfo(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref );
TRACE("%p, refcount %ld.\n", iface, ref );
return ref;
}
@@ -146,10 +116,10 @@ static ULONG WINAPI SupportErrorInfo_Release(ISupportErrorInfo *iface)
SupportErrorInfo *This = impl_from_ISupportErrorInfo(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %ld.\n", iface, ref);
if (ref == 0)
heap_free(This);
if (!ref)
free(This);
return ref;
}
@@ -183,7 +153,7 @@ HRESULT node_create_supporterrorinfo(enum tid_t const *iids, void **obj)
{
SupportErrorInfo *This;
This = heap_alloc(sizeof(*This));
This = malloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY;
This->ISupportErrorInfo_iface.lpVtbl = &SupportErrorInfoVtbl;
@@ -216,6 +186,13 @@ HRESULT node_get_nodeName(xmlnode *This, BSTR *name)
hr = node_get_base_name(This, &base);
if (hr != S_OK) return hr;
if (!base[0] && xmldoc_version(This->node->doc) != MSXML6)
{
SysFreeString(base);
*name = SysAllocString(L"xmlns");
return S_OK;
}
hr = node_get_prefix(This, &prefix);
if (hr == S_OK)
{
@@ -224,10 +201,17 @@ HRESULT node_get_nodeName(xmlnode *This, BSTR *name)
/* +1 for ':' */
ptr = *name = SysAllocStringLen(NULL, SysStringLen(base) + SysStringLen(prefix) + 1);
memcpy(ptr, prefix, SysStringByteLen(prefix));
ptr += SysStringLen(prefix);
memcpy(ptr++, &colW, sizeof(WCHAR));
memcpy(ptr, base, SysStringByteLen(base));
if (SysStringByteLen(prefix))
{
memcpy(ptr, prefix, SysStringByteLen(prefix));
ptr += SysStringLen(prefix);
}
if (SysStringByteLen(base))
{
if (SysStringByteLen(prefix))
memcpy(ptr++, &colW, sizeof(WCHAR));
memcpy(ptr, base, SysStringByteLen(base));
}
SysFreeString(base);
SysFreeString(prefix);
@@ -264,7 +248,7 @@ HRESULT node_set_content(xmlnode *This, LPCWSTR value)
return E_OUTOFMEMORY;
xmlNodeSetContent(This->node, str);
heap_free(str);
free(str);
return S_OK;
}
@@ -280,13 +264,13 @@ static HRESULT node_set_content_escaped(xmlnode *This, LPCWSTR value)
escaped = xmlEncodeSpecialChars(NULL, str);
if(!escaped)
{
heap_free(str);
free(str);
return E_OUTOFMEMORY;
}
xmlNodeSetContent(This->node, escaped);
heap_free(str);
free(str);
xmlFree(escaped);
return S_OK;
@@ -432,7 +416,7 @@ int xmlnode_get_inst_cnt(xmlnode *node)
}
/* _private field holds a number of COM instances spawned from this libxml2 node
* most significant bits are used to store information about ignorrable whitespace nodes */
* most significant bits are used to store information about ignorable whitespace nodes */
void xmlnode_add_ref(xmlNodePtr node)
{
if (node->type == XML_DOCUMENT_NODE) return;
@@ -890,7 +874,7 @@ HRESULT node_put_text(xmlnode *This, BSTR text)
/* Escape the string. */
str2 = xmlEncodeEntitiesReentrant(This->node->doc, str);
heap_free(str);
free(str);
xmlNodeSetContent(This->node, str2);
xmlFree(str2);
@@ -988,8 +972,6 @@ HRESULT node_get_xml(xmlnode *This, BOOL ensure_eol, BSTR *ret)
return *ret ? S_OK : E_OUTOFMEMORY;
}
#ifdef SONAME_LIBXSLT
/* duplicates xmlBufferWriteQuotedString() logic */
static void xml_write_quotedstring(xmlOutputBufferPtr buf, const xmlChar *string)
{
@@ -1090,7 +1072,7 @@ static void transform_write_text(xmlDocPtr result, xsltStylesheetPtr style, xmlO
res = NULL; \
while (st != NULL) { \
if (st->name != NULL) { res = st->name; break; } \
st = pxsltNextImport(st); \
st = xsltNextImport(st); \
}}
#undef XSLT_GET_IMPORT_INT
@@ -1099,7 +1081,7 @@ static void transform_write_text(xmlDocPtr result, xsltStylesheetPtr style, xmlO
res = -1; \
while (st != NULL) { \
if (st->name != -1) { res = st->name; break; } \
st = pxsltNextImport(st); \
st = xsltNextImport(st); \
}}
static void transform_write_xmldecl(xmlDocPtr result, xsltStylesheetPtr style, BOOL omit_encoding, xmlOutputBufferPtr output)
@@ -1266,13 +1248,8 @@ static HRESULT node_transform_write_to_bstr(xsltStylesheetPtr style, xmlDocPtr r
return E_OUTOFMEMORY;
hr = node_transform_write(style, result, TRUE, "UTF-16", output);
#ifdef LIBXML2_NEW_BUFFER
content = xmlBufContent(output->conv);
len = xmlBufUse(output->conv);
#else
content = xmlBufferContent(output->conv);
len = xmlBufferLength(output->conv);
#endif
/* UTF-16 encoder places UTF-16 bom, we don't need it for BSTR */
content += sizeof(WCHAR);
*str = SysAllocStringLen((WCHAR*)content, len/sizeof(WCHAR) - 1);
@@ -1346,8 +1323,8 @@ static int XMLCALL import_loader_io_close(void * context)
TRACE("%p\n", context);
heap_free(buffer->data);
heap_free(buffer);
free(buffer->data);
free(buffer);
return 0;
}
@@ -1357,16 +1334,16 @@ static HRESULT import_loader_onDataAvailable(void *ctxt, char *ptr, DWORD len)
xmlParserInputBufferPtr inputbuffer;
struct import_buffer *buffer;
buffer = heap_alloc(sizeof(*buffer));
buffer = malloc(sizeof(*buffer));
buffer->data = heap_alloc(len);
buffer->data = malloc(len);
memcpy(buffer->data, ptr, len);
buffer->cur = 0;
buffer->len = len;
inputbuffer = xmlParserInputBufferCreateIO(import_loader_io_read, import_loader_io_close, buffer,
XML_CHAR_ENCODING_NONE);
*input = xmlNewIOInputStream(ctxt, inputbuffer, XML_CHAR_ENCODING_NONE);
*input = xmlNewIOInputStream(NULL, inputbuffer, XML_CHAR_ENCODING_NONE);
if (!*input)
xmlFreeParserInputBuffer(inputbuffer);
@@ -1387,7 +1364,7 @@ static HRESULT xslt_doc_get_uri(const xmlChar *uri, void *_ctxt, xsltLoadType ty
SysFreeString(uriW);
if (FAILED(hr))
{
WARN("Failed to create href uri, %#x.\n", hr);
WARN("Failed to create href uri, %#lx.\n", hr);
return hr;
}
@@ -1401,14 +1378,14 @@ static HRESULT xslt_doc_get_uri(const xmlChar *uri, void *_ctxt, xsltLoadType ty
SysFreeString(baseuriW);
if (FAILED(hr))
{
WARN("Failed to create base uri, %#x.\n", hr);
WARN("Failed to create base uri, %#lx.\n", hr);
return hr;
}
hr = CoInternetCombineIUri(base_uri, href_uri, 0, doc_uri, 0);
IUri_Release(base_uri);
if (FAILED(hr))
WARN("Failed to combine uris, %#x.\n", hr);
WARN("Failed to combine uris, hr %#lx.\n", hr);
}
else
{
@@ -1500,27 +1477,23 @@ failed:
return doc;
}
#endif /* SONAME_LIBXSLT */
HRESULT node_transform_node_params(const xmlnode *This, IXMLDOMNode *stylesheet, BSTR *p,
ISequentialStream *stream, const struct xslprocessor_params *params)
{
#ifdef SONAME_LIBXSLT
xsltStylesheetPtr xsltSS;
xmlDocPtr sheet_doc;
HRESULT hr = S_OK;
xmlnode *sheet;
if (!libxslt_handle) return E_NOTIMPL;
if (!stylesheet || !p) return E_INVALIDARG;
if (!stylesheet || (!p && !stream)) return E_INVALIDARG;
*p = NULL;
if (p) *p = NULL;
sheet = get_node_obj(stylesheet);
if(!sheet) return E_FAIL;
sheet_doc = xmlCopyDoc(sheet->node->doc, 1);
xsltSS = pxsltParseStylesheetDoc(sheet_doc);
xsltSS = xsltParseStylesheetDoc(sheet_doc);
if (xsltSS)
{
const char **xslparams = NULL;
@@ -1533,7 +1506,7 @@ HRESULT node_transform_node_params(const xmlnode *This, IXMLDOMNode *stylesheet,
struct xslprocessor_par *par;
i = 0;
xslparams = heap_alloc((params->count*2 + 1)*sizeof(char*));
xslparams = malloc((params->count * 2 + 1) * sizeof(char*));
LIST_FOR_EACH_ENTRY(par, &params->list, struct xslprocessor_par, entry)
{
xslparams[i++] = (char*)xmlchar_from_wchar(par->name);
@@ -1544,19 +1517,19 @@ HRESULT node_transform_node_params(const xmlnode *This, IXMLDOMNode *stylesheet,
if (xslparams)
{
xsltTransformContextPtr ctxt = pxsltNewTransformContext(xsltSS, This->node->doc);
xsltTransformContextPtr ctxt = xsltNewTransformContext(xsltSS, This->node->doc);
/* push parameters to user context */
pxsltQuoteUserParams(ctxt, xslparams);
result = pxsltApplyStylesheetUser(xsltSS, This->node->doc, NULL, NULL, NULL, ctxt);
pxsltFreeTransformContext(ctxt);
xsltQuoteUserParams(ctxt, xslparams);
result = xsltApplyStylesheetUser(xsltSS, This->node->doc, NULL, NULL, NULL, ctxt);
xsltFreeTransformContext(ctxt);
for (i = 0; i < params->count*2; i++)
heap_free((char*)xslparams[i]);
heap_free(xslparams);
free((char*)xslparams[i]);
free(xslparams);
}
else
result = pxsltApplyStylesheet(xsltSS, This->node->doc, NULL);
result = xsltApplyStylesheet(xsltSS, This->node->doc, NULL);
if (result)
{
@@ -1567,19 +1540,14 @@ HRESULT node_transform_node_params(const xmlnode *This, IXMLDOMNode *stylesheet,
xmlFreeDoc(result);
}
pxsltFreeStylesheet(xsltSS);
xsltFreeStylesheet(xsltSS);
}
else
xmlFreeDoc(sheet_doc);
if(!*p) *p = SysAllocStringLen(NULL, 0);
if (p && !*p) *p = SysAllocStringLen(NULL, 0);
return hr;
#else
ERR_(winediag)("libxslt headers were not found at compile time. Expect problems.\n");
return E_NOTIMPL;
#endif
}
HRESULT node_transform_node(const xmlnode *node, IXMLDOMNode *stylesheet, BSTR *p)
@@ -1596,7 +1564,7 @@ HRESULT node_select_nodes(const xmlnode *This, BSTR query, IXMLDOMNodeList **nod
str = xmlchar_from_wchar(query);
hr = create_selection(This->node, str, nodes);
heap_free(str);
free(str);
return hr;
}
@@ -1606,6 +1574,9 @@ HRESULT node_select_singlenode(const xmlnode *This, BSTR query, IXMLDOMNode **no
IXMLDOMNodeList *list;
HRESULT hr;
if (node)
*node = NULL;
hr = node_select_nodes(This, query, &list);
if (hr == S_OK)
{
@@ -1652,7 +1623,11 @@ HRESULT node_get_base_name(xmlnode *This, BSTR *name)
{
if (!name) return E_INVALIDARG;
*name = bstr_from_xmlChar(This->node->name);
if (xmldoc_version(This->node->doc) != MSXML6 &&
xmlStrEqual(This->node->name, BAD_CAST "xmlns"))
*name = SysAllocString(L"");
else
*name = bstr_from_xmlChar(This->node->name);
if (!*name) return E_OUTOFMEMORY;
TRACE("returning %s\n", debugstr_w(*name));
@@ -1738,7 +1713,7 @@ static ULONG WINAPI unknode_Release(
ref = InterlockedDecrement( &This->ref );
if(!ref) {
destroy_xmlnode(&This->node);
heap_free(This);
free(This);
}
return ref;
@@ -1763,14 +1738,9 @@ static HRESULT WINAPI unknode_GetTypeInfo(
LCID lcid,
ITypeInfo** ppTInfo )
{
unknode *This = unknode_from_IXMLDOMNode( iface );
HRESULT hr;
TRACE("%p, %u, %lx, %p.\n", iface, iTInfo, lcid, ppTInfo);
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
hr = get_typeinfo(IXMLDOMNode_tid, ppTInfo);
return hr;
return get_typeinfo(IXMLDOMNode_tid, ppTInfo);
}
static HRESULT WINAPI unknode_GetIDsOfNames(
@@ -1781,12 +1751,10 @@ static HRESULT WINAPI unknode_GetIDsOfNames(
LCID lcid,
DISPID* rgDispId )
{
unknode *This = unknode_from_IXMLDOMNode( iface );
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
TRACE("%p, %s, %p, %u, %lx, %p.\n", iface, debugstr_guid(riid), rgszNames, cNames,
lcid, rgDispId);
if(!rgszNames || cNames == 0 || !rgDispId)
@@ -1813,17 +1781,16 @@ static HRESULT WINAPI unknode_Invoke(
EXCEPINFO* pExcepInfo,
UINT* puArgErr )
{
unknode *This = unknode_from_IXMLDOMNode( iface );
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
TRACE("%p, %ld, %s, %lx, %d, %p, %p, %p, %p.\n", iface, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
hr = get_typeinfo(IXMLDOMNode_tid, &typeinfo);
if(SUCCEEDED(hr))
{
hr = ITypeInfo_Invoke(typeinfo, &This->IXMLDOMNode_iface, dispIdMember, wFlags, pDispParams,
hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, pDispParams,
pVarResult, pExcepInfo, puArgErr);
ITypeInfo_Release(typeinfo);
}
@@ -2304,7 +2271,7 @@ IXMLDOMNode *create_node( xmlNodePtr node )
FIXME("only creating basic node for type %d\n", node->type);
new_node = heap_alloc(sizeof(unknode));
new_node = malloc(sizeof(unknode));
if(!new_node)
return NULL;
@@ -2324,4 +2291,3 @@ IXMLDOMNode *create_node( xmlNodePtr node )
if(FAILED(hr)) return NULL;
return ret;
}
#endif
+12 -19
View File
@@ -20,13 +20,9 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
#endif
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include "windef.h"
#include "winbase.h"
@@ -48,8 +44,6 @@
* thus the child is inaccessible by an XPath query
*/
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
typedef struct
@@ -135,7 +129,7 @@ static ULONG WINAPI xmlnodelist_AddRef(
{
xmlnodelist *This = impl_from_IXMLDOMNodeList( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -145,12 +139,13 @@ static ULONG WINAPI xmlnodelist_Release(
xmlnodelist *This = impl_from_IXMLDOMNodeList( iface );
ULONG ref = InterlockedDecrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
if ( ref == 0 )
TRACE("%p, refcount %lu.\n", iface, ref);
if (!ref)
{
xmldoc_release( This->parent->doc );
if (This->enumvariant) IEnumVARIANT_Release(This->enumvariant);
heap_free( This );
free( This );
}
return ref;
@@ -213,7 +208,7 @@ static HRESULT WINAPI xmlnodelist_get_item(
xmlNodePtr curr;
LONG nodeIndex = 0;
TRACE("(%p)->(%d %p)\n", This, index, listItem);
TRACE("%p, %ld, %p.\n", iface, index, listItem);
if(!listItem)
return E_INVALIDARG;
@@ -323,13 +318,13 @@ static HRESULT xmlnodelist_get_dispid(IUnknown *iface, BSTR name, DWORD flags, D
WCHAR *ptr;
int idx = 0;
for(ptr = name; *ptr && isdigitW(*ptr); ptr++)
for(ptr = name; *ptr >= '0' && *ptr <= '9'; ptr++)
idx = idx*10 + (*ptr-'0');
if(*ptr)
return DISP_E_UNKNOWNNAME;
*dispid = DISPID_DOM_COLLECTION_BASE + idx;
TRACE("ret %x\n", *dispid);
TRACE("ret %lx\n", *dispid);
return S_OK;
}
@@ -338,7 +333,7 @@ static HRESULT xmlnodelist_invoke(IUnknown *iface, DISPID id, LCID lcid, WORD fl
{
xmlnodelist *This = impl_from_IXMLDOMNodeList( (IXMLDOMNodeList*)iface );
TRACE("(%p)->(%x %x %x %p %p %p)\n", This, id, lcid, flags, params, res, ei);
TRACE("%p, %ld, %lx, %x, %p, %p, %p.\n", iface, id, lcid, flags, params, res, ei);
if (id >= DISPID_DOM_COLLECTION_BASE && id <= DISPID_DOM_COLLECTION_MAX)
{
@@ -422,7 +417,7 @@ IXMLDOMNodeList* create_children_nodelist( xmlNodePtr node )
{
xmlnodelist *This;
This = heap_alloc( sizeof *This );
This = malloc(sizeof(*This));
if ( !This )
return NULL;
@@ -437,5 +432,3 @@ IXMLDOMNodeList* create_children_nodelist( xmlNodePtr node )
return &This->IXMLDOMNodeList_iface;
}
#endif
+14 -21
View File
@@ -18,15 +18,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#define COBJMACROS
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
#endif
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include "windef.h"
#include "winbase.h"
@@ -40,8 +36,6 @@
#include "wine/debug.h"
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
typedef struct
@@ -127,7 +121,7 @@ static ULONG WINAPI xmlnodemap_AddRef(
{
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -137,13 +131,14 @@ static ULONG WINAPI xmlnodemap_Release(
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
ULONG ref = InterlockedDecrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
if ( ref == 0 )
TRACE("%p, refcount %lu.\n", iface, ref);
if (!ref)
{
xmlnode_release( This->node );
xmldoc_release( This->node->doc );
if (This->enumvariant) IEnumVARIANT_Release(This->enumvariant);
heap_free( This );
free( This );
}
return ref;
@@ -231,7 +226,7 @@ static HRESULT WINAPI xmlnodemap_get_item(
{
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
TRACE("(%p)->(%d %p)\n", This, index, item);
TRACE("%p, %ld, %p.\n", iface, index, item);
return This->funcs->get_item(This->node, index, item);
}
@@ -279,7 +274,7 @@ static HRESULT WINAPI xmlnodemap_nextNode(
{
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
TRACE("(%p)->(%p: %d)\n", This, nextItem, This->iterator);
TRACE("%p, %p, %ld.\n", iface, nextItem, This->iterator);
return This->funcs->next_node(This->node, &This->iterator, nextItem);
}
@@ -289,7 +284,7 @@ static HRESULT WINAPI xmlnodemap_reset(
{
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
TRACE("(%p)->(%d)\n", This, This->iterator);
TRACE("%p, %ld.\n", iface, This->iterator);
This->iterator = 0;
@@ -371,13 +366,13 @@ static HRESULT xmlnodemap_get_dispid(IUnknown *iface, BSTR name, DWORD flags, DI
WCHAR *ptr;
int idx = 0;
for(ptr = name; *ptr && isdigitW(*ptr); ptr++)
for(ptr = name; *ptr >= '0' && *ptr <= '9'; ptr++)
idx = idx*10 + (*ptr-'0');
if(*ptr)
return DISP_E_UNKNOWNNAME;
*dispid = DISPID_DOM_COLLECTION_BASE + idx;
TRACE("ret %x\n", *dispid);
TRACE("ret %lx\n", *dispid);
return S_OK;
}
@@ -386,7 +381,7 @@ static HRESULT xmlnodemap_invoke(IUnknown *iface, DISPID id, LCID lcid, WORD fla
{
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( (IXMLDOMNamedNodeMap*)iface );
TRACE("(%p)->(%x %x %x %p %p %p)\n", This, id, lcid, flags, params, res, ei);
TRACE("%p, %ld, %lx, %x, %p, %p, %p.\n", iface, id, lcid, flags, params, res, ei);
V_VT(res) = VT_DISPATCH;
V_DISPATCH(res) = NULL;
@@ -437,7 +432,7 @@ IXMLDOMNamedNodeMap *create_nodemap(xmlNodePtr node, const struct nodemap_funcs
{
xmlnodemap *This;
This = heap_alloc( sizeof *This );
This = malloc(sizeof(*This));
if ( !This )
return NULL;
@@ -456,5 +451,3 @@ IXMLDOMNamedNodeMap *create_nodemap(xmlNodePtr node, const struct nodemap_funcs
return &This->IXMLDOMNamedNodeMap_iface;
}
#endif
+8 -17
View File
@@ -21,22 +21,12 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
#endif
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winuser.h"
#include "ole2.h"
#include "msxml6.h"
#include "msxml_private.h"
#include "msxml_dispex.h"
#include "wine/debug.h"
@@ -93,7 +83,7 @@ static ULONG WINAPI parseError_AddRef(
{
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -103,13 +93,14 @@ static ULONG WINAPI parseError_Release(
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
ULONG ref = InterlockedDecrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
if ( ref == 0 )
TRACE("%p, refcount %lu.\n", iface, ref);
if (!ref)
{
SysFreeString(This->url);
SysFreeString(This->reason);
SysFreeString(This->srcText);
heap_free( This );
free(This);
}
return ref;
@@ -224,7 +215,7 @@ static HRESULT WINAPI parseError_get_line(
{
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
TRACE("(%p)->(%p): stub\n", This, line);
TRACE("%p, %p.\n", This, line);
if (!line) return E_INVALIDARG;
@@ -331,7 +322,7 @@ IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR src
{
parse_error_t *This;
This = heap_alloc( sizeof(*This) );
This = malloc(sizeof(*This));
if ( !This )
return NULL;
+216 -28
View File
@@ -20,13 +20,9 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
#endif
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include "windef.h"
#include "winbase.h"
@@ -34,12 +30,11 @@
#include "ole2.h"
#include "msxml6.h"
#include "xmlparser.h"
#include "msxml_private.h"
#include "wine/debug.h"
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
typedef struct _dom_pi
@@ -101,7 +96,7 @@ static ULONG WINAPI dom_pi_AddRef(
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -111,11 +106,11 @@ static ULONG WINAPI dom_pi_Release(
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
ULONG ref = InterlockedDecrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
if ( ref == 0 )
{
destroy_xmlnode(&This->node);
heap_free( This );
free(This);
}
return ref;
@@ -197,7 +192,7 @@ static HRESULT WINAPI dom_pi_put_nodeValue(
if(hr == S_OK)
{
static const WCHAR xmlW[] = {'x','m','l',0};
if(!strcmpW(target, xmlW))
if(!wcscmp(target, xmlW))
{
SysFreeString(target);
return E_FAIL;
@@ -287,6 +282,139 @@ static HRESULT WINAPI dom_pi_get_nextSibling(
return node_get_next_sibling(&This->node, domNode);
}
static HRESULT xml_get_value(xmlChar **p, xmlChar **value)
{
xmlChar *v, q;
int len;
while (isspace(**p)) *p += 1;
if (**p != '=') return XML_E_MISSINGEQUALS;
*p += 1;
while (isspace(**p)) *p += 1;
if (**p != '"' && **p != '\'') return XML_E_MISSINGQUOTE;
q = **p;
*p += 1;
v = *p;
while (**p && **p != q) *p += 1;
if (!**p) return XML_E_BADCHARINSTRING;
len = *p - v;
if (!len) return XML_E_MISSINGNAME;
*p += 1;
*value = malloc(len + 1);
if (!*value) return E_OUTOFMEMORY;
memcpy(*value, v, len);
*(*value + len) = 0;
return S_OK;
}
static void set_prop(xmlNodePtr node, xmlAttrPtr attr)
{
xmlAttrPtr prop;
if (!node->properties)
{
node->properties = attr;
return;
}
prop = node->properties;
while (prop->next) prop = prop->next;
prop->next = attr;
}
static HRESULT parse_xml_decl(xmlNodePtr node)
{
xmlChar *version, *encoding, *standalone, *p;
xmlAttrPtr attr;
HRESULT hr = S_OK;
if (!node->content) return S_OK;
version = encoding = standalone = NULL;
p = node->content;
while (*p)
{
while (isspace(*p)) p++;
if (!*p) break;
if (!strncmp((const char *)p, "version", 7))
{
p += 7;
if ((hr = xml_get_value(&p, &version)) != S_OK) goto fail;
}
else if (!strncmp((const char *)p, "encoding", 8))
{
p += 8;
if ((hr = xml_get_value(&p, &encoding)) != S_OK) goto fail;
}
else if (!strncmp((const char *)p, "standalone", 10))
{
p += 10;
if ((hr = xml_get_value(&p, &standalone)) != S_OK) goto fail;
}
else
{
FIXME("unexpected XML attribute %s\n", debugstr_a((const char *)p));
hr = XML_E_UNEXPECTED_ATTRIBUTE;
goto fail;
}
}
/* xmlSetProp/xmlSetNsProp accept only nodes of type XML_ELEMENT_NODE,
* so we have to create and assign attributes to a node by hand.
*/
if (version)
{
attr = xmlSetNsProp(NULL, NULL, (const xmlChar *)"version", version);
if (attr)
{
attr->doc = node->doc;
set_prop(node, attr);
}
else hr = E_OUTOFMEMORY;
}
if (encoding)
{
attr = xmlSetNsProp(NULL, NULL, (const xmlChar *)"encoding", encoding);
if (attr)
{
attr->doc = node->doc;
set_prop(node, attr);
}
else hr = E_OUTOFMEMORY;
}
if (standalone)
{
attr = xmlSetNsProp(NULL, NULL, (const xmlChar *)"standalone", standalone);
if (attr)
{
attr->doc = node->doc;
set_prop(node, attr);
}
else hr = E_OUTOFMEMORY;
}
fail:
if (hr != S_OK)
{
xmlFreePropList(node->properties);
node->properties = NULL;
}
free(version);
free(encoding);
free(standalone);
return hr;
}
static HRESULT WINAPI dom_pi_get_attributes(
IXMLDOMProcessingInstruction *iface,
IXMLDOMNamedNodeMap** map)
@@ -305,17 +433,12 @@ static HRESULT WINAPI dom_pi_get_attributes(
hr = node_get_nodeName(&This->node, &name);
if (hr != S_OK) return hr;
if (!strcmpW(name, xmlW))
{
FIXME("created dummy map for <?xml ?>\n");
if (!wcscmp(name, xmlW))
*map = create_nodemap(This->node.node, &dom_pi_attr_map);
SysFreeString(name);
return S_OK;
}
SysFreeString(name);
return S_FALSE;
return *map ? S_OK : S_FALSE;
}
static HRESULT WINAPI dom_pi_insertBefore(
@@ -612,7 +735,7 @@ static HRESULT WINAPI dom_pi_put_data(
if(hr == S_OK)
{
static const WCHAR xmlW[] = {'x','m','l',0};
if(!strcmpW(target, xmlW))
if(!wcscmp(target, xmlW))
{
SysFreeString(target);
return E_FAIL;
@@ -624,6 +747,34 @@ static HRESULT WINAPI dom_pi_put_data(
return node_set_content(&This->node, data);
}
HRESULT dom_pi_put_xml_decl(IXMLDOMNode *node, BSTR data)
{
static const WCHAR xmlW[] = {'x','m','l',0};
xmlnode *node_obj;
HRESULT hr;
BSTR name;
if (!data)
return XML_E_XMLDECLSYNTAX;
node_obj = get_node_obj(node);
hr = node_set_content(node_obj, data);
if (FAILED(hr))
return hr;
hr = node_get_nodeName(node_obj, &name);
if (FAILED(hr))
return hr;
if (!lstrcmpW(name, xmlW) && !node_obj->node->properties)
hr = parse_xml_decl(node_obj->node);
else
hr = S_OK;
SysFreeString(name);
return hr;
}
static const struct IXMLDOMProcessingInstructionVtbl dom_pi_vtbl =
{
dom_pi_QueryInterface,
@@ -675,6 +826,27 @@ static const struct IXMLDOMProcessingInstructionVtbl dom_pi_vtbl =
dom_pi_put_data
};
static xmlAttrPtr node_has_prop(const xmlNode *node, const xmlChar *name)
{
xmlAttrPtr prop;
/* xmlHasNsProp accepts only nodes of type XML_ELEMENT_NODE,
* so we have to look for an attribute in the node by hand.
*/
prop = node->properties;
while (prop)
{
if (xmlStrEqual(prop->name, name))
return prop;
prop = prop->next;
}
return NULL;
}
static HRESULT dom_pi_get_qualified_item(const xmlNodePtr node, BSTR name, BSTR uri,
IXMLDOMNode **item)
{
@@ -684,10 +856,28 @@ static HRESULT dom_pi_get_qualified_item(const xmlNodePtr node, BSTR name, BSTR
static HRESULT dom_pi_get_named_item(const xmlNodePtr node, BSTR name, IXMLDOMNode **item)
{
FIXME("(%p)->(%s %p): stub\n", node, debugstr_w(name), item );
if (item)
xmlChar *nameA;
xmlAttrPtr attr;
TRACE("(%p)->(%s %p)\n", node, debugstr_w(name), item);
if (!item) return E_POINTER;
nameA = xmlchar_from_wchar(name);
if (!nameA) return E_OUTOFMEMORY;
attr = node_has_prop(node, nameA);
free(nameA);
if (!attr)
{
*item = NULL;
return S_FALSE;
return S_FALSE;
}
*item = create_node((xmlNodePtr)attr);
return S_OK;
}
static HRESULT dom_pi_set_named_item(xmlNodePtr node, IXMLDOMNode *newItem, IXMLDOMNode **namedItem)
@@ -710,7 +900,7 @@ static HRESULT dom_pi_remove_named_item(xmlNodePtr node, BSTR name, IXMLDOMNode
static HRESULT dom_pi_get_item(const xmlNodePtr node, LONG index, IXMLDOMNode **item)
{
FIXME("(%p)->(%d %p): stub\n", node, index, item);
FIXME("%p, %ld, %p: stub\n", node, index, item);
return E_NOTIMPL;
}
@@ -724,7 +914,7 @@ static HRESULT dom_pi_get_length(const xmlNodePtr node, LONG *length)
static HRESULT dom_pi_next_node(const xmlNodePtr node, LONG *iter, IXMLDOMNode **nextNode)
{
FIXME("(%p)->(%d %p): stub\n", node, *iter, nextNode);
FIXME("%p, %ld, %p: stub\n", node, *iter, nextNode);
return E_NOTIMPL;
}
@@ -755,7 +945,7 @@ IUnknown* create_pi( xmlNodePtr pi )
{
dom_pi *This;
This = heap_alloc( sizeof *This );
This = malloc(sizeof(*This));
if ( !This )
return NULL;
@@ -766,5 +956,3 @@ IUnknown* create_pi( xmlNodePtr pi )
return (IUnknown*)&This->IXMLDOMProcessingInstruction_iface;
}
#endif
-1
View File
@@ -12,7 +12,6 @@
#define _INC_WINDOWS
#define COBJMACROS
#define NONAMELESSUNION
#include <windef.h>
#include <winbase.h>
+8
View File
@@ -0,0 +1,8 @@
#include <windef.h>
#include <winbase.h>
HRESULT WINAPI DllCanUnloadNow(void)
{
return S_FALSE;
}
+56 -90
View File
@@ -20,15 +20,11 @@
*/
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
# include <libxml/SAX2.h>
# include <libxml/parserInternals.h>
#endif
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include <libxml/SAX2.h>
#include <libxml/parserInternals.h>
#include "windef.h"
#include "winbase.h"
@@ -45,8 +41,6 @@
#include "msxml_private.h"
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
typedef enum
@@ -136,7 +130,7 @@ static saxreader_feature get_saxreader_feature(const WCHAR *name)
{
n = (min+max)/2;
c = strcmpW(saxreader_feature_map[n].name, name);
c = wcscmp(saxreader_feature_map[n].name, name);
if (!c)
return saxreader_feature_map[n].feature;
@@ -456,10 +450,10 @@ static BSTR build_qname(BSTR prefix, BSTR local)
WCHAR *ptr;
ptr = qname;
strcpyW(ptr, prefix);
lstrcpyW(ptr, prefix);
ptr += SysStringLen(prefix);
*ptr++ = ':';
strcpyW(ptr, local);
lstrcpyW(ptr, local);
return qname;
}
else
@@ -472,13 +466,13 @@ static element_entry* alloc_element_entry(const xmlChar *local, const xmlChar *p
element_entry *ret;
int i;
ret = heap_alloc(sizeof(*ret));
ret = malloc(sizeof(*ret));
if (!ret) return ret;
ret->local = bstr_from_xmlChar(local);
ret->prefix = bstr_from_xmlChar(prefix);
ret->qname = build_qname(ret->prefix, ret->local);
ret->ns = nb_ns ? heap_alloc(nb_ns*sizeof(ns)) : NULL;
ret->ns = nb_ns ? malloc(nb_ns * sizeof(ns)) : NULL;
ret->ns_count = nb_ns;
for (i=0; i < nb_ns; i++)
@@ -504,8 +498,8 @@ static void free_element_entry(element_entry *element)
SysFreeString(element->local);
SysFreeString(element->qname);
heap_free(element->ns);
heap_free(element);
free(element->ns);
free(element);
}
static void push_element_ns(saxlocator *locator, element_entry *element)
@@ -536,7 +530,7 @@ static BSTR find_element_uri(saxlocator *locator, const xmlChar *uri)
LIST_FOR_EACH_ENTRY(element, &locator->elements, element_entry, entry)
{
for (i=0; i < element->ns_count; i++)
if (!strcmpW(uriW, element->ns[i].uri))
if (!wcscmp(uriW, element->ns[i].uri))
{
SysFreeString(uriW);
return element->ns[i].uri;
@@ -573,7 +567,7 @@ static BOOL bstr_pool_insert(struct bstrpool *pool, BSTR pool_entry)
{
if (!pool->pool)
{
pool->pool = heap_alloc(16 * sizeof(*pool->pool));
pool->pool = malloc(16 * sizeof(*pool->pool));
if (!pool->pool)
return FALSE;
@@ -582,12 +576,12 @@ static BOOL bstr_pool_insert(struct bstrpool *pool, BSTR pool_entry)
}
else if (pool->index == pool->len)
{
BSTR *realloc = heap_realloc(pool->pool, pool->len * 2 * sizeof(*realloc));
BSTR *new_pool = realloc(pool->pool, pool->len * 2 * sizeof(*new_pool));
if (!realloc)
if (!new_pool)
return FALSE;
pool->pool = realloc;
pool->pool = new_pool;
pool->len *= 2;
}
@@ -602,7 +596,7 @@ static void free_bstr_pool(struct bstrpool *pool)
for (i = 0; i < pool->index; i++)
SysFreeString(pool->pool[i]);
heap_free(pool->pool);
free(pool->pool);
pool->pool = NULL;
pool->index = pool->len = 0;
@@ -755,9 +749,7 @@ static HRESULT WINAPI ivbsaxattributes_GetTypeInfo(
IVBSAXAttributes *iface,
UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo )
{
saxlocator *This = impl_from_IVBSAXAttributes( iface );
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
TRACE("%p, %u, %lx, %p.\n", iface, iTInfo, lcid, ppTInfo);
return get_typeinfo(IVBSAXAttributes_tid, ppTInfo);
}
@@ -770,11 +762,10 @@ static HRESULT WINAPI ivbsaxattributes_GetIDsOfNames(
LCID lcid,
DISPID* rgDispId)
{
saxlocator *This = impl_from_IVBSAXAttributes( iface );
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
TRACE("%p, %s, %p, %u, %lx %p.\n", iface, debugstr_guid(riid), rgszNames, cNames,
lcid, rgDispId);
if(!rgszNames || cNames == 0 || !rgDispId)
@@ -801,18 +792,16 @@ static HRESULT WINAPI ivbsaxattributes_Invoke(
EXCEPINFO* pExcepInfo,
UINT* puArgErr)
{
saxlocator *This = impl_from_IVBSAXAttributes( iface );
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
TRACE("%p, %ld, %s, %lx, %d, %p, %p, %p, %p.\n", iface, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
hr = get_typeinfo(IVBSAXAttributes_tid, &typeinfo);
if(SUCCEEDED(hr))
{
hr = ITypeInfo_Invoke(typeinfo, &This->IVBSAXAttributes_iface, dispIdMember, wFlags,
pDispParams, pVarResult, pExcepInfo, puArgErr);
hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
ITypeInfo_Release(typeinfo);
}
@@ -1410,14 +1399,14 @@ static BSTR saxreader_get_unescaped_value(const xmlChar *buf, int len)
str_len = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)buf, len, NULL, 0);
if (len != -1) str_len++;
str = heap_alloc(str_len*sizeof(WCHAR));
str = malloc(str_len * sizeof(WCHAR));
if (!str) return NULL;
MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)buf, len, str, str_len);
if (len != -1) str[str_len-1] = 0;
ptrW = str;
while ((dest = strstrW(ptrW, ampescW)))
while ((dest = wcsstr(ptrW, ampescW)))
{
WCHAR *src;
@@ -1426,13 +1415,13 @@ static BSTR saxreader_get_unescaped_value(const xmlChar *buf, int len)
dest++;
/* move together with null terminator */
memmove(dest, src, (strlenW(src) + 1)*sizeof(WCHAR));
memmove(dest, src, (lstrlenW(src) + 1)*sizeof(WCHAR));
ptrW++;
}
bstr = SysAllocString(str);
heap_free(str);
free(str);
return bstr;
}
@@ -1472,13 +1461,15 @@ static HRESULT SAXAttributes_populate(saxlocator *locator,
if(locator->attr_count > locator->attr_alloc_count)
{
int new_size = locator->attr_count * 2;
attrs = heap_realloc_zero(locator->attributes, new_size * sizeof(struct _attributes));
attrs = realloc(locator->attributes, new_size * sizeof(*locator->attributes));
if(!attrs)
{
free_attribute_values(locator);
locator->attr_count = 0;
return E_OUTOFMEMORY;
}
memset(attrs + locator->attr_alloc_count, 0,
(new_size - locator->attr_alloc_count) * sizeof(*locator->attributes));
locator->attributes = attrs;
locator->attr_alloc_count = new_size;
}
@@ -1922,7 +1913,7 @@ static void libxmlComment(void *ctx, const xmlChar *value)
format_error_message_from_id(This, hr);
}
static void libxmlFatalError(void *ctx, const char *msg, ...)
static void WINAPIV libxmlFatalError(void *ctx, const char *msg, ...)
{
saxlocator *This = ctx;
struct saxerrorhandler_iface *handler = saxreader_get_errorhandler(This->saxreader);
@@ -1941,7 +1932,7 @@ static void libxmlFatalError(void *ctx, const char *msg, ...)
va_end(args);
len = MultiByteToWideChar(CP_UNIXCP, 0, message, -1, NULL, 0);
error = heap_alloc(sizeof(WCHAR)*len);
error = malloc(sizeof(WCHAR) * len);
if(error)
{
MultiByteToWideChar(CP_UNIXCP, 0, message, -1, error, len);
@@ -1952,7 +1943,7 @@ static void libxmlFatalError(void *ctx, const char *msg, ...)
{
xmlStopParser(This->pParserCtxt);
This->ret = E_FAIL;
heap_free(error);
free(error);
return;
}
@@ -1968,7 +1959,7 @@ static void libxmlFatalError(void *ctx, const char *msg, ...)
else
ISAXErrorHandler_fatalError(handler->handler, &This->ISAXLocator_iface, error, E_FAIL);
heap_free(error);
free(error);
xmlStopParser(This->pParserCtxt);
This->ret = E_FAIL;
@@ -2156,9 +2147,7 @@ static HRESULT WINAPI ivbsaxlocator_GetTypeInfo(
IVBSAXLocator *iface,
UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo )
{
saxlocator *This = impl_from_IVBSAXLocator( iface );
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
TRACE("%p, %u, %lx, %p.\n", iface, iTInfo, lcid, ppTInfo);
return get_typeinfo(IVBSAXLocator_tid, ppTInfo);
}
@@ -2171,11 +2160,10 @@ static HRESULT WINAPI ivbsaxlocator_GetIDsOfNames(
LCID lcid,
DISPID* rgDispId)
{
saxlocator *This = impl_from_IVBSAXLocator( iface );
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
TRACE("%p, %s, %p, %u, %lx, %p.\n", iface, debugstr_guid(riid), rgszNames, cNames,
lcid, rgDispId);
if(!rgszNames || cNames == 0 || !rgDispId)
@@ -2202,18 +2190,16 @@ static HRESULT WINAPI ivbsaxlocator_Invoke(
EXCEPINFO* pExcepInfo,
UINT* puArgErr)
{
saxlocator *This = impl_from_IVBSAXLocator( iface );
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
TRACE("%p, %ld, %s, %lx, %d, %p, %p, %p, %p.\n", iface, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
hr = get_typeinfo(IVBSAXLocator_tid, &typeinfo);
if(SUCCEEDED(hr))
{
hr = ITypeInfo_Invoke(typeinfo, &This->IVBSAXLocator_iface, dispIdMember, wFlags,
pDispParams, pVarResult, pExcepInfo, puArgErr);
hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
ITypeInfo_Release(typeinfo);
}
@@ -2324,7 +2310,7 @@ static ULONG WINAPI isaxlocator_AddRef(ISAXLocator* iface)
{
saxlocator *This = impl_from_ISAXLocator( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -2332,11 +2318,11 @@ static ULONG WINAPI isaxlocator_Release(
ISAXLocator* iface)
{
saxlocator *This = impl_from_ISAXLocator( iface );
LONG ref = InterlockedDecrement( &This->ref );
ULONG ref = InterlockedDecrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref );
TRACE("%p, refcount %ld.\n", iface, ref );
if (ref == 0)
if (!ref)
{
element_entry *element, *element2;
int index;
@@ -2351,7 +2337,7 @@ static ULONG WINAPI isaxlocator_Release(
SysFreeString(This->attributes[index].szValue);
SysFreeString(This->attributes[index].szQName);
}
heap_free(This->attributes);
free(This->attributes);
/* element stack */
LIST_FOR_EACH_ENTRY_SAFE(element, element2, &This->elements, element_entry, entry)
@@ -2361,7 +2347,7 @@ static ULONG WINAPI isaxlocator_Release(
}
ISAXXMLReader_Release(&This->saxreader->ISAXXMLReader_iface);
heap_free( This );
free(This);
}
return ref;
@@ -2450,7 +2436,7 @@ static HRESULT SAXLocator_create(saxreader *reader, saxlocator **ppsaxlocator, B
saxlocator *locator;
locator = heap_alloc( sizeof (*locator) );
locator = malloc(sizeof(*locator));
if( !locator )
return E_OUTOFMEMORY;
@@ -2477,18 +2463,18 @@ static HRESULT SAXLocator_create(saxreader *reader, saxlocator **ppsaxlocator, B
if(!locator->namespaceUri)
{
ISAXXMLReader_Release(&reader->ISAXXMLReader_iface);
heap_free(locator);
free(locator);
return E_OUTOFMEMORY;
}
locator->attr_alloc_count = 8;
locator->attr_count = 0;
locator->attributes = heap_alloc_zero(sizeof(struct _attributes)*locator->attr_alloc_count);
locator->attributes = calloc(locator->attr_alloc_count, sizeof(*locator->attributes));
if(!locator->attributes)
{
ISAXXMLReader_Release(&reader->ISAXXMLReader_iface);
SysFreeString(locator->namespaceUri);
heap_free(locator);
free(locator);
return E_OUTOFMEMORY;
}
@@ -2517,18 +2503,9 @@ static HRESULT internal_parseBuffer(saxreader *This, const char *buffer, int siz
if (size >= 4)
{
const unsigned char *buff = (unsigned char*)buffer;
encoding = xmlDetectCharEncoding((xmlChar*)buffer, 4);
enc_name = (xmlChar*)xmlGetCharEncodingName(encoding);
TRACE("detected encoding: %s\n", enc_name);
/* skip BOM, parser won't switch encodings and so won't skip it on its own */
if ((encoding == XML_CHAR_ENCODING_UTF8) &&
buff[0] == 0xEF && buff[1] == 0xBB && buff[2] == 0xBF)
{
buffer += 3;
size -= 3;
}
}
/* if libxml2 detection failed try to guess */
@@ -2653,7 +2630,7 @@ static HRESULT internal_parse(
case VT_BSTR|VT_BYREF:
{
BSTR str = V_ISBYREF(&varInput) ? *V_BSTRREF(&varInput) : V_BSTR(&varInput);
hr = internal_parseBuffer(This, (const char*)str, strlenW(str)*sizeof(WCHAR), vbInterface);
hr = internal_parseBuffer(This, (const char*)str, lstrlenW(str)*sizeof(WCHAR), vbInterface);
break;
}
case VT_ARRAY|VT_UI1: {
@@ -2734,23 +2711,23 @@ static HRESULT internal_onDataAvailable(void *obj, char *ptr, DWORD len)
return internal_parseBuffer(This, ptr, len, FALSE);
}
static HRESULT internal_parseURL(
saxreader* This,
const WCHAR *url,
BOOL vbInterface)
static HRESULT internal_parseURL(saxreader *reader, const WCHAR *url, BOOL vbInterface)
{
IMoniker *mon;
bsc_t *bsc;
HRESULT hr;
TRACE("(%p)->(%s)\n", This, debugstr_w(url));
TRACE("%p, %s.\n", reader, debugstr_w(url));
if (!url && reader->version < MSXML4)
return E_INVALIDARG;
hr = create_moniker_from_url(url, &mon);
if(FAILED(hr))
return hr;
if(vbInterface) hr = bind_url(mon, internal_vbonDataAvailable, This, &bsc);
else hr = bind_url(mon, internal_onDataAvailable, This, &bsc);
if(vbInterface) hr = bind_url(mon, internal_vbonDataAvailable, reader, &bsc);
else hr = bind_url(mon, internal_onDataAvailable, reader, &bsc);
IMoniker_Release(mon);
if(FAILED(hr))
@@ -2964,7 +2941,7 @@ static ULONG WINAPI saxxmlreader_Release(
SysFreeString(This->xmldecl_version);
free_bstr_pool(&This->pool);
heap_free( This );
free(This);
}
return ref;
@@ -3453,7 +3430,7 @@ HRESULT SAXXMLReader_create(MSXML_VERSION version, LPVOID *ppObj)
TRACE("(%p)\n", ppObj);
reader = heap_alloc( sizeof (*reader) );
reader = malloc(sizeof(*reader));
if( !reader )
return E_OUTOFMEMORY;
@@ -3491,14 +3468,3 @@ HRESULT SAXXMLReader_create(MSXML_VERSION version, LPVOID *ppObj)
return S_OK;
}
#else
HRESULT SAXXMLReader_create(MSXML_VERSION version, LPVOID *ppObj)
{
MESSAGE("This program tried to use a SAX XML Reader object, but\n"
"libxml2 support was not present at compile time.\n");
return E_NOTIMPL;
}
#endif
+47 -79
View File
@@ -21,22 +21,18 @@
#define COBJMACROS
#include "config.h"
#include <assert.h>
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/xmlerror.h>
# include <libxml/tree.h>
# include <libxml/xmlschemas.h>
# include <libxml/schemasInternals.h>
# include <libxml/hash.h>
# include <libxml/parser.h>
# include <libxml/parserInternals.h>
# include <libxml/xmlIO.h>
# include <libxml/xmlversion.h>
# include <libxml/xpath.h>
#endif
#include <libxml/xmlerror.h>
#include <libxml/tree.h>
#include <libxml/xmlschemas.h>
#include <libxml/schemasInternals.h>
#include <libxml/hash.h>
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#include <libxml/xmlIO.h>
#include <libxml/xmlversion.h>
#include <libxml/xpath.h>
#include "windef.h"
#include "winbase.h"
@@ -48,16 +44,8 @@
#include "msxml_private.h"
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
#if LIBXML_VERSION >= 20908
#define XMLHASH_CONST const
#else
#define XMLHASH_CONST
#endif
/* We use a chained hashtable, which can hold any number of schemas
* TODO: grow/shrink hashtable depending on load factor
* TODO: implement read-only where appropriate
@@ -255,22 +243,17 @@ static void LIBXML2_LOG_CALLBACK parser_warning(void* ctx, char const* msg, ...)
va_end(ap);
}
#ifdef HAVE_XMLSCHEMASSETPARSERSTRUCTUREDERRORS
static void parser_serror(void* ctx, xmlErrorPtr err)
static void parser_serror(void* ctx, const xmlError* err)
{
LIBXML2_CALLBACK_SERROR(Schema_parse, err);
}
#endif
static inline xmlSchemaPtr Schema_parse(xmlSchemaParserCtxtPtr spctx)
{
TRACE("(%p)\n", spctx);
xmlSchemaSetParserErrors(spctx, parser_error, parser_warning, NULL);
#ifdef HAVE_XMLSCHEMASSETPARSERSTRUCTUREDERRORS
xmlSchemaSetParserStructuredErrors(spctx, parser_serror, NULL);
#endif
return xmlSchemaParse(spctx);
}
@@ -290,12 +273,10 @@ static void LIBXML2_LOG_CALLBACK validate_warning(void* ctx, char const* msg, ..
va_end(ap);
}
#ifdef HAVE_XMLSCHEMASSETVALIDSTRUCTUREDERRORS
static void validate_serror(void* ctx, xmlErrorPtr err)
static void validate_serror(void* ctx, const xmlError* err)
{
LIBXML2_CALLBACK_SERROR(Schema_validate_tree, err);
}
#endif
static HRESULT schema_cache_get_item(IUnknown *iface, LONG index, VARIANT *item)
{
@@ -318,9 +299,7 @@ static inline HRESULT Schema_validate_tree(xmlSchemaPtr schema, xmlNodePtr tree)
* we probably need to validate the schema here. */
svctx = xmlSchemaNewValidCtxt(schema);
xmlSchemaSetValidErrors(svctx, validate_error, validate_warning, NULL);
#ifdef HAVE_XMLSCHEMASSETVALIDSTRUCTUREDERRORS
xmlSchemaSetValidStructuredErrors(svctx, validate_serror, NULL);
#endif
if (tree->type == XML_DOCUMENT_NODE)
err = xmlSchemaValidateDoc(svctx, (xmlDocPtr)tree);
@@ -755,7 +734,7 @@ void schemasInit(void)
/* Resource is loaded as raw data,
* need a null-terminated string */
while (buf[datatypes_len - 1] != '>') datatypes_len--;
datatypes_src = heap_alloc(datatypes_len + 1);
datatypes_src = malloc(datatypes_len + 1);
memcpy(datatypes_src, buf, datatypes_len);
datatypes_src[datatypes_len] = 0;
@@ -769,21 +748,21 @@ void schemasInit(void)
void schemasCleanup(void)
{
xmlSchemaFree(datatypes_schema);
heap_free(datatypes_src);
free(datatypes_src);
xmlSetExternalEntityLoader(_external_entity_loader);
}
static LONG cache_entry_add_ref(cache_entry* entry)
{
LONG ref = InterlockedIncrement(&entry->ref);
TRACE("(%p)->(%d)\n", entry, ref);
TRACE("%p, refcount %ld.\n", entry, ref);
return ref;
}
static LONG cache_entry_release(cache_entry* entry)
{
LONG ref = InterlockedDecrement(&entry->ref);
TRACE("(%p)->(%d)\n", entry, ref);
TRACE("%p, refcount %ld.\n", entry, ref);
if (ref == 0)
{
@@ -801,7 +780,7 @@ static LONG cache_entry_release(cache_entry* entry)
xmlSchemaFree(entry->schema);
}
heap_free(entry);
free(entry);
}
return ref;
}
@@ -815,7 +794,7 @@ static inline schema_cache* impl_from_IXMLDOMSchemaCollection2(IXMLDOMSchemaColl
static inline schema_cache* impl_from_IXMLDOMSchemaCollection(IXMLDOMSchemaCollection* iface)
{
return CONTAINING_RECORD((IXMLDOMSchemaCollection2 *)iface, schema_cache, IXMLDOMSchemaCollection2_iface);
return CONTAINING_RECORD(iface, schema_cache, IXMLDOMSchemaCollection2_iface);
}
static inline schema_cache* unsafe_impl_from_IXMLDOMSchemaCollection(IXMLDOMSchemaCollection *iface)
@@ -875,7 +854,7 @@ static BOOL link_datatypes(xmlDocPtr schema)
static cache_entry* cache_entry_from_xsd_doc(xmlDocPtr doc, xmlChar const* nsURI, MSXML_VERSION v)
{
cache_entry* entry = heap_alloc(sizeof(cache_entry));
cache_entry* entry = malloc(sizeof(cache_entry));
xmlSchemaParserCtxtPtr spctx;
xmlDocPtr new_doc = xmlCopyDoc(doc, 1);
@@ -897,7 +876,7 @@ static cache_entry* cache_entry_from_xsd_doc(xmlDocPtr doc, xmlChar const* nsURI
{
FIXME("failed to parse doc\n");
xmlFreeDoc(new_doc);
heap_free(entry);
free(entry);
entry = NULL;
}
xmlSchemaFreeParserCtxt(spctx);
@@ -906,7 +885,7 @@ static cache_entry* cache_entry_from_xsd_doc(xmlDocPtr doc, xmlChar const* nsURI
static cache_entry* cache_entry_from_xdr_doc(xmlDocPtr doc, xmlChar const* nsURI, MSXML_VERSION version)
{
cache_entry* entry = heap_alloc(sizeof(cache_entry));
cache_entry* entry = malloc(sizeof(cache_entry));
xmlSchemaParserCtxtPtr spctx;
xmlDocPtr new_doc = xmlCopyDoc(doc, 1), xsd_doc = XDR_to_XSD_doc(doc, nsURI);
@@ -929,7 +908,7 @@ static cache_entry* cache_entry_from_xdr_doc(xmlDocPtr doc, xmlChar const* nsURI
FIXME("failed to parse doc\n");
xmlFreeDoc(new_doc);
xmlFreeDoc(xsd_doc);
heap_free(entry);
free(entry);
entry = NULL;
}
xmlSchemaFreeParserCtxt(spctx);
@@ -942,7 +921,7 @@ static cache_entry* cache_entry_from_url(VARIANT url, xmlChar const* nsURI, MSXM
cache_entry* entry;
IXMLDOMDocument3* domdoc = NULL;
xmlDocPtr doc = NULL;
HRESULT hr = DOMDocument_create(version, (void**)&domdoc);
HRESULT hr = dom_document_create(version, (void **)&domdoc);
VARIANT_BOOL b = VARIANT_FALSE;
CacheEntryType type = CacheEntryType_Invalid;
@@ -957,7 +936,7 @@ static cache_entry* cache_entry_from_url(VARIANT url, xmlChar const* nsURI, MSXM
hr = IXMLDOMDocument3_load(domdoc, url, &b);
if (hr != S_OK)
{
ERR("IXMLDOMDocument3_load() returned 0x%08x\n", hr);
ERR("load() returned %#lx.\n", hr);
if (b != VARIANT_TRUE)
{
FIXME("Failed to load doc at %s\n", debugstr_w(V_BSTR(&url)));
@@ -986,7 +965,7 @@ static cache_entry* cache_entry_from_url(VARIANT url, xmlChar const* nsURI, MSXM
return entry;
}
static void cache_free(void* data, XMLHASH_CONST xmlChar* name /* ignored */)
static void cache_free(void* data, const xmlChar* name /* ignored */)
{
cache_entry_release((cache_entry*)data);
}
@@ -999,7 +978,7 @@ static int cache_free_uri(schema_cache *cache, const xmlChar *uri)
for (i = 0; i < cache->count; i++)
if (xmlStrEqual(cache->uris[i], uri))
{
heap_free(cache->uris[i]);
free(cache->uris[i]);
return i;
}
@@ -1016,14 +995,14 @@ static void cache_add_entry(schema_cache *cache, const xmlChar *uri, cache_entry
if (cache->count == cache->allocated)
{
cache->allocated *= 2;
cache->uris = heap_realloc(cache->uris, cache->allocated*sizeof(xmlChar*));
cache->uris = realloc(cache->uris, cache->allocated * sizeof(xmlChar*));
}
i = cache->count++;
}
else
i = cache_free_uri(cache, uri);
cache->uris[i] = heap_strdupxmlChar(uri);
cache->uris[i] = strdupxmlChar(uri);
xmlHashAddEntry(cache->cache, uri, entry);
}
@@ -1080,7 +1059,7 @@ HRESULT cache_from_doc_ns(IXMLDOMSchemaCollection2 *iface, xmlnode *node)
continue;
}
entry = heap_alloc(sizeof(cache_entry));
entry = malloc(sizeof(cache_entry));
entry->type = CacheEntryType_NS;
entry->ref = 1;
entry->schema = NULL;
@@ -1147,7 +1126,7 @@ static ULONG WINAPI schema_cache_AddRef(IXMLDOMSchemaCollection2* iface)
{
schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %ld.\n", iface, ref);
return ref;
}
@@ -1155,17 +1134,17 @@ static ULONG WINAPI schema_cache_Release(IXMLDOMSchemaCollection2* iface)
{
schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %ld.\n", iface, ref);
if (ref == 0)
if (!ref)
{
int i;
for (i = 0; i < This->count; i++)
heap_free(This->uris[i]);
heap_free(This->uris);
free(This->uris[i]);
free(This->uris);
xmlHashFree(This->cache, cache_free);
heap_free(This);
free(This);
}
return ref;
@@ -1235,7 +1214,7 @@ static HRESULT WINAPI schema_cache_add(IXMLDOMSchemaCollection2* iface, BSTR uri
}
else
{
heap_free(name);
free(name);
return E_FAIL;
}
@@ -1266,7 +1245,7 @@ static HRESULT WINAPI schema_cache_add(IXMLDOMSchemaCollection2* iface, BSTR uri
BSTR xml;
IXMLDOMNode_get_xml(domnode, &xml);
DOMDocument_create(This->version, (void**)&domdoc);
dom_document_create(This->version, (void **)&domdoc);
IXMLDOMDocument_loadXML(domdoc, xml, &b);
SysFreeString(xml);
doc = xmlNodePtr_from_domnode((IXMLDOMNode*)domdoc, XML_DOCUMENT_NODE)->doc;
@@ -1281,7 +1260,7 @@ static HRESULT WINAPI schema_cache_add(IXMLDOMSchemaCollection2* iface, BSTR uri
if (!doc)
{
IXMLDOMNode_Release(domnode);
heap_free(name);
free(name);
return E_INVALIDARG;
}
type = cache_type_from_xmlDocPtr(doc);
@@ -1308,7 +1287,7 @@ static HRESULT WINAPI schema_cache_add(IXMLDOMSchemaCollection2* iface, BSTR uri
}
else
{
heap_free(name);
free(name);
return E_FAIL;
}
@@ -1318,10 +1297,10 @@ static HRESULT WINAPI schema_cache_add(IXMLDOMSchemaCollection2* iface, BSTR uri
default:
FIXME("arg type is not supported, %s\n", debugstr_variant(&var));
heap_free(name);
free(name);
return E_INVALIDARG;
}
heap_free(name);
free(name);
return S_OK;
}
@@ -1347,7 +1326,7 @@ static HRESULT WINAPI schema_cache_get(IXMLDOMSchemaCollection2* iface, BSTR uri
name = uri ? xmlchar_from_wchar(uri) : xmlchar_from_wchar(emptyW);
entry = (cache_entry*) xmlHashLookup(This->cache, name);
heap_free(name);
free(name);
/* TODO: this should be read-only */
if (entry && entry->doc)
@@ -1367,7 +1346,7 @@ static HRESULT WINAPI schema_cache_remove(IXMLDOMSchemaCollection2* iface, BSTR
name = uri ? xmlchar_from_wchar(uri) : xmlchar_from_wchar(emptyW);
cache_remove_entry(This, name);
heap_free(name);
free(name);
return S_OK;
}
@@ -1388,7 +1367,7 @@ static HRESULT WINAPI schema_cache_get_namespaceURI(IXMLDOMSchemaCollection2* if
{
schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
TRACE("(%p)->(%i %p)\n", This, index, uri);
TRACE("%p, %ld, %p.\n", iface, index, uri);
if (!uri)
return E_POINTER;
@@ -1403,7 +1382,7 @@ static HRESULT WINAPI schema_cache_get_namespaceURI(IXMLDOMSchemaCollection2* if
return S_OK;
}
static void cache_copy(void* data, void* dest, XMLHASH_CONST xmlChar* name)
static void cache_copy(void* data, void* dest, const xmlChar* name)
{
schema_cache* This = (schema_cache*) dest;
cache_entry* entry = (cache_entry*) data;
@@ -1621,7 +1600,7 @@ static dispex_static_data_t schemacache_dispex = {
HRESULT SchemaCache_create(MSXML_VERSION version, void** obj)
{
schema_cache* This = heap_alloc(sizeof(schema_cache));
schema_cache* This = malloc(sizeof(schema_cache));
if (!This)
return E_OUTOFMEMORY;
@@ -1631,7 +1610,7 @@ HRESULT SchemaCache_create(MSXML_VERSION version, void** obj)
This->cache = xmlHashCreate(DEFAULT_HASHTABLE_SIZE);
This->allocated = 10;
This->count = 0;
This->uris = heap_alloc(This->allocated*sizeof(xmlChar*));
This->uris = malloc(This->allocated * sizeof(xmlChar*));
This->ref = 1;
This->version = version;
This->validateOnLoad = VARIANT_TRUE;
@@ -1641,14 +1620,3 @@ HRESULT SchemaCache_create(MSXML_VERSION version, void** obj)
*obj = &This->IXMLDOMSchemaCollection2_iface;
return S_OK;
}
#else
HRESULT SchemaCache_create(MSXML_VERSION version, void** obj)
{
MESSAGE("This program tried to use a SchemaCache object, but\n"
"libxml2 support was not present at compile time.\n");
return E_NOTIMPL;
}
#endif
+27 -32
View File
@@ -22,15 +22,11 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
# include <libxml/xpath.h>
# include <libxml/xpathInternals.h>
#endif
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include "windef.h"
#include "winbase.h"
@@ -52,8 +48,6 @@
*
*/
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
int registerNamespaces(xmlXPathContextPtr ctxt);
@@ -161,7 +155,7 @@ static ULONG WINAPI domselection_AddRef(
{
domselection *This = impl_from_IXMLDOMSelection( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -171,13 +165,13 @@ static ULONG WINAPI domselection_Release(
domselection *This = impl_from_IXMLDOMSelection( iface );
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
if ( ref == 0 )
{
xmlXPathFreeObject(This->result);
xmldoc_release(This->node->doc);
if (This->enumvariant) IEnumVARIANT_Release(This->enumvariant);
heap_free(This);
free(This);
}
return ref;
@@ -238,7 +232,7 @@ static HRESULT WINAPI domselection_get_item(
{
domselection *This = impl_from_IXMLDOMSelection( iface );
TRACE("(%p)->(%d %p)\n", This, index, listItem);
TRACE("%p, %ld, %p.\n", iface, index, listItem);
if(!listItem)
return E_INVALIDARG;
@@ -474,7 +468,7 @@ static ULONG WINAPI enumvariant_AddRef(IEnumVARIANT *iface )
{
enumvariant *This = impl_from_IEnumVARIANT( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -483,11 +477,11 @@ static ULONG WINAPI enumvariant_Release(IEnumVARIANT *iface )
enumvariant *This = impl_from_IEnumVARIANT( iface );
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
if ( ref == 0 )
{
if (This->own) IUnknown_Release(This->outer);
heap_free(This);
free(This);
}
return ref;
@@ -502,7 +496,7 @@ static HRESULT WINAPI enumvariant_Next(
enumvariant *This = impl_from_IEnumVARIANT( iface );
ULONG ret_count = 0;
TRACE("(%p)->(%u %p %p)\n", This, celt, var, fetched);
TRACE("%p, %lu, %p, %p.\n", iface, celt, var, fetched);
if (fetched) *fetched = 0;
@@ -519,7 +513,7 @@ static HRESULT WINAPI enumvariant_Next(
ret_count++;
}
if (fetched) (*fetched)++;
if (fetched) *fetched = ret_count;
/* we need to advance one step more for some reason */
if (ret_count)
@@ -535,16 +529,18 @@ static HRESULT WINAPI enumvariant_Skip(
IEnumVARIANT *iface,
ULONG celt)
{
enumvariant *This = impl_from_IEnumVARIANT( iface );
FIXME("(%p)->(%u): stub\n", This, celt);
FIXME("%p, %lu: stub\n", iface, celt);
return E_NOTIMPL;
}
static HRESULT WINAPI enumvariant_Reset(IEnumVARIANT *iface)
{
enumvariant *This = impl_from_IEnumVARIANT( iface );
FIXME("(%p): stub\n", This);
return E_NOTIMPL;
TRACE("%p\n", This);
This->pos = 0;
return S_OK;
}
static HRESULT WINAPI enumvariant_Clone(
@@ -570,7 +566,7 @@ HRESULT create_enumvariant(IUnknown *outer, BOOL own, const struct enumvariant_f
{
enumvariant *This;
This = heap_alloc(sizeof(enumvariant));
This = malloc(sizeof(enumvariant));
if (!This) return E_OUTOFMEMORY;
This->IEnumVARIANT_iface.lpVtbl = &EnumVARIANTVtbl;
@@ -593,13 +589,13 @@ static HRESULT domselection_get_dispid(IUnknown *iface, BSTR name, DWORD flags,
WCHAR *ptr;
int idx = 0;
for(ptr = name; *ptr && isdigitW(*ptr); ptr++)
for(ptr = name; *ptr >= '0' && *ptr <= '9'; ptr++)
idx = idx*10 + (*ptr-'0');
if(*ptr)
return DISP_E_UNKNOWNNAME;
*dispid = DISPID_DOM_COLLECTION_BASE + idx;
TRACE("ret %x\n", *dispid);
TRACE("ret %lx\n", *dispid);
return S_OK;
}
@@ -608,7 +604,7 @@ static HRESULT domselection_invoke(IUnknown *iface, DISPID id, LCID lcid, WORD f
{
domselection *This = impl_from_IXMLDOMSelection( (IXMLDOMSelection*)iface );
TRACE("(%p)->(%x %x %x %p %p %p)\n", This, id, lcid, flags, params, res, ei);
TRACE("%p, %ld, %lx, %x, %p, %p, %p.\n", iface, id, lcid, flags, params, res, ei);
V_VT(res) = VT_DISPATCH;
V_DISPATCH(res) = NULL;
@@ -760,14 +756,14 @@ static void XSLPattern_OP_IGEq(xmlXPathParserContextPtr pctx, int nargs)
xmlFree(arg2);
}
static void query_serror(void* ctx, xmlErrorPtr err)
static void query_serror(void* ctx, const xmlError* err)
{
LIBXML2_CALLBACK_SERROR(domselection_create, err);
}
HRESULT create_selection(xmlNodePtr node, xmlChar* query, IXMLDOMNodeList **out)
{
domselection *This = heap_alloc(sizeof(domselection));
domselection *This = malloc(sizeof(domselection));
xmlXPathContextPtr ctxt = xmlXPathNewContext(node->doc);
HRESULT hr;
@@ -777,7 +773,7 @@ HRESULT create_selection(xmlNodePtr node, xmlChar* query, IXMLDOMNodeList **out)
if (!This || !ctxt || !query)
{
xmlXPathFreeContext(ctxt);
heap_free(This);
free(This);
return E_OUTOFMEMORY;
}
@@ -792,6 +788,7 @@ HRESULT create_selection(xmlNodePtr node, xmlChar* query, IXMLDOMNodeList **out)
ctxt->error = query_serror;
ctxt->node = node;
registerNamespaces(ctxt);
xmlXPathContextSetCache(ctxt, 1, -1, 0);
if (is_xpathmode(This->node->doc))
{
@@ -836,5 +833,3 @@ cleanup:
xmlXPathFreeContext(ctxt);
return hr;
}
#endif
+16 -25
View File
@@ -20,13 +20,9 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
#endif
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include "windef.h"
#include "winbase.h"
@@ -100,7 +96,7 @@ static void xslprocessor_par_free(struct xslprocessor_params *params, struct xsl
list_remove(&par->entry);
SysFreeString(par->name);
SysFreeString(par->value);
heap_free(par);
free(par);
}
static void xsltemplate_set_node( xsltemplate *This, IXMLDOMNode *node )
@@ -143,7 +139,7 @@ static ULONG WINAPI xsltemplate_AddRef( IXSLTemplate *iface )
{
xsltemplate *This = impl_from_IXSLTemplate( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -152,11 +148,11 @@ static ULONG WINAPI xsltemplate_Release( IXSLTemplate *iface )
xsltemplate *This = impl_from_IXSLTemplate( iface );
ULONG ref = InterlockedDecrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
if ( ref == 0 )
{
if (This->node) IXMLDOMNode_Release( This->node );
heap_free( This );
free( This );
}
return ref;
@@ -271,7 +267,7 @@ HRESULT XSLTemplate_create(void **ppObj)
TRACE("(%p)\n", ppObj);
This = heap_alloc( sizeof (*This) );
This = malloc(sizeof(*This));
if(!This)
return E_OUTOFMEMORY;
@@ -321,7 +317,7 @@ static ULONG WINAPI xslprocessor_AddRef( IXSLProcessor *iface )
{
xslprocessor *This = impl_from_IXSLProcessor( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -330,7 +326,7 @@ static ULONG WINAPI xslprocessor_Release( IXSLProcessor *iface )
xslprocessor *This = impl_from_IXSLProcessor( iface );
ULONG ref = InterlockedDecrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
if ( ref == 0 )
{
struct xslprocessor_par *par, *par2;
@@ -344,7 +340,7 @@ static ULONG WINAPI xslprocessor_Release( IXSLProcessor *iface )
xslprocessor_par_free(&This->params, par);
IXSLTemplate_Release(&This->stylesheet->IXSLTemplate_iface);
heap_free( This );
free(This);
}
return ref;
@@ -404,7 +400,7 @@ static HRESULT WINAPI xslprocessor_put_input( IXSLProcessor *iface, VARIANT inpu
{
IXMLDOMDocument *doc;
hr = DOMDocument_create(MSXML_DEFAULT, (void**)&doc);
hr = dom_document_create(MSXML_DEFAULT, (void **)&doc);
if (hr == S_OK)
{
VARIANT_BOOL b;
@@ -513,7 +509,7 @@ static HRESULT WINAPI xslprocessor_put_output(
if (FAILED(hr))
{
output_type = PROCESSOR_OUTPUT_NOT_SET;
WARN("failed to get output interface, 0x%08x\n", hr);
WARN("failed to get output interface, hr %#lx.\n", hr);
}
break;
default:
@@ -563,7 +559,6 @@ static HRESULT WINAPI xslprocessor_transform(
IXSLProcessor *iface,
VARIANT_BOOL *ret)
{
#ifdef HAVE_LIBXML2
xslprocessor *This = impl_from_IXSLProcessor( iface );
ISequentialStream *stream = NULL;
HRESULT hr;
@@ -650,10 +645,6 @@ static HRESULT WINAPI xslprocessor_transform(
*ret = hr == S_OK ? VARIANT_TRUE : VARIANT_FALSE;
return hr;
#else
FIXME("libxml2 is required but wasn't present at compile time\n");
return E_NOTIMPL;
#endif
}
static HRESULT WINAPI xslprocessor_reset( IXSLProcessor *iface )
@@ -713,7 +704,7 @@ static HRESULT WINAPI xslprocessor_addParameter(
/* search for existing parameter first */
LIST_FOR_EACH_ENTRY(cur, &This->params.list, struct xslprocessor_par, entry)
{
if (!strcmpW(cur->name, p))
if (!wcscmp(cur->name, p))
{
par = cur;
break;
@@ -735,13 +726,13 @@ static HRESULT WINAPI xslprocessor_addParameter(
else
{
/* new parameter */
par = heap_alloc(sizeof(struct xslprocessor_par));
par = malloc(sizeof(struct xslprocessor_par));
if (!par) return E_OUTOFMEMORY;
par->name = SysAllocString(p);
if (!par->name)
{
heap_free(par);
free(par);
return E_OUTOFMEMORY;
}
list_add_tail(&This->params.list, &par->entry);
@@ -819,7 +810,7 @@ HRESULT XSLProcessor_create(xsltemplate *template, IXSLProcessor **ppObj)
TRACE("(%p)\n", ppObj);
This = heap_alloc( sizeof (*This) );
This = malloc(sizeof(*This));
if(!This)
return E_OUTOFMEMORY;
+12 -24
View File
@@ -21,14 +21,10 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/parserInternals.h>
# include <libxml/xmlerror.h>
#endif
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#include <libxml/xmlerror.h>
#include "windef.h"
#include "winbase.h"
@@ -40,8 +36,6 @@
#include "wine/debug.h"
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
typedef struct _domtext
@@ -97,7 +91,7 @@ static ULONG WINAPI domtext_AddRef(
{
domtext *This = impl_from_IXMLDOMText( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -107,11 +101,11 @@ static ULONG WINAPI domtext_Release(
domtext *This = impl_from_IXMLDOMText( iface );
ULONG ref = InterlockedDecrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
if ( ref == 0 )
{
destroy_xmlnode(&This->node);
heap_free( This );
free(This);
}
return ref;
@@ -674,11 +668,10 @@ static HRESULT WINAPI domtext_substringData(
IXMLDOMText *iface,
LONG offset, LONG count, BSTR *p)
{
domtext *This = impl_from_IXMLDOMText( iface );
HRESULT hr;
BSTR data;
TRACE("(%p)->(%d %d %p)\n", This, offset, count, p);
TRACE("%p, %ld, %ld, %p.\n", iface, offset, count, p);
if(!p)
return E_INVALIDARG;
@@ -748,12 +741,11 @@ static HRESULT WINAPI domtext_insertData(
IXMLDOMText *iface,
LONG offset, BSTR p)
{
domtext *This = impl_from_IXMLDOMText( iface );
HRESULT hr;
BSTR data;
LONG p_len;
TRACE("(%p)->(%d %s)\n", This, offset, debugstr_w(p));
TRACE("%p, %ld, %s.\n", iface, offset, debugstr_w(p));
/* If have a NULL or empty string, don't do anything. */
if((p_len = SysStringLen(p)) == 0)
@@ -800,7 +792,7 @@ static HRESULT WINAPI domtext_deleteData(
LONG len = -1;
BSTR str;
TRACE("(%p)->(%d %d)\n", iface, offset, count);
TRACE("%p, %ld, %ld.\n", iface, offset, count);
hr = IXMLDOMText_get_length(iface, &len);
if(hr != S_OK) return hr;
@@ -843,10 +835,9 @@ static HRESULT WINAPI domtext_replaceData(
IXMLDOMText *iface,
LONG offset, LONG count, BSTR p)
{
domtext *This = impl_from_IXMLDOMText( iface );
HRESULT hr;
TRACE("(%p)->(%d %d %s)\n", This, offset, count, debugstr_w(p));
TRACE("%p, %ld, %ld, %s.\n", iface, offset, count, debugstr_w(p));
hr = IXMLDOMText_deleteData(iface, offset, count);
@@ -860,10 +851,9 @@ static HRESULT WINAPI domtext_splitText(
IXMLDOMText *iface,
LONG offset, IXMLDOMText **txtNode)
{
domtext *This = impl_from_IXMLDOMText( iface );
LONG length = 0;
TRACE("(%p)->(%d %p)\n", This, offset, txtNode);
TRACE("%p, %ld, %p.\n", iface, offset, txtNode);
if (!txtNode || offset < 0) return E_INVALIDARG;
@@ -951,7 +941,7 @@ IUnknown* create_text( xmlNodePtr text )
{
domtext *This;
This = heap_alloc( sizeof *This );
This = malloc(sizeof(*This));
if ( !This )
return NULL;
@@ -962,5 +952,3 @@ IUnknown* create_text( xmlNodePtr text )
return (IUnknown*)&This->IXMLDOMText_iface;
}
#endif
+4
View File
@@ -54,3 +54,7 @@
* XMLDSOControl DSOControl
*
*/
#ifndef __REACTOS__
DEFINE_GUID(CLSID_XMLSchemaCache60, 0x88d96a07, 0xf192, 0x11d4, 0xa6, 0x5f, 0x00, 0x40, 0x96, 0x32, 0x51, 0xe5);
#endif
+4 -4
View File
@@ -16,10 +16,10 @@
#define WINE_FILEDESCRIPTION_STR "Wine MSXML 3.0"
#define WINE_FILENAME_STR "msxml3.dll"
#define WINE_FILEVERSION 8,90,1101,0
#define WINE_FILEVERSION_STR "8.90.1101.0"
#define WINE_PRODUCTVERSION 8,90,1101,0
#define WINE_PRODUCTVERSION_STR "8.90.1101.0"
#define WINE_FILEVERSION 8,110,7601,24402
#define WINE_FILEVERSION_STR "8.110.7601.24402"
#define WINE_PRODUCTVERSION 8,110,7601,24402
#define WINE_PRODUCTVERSION_STR "8.110.7601.24402"
#define WINE_EXTRAVALUES VALUE "OLESelfRegister",""
#include "wine/wine_common_ver.rc"
+1 -10
View File
@@ -18,13 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <assert.h>
#ifdef HAVE_LIBXML2
# include <libxml/tree.h>
#endif
#include <libxml/tree.h>
#include "wine/debug.h"
@@ -32,8 +27,6 @@
* We just convert the doc tree, no need for a parser.
*/
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
static const xmlChar DT_prefix[] = "dt";
@@ -824,5 +817,3 @@ xmlDocPtr XDR_to_XSD_doc(xmlDocPtr xdr_doc, xmlChar const* nsURI)
return xsd_doc;
}
#endif /* HAVE_LIBXML2 */
+10 -36
View File
@@ -20,13 +20,9 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
#endif
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include "windef.h"
#include "winbase.h"
@@ -42,8 +38,6 @@
#include "msxml_private.h"
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
/* FIXME: IXMLDocument needs to implement
@@ -108,7 +102,7 @@ static ULONG WINAPI xmldoc_AddRef(IXMLDocument *iface)
{
xmldoc *This = impl_from_IXMLDocument(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %ld.\n", iface, ref);
return ref;
}
@@ -117,13 +111,13 @@ static ULONG WINAPI xmldoc_Release(IXMLDocument *iface)
xmldoc *This = impl_from_IXMLDocument(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %ld.\n", iface, ref);
if (ref == 0)
{
xmlFreeDoc(This->xmldoc);
if (This->stream) IStream_Release(This->stream);
heap_free(This);
free(This);
}
return ref;
@@ -143,9 +137,7 @@ static HRESULT WINAPI xmldoc_GetTypeInfoCount(IXMLDocument *iface, UINT* pctinfo
static HRESULT WINAPI xmldoc_GetTypeInfo(IXMLDocument *iface, UINT iTInfo,
LCID lcid, ITypeInfo** ppTInfo)
{
xmldoc *This = impl_from_IXMLDocument(iface);
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
TRACE("%p, %u, %lx, %p.\n", iface, iTInfo, lcid, ppTInfo);
return get_typeinfo(IXMLDocument_tid, ppTInfo);
}
@@ -154,11 +146,10 @@ static HRESULT WINAPI xmldoc_GetIDsOfNames(IXMLDocument *iface, REFIID riid,
LPOLESTR* rgszNames, UINT cNames,
LCID lcid, DISPID* rgDispId)
{
xmldoc *This = impl_from_IXMLDocument(iface);
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
TRACE("%p, %s, %p, %u, %lx, %p.\n", iface, debugstr_guid(riid), rgszNames, cNames,
lcid, rgDispId);
if(!rgszNames || cNames == 0 || !rgDispId)
@@ -179,18 +170,16 @@ static HRESULT WINAPI xmldoc_Invoke(IXMLDocument *iface, DISPID dispIdMember,
DISPPARAMS* pDispParams, VARIANT* pVarResult,
EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
xmldoc *This = impl_from_IXMLDocument(iface);
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
TRACE("%p, %ld, %s, %lx, %d, %p, %p, %p, %p.\n", iface, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
hr = get_typeinfo(IXMLDocument_tid, &typeinfo);
if(SUCCEEDED(hr))
{
hr = ITypeInfo_Invoke(typeinfo, &This->IXMLDocument_iface, dispIdMember, wFlags,
pDispParams, pVarResult, pExcepInfo, puArgErr);
hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
ITypeInfo_Release(typeinfo);
}
@@ -597,12 +586,8 @@ static HRESULT WINAPI xmldoc_IPersistStreamInit_IsDirty(
static xmlDocPtr parse_xml(char *ptr, int len)
{
#ifdef HAVE_XMLREADMEMORY
return xmlReadMemory(ptr, len, NULL, NULL,
XML_PARSE_NOERROR | XML_PARSE_NOWARNING | XML_PARSE_NOBLANKS);
#else
return xmlParseMemory(ptr, len);
#endif
}
static HRESULT WINAPI xmldoc_IPersistStreamInit_Load(
@@ -702,7 +687,7 @@ HRESULT XMLDocument_create(LPVOID *ppObj)
TRACE("(%p)\n", ppObj);
doc = heap_alloc(sizeof (*doc));
doc = malloc(sizeof(*doc));
if(!doc)
return E_OUTOFMEMORY;
@@ -718,14 +703,3 @@ HRESULT XMLDocument_create(LPVOID *ppObj)
TRACE("returning iface %p\n", *ppObj);
return S_OK;
}
#else
HRESULT XMLDocument_create(LPVOID *ppObj)
{
MESSAGE("This program tried to use an XMLDocument object, but\n"
"libxml2 support was not present at compile time.\n");
return E_NOTIMPL;
}
#endif
+38 -49
View File
@@ -20,13 +20,9 @@
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
#endif
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include "windef.h"
#include "winbase.h"
@@ -39,8 +35,6 @@
#include "msxml_private.h"
#ifdef HAVE_LIBXML2
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
static HRESULT XMLElementCollection_create( xmlNodePtr node, LPVOID *ppObj );
@@ -103,7 +97,7 @@ static ULONG WINAPI xmlelem_Release(IXMLElement *iface)
if (ref == 0)
{
if (This->own) xmlFreeNode(This->node);
heap_free(This);
free(This);
}
return ref;
@@ -123,25 +117,19 @@ static HRESULT WINAPI xmlelem_GetTypeInfoCount(IXMLElement *iface, UINT* pctinfo
static HRESULT WINAPI xmlelem_GetTypeInfo(IXMLElement *iface, UINT iTInfo,
LCID lcid, ITypeInfo** ppTInfo)
{
xmlelem *This = impl_from_IXMLElement(iface);
HRESULT hr;
TRACE("%p, %u, %lx, %p.\n", iface, iTInfo, lcid, ppTInfo);
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
hr = get_typeinfo(IXMLElement_tid, ppTInfo);
return hr;
return get_typeinfo(IXMLElement_tid, ppTInfo);
}
static HRESULT WINAPI xmlelem_GetIDsOfNames(IXMLElement *iface, REFIID riid,
LPOLESTR* rgszNames, UINT cNames,
LCID lcid, DISPID* rgDispId)
{
xmlelem *This = impl_from_IXMLElement(iface);
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
TRACE("%p, %s, %p, %u, %lx, %p.\n", iface, debugstr_guid(riid), rgszNames, cNames,
lcid, rgDispId);
if(!rgszNames || cNames == 0 || !rgDispId)
@@ -162,18 +150,16 @@ static HRESULT WINAPI xmlelem_Invoke(IXMLElement *iface, DISPID dispIdMember,
DISPPARAMS* pDispParams, VARIANT* pVarResult,
EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
xmlelem *This = impl_from_IXMLElement(iface);
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
TRACE("%p, %ld, %s, %lx, %d, %p, %p, %p, %p.\n", iface, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
hr = get_typeinfo(IXMLElement_tid, &typeinfo);
if(SUCCEEDED(hr))
{
hr = ITypeInfo_Invoke(typeinfo, &This->IXMLElement_iface, dispIdMember, wFlags, pDispParams,
pVarResult, pExcepInfo, puArgErr);
hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
ITypeInfo_Release(typeinfo);
}
@@ -246,8 +232,8 @@ static HRESULT WINAPI xmlelem_setAttribute(IXMLElement *iface, BSTR strPropertyN
value = xmlchar_from_wchar(V_BSTR(&PropertyValue));
attr = xmlSetProp(This->node, name, value);
heap_free(name);
heap_free(value);
free(name);
free(value);
return (attr) ? S_OK : S_FALSE;
}
@@ -299,7 +285,7 @@ static HRESULT WINAPI xmlelem_getAttribute(IXMLElement *iface, BSTR name,
SysFreeString(attr_name);
}
heap_free(xml_name);
free(xml_name);
}
if (val)
@@ -337,7 +323,7 @@ static HRESULT WINAPI xmlelem_removeAttribute(IXMLElement *iface, BSTR strProper
hr = S_OK;
done:
heap_free(name);
free(name);
return hr;
}
@@ -386,7 +372,7 @@ static HRESULT WINAPI xmlelem_get_type(IXMLElement *iface, LONG *p)
return E_INVALIDARG;
*p = type_libxml_to_msxml(This->node->type);
TRACE("returning %d\n", *p);
TRACE("returning %ld\n", *p);
return S_OK;
}
@@ -422,7 +408,7 @@ static HRESULT WINAPI xmlelem_put_text(IXMLElement *iface, BSTR p)
content = xmlchar_from_wchar(p);
xmlNodeSetContent(This->node, content);
heap_free(content);
free(content);
return S_OK;
}
@@ -434,7 +420,7 @@ static HRESULT WINAPI xmlelem_addChild(IXMLElement *iface, IXMLElement *pChildEl
xmlelem *childElem = impl_from_IXMLElement(pChildElem);
xmlNodePtr child;
TRACE("(%p)->(%p %d %d)\n", This, pChildElem, lIndex, lreserved);
TRACE("%p, %p, %ld, %ld.\n", iface, pChildElem, lIndex, lreserved);
if (lIndex == 0)
child = xmlAddChild(This->node, childElem->node);
@@ -502,7 +488,7 @@ HRESULT XMLElement_create(xmlNodePtr node, LPVOID *ppObj, BOOL own)
*ppObj = NULL;
elem = heap_alloc(sizeof (*elem));
elem = malloc(sizeof(*elem));
if(!elem)
return E_OUTOFMEMORY;
@@ -599,7 +585,7 @@ static ULONG WINAPI xmlelem_collection_Release(IXMLElementCollection *iface)
ref = InterlockedDecrement(&This->ref);
if (ref == 0)
{
heap_free(This);
free(This);
}
return ref;
@@ -637,8 +623,8 @@ static HRESULT WINAPI xmlelem_collection_Invoke(IXMLElementCollection *iface, DI
static HRESULT WINAPI xmlelem_collection_put_length(IXMLElementCollection *iface, LONG v)
{
xmlelem_collection *This = impl_from_IXMLElementCollection(iface);
TRACE("(%p)->(%d)\n", This, v);
TRACE("%p, %ld.\n", iface, v);
return E_FAIL;
}
@@ -753,35 +739,40 @@ static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Next(
IEnumVARIANT *iface, ULONG celt, VARIANT *rgVar, ULONG *fetched)
{
xmlelem_collection *This = impl_from_IEnumVARIANT(iface);
xmlNodePtr ptr = This->current;
HRESULT hr;
TRACE("(%p)->(%d %p %p)\n", This, celt, rgVar, fetched);
TRACE("%p, %lu, %p, %p.\n", iface, celt, rgVar, fetched);
if (!rgVar)
return E_INVALIDARG;
/* FIXME: handle celt */
if (fetched)
*fetched = 1;
if (fetched) *fetched = 0;
if (This->current)
This->current = This->current->next;
else
if (!This->current)
{
V_VT(rgVar) = VT_EMPTY;
if (fetched) *fetched = 0;
return S_FALSE;
}
V_VT(rgVar) = VT_DISPATCH;
return XMLElement_create(ptr, (LPVOID *)&V_DISPATCH(rgVar), FALSE);
while (celt > 0 && This->current)
{
V_VT(rgVar) = VT_DISPATCH;
hr = XMLElement_create(This->current, (void **)&V_DISPATCH(rgVar), FALSE);
if (FAILED(hr)) return hr;
This->current = This->current->next;
if (fetched) ++*fetched;
rgVar++;
celt--;
}
if (!celt) return S_OK;
V_VT(rgVar) = VT_EMPTY;
return S_FALSE;
}
static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Skip(
IEnumVARIANT *iface, ULONG celt)
{
xmlelem_collection *This = impl_from_IEnumVARIANT(iface);
FIXME("(%p)->(%d): stub\n", This, celt);
FIXME("%p, %lu: stub\n", iface, celt);
return E_NOTIMPL;
}
@@ -824,7 +815,7 @@ static HRESULT XMLElementCollection_create(xmlNodePtr node, LPVOID *ppObj)
if (!node->children)
return S_FALSE;
collection = heap_alloc(sizeof (*collection));
collection = malloc(sizeof(*collection));
if(!collection)
return E_OUTOFMEMORY;
@@ -841,5 +832,3 @@ static HRESULT XMLElementCollection_create(xmlNodePtr node, LPVOID *ppObj)
TRACE("returning iface %p\n", *ppObj);
return S_OK;
}
#endif
+10 -33
View File
@@ -19,22 +19,9 @@
*/
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_LIBXML2
# include <libxml/parser.h>
# include <libxml/xmlerror.h>
# include <libxml/HTMLtree.h>
#endif
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "msxml6.h"
#include "msxml_private.h"
#include "initguid.h"
#include "xmlparser.h"
@@ -86,7 +73,7 @@ static ULONG WINAPI xmlparser_AddRef(IXMLParser* iface)
{
xmlparser *This = impl_from_IXMLParser( iface );
ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -95,7 +82,7 @@ static ULONG WINAPI xmlparser_Release(IXMLParser* iface)
xmlparser *This = impl_from_IXMLParser( iface );
ULONG ref = InterlockedDecrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
if ( ref == 0 )
{
if(This->input)
@@ -104,7 +91,7 @@ static ULONG WINAPI xmlparser_Release(IXMLParser* iface)
if(This->nodefactory)
IXMLNodeFactory_Release(This->nodefactory);
heap_free( This );
free(This);
}
return ref;
@@ -240,9 +227,7 @@ static HRESULT WINAPI xmlparser_SetURL(IXMLParser *iface,const WCHAR *pszBaseUrl
static HRESULT WINAPI xmlparser_Load(IXMLParser *iface, BOOL bFullyAvailable,
IMoniker *pMon, LPBC pBC, DWORD dwMode)
{
xmlparser *This = impl_from_IXMLParser( iface );
FIXME("(%p %d %p %p %d)\n", This, bFullyAvailable, pMon, pBC, dwMode);
FIXME("%p, %d, %p, %p, %ld.\n", iface, bFullyAvailable, pMon, pBC, dwMode);
return E_NOTIMPL;
}
@@ -268,9 +253,7 @@ static HRESULT WINAPI xmlparser_SetInput(IXMLParser *iface, IUnknown *pStm)
static HRESULT WINAPI xmlparser_PushData(IXMLParser *iface, const char *pData,
ULONG nChars, BOOL fLastBuffer)
{
xmlparser *This = impl_from_IXMLParser( iface );
FIXME("(%p %s %d %d)\n", This, debugstr_a(pData), nChars, fLastBuffer);
FIXME("%p, %s, %lu, %d.\n", iface, debugstr_a(pData), nChars, fLastBuffer);
return E_NOTIMPL;
}
@@ -298,9 +281,7 @@ static HRESULT WINAPI xmlparser_LoadEntity(IXMLParser *iface, const WCHAR *baseU
static HRESULT WINAPI xmlparser_ParseEntity(IXMLParser *iface, const WCHAR *text,
ULONG len, BOOL fpe)
{
xmlparser *This = impl_from_IXMLParser( iface );
FIXME("(%p %s %d %d)\n", This, debugstr_w(text), len, fpe);
FIXME("%p, %s, %lu, %d.\n", iface, debugstr_w(text), len, fpe);
return E_NOTIMPL;
}
@@ -308,9 +289,7 @@ static HRESULT WINAPI xmlparser_ParseEntity(IXMLParser *iface, const WCHAR *text
static HRESULT WINAPI xmlparser_ExpandEntity(IXMLParser *iface, const WCHAR *text,
ULONG len)
{
xmlparser *This = impl_from_IXMLParser( iface );
FIXME("(%p %s %d)\n", This, debugstr_w(text), len);
FIXME("%p, %s, %ld.\n", iface, debugstr_w(text), len);
return E_NOTIMPL;
}
@@ -335,9 +314,7 @@ static HRESULT WINAPI xmlparser_GetRoot( IXMLParser *iface, PVOID *ppRoot)
static HRESULT WINAPI xmlparser_Run(IXMLParser *iface, LONG chars)
{
xmlparser *This = impl_from_IXMLParser( iface );
FIXME("(%p %d)\n", This, chars);
FIXME("%p, %ld.\n", iface, chars);
return E_NOTIMPL;
}
@@ -373,7 +350,7 @@ static HRESULT WINAPI xmlparser_SetFlags(IXMLParser *iface, ULONG flags)
{
xmlparser *This = impl_from_IXMLParser( iface );
TRACE("(%p %d)\n", This, flags);
TRACE("%p, %lx.\n", iface, flags);
This->flags = flags;
@@ -440,7 +417,7 @@ HRESULT XMLParser_create(void **ppObj)
TRACE("(%p)\n", ppObj);
This = heap_alloc( sizeof(xmlparser) );
This = malloc(sizeof(xmlparser));
if(!This)
return E_OUTOFMEMORY;
+50 -87
View File
@@ -16,17 +16,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#define COBJMACROS
#define NONAMELESSUNION
#ifdef HAVE_LIBXML2
#include <libxml/parser.h>
#endif
#include "windef.h"
#include "winbase.h"
#include "ole2.h"
@@ -41,9 +33,7 @@
#include "wine/debug.h"
#include "msxml_private.h"
#ifdef HAVE_LIBXML2
#include "msxml_dispex.h"
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
@@ -111,9 +101,9 @@ static HRESULT WINAPI XMLView_Binding_QueryInterface(
static ULONG WINAPI XMLView_Binding_AddRef(IBinding *iface)
{
Binding *This = impl_from_IBinding(iface);
LONG ref = InterlockedIncrement(&This->ref);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -123,11 +113,11 @@ static ULONG WINAPI XMLView_Binding_Release(IBinding *iface)
Binding *This = impl_from_IBinding(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
if(!ref) {
IBinding_Release(This->binding);
heap_free(This);
free(This);
}
return ref;
}
@@ -158,7 +148,7 @@ static HRESULT WINAPI XMLView_Binding_SetPriority(
IBinding *iface, LONG nPriority)
{
Binding *This = impl_from_IBinding(iface);
TRACE("(%p)->(%d)\n", This, nPriority);
TRACE("%p, %ld.\n", iface, nPriority);
return IBinding_SetPriority(This->binding, nPriority);
}
@@ -198,7 +188,7 @@ static inline HRESULT XMLView_Binding_Create(IBinding *binding, IBinding **ret)
{
Binding *bind;
bind = heap_alloc_zero(sizeof(Binding));
bind = calloc(1, sizeof(Binding));
if(!bind)
return E_OUTOFMEMORY;
@@ -240,9 +230,9 @@ static ULONG WINAPI XMLView_BindStatusCallback_AddRef(
IBindStatusCallback *iface)
{
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
LONG ref = InterlockedIncrement(&This->ref);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -253,14 +243,14 @@ static ULONG WINAPI XMLView_BindStatusCallback_Release(
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
if(!ref) {
if(This->stream)
IStream_Release(This->stream);
IBindStatusCallback_Release(This->bsc);
IMoniker_Release(This->mon);
heap_free(This);
free(This);
}
return ref;
}
@@ -272,7 +262,7 @@ static HRESULT WINAPI XMLView_BindStatusCallback_OnStartBinding(
IBinding *binding;
HRESULT hres;
TRACE("(%p)->(%x %p)\n", This, dwReserved, pib);
TRACE("%p, %lx, %p.\n", iface, dwReserved, pib);
hres = XMLView_Binding_Create(pib, &binding);
if(FAILED(hres)) {
@@ -301,8 +291,7 @@ static HRESULT WINAPI XMLView_BindStatusCallback_GetPriority(
static HRESULT WINAPI XMLView_BindStatusCallback_OnLowResource(
IBindStatusCallback *iface, DWORD reserved)
{
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
FIXME("(%p)->(%x)\n", This, reserved);
FIXME("%p, %lx.\n", iface, reserved);
return E_NOTIMPL;
}
@@ -311,7 +300,7 @@ static HRESULT WINAPI XMLView_BindStatusCallback_OnProgress(
ULONG ulStatusCode, LPCWSTR szStatusText)
{
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
TRACE("(%p)->(%d %d %x %s)\n", This, ulProgress, ulProgressMax,
TRACE("%p, %lu, %lu, %lu, %s.\n", iface, ulProgress, ulProgressMax,
ulStatusCode, debugstr_w(szStatusText));
switch(ulStatusCode) {
@@ -321,7 +310,7 @@ static HRESULT WINAPI XMLView_BindStatusCallback_OnProgress(
case BINDSTATUS_MIMETYPEAVAILABLE:
return S_OK;
default:
FIXME("ulStatusCode: %d\n", ulStatusCode);
FIXME("ulStatusCode: %lu\n", ulStatusCode);
return E_NOTIMPL;
}
}
@@ -330,7 +319,7 @@ static HRESULT WINAPI XMLView_BindStatusCallback_OnStopBinding(
IBindStatusCallback *iface, HRESULT hresult, LPCWSTR szError)
{
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
TRACE("(%p)->(%x %s)\n", This, hresult, debugstr_w(szError));
TRACE("%p, %#lx, %s.\n", iface, hresult, debugstr_w(szError));
return IBindStatusCallback_OnStopBinding(This->bsc, hresult, szError);
}
@@ -360,7 +349,7 @@ static inline HRESULT report_data(BindStatusCallback *This)
return hres;
stgmedium.tymed = TYMED_ISTREAM;
stgmedium.u.pstm = This->stream;
stgmedium.pstm = This->stream;
stgmedium.pUnkForRelease = NULL;
hres = IBindStatusCallback_OnDataAvailable(This->bsc,
@@ -402,7 +391,7 @@ static inline HRESULT handle_xml_load(BindStatusCallback *This)
if(FAILED(hres))
return display_error_page(This);
hres = DOMDocument_create(MSXML_DEFAULT, (void**)&xml);
hres = dom_document_create(MSXML_DEFAULT, (void **)&xml);
if(FAILED(hres))
return display_error_page(This);
@@ -436,12 +425,12 @@ static inline HRESULT handle_xml_load(BindStatusCallback *This)
}
/* TODO: fix parsing processing instruction value */
if((p = strstrW(V_BSTR(&var), hrefW))) {
if((p = wcsstr(V_BSTR(&var), hrefW))) {
p += ARRAY_SIZE(hrefW) - 1;
if(*p!='\'' && *p!='\"') p = NULL;
else {
href = p+1;
p = strchrW(href, *p);
p = wcschr(href, *p);
}
}
if(p) {
@@ -478,7 +467,7 @@ static inline HRESULT handle_xml_load(BindStatusCallback *This)
return display_error_page(This);
}
hres = DOMDocument_create(MSXML_DEFAULT, (void**)&xsl);
hres = dom_document_create(MSXML_DEFAULT, (void **)&xsl);
if(FAILED(hres)) {
VariantClear(&var);
IXMLDOMDocument3_Release(xml);
@@ -524,13 +513,13 @@ static HRESULT WINAPI XMLView_BindStatusCallback_OnDataAvailable(
DWORD size;
HRESULT hres;
TRACE("(%p)->(%x %d %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed);
TRACE("%p, %lx, %ld, %p, %p.\n", iface, grfBSCF, dwSize, pformatetc, pstgmed);
if(!This->stream)
return E_FAIL;
do {
hres = IStream_Read(pstgmed->u.pstm, buf, sizeof(buf), &size);
hres = IStream_Read(pstgmed->pstm, buf, sizeof(buf), &size);
IStream_Write(This->stream, buf, size, &size);
} while(hres==S_OK && size);
@@ -569,7 +558,7 @@ static inline HRESULT XMLView_BindStatusCallback_Create(IBindStatusCallback *bsc
{
BindStatusCallback *bsc;
bsc = heap_alloc_zero(sizeof(BindStatusCallback));
bsc = calloc(1, sizeof(BindStatusCallback));
if(!bsc)
return E_OUTOFMEMORY;
@@ -615,7 +604,7 @@ static ULONG WINAPI XMLView_Moniker_AddRef(IMoniker *iface)
Moniker *This = impl_from_IMoniker(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -625,11 +614,11 @@ static ULONG WINAPI XMLView_Moniker_Release(IMoniker *iface)
Moniker *This = impl_from_IMoniker(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
if(!ref) {
IMoniker_Release(This->mon);
heap_free(This);
free(This);
}
return ref;
}
@@ -702,8 +691,7 @@ static HRESULT WINAPI XMLView_Moniker_BindToStorage(IMoniker *iface, IBindCtx *p
static HRESULT WINAPI XMLView_Moniker_Reduce(IMoniker *iface, IBindCtx *pbc,
DWORD dwReduceHowFar, IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
{
Moniker *This = impl_from_IMoniker(iface);
FIXME("(%p)->(%p %d %p %p)\n", This, pbc, dwReduceHowFar, ppmkToLeft, ppmkReduced);
FIXME("%p, %p, %ld, %p, %p.\n", iface, pbc, dwReduceHowFar, ppmkToLeft, ppmkReduced);
return E_NOTIMPL;
}
@@ -834,7 +822,7 @@ static inline HRESULT XMLView_Moniker_Create(IMoniker *mon,
{
Moniker *wrap;
wrap = heap_alloc_zero(sizeof(Moniker));
wrap = calloc(1, sizeof(Moniker));
if(!wrap)
return E_OUTOFMEMORY;
@@ -881,9 +869,9 @@ static HRESULT WINAPI XMLView_PersistMoniker_QueryInterface(
static ULONG WINAPI XMLView_PersistMoniker_AddRef(IPersistMoniker *iface)
{
XMLView *This = impl_from_IPersistMoniker(iface);
LONG ref = InterlockedIncrement(&This->ref);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
return ref;
}
@@ -893,13 +881,13 @@ static ULONG WINAPI XMLView_PersistMoniker_Release(IPersistMoniker *iface)
XMLView *This = impl_from_IPersistMoniker(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("%p, refcount %lu.\n", iface, ref);
if(!ref) {
if(This->mon)
IMoniker_Release(This->mon);
IUnknown_Release(This->html_doc);
heap_free(This);
free(This);
}
return ref;
}
@@ -937,7 +925,7 @@ static HRESULT WINAPI XMLView_PersistMoniker_Load(IPersistMoniker *iface,
IUnknown *unk;
HRESULT hres;
TRACE("(%p)->(%x %p %p %x)\n", This, fFullyAvailable, pimkName, pibc, grfMode);
TRACE("%p, %x, %p, %p, %lx.\n", iface, fFullyAvailable, pimkName, pibc, grfMode);
hres = IBindCtx_GetObjectParam(pibc, (LPOLESTR)XSLParametersW, &unk);
if(SUCCEEDED(hres)) {
@@ -1136,8 +1124,7 @@ static HRESULT WINAPI XMLView_PersistHistory_SaveHistory(
static HRESULT WINAPI XMLView_PersistHistory_SetPositionCookie(
IPersistHistory *iface, DWORD dwPositioncookie)
{
XMLView *This = impl_from_IPersistHistory(iface);
FIXME("(%p)->(%d)\n", This, dwPositioncookie);
FIXME("%p, %ld.\n", iface, dwPositioncookie);
return E_NOTIMPL;
}
@@ -1187,8 +1174,7 @@ static ULONG WINAPI XMLView_OleCommandTarget_Release(IOleCommandTarget *iface)
static HRESULT WINAPI XMLView_OleCommandTarget_QueryStatus(IOleCommandTarget *iface,
const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
{
XMLView *This = impl_from_IOleCommandTarget(iface);
FIXME("(%p)->(%p %x %p %p)\n", This, pguidCmdGroup, cCmds, prgCmds, pCmdText);
FIXME("%p, %p, %lu, %p, %p.\n", iface, pguidCmdGroup, cCmds, prgCmds, pCmdText);
return E_NOTIMPL;
}
@@ -1196,8 +1182,7 @@ static HRESULT WINAPI XMLView_OleCommandTarget_Exec(IOleCommandTarget *iface,
const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt,
VARIANT *pvaIn, VARIANT *pvaOut)
{
XMLView *This = impl_from_IOleCommandTarget(iface);
FIXME("(%p)->(%p %d %x %p %p)\n", This, pguidCmdGroup,
FIXME("%p, %p, %ld, %lx, %p, %p.\n", iface, pguidCmdGroup,
nCmdID, nCmdexecopt, pvaIn, pvaOut);
return E_NOTIMPL;
}
@@ -1260,40 +1245,35 @@ static HRESULT WINAPI XMLView_OleObject_SetHostNames(IOleObject *iface,
static HRESULT WINAPI XMLView_OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
{
XMLView *This = impl_from_IOleObject(iface);
FIXME("(%p)->(%x)\n", This, dwSaveOption);
FIXME("%p, %lx.\n", iface, dwSaveOption);
return E_NOTIMPL;
}
static HRESULT WINAPI XMLView_OleObject_SetMoniker(IOleObject *iface,
DWORD dwWhichMoniker, IMoniker *pmk)
{
XMLView *This = impl_from_IOleObject(iface);
FIXME("(%p)->(%x %p)\n", This, dwWhichMoniker, pmk);
FIXME("%p, %lx, %p.\n", iface, dwWhichMoniker, pmk);
return E_NOTIMPL;
}
static HRESULT WINAPI XMLView_OleObject_GetMoniker(IOleObject *iface,
DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
{
XMLView *This = impl_from_IOleObject(iface);
FIXME("(%p)->(%x %x %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
FIXME("%p, %lx, %lx, %p.\n", iface, dwAssign, dwWhichMoniker, ppmk);
return E_NOTIMPL;
}
static HRESULT WINAPI XMLView_OleObject_InitFromData(IOleObject *iface,
IDataObject *pDataObject, BOOL fCreation, DWORD dwReserved)
{
XMLView *This = impl_from_IOleObject(iface);
FIXME("(%p)->(%p %x %x)\n", This, pDataObject, fCreation, dwReserved);
FIXME("%p, %p, %x, %lx.\n", iface, pDataObject, fCreation, dwReserved);
return E_NOTIMPL;
}
static HRESULT WINAPI XMLView_OleObject_GetClipboardData(IOleObject *iface,
DWORD dwReserved, IDataObject **ppDataObject)
{
XMLView *This = impl_from_IOleObject(iface);
FIXME("(%p)->(%x %p)\n", This, dwReserved, ppDataObject);
FIXME("%p, %lx, %p.\n", iface, dwReserved, ppDataObject);
return E_NOTIMPL;
}
@@ -1301,8 +1281,7 @@ static HRESULT WINAPI XMLView_OleObject_DoVerb(IOleObject *iface,
LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite,
LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
{
XMLView *This = impl_from_IOleObject(iface);
FIXME("(%p)->(%d %p %p %d %p %p)\n", This, iVerb, lpmsg,
FIXME("%p, %ld, %p, %p, %ld, %p, %p.\n", iface, iVerb, lpmsg,
pActiveSite, lindex, hwndParent, lprcPosRect);
return E_NOTIMPL;
}
@@ -1339,24 +1318,21 @@ static HRESULT WINAPI XMLView_OleObject_GetUserClassID(IOleObject *iface, CLSID
static HRESULT WINAPI XMLView_OleObject_GetUserType(IOleObject *iface,
DWORD dwFormOfType, LPOLESTR *pszUserType)
{
XMLView *This = impl_from_IOleObject(iface);
FIXME("(%p)->(%x %p)\n", This, dwFormOfType, pszUserType);
FIXME("%p, %lx, %p.\n", iface, dwFormOfType, pszUserType);
return E_NOTIMPL;
}
static HRESULT WINAPI XMLView_OleObject_SetExtent(IOleObject *iface,
DWORD dwDrawAspect, SIZEL *psizel)
{
XMLView *This = impl_from_IOleObject(iface);
FIXME("(%p)->(%x %p)\n", This, dwDrawAspect, psizel);
FIXME("%p, %lx, %p.\n", iface, dwDrawAspect, psizel);
return E_NOTIMPL;
}
static HRESULT WINAPI XMLView_OleObject_GetExtent(IOleObject *iface,
DWORD dwDrawAspect, SIZEL *psizel)
{
XMLView *This = impl_from_IOleObject(iface);
FIXME("(%p)->(%x %p)\n", This, dwDrawAspect, psizel);
FIXME("%p, %lx, %p.\n", iface, dwDrawAspect, psizel);
return E_NOTIMPL;
}
@@ -1371,8 +1347,7 @@ static HRESULT WINAPI XMLView_OleObject_Advise(IOleObject *iface,
static HRESULT WINAPI XMLView_OleObject_Unadvise(
IOleObject *iface, DWORD dwConnection)
{
XMLView *This = impl_from_IOleObject(iface);
FIXME("(%p)->(%d)\n", This, dwConnection);
FIXME("%p, %ld.\n", iface, dwConnection);
return E_NOTIMPL;
}
@@ -1387,8 +1362,7 @@ static HRESULT WINAPI XMLView_OleObject_EnumAdvise(
static HRESULT WINAPI XMLView_OleObject_GetMiscStatus(
IOleObject *iface, DWORD dwAspect, DWORD *pdwStatus)
{
XMLView *This = impl_from_IOleObject(iface);
FIXME("(%p)->(%d %p)\n", This, dwAspect, pdwStatus);
FIXME("%p, %ld, %p.\n", iface, dwAspect, pdwStatus);
return E_NOTIMPL;
}
@@ -1434,7 +1408,7 @@ HRESULT XMLView_create(void **ppObj)
TRACE("(%p)\n", ppObj);
This = heap_alloc_zero(sizeof(*This));
This = calloc(1, sizeof(*This));
if(!This)
return E_OUTOFMEMORY;
@@ -1447,21 +1421,10 @@ HRESULT XMLView_create(void **ppObj)
hres = CoCreateInstance(&CLSID_HTMLDocument, (IUnknown*)&This->IPersistMoniker_iface,
CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&This->html_doc);
if(FAILED(hres)) {
heap_free(This);
free(This);
return hres;
}
*ppObj = &This->IPersistMoniker_iface;
return S_OK;
}
#else
HRESULT XMLView_create(void **ppObj)
{
MESSAGE("This program tried to use a XMLView object, but\n"
"libxml2 support was not present at compile time.\n");
return E_NOTIMPL;
}
#endif /* HAVE_LIBXML2 */
+7 -14
View File
@@ -21,14 +21,7 @@
#ifndef __XSLPATTERN__
#define __XSLPATTERN__
#ifndef __WINE_CONFIG_H
#error You must include config.h to use this header
#endif
#ifndef HAVE_LIBXML2
#error You must have libxml2 to use this header
#endif
#include <stdlib.h>
#include <libxml/tree.h>
#include <libxml/xmlstring.h>
#include <libxml/xpath.h>
@@ -46,14 +39,14 @@ typedef struct _parser_param {
int err;
} parser_param;
#define YYSTYPE xmlChar*
#define XSLPATTERN_STYPE xmlChar*
#define YY_EXTRA_TYPE parser_param*
int xslpattern_lex(xmlChar**, void*) DECLSPEC_HIDDEN;
int xslpattern_lex_init(void**) DECLSPEC_HIDDEN;
int xslpattern_lex_destroy(void*) DECLSPEC_HIDDEN;
void xslpattern_set_extra(parser_param*, void*) DECLSPEC_HIDDEN;
int xslpattern_parse(parser_param*, void*) DECLSPEC_HIDDEN;
int xslpattern_lex(xmlChar**, void*);
int xslpattern_lex_init(void**);
int xslpattern_lex_destroy(void*);
void xslpattern_set_extra(parser_param*, void*);
int xslpattern_parse(parser_param*, void*);
#endif /* __XSLPATTERN__ */
+2 -8
View File
@@ -19,11 +19,6 @@
*/
%{
#include "config.h"
#include "wine/port.h"
#ifdef HAVE_LIBXML2
#include "xslpattern.h"
#include "xslpattern.tab.h"
#include "wine/debug.h"
@@ -31,6 +26,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
#define SCAN xslpattern_get_extra(yyscanner)
#define YYSTYPE XSLPATTERN_STYPE
#define YY_INPUT(tok_buf, tok_len, max) \
do { \
@@ -152,7 +148,7 @@ ANY (.)
%%
xmlChar* XSLPattern_to_XPath(xmlXPathContextPtr, xmlChar const*) DECLSPEC_HIDDEN;
xmlChar* XSLPattern_to_XPath(xmlXPathContextPtr, xmlChar const*);
xmlChar* XSLPattern_to_XPath(xmlXPathContextPtr ctxt, xmlChar const* xslpat_str)
{
parser_param p;
@@ -181,5 +177,3 @@ xmlChar* XSLPattern_to_XPath(xmlXPathContextPtr ctxt, xmlChar const* xslpat_str)
}
}
#endif /* HAVE_LIBXML2 */
+8 -8
View File
@@ -19,16 +19,15 @@
*/
%{
#include "config.h"
#include "wine/port.h"
#ifdef HAVE_LIBXML2
#include "xslpattern.h"
#include <libxml/xpathInternals.h>
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
#ifdef __REACTOS__
#define YYSTYPE XSLPATTERN_STYPE
#endif
static const xmlChar NameTest_mod_pre[] = "*[name()='";
static const xmlChar NameTest_mod_post[] = "']";
@@ -44,6 +43,7 @@ static inline BOOL is_literal(xmlChar const* tok)
static void xslpattern_error(parser_param* param, void const* scanner, char const* msg)
{
param->err++;
FIXME("%s:\n"
" param {\n"
" yyscanner=%p\n"
@@ -56,7 +56,7 @@ static void xslpattern_error(parser_param* param, void const* scanner, char cons
" }\n"
" scanner=%p\n",
msg, param->yyscanner, param->ctx, param->in, param->pos,
param->len, param->out, ++param->err, scanner);
param->len, param->out, param->err, scanner);
}
%}
@@ -70,7 +70,8 @@ static void xslpattern_error(parser_param* param, void const* scanner, char cons
%start XSLPattern
%pure-parser
//%define api.prefix {xslpattern_} // __REACTOS__
%define api.pure
%parse-param {parser_param* p}
%parse-param {void* scanner}
%lex-param {yyscan_t* scanner}
@@ -86,6 +87,7 @@ static void xslpattern_error(parser_param* param, void const* scanner, char cons
XSLPattern : Expr
{
p->out = $1;
(void)xslpattern_nerrs; /* avoid unused variable warning */
}
;
@@ -750,5 +752,3 @@ static void xslpattern_error(parser_param* param, void const* scanner, char cons
;
%%
#endif /* HAVE_LIBXML2 */
+4 -10
View File
@@ -134,16 +134,10 @@ dll/win32/msvcrt20 # Out of sync
dll/win32/msvcrt40 # Out of sync
dll/win32/msvfw32 # Synced to WineStaging-4.18
dll/win32/msvidc32 # Synced to WineStaging-4.0
dll/win32/msxml # Synced to WineStaging-3.3
dll/win32/msxml2 # Synced to WineStaging-3.3
dll/win32/msxml3/domdoc # Synced to WineStaging-4.18
dll/win32/msxml3/httpreq # Synced to WineStaging-4.18
dll/win32/msxml3/saxreader # Synced to WineStaging-4.18
dll/win32/msxml3/schema # Synced to Wine-6.14
dll/win32/msxml3/xmldoc # Synced to WineStaging-4.18
dll/win32/msxml3/xmlparser # Synced to WineStaging-4.18
dll/win32/msxml3/xmlview # Synced to WineStaging-4.18
dll/win32/msxml4 # Synced to WineStaging-3.3
dll/win32/msxml # Synced to Wine-10.0
dll/win32/msxml2 # Synced to Wine-10.0
dll/win32/msxml3 # Synced to Wine-10.0
dll/win32/msxml4 # Synced to Wine-10.0
dll/win32/msxml6 # Synced to WineStaging-3.3
dll/win32/nddeapi # Synced to WineStaging-3.3
dll/win32/netapi32 # Forked at Wine-1.3.34
+55 -50
View File
@@ -31,6 +31,10 @@ import "oaidl.idl";
#define vi_progid(str)
#endif
cpp_quote("#ifdef __ISAXXMLReader_INTERFACE_DEFINED__")
cpp_quote("#undef __MSXML2_LIBRARY_DEFINED__")
cpp_quote("#endif")
[
uuid(f5078f18-c551-11d3-89b9-0000f81fe221),
version(3.0),
@@ -75,8 +79,8 @@ interface ISAXEntityResolver;
interface ISAXErrorHandler;
interface ISAXLexicalHandler;
interface ISAXLocator;
interface ISAXXMLReader;
interface ISAXXMLFilter;
interface ISAXXMLReader;
interface IVBSAXAttributes;
interface IVBSAXContentHandler;
@@ -133,6 +137,8 @@ typedef enum tagDOMNodeType
} DOMNodeType;
cpp_quote("#endif")
cpp_quote("#ifndef __msxml_som_enums__")
cpp_quote("#define __msxml_som_enums__")
typedef enum _SOMITEMTYPE
{
SOMITEM_SCHEMA = 0x1000,
@@ -260,6 +266,7 @@ typedef enum _SCHEMATYPEVARIETY
SCHEMATYPEVARIETY_LIST = 1,
SCHEMATYPEVARIETY_UNION = 2,
} SCHEMATYPEVARIETY;
cpp_quote("#endif /* __msxml_som_enums__ */")
[
local,
@@ -684,7 +691,7 @@ interface IXMLDOMSchemaCollection2 : IXMLDOMSchemaCollection
HRESULT getDeclaration(
[in] IXMLDOMNode* node,
[out,retval]ISchemaItem** item);
};
}
[
local,
@@ -1258,7 +1265,7 @@ interface IXSLProcessor : IDispatch
[id(DISPID_XMLDOM_PROCESSOR_SETSTARTMODE)]
HRESULT setStartMode(
[in] BSTR p,
[in] BSTR uri);
[in, defaultvalue("")] BSTR uri);
[propget, id(DISPID_XMLDOM_PROCESSOR_STARTMODE)]
HRESULT startMode([retval, out] BSTR *p);
@@ -1286,11 +1293,7 @@ interface IXSLProcessor : IDispatch
HRESULT addParameter(
[in] BSTR p,
[in] VARIANT var,
#ifndef __REACTOS__
[in, defaultvalue(L"")] BSTR uri);
#else
[in] BSTR uri);
#endif
[in, defaultvalue("")] BSTR uri);
[id(DISPID_XMLDOM_PROCESSOR_ADDOBJECT)]
HRESULT addObject(
@@ -1373,7 +1376,7 @@ interface IXMLHTTPRequest : IDispatch
[propput, id(14)]
HRESULT onreadystatechange([in] IDispatch *pReadyStateSink);
};
}
[
object,
@@ -1747,6 +1750,7 @@ coclass XMLSchemaCache40
[default] interface IXMLDOMSchemaCollection2;
}
#ifdef __REACTOS__
[
uuid(88d96a07-f192-11d4-a65f-0040963251e5)
]
@@ -1754,6 +1758,7 @@ coclass XMLSchemaCache60
{
[default] interface IXMLDOMSchemaCollection2;
}
#endif
[
helpstring("XML Schema Cache"),
@@ -1901,7 +1906,7 @@ interface ISAXAttributes : IUnknown
[in] int nQName,
[out] const WCHAR ** pValue,
[out] int * nValue);
};
}
[
object,
@@ -1961,7 +1966,7 @@ interface ISAXContentHandler : IUnknown
HRESULT skippedEntity(
[in] const WCHAR * pName,
[in] int nName);
};
}
[
object,
@@ -2001,7 +2006,7 @@ interface ISAXDeclHandler : IUnknown
[in] int nPublicId,
[in] const WCHAR * pSystemId,
[in] int nSystemId);
};
}
[
object,
@@ -2027,7 +2032,7 @@ interface ISAXDTDHandler : IUnknown
[in] int nSystemId,
[in] const WCHAR * pNotationName,
[in] int nNotationName);
};
}
[
object,
@@ -2040,7 +2045,7 @@ interface ISAXEntityResolver : IUnknown
[in] const WCHAR * pPublicId,
[in] const WCHAR * pSystemId,
[out, retval] VARIANT * ret);
};
}
[
object,
@@ -2063,7 +2068,7 @@ interface ISAXErrorHandler : IUnknown
[in] ISAXLocator * pLocator,
[in] const WCHAR * pErrorMessage,
[in] HRESULT hrErrorCode);
};
}
[
object,
@@ -2097,7 +2102,7 @@ interface ISAXLexicalHandler : IUnknown
HRESULT comment(
[in] const WCHAR * pChars,
[in] int nChars);
};
}
[
object,
@@ -2117,12 +2122,12 @@ interface ISAXLocator : IUnknown
HRESULT getSystemId(
[out, retval] const WCHAR ** systemId);
};
}
[
local,
object,
uuid (a4f96ed0-f829-476e-81c0-cdc7bd2a0802)
local,
object,
uuid(a4f96ed0-f829-476e-81c0-cdc7bd2a0802)
]
interface ISAXXMLReader : IUnknown
{
@@ -2174,7 +2179,7 @@ interface ISAXXMLReader : IUnknown
[in] VARIANT varInput);
HRESULT parseURL(
[in] const WCHAR * url);
};
}
[
local,
@@ -2187,7 +2192,7 @@ interface ISAXXMLFilter : ISAXXMLReader
[out, retval] ISAXXMLReader ** pReader);
HRESULT putParent(
[in] ISAXXMLReader * reader);
};
}
[
object,
@@ -2236,7 +2241,7 @@ interface IVBSAXAttributes : IDispatch
[id(DISPID_SAX_ATTRIBUTES_GETVALUEFROMQNAME)]
HRESULT getValueFromQName( [in] BSTR QName, [out, retval] BSTR * value);
};
}
[
object,
@@ -2283,7 +2288,7 @@ interface IVBSAXContentHandler : IDispatch
[id(DISPID_SAX_CONTENTHANDLER_SKIPPEDENTITY)]
HRESULT skippedEntity( [in, out] BSTR * name);
};
}
[
object,
@@ -2316,7 +2321,7 @@ interface IVBSAXDeclHandler : IDispatch
[in, out] BSTR * name,
[in, out] BSTR * publicId,
[in, out] BSTR * systemId);
};
}
[
object,
@@ -2338,7 +2343,7 @@ interface IVBSAXDTDHandler : IDispatch
[in, out] BSTR * publicId,
[in, out] BSTR * systemId,
[in, out] BSTR * notationName);
};
}
[
object,
@@ -2353,7 +2358,7 @@ interface IVBSAXEntityResolver : IDispatch
[in, out] BSTR * publicId,
[in, out] BSTR * systemId,
[out, retval] VARIANT * ret);
};
}
[
object,
@@ -2380,7 +2385,7 @@ interface IVBSAXErrorHandler : IDispatch
[in] IVBSAXLocator * locator,
[in, out] BSTR * errorMessage,
[in] LONG errorCode);
};
}
[
object,
@@ -2410,7 +2415,7 @@ interface IVBSAXLexicalHandler : IDispatch
[id(DISPID_SAX_LEXICALHANDLER_COMMENT)]
HRESULT comment( [in, out] BSTR * chars);
};
}
[
object,
@@ -2431,7 +2436,7 @@ interface IVBSAXLocator : IDispatch
[propget, id(DISPID_SAX_LOCATOR_SYSTEMID)]
HRESULT systemId( [out, retval] BSTR * systemId);
};
}
[
object,
@@ -2446,7 +2451,7 @@ interface IVBSAXXMLFilter : IDispatch
[propputref, id(DISPID_SAX_XMLFILTER_PARENT)]
HRESULT parent( [in] IVBSAXXMLReader * reader);
};
}
[
dual,
@@ -2562,7 +2567,7 @@ interface IMXAttributes : IDispatch
[id(DISPID_MX_ATTRIBUTES_SETVALUE)]
HRESULT setValue([in] int index, [in] BSTR value);
};
}
[
local,
@@ -2593,7 +2598,7 @@ interface IMXReaderControl : IDispatch
[id(DISPID_MX_READER_CONTROL_SUSPEND)]
HRESULT suspend();
};
}
[
object,
@@ -2645,7 +2650,7 @@ interface IMXWriter : IDispatch
[id(DISPID_MX_WRITER_FLUSH)]
HRESULT flush();
};
}
[
local,
@@ -2841,7 +2846,7 @@ interface ISchemaStringCollection : IDispatch
[id(DISPID_NEWENUM), hidden, restricted, propget]
HRESULT _newEnum(
[out,retval] IUnknown** ppunk);
};
}
[
local,
@@ -2875,7 +2880,7 @@ interface ISchemaItemCollection : IDispatch
[id(DISPID_NEWENUM), hidden, restricted, propget]
HRESULT _newEnum(
[out,retval]IUnknown** ppunk);
};
}
[
local,
@@ -2914,7 +2919,7 @@ interface ISchemaItem : IDispatch
HRESULT writeAnnotation(
[in] IUnknown* annotationSink,
[out,retval] VARIANT_BOOL* isWritten);
};
}
[
local,
@@ -2960,7 +2965,7 @@ interface ISchema : ISchemaItem
[id(DISPID_SOM_SCHEMALOCATIONS), propget]
HRESULT schemaLocations(
[out,retval] ISchemaStringCollection** schemaLocations);
};
}
[
local,
@@ -2978,7 +2983,7 @@ interface ISchemaParticle : ISchemaItem
[id(DISPID_SOM_MAXOCCURS), propget]
HRESULT maxOccurs(
[out,retval] VARIANT* maxOccurs);
};
}
[
object,
@@ -3011,7 +3016,7 @@ interface ISchemaAttribute : ISchemaItem
[id(DISPID_SOM_ISREFERENCE), propget]
HRESULT isReference(
[out,retval] VARIANT_BOOL* reference);
};
}
[
local,
@@ -3065,7 +3070,7 @@ interface ISchemaElement : ISchemaParticle
[id(DISPID_SOM_ISREFERENCE), propget]
HRESULT isReference(
[out,retval] VARIANT_BOOL* reference);
};
}
[
local,
@@ -3144,7 +3149,7 @@ interface ISchemaType : ISchemaItem
[id(DISPID_SOM_PATTERNS), propget]
HRESULT patterns(
[out,retval] ISchemaStringCollection** patterns);
};
}
[
local,
@@ -3178,7 +3183,7 @@ interface ISchemaComplexType : ISchemaType
[id(DISPID_SOM_PROHIBITED), propget]
HRESULT prohibitedSubstitutions(
[out,retval] SCHEMADERIVATIONMETHOD* prohibited);
};
}
[
local,
@@ -3196,7 +3201,7 @@ interface ISchemaAttributeGroup : ISchemaItem
[id(DISPID_SOM_ATTRIBUTES), propget]
HRESULT attributes(
[out,retval] ISchemaItemCollection** attributes);
};
}
[
local,
@@ -3210,7 +3215,7 @@ interface ISchemaModelGroup : ISchemaParticle
[id(DISPID_SOM_PARTICLES), propget]
HRESULT particles(
[out,retval] ISchemaItemCollection** particles);
};
}
[
local,
@@ -3228,7 +3233,7 @@ interface ISchemaAny : ISchemaParticle
[id(DISPID_SOM_PROCESSCONTENTS), propget]
HRESULT processContents(
[out,retval] SCHEMAPROCESSCONTENTS* processContents);
};
}
[
local,
@@ -3250,7 +3255,7 @@ interface ISchemaIdentityConstraint : ISchemaItem
[id(DISPID_SOM_REFERENCEDKEY), propget]
HRESULT referencedKey(
[out,retval] ISchemaIdentityConstraint** key);
};
}
[
local,
@@ -3268,7 +3273,7 @@ interface ISchemaNotation : ISchemaItem
[id(DISPID_SOM_PUBLICIDENTIFIER), propget]
HRESULT publicIdentifier(
[out,retval] BSTR* uri);
};
}
[
@@ -3283,7 +3288,7 @@ coclass SAXXMLReader30
[default] interface IVBSAXXMLReader;
interface ISAXXMLReader;
interface IMXReaderControl;
};
}
[
uuid(7c6e29bc-8b8b-4c3d-859e-af6cd158be0f)
@@ -3419,7 +3424,7 @@ coclass MXXMLWriter30
interface IVBSAXDTDHandler;
interface IVBSAXErrorHandler;
interface IVBSAXLexicalHandler;
};
}
[
uuid(88d969c8-f192-11d4-a65f-0040963251e5),
File diff suppressed because it is too large Load Diff