43DEFINE_GUID(IID_IXmlWriterOutput, 0xc1131708, 0x0f59, 0x477f, 0x93, 0x59, 0x7d, 0x33, 0x24, 0x51, 0xbc, 0x1a);
49static const WCHAR xmlnsuriW[] = {
'h',
't',
't',
'p',
':',
'/',
'/',
'w',
'w',
'w',
'.',
'w',
'3',
'.',
'o',
'r',
'g',
'/',
'2',
'0',
'0',
'0',
'/',
'x',
'm',
'l',
'n',
's',
'/',0};
134 static const char *
const prop_names[] =
139 "OmitXmlDeclaration",
146 return prop_names[prop];
193 static const WCHAR colonW[] = {
':',0};
369 unsigned int len = 1;
392 unsigned int len = 0;
414 const int initial_len = 0x2000;
419 WARN(
"Failed to get code page for specified encoding.\n");
425 buffer->allocated = initial_len;
450 buffer->allocated = grown_size;
463 if (
buffer->codepage == 1200) {
511 assert(prefix_len >= 0 && local_len >= 0);
516 if (prefix_len && local_len)
526 if (writeroutput->
stream) {
527 ISequentialStream_Release(writeroutput->
stream);
537 hr = IUnknown_QueryInterface(writeroutput->
output, &IID_IStream, (
void**)&writeroutput->
stream);
539 hr = IUnknown_QueryInterface(writeroutput->
output, &IID_ISequentialStream, (
void**)&writeroutput->
stream);
550 if (!output || !output->
stream)
560 WARN(
"write to stream failed (0x%08x)\n",
hr);
567 }
while (
buffer->written > 0);
577 static const char utf16bom[] = {0xff, 0xfe};
602 static const WCHAR versionW[] = {
'<',
'?',
'x',
'm',
'l',
' ',
'v',
'e',
'r',
's',
'i',
'o',
'n',
'=',
'"',
'1',
'.',
'0',
'"'};
603 static const WCHAR encodingW[] = {
' ',
'e',
'n',
'c',
'o',
'd',
'i',
'n',
'g',
'='};
620 static const WCHAR standaloneW[] = {
' ',
's',
't',
'a',
'n',
'd',
'a',
'l',
'o',
'n',
'e',
'=',
'\"'};
621 static const WCHAR yesW[] = {
'y',
'e',
's',
'\"',
'?',
'>'};
622 static const WCHAR noW[] = {
'n',
'o',
'\"',
'?',
'>'};
674 static const WCHAR dblspaceW[] = {
' ',
' '};
688 while (indent_level--)
712 IXmlWriter_AddRef(iface);
736 if (
This->output) IUnknown_Release(&
This->output->IXmlWriterOutput_iface);
741 if (imalloc) IMalloc_Release(imalloc);
758 IUnknown_Release(&
This->output->IXmlWriterOutput_iface);
760 This->bomwritten = 0;
762 This->indent_level = 0;
773 hr = IUnknown_QueryInterface(output, &IID_IXmlWriterOutput, (
void**)&writeroutput);
778 ERR(
"got external IXmlWriterOutput implementation: %p, vtbl=%p\n",
779 writeroutput, writeroutput->lpVtbl);
780 IUnknown_Release(writeroutput);
785 if (
hr !=
S_OK || !writeroutput) {
855 BOOL fWriteDefaultAttributes)
859 FIXME(
"%p %p %d\n",
This, pReader, fWriteDefaultAttributes);
875 static const WCHAR preserveW[] = {
'p',
'r',
'e',
's',
'e',
'r',
'v',
'e',0};
876 static const WCHAR defaultW[] = {
'd',
'e',
'f',
'a',
'u',
'l',
't',0};
887 static const WCHAR spaceattrW[] = {
's',
'p',
'a',
'c',
'e',0};
888 static const WCHAR xmlnsW[] = {
'x',
'm',
'l',
'n',
's',0};
889 static const WCHAR xmlW[] = {
'x',
'm',
'l',0};
891 BOOL is_xmlns_prefix, is_xmlns_local;
978 FIXME(
"Prefix autogeneration is not implemented.\n");
995 static const WCHAR cdataopenW[] = {
'<',
'!',
'[',
'C',
'D',
'A',
'T',
'A',
'['};
996 static const WCHAR cdatacloseW[] = {
']',
']',
'>'};
1010 switch (
This->state)
1033 static const WCHAR cdatacloseW[] = {
']',
']',
'>',0};
1054 static const WCHAR fmtW[] = {
'&',
'#',
'x',
'%',
'x',
';',0};
1060 switch (
This->state)
1087 switch (
This->state)
1105 static const WCHAR copenW[] = {
'<',
'!',
'-',
'-'};
1106 static const WCHAR ccloseW[] = {
'-',
'-',
'>'};
1111 switch (
This->state)
1134 for (
i = 0;
i <
len;
i++) {
1154 static const WCHAR doctypeW[] = {
'<',
'!',
'D',
'O',
'C',
'T',
'Y',
'P',
'E',
' '};
1155 static const WCHAR publicW[] = {
' ',
'P',
'U',
'B',
'L',
'I',
'C',
' '};
1156 static const WCHAR systemW[] = {
' ',
'S',
'Y',
'S',
'T',
'E',
'M',
' '};
1158 unsigned int name_len, pubid_len;
1164 switch (
This->state)
1227 switch (
This->state)
1303 switch (
This->state)
1318 while (IXmlWriter_WriteEndElement(iface) ==
S_OK)
1332 switch (
This->state)
1352 if (
This->starttagopen)
1356 This->starttagopen = 0;
1377 switch (
This->state)
1399 switch (
This->state)
1447 switch (
This->state)
1470 switch (
This->state)
1488 BOOL fWriteDefaultAttributes)
1492 FIXME(
"%p %p %d\n",
This, pReader, fWriteDefaultAttributes);
1498 BOOL fWriteDefaultAttributes)
1502 FIXME(
"%p %p %d\n",
This, pReader, fWriteDefaultAttributes);
1511 static const WCHAR xmlW[] = {
'x',
'm',
'l',0};
1512 static const WCHAR openpiW[] = {
'<',
'?'};
1516 switch (
This->state)
1554 switch (
This->state)
1578 switch (
This->state)
1605 switch (
This->state)
1624 TRACE(
"(%p)->(%d)\n",
This, standalone);
1626 switch (
This->state)
1648 int prefix_len, local_len;
1658 switch (
This->state)
1699 This->starttagopen = 1;
1718 static const WCHAR ampW[] = {
'&',
'a',
'm',
'p',
';'};
1719 static const WCHAR ltW[] = {
'&',
'l',
't',
';'};
1720 static const WCHAR gtW[] = {
'&',
'g',
't',
';'};
1752 switch (
This->state)
1778 FIXME(
"%p %d %d\n",
This, wchLow, wchHigh);
1856 IUnknown_AddRef(iface);
1879 if (
This->output) IUnknown_Release(
This->output);
1880 if (
This->stream) ISequentialStream_Release(
This->stream);
1884 if (imalloc) IMalloc_Release(imalloc);
1905 writer = IMalloc_Alloc(imalloc,
sizeof(*writer));
1911 memset(writer, 0,
sizeof(*writer));
1916 if (imalloc) IMalloc_AddRef(imalloc);
1925 TRACE(
"returning iface %p, hr %#x\n", *
obj,
hr);
1939 writeroutput = IMalloc_Alloc(imalloc,
sizeof(*writeroutput));
1941 writeroutput =
heap_alloc(
sizeof(*writeroutput));
1946 writeroutput->
ref = 1;
1947 writeroutput->
imalloc = imalloc;
1949 IMalloc_AddRef(imalloc);
1958 if (encoding_name) {
1969 *
out = writeroutput;
1971 TRACE(
"Created writer output %p\n", *
out);
static void * heap_alloc(size_t len)
#define InterlockedIncrement
#define InterlockedDecrement
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static void list_remove(struct list_entry *entry)
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
static void list_add_head(struct list_entry *head, struct list_entry *entry)
static void list_init(struct list_entry *head)
const char * wine_dbg_sprintf(const char *format,...)
#define WideCharToMultiByte
static const WCHAR utf16bom
static const WCHAR versionW[]
BOOL is_namechar(WCHAR ch)
BOOL is_namestartchar(WCHAR ch)
const WCHAR * get_encoding_name(xml_encoding encoding)
xml_encoding get_encoding_from_codepage(UINT codepage)
BOOL is_pubchar(WCHAR ch)
BOOL is_ncnamechar(WCHAR ch)
static HRESULT WINAPI xmlwriter_SetOutput(IXmlWriter *iface, IUnknown *output)
static HRESULT WINAPI xmlwriter_WriteElementString(IXmlWriter *iface, LPCWSTR prefix, LPCWSTR local_name, LPCWSTR uri, LPCWSTR value)
static HRESULT write_xmldecl(xmlwriter *writer, XmlStandalone standalone)
static const WCHAR closeelementW[]
static BOOL is_empty_string(const WCHAR *str)
static HRESULT WINAPI xmlwriter_WriteDocType(IXmlWriter *iface, LPCWSTR name, LPCWSTR pubid, LPCWSTR sysid, LPCWSTR subset)
static HRESULT WINAPI xmlwriter_WriteRaw(IXmlWriter *iface, LPCWSTR data)
static HRESULT WINAPI xmlwriter_WriteProcessingInstruction(IXmlWriter *iface, LPCWSTR name, LPCWSTR text)
static HRESULT WINAPI xmlwriter_WriteRawChars(IXmlWriter *iface, const WCHAR *pwch, UINT cwch)
static HRESULT WINAPI xmlwriter_WriteCData(IXmlWriter *iface, LPCWSTR data)
HRESULT WINAPI CreateXmlWriter(REFIID riid, void **obj, IMalloc *imalloc)
static ULONG WINAPI xmlwriter_AddRef(IXmlWriter *iface)
static struct element * alloc_element(xmlwriter *writer, const WCHAR *prefix, const WCHAR *local)
static ULONG WINAPI xmlwriteroutput_Release(IXmlWriterOutput *iface)
struct _xmlwriter xmlwriter
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
static HRESULT WINAPI xmlwriter_WriteEndDocument(IXmlWriter *iface)
static void write_output_attribute(xmlwriter *writer, const WCHAR *prefix, int prefix_len, const WCHAR *local, int local_len, const WCHAR *value)
static WCHAR * writer_strndupW(const xmlwriter *writer, const WCHAR *str, int len)
static HRESULT WINAPI xmlwriter_WriteSurrogateCharEntity(IXmlWriter *iface, WCHAR wchLow, WCHAR wchHigh)
static HRESULT WINAPI xmlwriter_WriteAttributes(IXmlWriter *iface, IXmlReader *pReader, BOOL fWriteDefaultAttributes)
static HRESULT WINAPI xmlwriter_WriteCharEntity(IXmlWriter *iface, WCHAR ch)
static HRESULT grow_output_buffer(xmlwriteroutput *output, int length)
static struct ns * writer_find_ns_current(const xmlwriter *writer, const WCHAR *prefix, const WCHAR *uri)
static HRESULT is_valid_ncname(const WCHAR *str, int *out)
static HRESULT write_encoding_bom(xmlwriter *writer)
static struct element * pop_element(xmlwriter *writer)
static BOOL is_valid_xml_space_value(const WCHAR *value)
static HRESULT WINAPI xmlwriter_WriteQualifiedName(IXmlWriter *iface, LPCWSTR pwszLocalName, LPCWSTR pwszNamespaceUri)
static HRESULT writeroutput_query_for_stream(xmlwriteroutput *writeroutput)
static HRESULT WINAPI xmlwriter_WriteWhitespace(IXmlWriter *iface, LPCWSTR pwszWhitespace)
static HRESULT is_valid_name(const WCHAR *str, unsigned int *out)
static HRESULT WINAPI xmlwriter_WriteString(IXmlWriter *iface, const WCHAR *string)
static HRESULT write_output_buffer_char(xmlwriteroutput *output, WCHAR ch)
static HRESULT WINAPI xmlwriter_WriteEntityRef(IXmlWriter *iface, LPCWSTR pwszName)
static HRESULT WINAPI xmlwriter_WriteAttributeString(IXmlWriter *iface, LPCWSTR prefix, LPCWSTR local, LPCWSTR uri, LPCWSTR value)
static const WCHAR xmlnsW[]
static const WCHAR * get_output_encoding_name(xmlwriteroutput *output)
static struct ns * writer_find_ns(const xmlwriter *writer, const WCHAR *prefix, const WCHAR *uri)
static HRESULT create_writer_output(IUnknown *stream, IMalloc *imalloc, xml_encoding encoding, const WCHAR *encoding_name, xmlwriteroutput **out)
static const struct IXmlWriterVtbl xmlwriter_vtbl
static HRESULT WINAPI xmlwriter_WriteStartElement(IXmlWriter *iface, LPCWSTR prefix, LPCWSTR local_name, LPCWSTR uri)
static HRESULT WINAPI xmlwriter_GetProperty(IXmlWriter *iface, UINT property, LONG_PTR *value)
static const WCHAR xmlnsuriW[]
static HRESULT writer_close_starttag(xmlwriter *writer)
static void free_output_buffer(xmlwriteroutput *output)
static HRESULT WINAPI xmlwriter_WriteChars(IXmlWriter *iface, const WCHAR *pwch, UINT cwch)
static void * writeroutput_alloc(xmlwriteroutput *output, size_t len)
static void writeroutput_free(xmlwriteroutput *output, void *mem)
static HRESULT WINAPI xmlwriter_WriteNodeShallow(IXmlWriter *iface, IXmlReader *pReader, BOOL fWriteDefaultAttributes)
static HRESULT write_output_qname(xmlwriteroutput *output, const WCHAR *prefix, int prefix_len, const WCHAR *local_name, int local_len)
static void write_cdata_section(xmlwriteroutput *output, const WCHAR *data, int len)
HRESULT WINAPI CreateXmlWriterOutputWithEncodingCodePage(IUnknown *stream, IMalloc *imalloc, UINT codepage, IXmlWriterOutput **out)
static void write_escaped_string(xmlwriter *writer, const WCHAR *string)
static HRESULT write_output_buffer_quoted(xmlwriteroutput *output, const WCHAR *data, int len)
static const char * debugstr_writer_prop(XmlWriterProperty prop)
static HRESULT writeroutput_flush_stream(xmlwriteroutput *output)
static HRESULT is_valid_pubid(const WCHAR *str, unsigned int *out)
static void writer_push_element(xmlwriter *writer, struct element *element)
static void writeroutput_release_stream(xmlwriteroutput *writeroutput)
static ULONG WINAPI xmlwriter_Release(IXmlWriter *iface)
static HRESULT WINAPI xmlwriter_WriteNmToken(IXmlWriter *iface, LPCWSTR pwszNmToken)
static HRESULT WINAPI xmlwriter_Flush(IXmlWriter *iface)
static HRESULT WINAPI xmlwriter_WriteNode(IXmlWriter *iface, IXmlReader *pReader, BOOL fWriteDefaultAttributes)
@ XmlWriterState_InvalidEncoding
@ XmlWriterState_DocStarted
@ XmlWriterState_ElemStarted
@ XmlWriterState_DocClosed
@ XmlWriterState_PIDocStarted
static void writer_inc_indent(xmlwriter *writer)
static struct ns * writer_push_ns(xmlwriter *writer, const WCHAR *prefix, int prefix_len, const WCHAR *uri)
static void write_node_indent(xmlwriter *writer)
static HRESULT WINAPI xmlwriter_WriteStartDocument(IXmlWriter *iface, XmlStandalone standalone)
static HRESULT WINAPI xmlwriter_WriteName(IXmlWriter *iface, LPCWSTR pwszName)
static const WCHAR closepiW[]
static void writer_free_element_stack(xmlwriter *writer)
static void writer_free_element(xmlwriter *writer, struct element *element)
static const WCHAR closetagW[]
static HRESULT WINAPI xmlwriter_WriteFullEndElement(IXmlWriter *iface)
static const struct IUnknownVtbl xmlwriteroutputvtbl
static void * writer_alloc(const xmlwriter *writer, size_t len)
static xmlwriteroutput * impl_from_IXmlWriterOutput(IXmlWriterOutput *iface)
static void writer_output_ns(xmlwriter *writer, struct element *element)
static ULONG WINAPI xmlwriteroutput_AddRef(IXmlWriterOutput *iface)
static HRESULT WINAPI xmlwriteroutput_QueryInterface(IXmlWriterOutput *iface, REFIID riid, void **ppvObject)
static void * writeroutput_realloc(xmlwriteroutput *output, void *mem, size_t len)
static HRESULT WINAPI xmlwriter_WriteEndElement(IXmlWriter *iface)
static void writer_dec_indent(xmlwriter *writer)
static HRESULT WINAPI xmlwriter_WriteComment(IXmlWriter *iface, LPCWSTR comment)
HRESULT WINAPI CreateXmlWriterOutputWithEncodingName(IUnknown *stream, IMalloc *imalloc, const WCHAR *encoding, IXmlWriterOutput **out)
static HRESULT WINAPI xmlwriter_SetProperty(IXmlWriter *iface, UINT property, LONG_PTR value)
static void writer_free(const xmlwriter *writer, void *mem)
static HRESULT WINAPI xmlwriter_QueryInterface(IXmlWriter *iface, REFIID riid, void **ppvObject)
static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, int len)
static WCHAR * writer_strdupW(const xmlwriter *writer, const WCHAR *str)
static BSTR local_name(call_frame_t *frame, int ref)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLuint GLsizei GLsizei * length
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
static const WCHAR yesW[]
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
#define memcpy(s1, s2, n)
#define comment(fmt, arg1)
static const WCHAR xmlW[]
static const WCHAR crlfW[]
static HRESULT get_code_page(xml_encoding encoding, UINT *cp)
static xml_encoding parse_encoding_name(const WCHAR *encoding)
static const WCHAR publicW[]
static const WCHAR systemW[]
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
#define IsEqualGUID(rguid1, rguid2)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
static __inline const char * wine_dbgstr_guid(const GUID *id)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
unsigned int indent_level
IXmlWriter IXmlWriter_iface
XmlConformanceLevel conformance
IXmlWriterOutput IXmlWriterOutput_iface
struct output_buffer buffer
ISequentialStream * stream
#define CONTAINING_RECORD(address, type, field)
static const WCHAR defaultW[]
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
@ WR_E_XMLPREFIXDECLARATION
@ WR_E_XMLNSURIDECLARATION
@ WR_E_XMLNSPREFIXDECLARATION
@ WR_E_NSPREFIXWITHEMPTYNSURI
@ XmlWriterProperty_ConformanceLevel
@ XmlWriterProperty_OmitXmlDeclaration
@ XmlWriterProperty_ByteOrderMark
@ XmlWriterProperty_Indent
@ _XmlWriterProperty_Last
@ XmlConformanceLevel_Document
static void * m_alloc(IMalloc *imalloc, size_t len)
static void m_free(IMalloc *imalloc, void *mem)
static void * m_realloc(IMalloc *imalloc, void *mem, size_t len)