[XMLLITE]

* Sync with Wine 1.7.17.
CORE-8080

svn path=/trunk/; revision=62868
This commit is contained in:
Amine Khaldi 2014-04-22 11:25:12 +00:00
parent 7188e0d7c6
commit 83e4c1e179
7 changed files with 487 additions and 279 deletions

View file

@ -14,5 +14,7 @@
/* reader.c */
DEFINE_GUID(IID_IXmlReaderInput, 0x0b3ccc9b, 0x9214, 0x428b, 0xa2, 0xae, 0xef, 0x3a, 0xa8, 0x71, 0xaf, 0xda);
/* writer.c */
DEFINE_GUID(IID_IXmlWriterOutput, 0xc1131708, 0x0f59, 0x477f, 0x93, 0x59, 0x7d, 0x33, 0x24, 0x51, 0xbc, 0x1a);
/* NO CODE HERE, THIS IS JUST REQUIRED FOR THE GUID DEFINITIONS */

File diff suppressed because it is too large Load diff

View file

@ -20,6 +20,18 @@
#include "xmllite_private.h"
/* not defined in public headers */
DEFINE_GUID(IID_IXmlWriterOutput, 0xc1131708, 0x0f59, 0x477f, 0x93, 0x59, 0x7d, 0x33, 0x24, 0x51, 0xbc, 0x1a);
typedef struct
{
IXmlWriterOutput IXmlWriterOutput_iface;
LONG ref;
IUnknown *output;
IMalloc *imalloc;
xml_encoding encoding;
} xmlwriteroutput;
typedef struct _xmlwriter
{
IXmlWriter IXmlWriter_iface;
@ -31,6 +43,22 @@ static inline xmlwriter *impl_from_IXmlWriter(IXmlWriter *iface)
return CONTAINING_RECORD(iface, xmlwriter, IXmlWriter_iface);
}
static inline xmlwriteroutput *impl_from_IXmlWriterOutput(IXmlWriterOutput *iface)
{
return CONTAINING_RECORD(iface, xmlwriteroutput, IXmlWriterOutput_iface);
}
/* reader input memory allocation functions */
static inline void *writeroutput_alloc(xmlwriteroutput *output, size_t len)
{
return m_alloc(output->imalloc, len);
}
static inline void writeroutput_free(xmlwriteroutput *output, void *mem)
{
m_free(output->imalloc, mem);
}
static HRESULT WINAPI xmlwriter_QueryInterface(IXmlWriter *iface, REFIID riid, void **ppvObject)
{
xmlwriter *This = impl_from_IXmlWriter(iface);
@ -64,9 +92,7 @@ static ULONG WINAPI xmlwriter_Release(IXmlWriter *iface)
ref = InterlockedDecrement(&This->ref);
if (ref == 0)
{
HeapFree(GetProcessHeap(), 0, This);
}
heap_free(This);
return ref;
}
@ -376,6 +402,63 @@ static const struct IXmlWriterVtbl xmlwriter_vtbl =
xmlwriter_Flush
};
/** IXmlWriterOutput **/
static HRESULT WINAPI xmlwriteroutput_QueryInterface(IXmlWriterOutput *iface, REFIID riid, void** ppvObject)
{
xmlwriteroutput *This = impl_from_IXmlWriterOutput(iface);
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
if (IsEqualGUID(riid, &IID_IXmlWriterOutput) ||
IsEqualGUID(riid, &IID_IUnknown))
{
*ppvObject = iface;
}
else
{
WARN("interface %s not implemented\n", debugstr_guid(riid));
*ppvObject = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef(iface);
return S_OK;
}
static ULONG WINAPI xmlwriteroutput_AddRef(IXmlWriterOutput *iface)
{
xmlwriteroutput *This = impl_from_IXmlWriterOutput(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
return ref;
}
static ULONG WINAPI xmlwriteroutput_Release(IXmlWriterOutput *iface)
{
xmlwriteroutput *This = impl_from_IXmlWriterOutput(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
if (ref == 0)
{
IMalloc *imalloc = This->imalloc;
if (This->output) IUnknown_Release(This->output);
writeroutput_free(This, This);
if (imalloc) IMalloc_Release(imalloc);
}
return ref;
}
static const struct IUnknownVtbl xmlwriteroutputvtbl =
{
xmlwriteroutput_QueryInterface,
xmlwriteroutput_AddRef,
xmlwriteroutput_Release
};
HRESULT WINAPI CreateXmlWriter(REFIID riid, void **pObject, IMalloc *pMalloc)
{
xmlwriter *writer;
@ -390,7 +473,7 @@ HRESULT WINAPI CreateXmlWriter(REFIID riid, void **pObject, IMalloc *pMalloc)
return E_FAIL;
}
writer = HeapAlloc(GetProcessHeap(), 0, sizeof (*writer));
writer = heap_alloc(sizeof(*writer));
if(!writer) return E_OUTOFMEMORY;
writer->IXmlWriter_iface.lpVtbl = &xmlwriter_vtbl;
@ -402,3 +485,35 @@ HRESULT WINAPI CreateXmlWriter(REFIID riid, void **pObject, IMalloc *pMalloc)
return S_OK;
}
HRESULT WINAPI CreateXmlWriterOutputWithEncodingName(IUnknown *stream,
IMalloc *imalloc,
LPCWSTR encoding,
IXmlWriterOutput **output)
{
xmlwriteroutput *writeroutput;
TRACE("%p %p %s %p\n", stream, imalloc, debugstr_w(encoding), output);
if (!stream || !output) return E_INVALIDARG;
if (imalloc)
writeroutput = IMalloc_Alloc(imalloc, sizeof(*writeroutput));
else
writeroutput = heap_alloc(sizeof(*writeroutput));
if(!writeroutput) return E_OUTOFMEMORY;
writeroutput->IXmlWriterOutput_iface.lpVtbl = &xmlwriteroutputvtbl;
writeroutput->ref = 1;
writeroutput->imalloc = imalloc;
if (imalloc) IMalloc_AddRef(imalloc);
writeroutput->encoding = parse_encoding_name(encoding, -1);
IUnknown_QueryInterface(stream, &IID_IUnknown, (void**)&writeroutput->output);
*output = &writeroutput->IXmlWriterOutput_iface;
TRACE("returning iface %p\n", *output);
return S_OK;
}

View file

@ -3,4 +3,4 @@
@ stdcall CreateXmlReaderInputWithEncodingName(ptr ptr ptr long ptr ptr)
@ stdcall CreateXmlWriter(ptr ptr ptr)
@ stub CreateXmlWriterOutputWithEncodingCodePage
@ stub CreateXmlWriterOutputWithEncodingName
@ stdcall CreateXmlWriterOutputWithEncodingName(ptr ptr wstr ptr)

View file

@ -55,4 +55,29 @@ static inline BOOL heap_free(void *mem)
return HeapFree(GetProcessHeap(), 0, mem);
}
static inline void *m_alloc(IMalloc *imalloc, size_t len)
{
if (imalloc)
return IMalloc_Alloc(imalloc, len);
else
return heap_alloc(len);
}
static inline void m_free(IMalloc *imalloc, void *mem)
{
if (imalloc)
IMalloc_Free(imalloc, mem);
else
heap_free(mem);
}
typedef enum
{
XmlEncoding_UTF16,
XmlEncoding_UTF8,
XmlEncoding_Unknown
} xml_encoding;
xml_encoding parse_encoding_name(const WCHAR *name, int len) DECLSPEC_HIDDEN;
#endif /* __XMLLITE_PRIVATE__ */

View file

@ -78,6 +78,21 @@ interface IXmlReader : IUnknown
BOOL IsEOF(void);
}
/* IXmlResolver */
[
local,
object,
uuid(7279fc82-709d-4095-b63d-69fe4b0d9030),
pointer_default(unique)
]
interface IXmlResolver : IUnknown
{
HRESULT ResolveUri([in] LPCWSTR base_uri,
[in] LPCWSTR public_id,
[in] LPCWSTR system_id,
[out] IUnknown **input);
}
/* IXmlReader state */
typedef enum XmlReadState
{
@ -278,3 +293,10 @@ interface IXmlWriter : IUnknown
HRESULT WriteWhitespace([in] LPCWSTR pwszWhitespace);
HRESULT Flush();
}
/* IXmlWriter construction */
cpp_quote("STDAPI CreateXmlWriter(REFIID riid, void **ppvObject, IMalloc *pMalloc);")
cpp_quote("typedef IUnknown IXmlWriterOutput;")
cpp_quote("STDAPI CreateXmlWriterOutputWithEncodingName(IUnknown *stream, IMalloc *pMalloc,")
cpp_quote(" LPCWSTR encoding, IXmlWriterOutput **output);")

View file

@ -220,7 +220,7 @@ reactos/dll/win32/xinput1_1 # Synced to Wine-1.7.1
reactos/dll/win32/xinput1_2 # Synced to Wine-1.7.1
reactos/dll/win32/xinput1_3 # Synced to Wine-1.7.1
reactos/dll/win32/xinput9_1_0 # Synced to Wine-1.7.1
reactos/dll/win32/xmllite # Synced to Wine-1.7.1
reactos/dll/win32/xmllite # Synced to Wine-1.7.17
reactos/dll/cpl/inetcpl # Synced to Wine-1.7.1