return xml_encoding_map[encoding].name;
}
+xml_encoding get_encoding_from_codepage(UINT codepage)
+{
+ int i;
+ for (i = 0; i < sizeof(xml_encoding_map)/sizeof(xml_encoding_map[0]); i++)
+ {
+ if (xml_encoding_map[i].cp == codepage) return xml_encoding_map[i].enc;
+ }
+ return XmlEncoding_Unknown;
+}
+
typedef struct
{
char *data;
static BOOL WINAPI xmlreader_IsEOF(IXmlReader* iface)
{
FIXME("(%p): stub\n", iface);
- return E_NOTIMPL;
+ return FALSE;
}
static const struct IXmlReaderVtbl xmlreader_vtbl =
return S_OK;
}
-HRESULT WINAPI CreateXmlWriterOutputWithEncodingName(IUnknown *stream,
- IMalloc *imalloc,
- LPCWSTR encoding,
- IXmlWriterOutput **output)
+static HRESULT create_writer(IUnknown *stream, IMalloc *imalloc, xml_encoding encoding,
+ IXmlWriterOutput **output)
{
- static const WCHAR utf8W[] = {'U','T','F','-','8',0};
xmlwriteroutput *writeroutput;
HRESULT hr;
- TRACE("%p %p %s %p\n", stream, imalloc, debugstr_w(encoding), output);
-
- if (!stream || !output) return E_INVALIDARG;
-
*output = NULL;
if (imalloc)
writeroutput->ref = 1;
writeroutput->imalloc = imalloc;
if (imalloc) IMalloc_AddRef(imalloc);
- writeroutput->encoding = parse_encoding_name(encoding ? encoding : utf8W, -1);
+ writeroutput->encoding = encoding;
writeroutput->stream = NULL;
hr = init_output_buffer(writeroutput);
if (FAILED(hr)) {
return S_OK;
}
+
+HRESULT WINAPI CreateXmlWriterOutputWithEncodingName(IUnknown *stream,
+ IMalloc *imalloc,
+ LPCWSTR encoding,
+ IXmlWriterOutput **output)
+{
+ static const WCHAR utf8W[] = {'U','T','F','-','8',0};
+ xml_encoding xml_enc;
+
+ TRACE("%p %p %s %p\n", stream, imalloc, debugstr_w(encoding), output);
+
+ if (!stream || !output) return E_INVALIDARG;
+
+ xml_enc = parse_encoding_name(encoding ? encoding : utf8W, -1);
+ return create_writer(stream, imalloc, xml_enc, output);
+}
+
+HRESULT WINAPI CreateXmlWriterOutputWithEncodingCodePage(IUnknown *stream,
+ IMalloc *imalloc,
+ UINT codepage,
+ IXmlWriterOutput **output)
+{
+ xml_encoding xml_enc;
+
+ TRACE("%p %p %u %p\n", stream, imalloc, codepage, output);
+
+ if (!stream || !output) return E_INVALIDARG;
+
+ xml_enc = get_encoding_from_codepage(codepage);
+ return create_writer(stream, imalloc, xml_enc, output);
+}