1
0
mirror of https://github.com/wine-mirror/wine synced 2024-06-29 06:14:34 +00:00

xmllite/reader: Implement CreateXmlReaderInputWithEncodingCodePage().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52953
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2022-05-03 14:40:31 +03:00 committed by Alexandre Julliard
parent 9afc20949a
commit f2403bf783
4 changed files with 35 additions and 11 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -1,5 +1,5 @@
@ 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)

View File

@ -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);")