Commit f2403bf7 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

xmllite/reader: Implement CreateXmlReaderInputWithEncodingCodePage().

parent 9afc2094
......@@ -3663,19 +3663,12 @@ HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
return hr;
}
HRESULT WINAPI CreateXmlReaderInputWithEncodingName(IUnknown *stream,
IMalloc *imalloc,
LPCWSTR encoding,
BOOL hint,
LPCWSTR base_uri,
IXmlReaderInput **ppInput)
static HRESULT create_reader_input(IUnknown *stream, IMalloc *imalloc, xml_encoding encoding,
BOOL hint, const WCHAR *base_uri, IXmlReaderInput **ppInput)
{
xmlreaderinput *readerinput;
HRESULT hr;
TRACE("%p %p %s %d %s %p\n", stream, imalloc, wine_dbgstr_w(encoding),
hint, wine_dbgstr_w(base_uri), ppInput);
if (!stream || !ppInput) return E_INVALIDARG;
if (!(readerinput = m_alloc(imalloc, sizeof(*readerinput))))
......@@ -3686,7 +3679,7 @@ HRESULT WINAPI CreateXmlReaderInputWithEncodingName(IUnknown *stream,
readerinput->ref = 1;
readerinput->imalloc = imalloc;
if (imalloc) IMalloc_AddRef(imalloc);
readerinput->encoding = parse_encoding_name(encoding, -1);
readerinput->encoding = encoding;
readerinput->hint = hint;
readerinput->baseuri = readerinput_strdupW(readerinput, base_uri);
......@@ -3706,3 +3699,26 @@ HRESULT WINAPI CreateXmlReaderInputWithEncodingName(IUnknown *stream,
return S_OK;
}
/***********************************************************************
* CreateXmlReaderInputWithEncodingName (xmllite.@)
*/
HRESULT WINAPI CreateXmlReaderInputWithEncodingName(IUnknown *stream, IMalloc *imalloc,
const WCHAR *encoding, BOOL hint, const WCHAR *base_uri, IXmlReaderInput **input)
{
TRACE("%p, %p, %s, %d, %s, %p.\n", stream, imalloc, wine_dbgstr_w(encoding),
hint, wine_dbgstr_w(base_uri), input);
return create_reader_input(stream, imalloc, parse_encoding_name(encoding, -1), hint, base_uri, input);
}
/***********************************************************************
* CreateXmlReaderInputWithEncodingCodePage (xmllite.@)
*/
HRESULT WINAPI CreateXmlReaderInputWithEncodingCodePage(IUnknown *stream, IMalloc *imalloc,
UINT codepage, BOOL hint, const WCHAR *base_uri, IXmlReaderInput **input)
{
TRACE("%p, %p, %u, %d, %s, %p.\n", stream, imalloc, codepage, hint, wine_dbgstr_w(base_uri), input);
return create_reader_input(stream, imalloc, get_encoding_from_codepage(codepage), hint, base_uri, input);
}
......@@ -766,6 +766,12 @@ static void test_readerinput(void)
IXmlReader_Release(reader);
IUnknown_Release(reader_input);
/* Using codepage */
hr = CreateXmlReaderInputWithEncodingCodePage(input, NULL, 1200, FALSE, NULL, &reader_input);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IUnknown_Release(reader_input);
IUnknown_Release(input);
}
......
@ stdcall CreateXmlReader(ptr ptr ptr)
@ stub CreateXmlReaderInputWithEncodingCodePage
@ stdcall CreateXmlReaderInputWithEncodingCodePage(ptr ptr long long wstr ptr)
@ stdcall CreateXmlReaderInputWithEncodingName(ptr ptr wstr long wstr ptr)
@ stdcall CreateXmlWriter(ptr ptr ptr)
@ stdcall CreateXmlWriterOutputWithEncodingCodePage(ptr ptr long ptr)
......
......@@ -228,6 +228,8 @@ typedef enum XmlError
cpp_quote("STDAPI CreateXmlReader(REFIID riid, void **ppvObject, IMalloc *pMalloc);")
cpp_quote("typedef IUnknown IXmlReaderInput;")
cpp_quote("STDAPI CreateXmlReaderInputWithEncodingCodePage(IUnknown *stream, IMalloc *pMalloc,")
cpp_quote(" UINT encoding_codepage, BOOL hint, const WCHAR *base_uri, IXmlReaderInput **pInput);")
cpp_quote("STDAPI CreateXmlReaderInputWithEncodingName(IUnknown *stream, IMalloc *pMalloc,")
cpp_quote(" LPCWSTR encoding, BOOL hint,")
cpp_quote(" LPCWSTR base_uri, IXmlReaderInput **ppInput);")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment