ReactOS  0.4.14-dev-337-gf981a68
writer.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "xmllite.h"
#include "xmllite_private.h"
#include "initguid.h"
#include "wine/debug.h"
#include "wine/list.h"
#include "wine/unicode.h"
Include dependency graph for writer.c:

Go to the source code of this file.

Classes

struct  output_buffer
 
struct  xmlwriteroutput
 
struct  element
 
struct  _xmlwriter
 

Macros

#define COBJMACROS
 

Typedefs

typedef struct _xmlwriter xmlwriter
 

Enumerations

enum  XmlWriterState {
  XmlWriterState_Initial, XmlWriterState_Ready, XmlWriterState_InvalidEncoding, XmlWriterState_PIDocStarted,
  XmlWriterState_DocStarted, XmlWriterState_ElemStarted, XmlWriterState_Content, XmlWriterState_DocClosed
}
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (xmllite)
 
 DEFINE_GUID (IID_IXmlWriterOutput, 0xc1131708, 0x0f59, 0x477f, 0x93, 0x59, 0x7d, 0x33, 0x24, 0x51, 0xbc, 0x1a)
 
static xmlwriterimpl_from_IXmlWriter (IXmlWriter *iface)
 
static xmlwriteroutputimpl_from_IXmlWriterOutput (IXmlWriterOutput *iface)
 
static const chardebugstr_writer_prop (XmlWriterProperty prop)
 
static voidwriteroutput_alloc (xmlwriteroutput *output, size_t len)
 
static void writeroutput_free (xmlwriteroutput *output, void *mem)
 
static voidwriteroutput_realloc (xmlwriteroutput *output, void *mem, size_t len)
 
static voidwriter_alloc (xmlwriter *writer, size_t len)
 
static void writer_free (xmlwriter *writer, void *mem)
 
static struct elementalloc_element (xmlwriter *writer, const WCHAR *prefix, const WCHAR *local)
 
static void free_element (xmlwriter *writer, struct element *element)
 
static void push_element (xmlwriter *writer, struct element *element)
 
static struct elementpop_element (xmlwriter *writer)
 
static HRESULT init_output_buffer (xmlwriteroutput *output)
 
static void free_output_buffer (xmlwriteroutput *output)
 
static HRESULT grow_output_buffer (xmlwriteroutput *output, int length)
 
static HRESULT write_output_buffer (xmlwriteroutput *output, const WCHAR *data, int len)
 
static HRESULT write_output_buffer_quoted (xmlwriteroutput *output, const WCHAR *data, int len)
 
static HRESULT write_output_qname (xmlwriteroutput *output, const WCHAR *prefix, const WCHAR *local_name)
 
static void writeroutput_release_stream (xmlwriteroutput *writeroutput)
 
static HRESULT writeroutput_query_for_stream (xmlwriteroutput *writeroutput)
 
static HRESULT writeroutput_flush_stream (xmlwriteroutput *output)
 
static HRESULT write_encoding_bom (xmlwriter *writer)
 
static const WCHARget_output_encoding_name (xmlwriteroutput *output)
 
static HRESULT write_xmldecl (xmlwriter *writer, XmlStandalone standalone)
 
static HRESULT writer_close_starttag (xmlwriter *writer)
 
static void writer_inc_indent (xmlwriter *writer)
 
static void writer_dec_indent (xmlwriter *writer)
 
static void write_node_indent (xmlwriter *writer)
 
static HRESULT WINAPI xmlwriter_QueryInterface (IXmlWriter *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI xmlwriter_AddRef (IXmlWriter *iface)
 
static ULONG WINAPI xmlwriter_Release (IXmlWriter *iface)
 
static HRESULT WINAPI xmlwriter_SetOutput (IXmlWriter *iface, IUnknown *output)
 
static HRESULT WINAPI xmlwriter_GetProperty (IXmlWriter *iface, UINT property, LONG_PTR *value)
 
static HRESULT WINAPI xmlwriter_SetProperty (IXmlWriter *iface, UINT property, LONG_PTR value)
 
static HRESULT WINAPI xmlwriter_WriteAttributes (IXmlWriter *iface, IXmlReader *pReader, BOOL fWriteDefaultAttributes)
 
static HRESULT WINAPI xmlwriter_WriteAttributeString (IXmlWriter *iface, LPCWSTR ns_prefix, LPCWSTR local_name, LPCWSTR ns_uri, LPCWSTR value)
 
static void write_cdata_section (xmlwriteroutput *output, const WCHAR *data, int len)
 
static HRESULT WINAPI xmlwriter_WriteCData (IXmlWriter *iface, LPCWSTR data)
 
static HRESULT WINAPI xmlwriter_WriteCharEntity (IXmlWriter *iface, WCHAR ch)
 
static HRESULT WINAPI xmlwriter_WriteChars (IXmlWriter *iface, const WCHAR *pwch, UINT cwch)
 
static HRESULT WINAPI xmlwriter_WriteComment (IXmlWriter *iface, LPCWSTR comment)
 
static HRESULT WINAPI xmlwriter_WriteDocType (IXmlWriter *iface, LPCWSTR pwszName, LPCWSTR pwszPublicId, LPCWSTR pwszSystemId, LPCWSTR pwszSubset)
 
static HRESULT WINAPI xmlwriter_WriteElementString (IXmlWriter *iface, LPCWSTR prefix, LPCWSTR local_name, LPCWSTR uri, LPCWSTR value)
 
static HRESULT WINAPI xmlwriter_WriteEndDocument (IXmlWriter *iface)
 
static HRESULT WINAPI xmlwriter_WriteEndElement (IXmlWriter *iface)
 
static HRESULT WINAPI xmlwriter_WriteEntityRef (IXmlWriter *iface, LPCWSTR pwszName)
 
static HRESULT WINAPI xmlwriter_WriteFullEndElement (IXmlWriter *iface)
 
static HRESULT WINAPI xmlwriter_WriteName (IXmlWriter *iface, LPCWSTR pwszName)
 
static HRESULT WINAPI xmlwriter_WriteNmToken (IXmlWriter *iface, LPCWSTR pwszNmToken)
 
static HRESULT WINAPI xmlwriter_WriteNode (IXmlWriter *iface, IXmlReader *pReader, BOOL fWriteDefaultAttributes)
 
static HRESULT WINAPI xmlwriter_WriteNodeShallow (IXmlWriter *iface, IXmlReader *pReader, BOOL fWriteDefaultAttributes)
 
static HRESULT WINAPI xmlwriter_WriteProcessingInstruction (IXmlWriter *iface, LPCWSTR name, LPCWSTR text)
 
static HRESULT WINAPI xmlwriter_WriteQualifiedName (IXmlWriter *iface, LPCWSTR pwszLocalName, LPCWSTR pwszNamespaceUri)
 
static HRESULT WINAPI xmlwriter_WriteRaw (IXmlWriter *iface, LPCWSTR data)
 
static HRESULT WINAPI xmlwriter_WriteRawChars (IXmlWriter *iface, const WCHAR *pwch, UINT cwch)
 
static HRESULT WINAPI xmlwriter_WriteStartDocument (IXmlWriter *iface, XmlStandalone standalone)
 
static HRESULT WINAPI xmlwriter_WriteStartElement (IXmlWriter *iface, LPCWSTR prefix, LPCWSTR local_name, LPCWSTR uri)
 
static void write_escaped_string (xmlwriter *writer, const WCHAR *string)
 
static HRESULT WINAPI xmlwriter_WriteString (IXmlWriter *iface, const WCHAR *string)
 
static HRESULT WINAPI xmlwriter_WriteSurrogateCharEntity (IXmlWriter *iface, WCHAR wchLow, WCHAR wchHigh)
 
static HRESULT WINAPI xmlwriter_WriteWhitespace (IXmlWriter *iface, LPCWSTR pwszWhitespace)
 
static HRESULT WINAPI xmlwriter_Flush (IXmlWriter *iface)
 
static HRESULT WINAPI xmlwriteroutput_QueryInterface (IXmlWriterOutput *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI xmlwriteroutput_AddRef (IXmlWriterOutput *iface)
 
static ULONG WINAPI xmlwriteroutput_Release (IXmlWriterOutput *iface)
 
HRESULT WINAPI CreateXmlWriter (REFIID riid, void **obj, IMalloc *imalloc)
 
static HRESULT create_writer_output (IUnknown *stream, IMalloc *imalloc, xml_encoding encoding, const WCHAR *encoding_name, IXmlWriterOutput **output)
 
HRESULT WINAPI CreateXmlWriterOutputWithEncodingName (IUnknown *stream, IMalloc *imalloc, LPCWSTR encoding, IXmlWriterOutput **output)
 
HRESULT WINAPI CreateXmlWriterOutputWithEncodingCodePage (IUnknown *stream, IMalloc *imalloc, UINT codepage, IXmlWriterOutput **output)
 

Variables

static const WCHAR closeelementW [] = {'<','/'}
 
static const WCHAR closetagW [] = {' ','/','>'}
 
static const WCHAR closepiW [] = {'?','>'}
 
static const WCHAR ltW [] = {'<'}
 
static const WCHAR gtW [] = {'>'}
 
static const WCHAR spaceW [] = {' '}
 
static const WCHAR quoteW [] = {'"'}
 
static const struct IUnknownVtbl xmlwriteroutputvtbl
 
static const struct IXmlWriterVtbl xmlwriter_vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file writer.c.

Typedef Documentation

◆ xmlwriter

Enumeration Type Documentation

◆ XmlWriterState

Enumerator
XmlWriterState_Initial 
XmlWriterState_Ready 
XmlWriterState_InvalidEncoding 
XmlWriterState_PIDocStarted 
XmlWriterState_DocStarted 
XmlWriterState_ElemStarted 
XmlWriterState_Content 
XmlWriterState_DocClosed 

Definition at line 56 of file writer.c.

57 {
58  XmlWriterState_Initial, /* output is not set yet */
59  XmlWriterState_Ready, /* SetOutput() was called, ready to start */
60  XmlWriterState_InvalidEncoding, /* SetOutput() was called, but output had invalid encoding */
61  XmlWriterState_PIDocStarted, /* document was started with manually added 'xml' PI */
62  XmlWriterState_DocStarted, /* document was started with WriteStartDocument() */
63  XmlWriterState_ElemStarted, /* writing element */
64  XmlWriterState_Content, /* content is accepted at this point */
65  XmlWriterState_DocClosed /* WriteEndDocument was called */
XmlWriterState
Definition: writer.c:56

Function Documentation

◆ alloc_element()

static struct element* alloc_element ( xmlwriter writer,
const WCHAR prefix,
const WCHAR local 
)
static

Definition at line 160 of file writer.c.

161 {
162  struct element *ret;
163  int len;
164 
165  ret = writer_alloc(writer, sizeof(*ret));
166  if (!ret) return ret;
167 
168  len = prefix ? strlenW(prefix) + 1 /* ':' */ : 0;
169  len += strlenW(local);
170 
171  ret->qname = writer_alloc(writer, (len + 1)*sizeof(WCHAR));
172  ret->len = len;
173  if (prefix) {
174  static const WCHAR colonW[] = {':',0};
175  strcpyW(ret->qname, prefix);
176  strcatW(ret->qname, colonW);
177  }
178  else
179  ret->qname[0] = 0;
180  strcatW(ret->qname, local);
181 
182  return ret;
183 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
strval prefix
Definition: reader.c:257
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void * writer_alloc(xmlwriter *writer, size_t len)
Definition: writer.c:150
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define local
Definition: zutil.h:30
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242

Referenced by xmlwriter_WriteStartElement().

◆ create_writer_output()

static HRESULT create_writer_output ( IUnknown stream,
IMalloc imalloc,
xml_encoding  encoding,
const WCHAR encoding_name,
IXmlWriterOutput **  output 
)
static

Definition at line 1480 of file writer.c.

1482 {
1483  xmlwriteroutput *writeroutput;
1484  HRESULT hr;
1485 
1486  *output = NULL;
1487 
1488  if (imalloc)
1489  writeroutput = IMalloc_Alloc(imalloc, sizeof(*writeroutput));
1490  else
1491  writeroutput = heap_alloc(sizeof(*writeroutput));
1492  if (!writeroutput)
1493  return E_OUTOFMEMORY;
1494 
1495  writeroutput->IXmlWriterOutput_iface.lpVtbl = &xmlwriteroutputvtbl;
1496  writeroutput->ref = 1;
1497  writeroutput->imalloc = imalloc;
1498  if (imalloc)
1499  IMalloc_AddRef(imalloc);
1500  writeroutput->encoding = encoding;
1501  writeroutput->stream = NULL;
1502  hr = init_output_buffer(writeroutput);
1503  if (FAILED(hr)) {
1504  IUnknown_Release(&writeroutput->IXmlWriterOutput_iface);
1505  return hr;
1506  }
1507 
1508  if (encoding_name) {
1509  unsigned int size = (strlenW(encoding_name) + 1) * sizeof(WCHAR);
1510  writeroutput->encoding_name = writeroutput_alloc(writeroutput, size);
1511  memcpy(writeroutput->encoding_name, encoding_name, size);
1512  }
1513  else
1514  writeroutput->encoding_name = NULL;
1515 
1516  IUnknown_QueryInterface(stream, &IID_IUnknown, (void**)&writeroutput->output);
1517 
1518  *output = &writeroutput->IXmlWriterOutput_iface;
1519 
1520  TRACE("returning iface %p\n", *output);
1521 
1522  return S_OK;
1523 }
WCHAR * encoding_name
Definition: writer.c:76
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
HRESULT hr
Definition: shlfolder.c:183
static const struct IUnknownVtbl xmlwriteroutputvtbl
Definition: writer.c:80
static void * writeroutput_alloc(xmlwriteroutput *output, size_t len)
Definition: writer.c:134
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
IUnknown * output
Definition: writer.c:72
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
IMalloc * imalloc
Definition: writer.c:74
xml_encoding encoding
Definition: writer.c:75
Definition: parse.h:22
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
IXmlWriterOutput IXmlWriterOutput_iface
Definition: writer.c:70
ed encoding
Definition: write.c:2839
#define S_OK
Definition: intsafe.h:59
static HRESULT init_output_buffer(xmlwriteroutput *output)
Definition: writer.c:206
ISequentialStream * stream
Definition: writer.c:73

Referenced by CreateXmlWriterOutputWithEncodingCodePage(), and CreateXmlWriterOutputWithEncodingName().

◆ CreateXmlWriter()

HRESULT WINAPI CreateXmlWriter ( REFIID  riid,
void **  obj,
IMalloc imalloc 
)

Definition at line 1444 of file writer.c.

1445 {
1446  xmlwriter *writer;
1447  HRESULT hr;
1448 
1449  TRACE("(%s, %p, %p)\n", wine_dbgstr_guid(riid), obj, imalloc);
1450 
1451  if (imalloc)
1452  writer = IMalloc_Alloc(imalloc, sizeof(*writer));
1453  else
1454  writer = heap_alloc(sizeof(*writer));
1455  if(!writer) return E_OUTOFMEMORY;
1456 
1457  writer->IXmlWriter_iface.lpVtbl = &xmlwriter_vtbl;
1458  writer->ref = 1;
1459  writer->imalloc = imalloc;
1460  if (imalloc) IMalloc_AddRef(imalloc);
1461  writer->output = NULL;
1462  writer->indent_level = 0;
1463  writer->indent = FALSE;
1464  writer->bom = TRUE;
1465  writer->omitxmldecl = FALSE;
1467  writer->state = XmlWriterState_Initial;
1468  writer->bomwritten = FALSE;
1469  writer->starttagopen = FALSE;
1470  list_init(&writer->elements);
1471 
1472  hr = IXmlWriter_QueryInterface(&writer->IXmlWriter_iface, riid, obj);
1473  IXmlWriter_Release(&writer->IXmlWriter_iface);
1474 
1475  TRACE("returning iface %p, hr %#x\n", *obj, hr);
1476 
1477  return hr;
1478 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
BOOL bom
Definition: writer.c:97
REFIID riid
Definition: precomp.h:44
const char * wine_dbgstr_guid(const GUID *guid)
BOOL omitxmldecl
Definition: writer.c:98
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
XmlWriterState state
Definition: writer.c:100
smooth NULL
Definition: ftsmooth.c:416
xmlwriteroutput * output
Definition: writer.c:94
IMalloc * imalloc
Definition: writer.c:93
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
BOOL indent
Definition: writer.c:96
struct list elements
Definition: writer.c:103
BOOL bomwritten
Definition: writer.c:101
static const struct IXmlWriterVtbl xmlwriter_vtbl
Definition: writer.c:1348
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
unsigned int indent_level
Definition: writer.c:95
LONG ref
Definition: writer.c:92
XmlConformanceLevel conformance
Definition: writer.c:99
BOOL starttagopen
Definition: writer.c:102
IXmlWriter IXmlWriter_iface
Definition: writer.c:91

Referenced by test_bom(), test_flush(), test_indentation(), test_omitxmldeclaration(), test_WriteAttributeString(), test_WriteCData(), test_WriteCharEntity(), test_WriteComment(), test_writeenddocument(), test_writeendelement(), test_WriteFullEndElement(), test_writer_create(), test_writer_state(), test_WriteRaw(), test_writeroutput(), test_writestartdocument(), test_writestartelement(), and test_WriteString().

◆ CreateXmlWriterOutputWithEncodingCodePage()

HRESULT WINAPI CreateXmlWriterOutputWithEncodingCodePage ( IUnknown stream,
IMalloc imalloc,
UINT  codepage,
IXmlWriterOutput **  output 
)

Definition at line 1541 of file writer.c.

1545 {
1546  xml_encoding xml_enc;
1547 
1548  TRACE("%p %p %u %p\n", stream, imalloc, codepage, output);
1549 
1550  if (!stream || !output) return E_INVALIDARG;
1551 
1553  return create_writer_output(stream, imalloc, xml_enc, NULL, output);
1554 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
int codepage
Definition: win_iconv.c:156
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT create_writer_output(IUnknown *stream, IMalloc *imalloc, xml_encoding encoding, const WCHAR *encoding_name, IXmlWriterOutput **output)
Definition: writer.c:1480
Definition: parse.h:22
xml_encoding get_encoding_from_codepage(UINT codepage)
Definition: reader.c:168
xml_encoding
Definition: mxwriter.c:53

Referenced by test_writeroutput().

◆ CreateXmlWriterOutputWithEncodingName()

HRESULT WINAPI CreateXmlWriterOutputWithEncodingName ( IUnknown stream,
IMalloc imalloc,
LPCWSTR  encoding,
IXmlWriterOutput **  output 
)

Definition at line 1525 of file writer.c.

1529 {
1530  static const WCHAR utf8W[] = {'U','T','F','-','8',0};
1531  xml_encoding xml_enc;
1532 
1533  TRACE("%p %p %s %p\n", stream, imalloc, debugstr_w(encoding), output);
1534 
1535  if (!stream || !output) return E_INVALIDARG;
1536 
1537  xml_enc = parse_encoding_name(encoding ? encoding : utf8W, -1);
1538  return create_writer_output(stream, imalloc, xml_enc, encoding, output);
1539 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
static const WCHAR utf8W[]
Definition: mxwriter.c:86
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
static xml_encoding parse_encoding_name(const WCHAR *encoding)
Definition: mxwriter.c:223
static HRESULT create_writer_output(IUnknown *stream, IMalloc *imalloc, xml_encoding encoding, const WCHAR *encoding_name, IXmlWriterOutput **output)
Definition: writer.c:1480
Definition: parse.h:22
ed encoding
Definition: write.c:2839
xml_encoding
Definition: mxwriter.c:53

Referenced by test_bom(), test_writeroutput(), test_writestartdocument(), and xmlwriter_SetOutput().

◆ debugstr_writer_prop()

static const char* debugstr_writer_prop ( XmlWriterProperty  prop)
static

Definition at line 116 of file writer.c.

117 {
118  static const char * const prop_names[] =
119  {
120  "MultiLanguage",
121  "Indent",
122  "ByteOrderMark",
123  "OmitXmlDeclaration",
124  "ConformanceLevel"
125  };
126 
127  if (prop > _XmlWriterProperty_Last)
128  return wine_dbg_sprintf("unknown property=%d", prop);
129 
130  return prop_names[prop];
131 }
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:271

Referenced by xmlwriter_GetProperty(), and xmlwriter_SetProperty().

◆ DEFINE_GUID()

DEFINE_GUID ( IID_IXmlWriterOutput  ,
0xc1131708  ,
0x0f59  ,
0x477f  ,
0x93  ,
0x59  ,
0x7d  ,
0x33  ,
0x24  ,
0x51  ,
0xbc  ,
0x1a   
)

◆ free_element()

static void free_element ( xmlwriter writer,
struct element element 
)
static

Definition at line 185 of file writer.c.

186 {
187  writer_free(writer, element->qname);
188  writer_free(writer, element);
189 }
static void writer_free(xmlwriter *writer, void *mem)
Definition: writer.c:155
strval qname
Definition: reader.c:259

Referenced by xmlwriter_Release().

◆ free_output_buffer()

static void free_output_buffer ( xmlwriteroutput output)
static

Definition at line 227 of file writer.c.

228 {
229  struct output_buffer *buffer = &output->buffer;
231  buffer->data = NULL;
232  buffer->allocated = 0;
233  buffer->written = 0;
234 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
GLuint buffer
Definition: glext.h:5915
static void writeroutput_free(xmlwriteroutput *output, void *mem)
Definition: writer.c:139
smooth NULL
Definition: ftsmooth.c:416

Referenced by xmlwriteroutput_Release().

◆ get_output_encoding_name()

static const WCHAR* get_output_encoding_name ( xmlwriteroutput output)
static

Definition at line 377 of file writer.c.

378 {
379  if (output->encoding_name)
380  return output->encoding_name;
381 
382  return get_encoding_name(output->encoding);
383 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
const WCHAR * get_encoding_name(xml_encoding encoding)
Definition: reader.c:163

Referenced by write_xmldecl().

◆ grow_output_buffer()

static HRESULT grow_output_buffer ( xmlwriteroutput output,
int  length 
)
static

Definition at line 236 of file writer.c.

237 {
238  struct output_buffer *buffer = &output->buffer;
239  /* grow if needed, plus 4 bytes to be sure null terminator will fit in */
240  if (buffer->allocated < buffer->written + length + 4) {
241  int grown_size = max(2*buffer->allocated, buffer->allocated + length);
242  char *ptr = writeroutput_realloc(output, buffer->data, grown_size);
243  if (!ptr) return E_OUTOFMEMORY;
244  buffer->data = ptr;
245  buffer->allocated = grown_size;
246  }
247 
248  return S_OK;
249 }
#define max(a, b)
Definition: svc.c:63
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
GLuint buffer
Definition: glext.h:5915
static void * writeroutput_realloc(xmlwriteroutput *output, void *mem, size_t len)
Definition: writer.c:144
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static PVOID ptr
Definition: dispmode.c:27
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define S_OK
Definition: intsafe.h:59

Referenced by write_encoding_bom(), and write_output_buffer().

◆ impl_from_IXmlWriter()

◆ impl_from_IXmlWriterOutput()

static xmlwriteroutput* impl_from_IXmlWriterOutput ( IXmlWriterOutput iface)
inlinestatic

Definition at line 111 of file writer.c.

112 {
113  return CONTAINING_RECORD(iface, xmlwriteroutput, IXmlWriterOutput_iface);
114 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by xmlwriter_SetOutput(), xmlwriteroutput_AddRef(), xmlwriteroutput_QueryInterface(), and xmlwriteroutput_Release().

◆ init_output_buffer()

static HRESULT init_output_buffer ( xmlwriteroutput output)
static

Definition at line 206 of file writer.c.

207 {
208  struct output_buffer *buffer = &output->buffer;
209  const int initial_len = 0x2000;
210  UINT cp = ~0u;
211  HRESULT hr;
212 
213  if (FAILED(hr = get_code_page(output->encoding, &cp)))
214  WARN("Failed to get code page for specified encoding.\n");
215 
216  buffer->data = writeroutput_alloc(output, initial_len);
217  if (!buffer->data) return E_OUTOFMEMORY;
218 
219  memset(buffer->data, 0, 4);
220  buffer->allocated = initial_len;
221  buffer->written = 0;
222  buffer->codepage = cp;
223 
224  return S_OK;
225 }
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
Definition: glfuncs.h:240
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
HRESULT hr
Definition: shlfolder.c:183
static void * writeroutput_alloc(xmlwriteroutput *output, size_t len)
Definition: writer.c:134
#define WARN(fmt,...)
Definition: debug.h:111
GLuint buffer
Definition: glext.h:5915
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static HRESULT get_code_page(xml_encoding encoding, UINT *cp)
Definition: mxwriter.c:265
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
unsigned int UINT
Definition: ndis.h:50
POINT cp
Definition: magnifier.c:59
#define memset(x, y, z)
Definition: compat.h:39

Referenced by create_writer_output().

◆ pop_element()

static struct element* pop_element ( xmlwriter writer)
static

Definition at line 196 of file writer.c.

197 {
198  struct element *element = LIST_ENTRY(list_head(&writer->elements), struct element, entry);
199 
200  if (element)
202 
203  return element;
204 }
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
struct list entry
Definition: reader.c:256
struct list elements
Definition: writer.c:103
uint32_t entry
Definition: isohybrid.c:63
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by xmlwriter_WriteEndElement(), and xmlwriter_WriteFullEndElement().

◆ push_element()

static void push_element ( xmlwriter writer,
struct element element 
)
static

Definition at line 191 of file writer.c.

192 {
193  list_add_head(&writer->elements, &element->entry);
194 }
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
struct list entry
Definition: reader.c:256
struct list elements
Definition: writer.c:103

Referenced by xmlwriter_WriteStartElement().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( xmllite  )

◆ write_cdata_section()

static void write_cdata_section ( xmlwriteroutput output,
const WCHAR data,
int  len 
)
static

Definition at line 668 of file writer.c.

669 {
670  static const WCHAR cdataopenW[] = {'<','!','[','C','D','A','T','A','['};
671  static const WCHAR cdatacloseW[] = {']',']','>'};
672  write_output_buffer(output, cdataopenW, ARRAY_SIZE(cdataopenW));
673  if (data)
675  write_output_buffer(output, cdatacloseW, ARRAY_SIZE(cdatacloseW));
676 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, int len)
Definition: writer.c:251
GLenum GLsizei len
Definition: glext.h:6722
#define ARRAY_SIZE(a)
Definition: main.h:24

Referenced by xmlwriter_WriteCData().

◆ write_encoding_bom()

static HRESULT write_encoding_bom ( xmlwriter writer)
static

Definition at line 357 of file writer.c.

358 {
359  if (!writer->bom || writer->bomwritten) return S_OK;
360 
361  if (writer->output->encoding == XmlEncoding_UTF16) {
362  static const char utf16bom[] = {0xff, 0xfe};
363  struct output_buffer *buffer = &writer->output->buffer;
364  int len = sizeof(utf16bom);
365  HRESULT hr;
366 
367  hr = grow_output_buffer(writer->output, len);
368  if (FAILED(hr)) return hr;
369  memcpy(buffer->data + buffer->written, utf16bom, len);
370  buffer->written += len;
371  }
372 
373  writer->bomwritten = TRUE;
374  return S_OK;
375 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
BOOL bom
Definition: writer.c:97
GLuint buffer
Definition: glext.h:5915
static const WCHAR utf16bom
Definition: filesystem.c:45
struct output_buffer buffer
Definition: writer.c:77
xmlwriteroutput * output
Definition: writer.c:94
LONG HRESULT
Definition: typedefs.h:77
static HRESULT grow_output_buffer(xmlwriteroutput *output, int length)
Definition: writer.c:236
xml_encoding encoding
Definition: writer.c:75
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
BOOL bomwritten
Definition: writer.c:101
#define S_OK
Definition: intsafe.h:59

Referenced by write_xmldecl(), xmlwriter_WriteElementString(), xmlwriter_WriteProcessingInstruction(), and xmlwriter_WriteStartElement().

◆ write_escaped_string()

static void write_escaped_string ( xmlwriter writer,
const WCHAR string 
)
static

Definition at line 1264 of file writer.c.

1265 {
1266  static const WCHAR ampW[] = {'&','a','m','p',';'};
1267  static const WCHAR ltW[] = {'&','l','t',';'};
1268  static const WCHAR gtW[] = {'&','g','t',';'};
1269 
1270  while (*string)
1271  {
1272  switch (*string)
1273  {
1274  case '<':
1276  break;
1277  case '&':
1278  write_output_buffer(writer->output, ampW, ARRAY_SIZE(ampW));
1279  break;
1280  case '>':
1282  break;
1283  default:
1284  write_output_buffer(writer->output, string, 1);
1285  }
1286 
1287  string++;
1288  }
1289 }
xmlwriteroutput * output
Definition: writer.c:94
static const WCHAR ltW[]
Definition: writer.c:43
__wchar_t WCHAR
Definition: xmlstorage.h:180
static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, int len)
Definition: writer.c:251
static const WCHAR gtW[]
Definition: writer.c:44
#define ARRAY_SIZE(a)
Definition: main.h:24

Referenced by xmlwriter_WriteString().

◆ write_node_indent()

static void write_node_indent ( xmlwriter writer)
static

Definition at line 440 of file writer.c.

441 {
442  static const WCHAR dblspaceW[] = {' ',' '};
443  static const WCHAR crlfW[] = {'\r','\n'};
444  unsigned int indent_level = writer->indent_level;
445 
446  if (!writer->indent)
447  return;
448 
449  /* Do state check to prevent newline inserted after BOM. It is assumed that
450  state does not change between writing BOM and inserting indentation. */
451  if (writer->output->buffer.written && writer->state != XmlWriterState_Ready)
453  while (indent_level--)
454  write_output_buffer(writer->output, dblspaceW, ARRAY_SIZE(dblspaceW));
455 }
static const WCHAR crlfW[]
Definition: mxwriter.c:47
struct output_buffer buffer
Definition: writer.c:77
XmlWriterState state
Definition: writer.c:100
xmlwriteroutput * output
Definition: writer.c:94
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL indent
Definition: writer.c:96
static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, int len)
Definition: writer.c:251
#define ARRAY_SIZE(a)
Definition: main.h:24
unsigned int indent_level
Definition: writer.c:95

Referenced by xmlwriter_WriteCData(), xmlwriter_WriteComment(), xmlwriter_WriteElementString(), xmlwriter_WriteEndElement(), xmlwriter_WriteFullEndElement(), xmlwriter_WriteProcessingInstruction(), and xmlwriter_WriteStartElement().

◆ write_output_buffer()

static HRESULT write_output_buffer ( xmlwriteroutput output,
const WCHAR data,
int  len 
)
static

Definition at line 251 of file writer.c.

252 {
253  struct output_buffer *buffer = &output->buffer;
254  int length;
255  HRESULT hr;
256  char *ptr;
257 
258  if (buffer->codepage == 1200) {
259  /* For UTF-16 encoding just copy. */
260  length = len == -1 ? strlenW(data) : len;
261  if (length) {
262  length *= sizeof(WCHAR);
263 
265  if (FAILED(hr)) return hr;
266  ptr = buffer->data + buffer->written;
267 
268  memcpy(ptr, data, length);
269  buffer->written += length;
270  ptr += length;
271  /* null termination */
272  *(WCHAR*)ptr = 0;
273  }
274  }
275  else {
276  length = WideCharToMultiByte(buffer->codepage, 0, data, len, NULL, 0, NULL, NULL);
278  if (FAILED(hr)) return hr;
279  ptr = buffer->data + buffer->written;
280  length = WideCharToMultiByte(buffer->codepage, 0, data, len, ptr, length, NULL, NULL);
281  buffer->written += len == -1 ? length-1 : length;
282  }
283 
284  return S_OK;
285 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define WideCharToMultiByte
Definition: compat.h:101
HRESULT hr
Definition: shlfolder.c:183
GLuint buffer
Definition: glext.h:5915
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
static HRESULT grow_output_buffer(xmlwriteroutput *output, int length)
Definition: writer.c:236
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59

Referenced by write_cdata_section(), write_escaped_string(), write_node_indent(), write_output_buffer_quoted(), write_output_qname(), write_xmldecl(), writer_close_starttag(), xmlwriter_WriteAttributeString(), xmlwriter_WriteCharEntity(), xmlwriter_WriteComment(), xmlwriter_WriteElementString(), xmlwriter_WriteEndElement(), xmlwriter_WriteFullEndElement(), xmlwriter_WriteProcessingInstruction(), xmlwriter_WriteRaw(), and xmlwriter_WriteStartElement().

◆ write_output_buffer_quoted()

static HRESULT write_output_buffer_quoted ( xmlwriteroutput output,
const WCHAR data,
int  len 
)
static

Definition at line 287 of file writer.c.

288 {
292  return S_OK;
293 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, int len)
Definition: writer.c:251
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
static const WCHAR quoteW[]
Definition: writer.c:46

Referenced by write_xmldecl().

◆ write_output_qname()

static HRESULT write_output_qname ( xmlwriteroutput output,
const WCHAR prefix,
const WCHAR local_name 
)
static

Definition at line 296 of file writer.c.

297 {
298  if (prefix) {
299  static const WCHAR colW[] = {':'};
300  write_output_buffer(output, prefix, -1);
301  write_output_buffer(output, colW, ARRAY_SIZE(colW));
302  }
303 
305 
306  return S_OK;
307 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
__wchar_t WCHAR
Definition: xmlstorage.h:180
static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, int len)
Definition: writer.c:251
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
static BSTR local_name(call_frame_t *frame, int ref)
Definition: engine.c:187

Referenced by xmlwriter_WriteElementString(), and xmlwriter_WriteStartElement().

◆ write_xmldecl()

static HRESULT write_xmldecl ( xmlwriter writer,
XmlStandalone  standalone 
)
static

Definition at line 385 of file writer.c.

386 {
387  static const WCHAR versionW[] = {'<','?','x','m','l',' ','v','e','r','s','i','o','n','=','"','1','.','0','"'};
388  static const WCHAR encodingW[] = {' ','e','n','c','o','d','i','n','g','='};
389 
390  write_encoding_bom(writer);
392  if (writer->omitxmldecl) return S_OK;
393 
394  /* version */
396 
397  /* encoding */
398  write_output_buffer(writer->output, encodingW, ARRAY_SIZE(encodingW));
400 
401  /* standalone */
402  if (standalone == XmlStandalone_Omit)
404  else {
405  static const WCHAR standaloneW[] = {' ','s','t','a','n','d','a','l','o','n','e','=','\"'};
406  static const WCHAR yesW[] = {'y','e','s','\"','?','>'};
407  static const WCHAR noW[] = {'n','o','\"','?','>'};
408 
409  write_output_buffer(writer->output, standaloneW, ARRAY_SIZE(standaloneW));
410  if (standalone == XmlStandalone_Yes)
412  else
414  }
415 
416  return S_OK;
417 }
static const WCHAR * get_output_encoding_name(xmlwriteroutput *output)
Definition: writer.c:377
BOOL omitxmldecl
Definition: writer.c:98
XmlWriterState state
Definition: writer.c:100
static const WCHAR yesW[]
Definition: htmlbody.c:594
xmlwriteroutput * output
Definition: writer.c:94
static const WCHAR noW[]
Definition: htmlbody.c:595
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR closepiW[]
Definition: writer.c:42
static HRESULT write_encoding_bom(xmlwriter *writer)
Definition: writer.c:357
static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, int len)
Definition: writer.c:251
static HRESULT write_output_buffer_quoted(xmlwriteroutput *output, const WCHAR *data, int len)
Definition: writer.c:287
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
static const WCHAR versionW[]
Definition: name.c:50

Referenced by xmlwriter_WriteRaw(), and xmlwriter_WriteStartDocument().

◆ writer_alloc()

static void* writer_alloc ( xmlwriter writer,
size_t  len 
)
inlinestatic

Definition at line 150 of file writer.c.

151 {
152  return m_alloc(writer->imalloc, len);
153 }
static void * m_alloc(IMalloc *imalloc, size_t len)
IMalloc * imalloc
Definition: writer.c:93
GLenum GLsizei len
Definition: glext.h:6722

Referenced by alloc_element().

◆ writer_close_starttag()

static HRESULT writer_close_starttag ( xmlwriter writer)
static

Definition at line 419 of file writer.c.

420 {
421  HRESULT hr;
422 
423  if (!writer->starttagopen) return S_OK;
425  writer->starttagopen = FALSE;
426  return hr;
427 }
HRESULT hr
Definition: shlfolder.c:183
xmlwriteroutput * output
Definition: writer.c:94
LONG HRESULT
Definition: typedefs.h:77
static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, int len)
Definition: writer.c:251
static const WCHAR gtW[]
Definition: writer.c:44
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
BOOL starttagopen
Definition: writer.c:102

Referenced by xmlwriter_WriteCData(), xmlwriter_WriteCharEntity(), xmlwriter_WriteComment(), xmlwriter_WriteElementString(), xmlwriter_WriteFullEndElement(), and xmlwriter_WriteString().

◆ writer_dec_indent()

static void writer_dec_indent ( xmlwriter writer)
static

Definition at line 434 of file writer.c.

435 {
436  if (writer->indent_level)
437  writer->indent_level--;
438 }
unsigned int indent_level
Definition: writer.c:95

Referenced by xmlwriter_WriteEndElement(), and xmlwriter_WriteFullEndElement().

◆ writer_free()

static void writer_free ( xmlwriter writer,
void mem 
)
inlinestatic

Definition at line 155 of file writer.c.

156 {
157  m_free(writer->imalloc, mem);
158 }
IMalloc * imalloc
Definition: writer.c:93
static void m_free(IMalloc *imalloc, void *mem)
Definition: mem.c:156

Referenced by free_element(), and xmlwriter_Release().

◆ writer_inc_indent()

static void writer_inc_indent ( xmlwriter writer)
static

Definition at line 429 of file writer.c.

430 {
431  writer->indent_level++;
432 }
unsigned int indent_level
Definition: writer.c:95

Referenced by xmlwriter_WriteStartElement().

◆ writeroutput_alloc()

static void* writeroutput_alloc ( xmlwriteroutput output,
size_t  len 
)
inlinestatic

Definition at line 134 of file writer.c.

135 {
136  return m_alloc(output->imalloc, len);
137 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
static void * m_alloc(IMalloc *imalloc, size_t len)
GLenum GLsizei len
Definition: glext.h:6722

Referenced by create_writer_output(), and init_output_buffer().

◆ writeroutput_flush_stream()

static HRESULT writeroutput_flush_stream ( xmlwriteroutput output)
static

Definition at line 329 of file writer.c.

330 {
331  struct output_buffer *buffer;
332  ULONG written, offset = 0;
333  HRESULT hr;
334 
335  if (!output || !output->stream)
336  return S_OK;
337 
338  buffer = &output->buffer;
339 
340  /* It will loop forever until everything is written or an error occurred. */
341  do {
342  written = 0;
343  hr = ISequentialStream_Write(output->stream, buffer->data + offset, buffer->written, &written);
344  if (FAILED(hr)) {
345  WARN("write to stream failed (0x%08x)\n", hr);
346  buffer->written = 0;
347  return hr;
348  }
349 
350  offset += written;
351  buffer->written -= written;
352  } while (buffer->written > 0);
353 
354  return S_OK;
355 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
GLintptr offset
Definition: glext.h:5920
GLuint buffer
Definition: glext.h:5915
unsigned int written
Definition: writer.c:52
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
unsigned int ULONG
Definition: retypes.h:1

Referenced by xmlwriter_Flush(), and xmlwriter_Release().

◆ writeroutput_free()

static void writeroutput_free ( xmlwriteroutput output,
void mem 
)
inlinestatic

Definition at line 139 of file writer.c.

140 {
141  m_free(output->imalloc, mem);
142 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
static void m_free(IMalloc *imalloc, void *mem)
Definition: mem.c:156

Referenced by free_output_buffer(), and xmlwriteroutput_Release().

◆ writeroutput_query_for_stream()

static HRESULT writeroutput_query_for_stream ( xmlwriteroutput writeroutput)
inlinestatic

Definition at line 317 of file writer.c.

318 {
319  HRESULT hr;
320 
321  writeroutput_release_stream(writeroutput);
322  hr = IUnknown_QueryInterface(writeroutput->output, &IID_IStream, (void**)&writeroutput->stream);
323  if (hr != S_OK)
324  hr = IUnknown_QueryInterface(writeroutput->output, &IID_ISequentialStream, (void**)&writeroutput->stream);
325 
326  return hr;
327 }
HRESULT hr
Definition: shlfolder.c:183
IUnknown * output
Definition: writer.c:72
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
ISequentialStream * stream
Definition: writer.c:73
static void writeroutput_release_stream(xmlwriteroutput *writeroutput)
Definition: writer.c:309

Referenced by xmlwriter_SetOutput().

◆ writeroutput_realloc()

static void* writeroutput_realloc ( xmlwriteroutput output,
void mem,
size_t  len 
)
inlinestatic

Definition at line 144 of file writer.c.

145 {
146  return m_realloc(output->imalloc, mem, len);
147 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
static void * m_realloc(IMalloc *imalloc, void *mem, size_t len)
GLenum GLsizei len
Definition: glext.h:6722
Definition: mem.c:156

Referenced by grow_output_buffer().

◆ writeroutput_release_stream()

static void writeroutput_release_stream ( xmlwriteroutput writeroutput)
static

Definition at line 309 of file writer.c.

310 {
311  if (writeroutput->stream) {
312  ISequentialStream_Release(writeroutput->stream);
313  writeroutput->stream = NULL;
314  }
315 }
smooth NULL
Definition: ftsmooth.c:416
ISequentialStream * stream
Definition: writer.c:73

Referenced by writeroutput_query_for_stream(), and xmlwriter_SetOutput().

◆ xmlwriter_AddRef()

static ULONG WINAPI xmlwriter_AddRef ( IXmlWriter iface)
static

Definition at line 480 of file writer.c.

481 {
484  TRACE("(%p)->(%u)\n", This, ref);
485  return ref;
486 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ xmlwriter_Flush()

static HRESULT WINAPI xmlwriter_Flush ( IXmlWriter iface)
static

Definition at line 1339 of file writer.c.

1340 {
1342 
1343  TRACE("%p\n", This);
1344 
1345  return writeroutput_flush_stream(This->output);
1346 }
#define TRACE(s)
Definition: solgame.cpp:4
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
static HRESULT writeroutput_flush_stream(xmlwriteroutput *output)
Definition: writer.c:329

◆ xmlwriter_GetProperty()

static HRESULT WINAPI xmlwriter_GetProperty ( IXmlWriter iface,
UINT  property,
LONG_PTR value 
)
static

Definition at line 565 of file writer.c.

566 {
568 
569  TRACE("(%p)->(%s %p)\n", This, debugstr_writer_prop(property), value);
570 
571  if (!value) return E_INVALIDARG;
572 
573  switch (property)
574  {
576  *value = This->indent;
577  break;
579  *value = This->bom;
580  break;
582  *value = This->omitxmldecl;
583  break;
585  *value = This->conformance;
586  break;
587  default:
588  FIXME("Unimplemented property (%u)\n", property);
589  return E_NOTIMPL;
590  }
591 
592  return S_OK;
593 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_INVALIDARG
Definition: ddrawi.h:101
static const char * debugstr_writer_prop(XmlWriterProperty prop)
Definition: writer.c:116
#define TRACE(s)
Definition: solgame.cpp:4
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ xmlwriter_QueryInterface()

static HRESULT WINAPI xmlwriter_QueryInterface ( IXmlWriter iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 457 of file writer.c.

458 {
460 
461  TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
462 
463  if (IsEqualGUID(riid, &IID_IXmlWriter) ||
465  {
466  *ppvObject = iface;
467  }
468  else
469  {
470  FIXME("interface %s is not supported\n", debugstr_guid(riid));
471  *ppvObject = NULL;
472  return E_NOINTERFACE;
473  }
474 
475  IXmlWriter_AddRef(iface);
476 
477  return S_OK;
478 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ xmlwriter_Release()

static ULONG WINAPI xmlwriter_Release ( IXmlWriter iface)
static

Definition at line 488 of file writer.c.

489 {
492 
493  TRACE("(%p)->(%u)\n", This, ref);
494 
495  if (ref == 0) {
496  struct element *element, *element2;
497  IMalloc *imalloc = This->imalloc;
498 
500  if (This->output) IUnknown_Release(&This->output->IXmlWriterOutput_iface);
501 
502  /* element stack */
503  LIST_FOR_EACH_ENTRY_SAFE(element, element2, &This->elements, struct element, entry) {
506  }
507 
509  if (imalloc) IMalloc_Release(imalloc);
510  }
511 
512  return ref;
513 }
static void writer_free(xmlwriter *writer, void *mem)
Definition: writer.c:155
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
struct list entry
Definition: reader.c:256
#define InterlockedDecrement
Definition: armddk.h:52
uint32_t entry
Definition: isohybrid.c:63
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
static HRESULT writeroutput_flush_stream(xmlwriteroutput *output)
Definition: writer.c:329
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
unsigned int ULONG
Definition: retypes.h:1
static void free_element(xmlwriter *writer, struct element *element)
Definition: writer.c:185

◆ xmlwriter_SetOutput()

static HRESULT WINAPI xmlwriter_SetOutput ( IXmlWriter iface,
IUnknown output 
)
static

Definition at line 516 of file writer.c.

517 {
519  IXmlWriterOutput *writeroutput;
520  HRESULT hr;
521 
522  TRACE("(%p)->(%p)\n", This, output);
523 
524  if (This->output) {
526  IUnknown_Release(&This->output->IXmlWriterOutput_iface);
527  This->output = NULL;
528  This->bomwritten = FALSE;
529  This->indent_level = 0;
530  }
531 
532  /* just reset current output */
533  if (!output) {
534  This->state = XmlWriterState_Initial;
535  return S_OK;
536  }
537 
538  /* now try IXmlWriterOutput, ISequentialStream, IStream */
539  hr = IUnknown_QueryInterface(output, &IID_IXmlWriterOutput, (void**)&writeroutput);
540  if (hr == S_OK) {
541  if (writeroutput->lpVtbl == &xmlwriteroutputvtbl)
542  This->output = impl_from_IXmlWriterOutput(writeroutput);
543  else {
544  ERR("got external IXmlWriterOutput implementation: %p, vtbl=%p\n",
545  writeroutput, writeroutput->lpVtbl);
546  IUnknown_Release(writeroutput);
547  return E_FAIL;
548  }
549  }
550 
551  if (hr != S_OK || !writeroutput) {
552  /* create IXmlWriterOutput basing on supplied interface */
553  hr = CreateXmlWriterOutputWithEncodingName(output, This->imalloc, NULL, &writeroutput);
554  if (hr != S_OK) return hr;
555  This->output = impl_from_IXmlWriterOutput(writeroutput);
556  }
557 
558  if (This->output->encoding == XmlEncoding_Unknown)
560  else
561  This->state = XmlWriterState_Ready;
562  return writeroutput_query_for_stream(This->output);
563 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
HRESULT hr
Definition: shlfolder.c:183
static const struct IUnknownVtbl xmlwriteroutputvtbl
Definition: writer.c:80
#define E_FAIL
Definition: ddrawi.h:102
HRESULT WINAPI CreateXmlWriterOutputWithEncodingName(IUnknown *stream, IMalloc *imalloc, LPCWSTR encoding, IXmlWriterOutput **output)
Definition: writer.c:1525
static HRESULT writeroutput_query_for_stream(xmlwriteroutput *writeroutput)
Definition: writer.c:317
smooth NULL
Definition: ftsmooth.c:416
static xmlwriteroutput * impl_from_IXmlWriterOutput(IXmlWriterOutput *iface)
Definition: writer.c:111
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
static void writeroutput_release_stream(xmlwriteroutput *writeroutput)
Definition: writer.c:309

◆ xmlwriter_SetProperty()

static HRESULT WINAPI xmlwriter_SetProperty ( IXmlWriter iface,
UINT  property,
LONG_PTR  value 
)
static

Definition at line 595 of file writer.c.

596 {
598 
599  TRACE("(%p)->(%s %lu)\n", This, debugstr_writer_prop(property), value);
600 
601  switch (property)
602  {
604  This->indent = !!value;
605  break;
607  This->bom = !!value;
608  break;
610  This->omitxmldecl = !!value;
611  break;
612  default:
613  FIXME("Unimplemented property (%u)\n", property);
614  return E_NOTIMPL;
615  }
616 
617  return S_OK;
618 }
#define FIXME(fmt,...)
Definition: debug.h:110
static const char * debugstr_writer_prop(XmlWriterProperty prop)
Definition: writer.c:116
#define TRACE(s)
Definition: solgame.cpp:4
GLsizei const GLfloat * value
Definition: glext.h:6069
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ xmlwriter_WriteAttributes()

static HRESULT WINAPI xmlwriter_WriteAttributes ( IXmlWriter iface,
IXmlReader pReader,
BOOL  fWriteDefaultAttributes 
)
static

Definition at line 620 of file writer.c.

622 {
624 
625  FIXME("%p %p %d\n", This, pReader, fWriteDefaultAttributes);
626 
627  return E_NOTIMPL;
628 }
#define FIXME(fmt,...)
Definition: debug.h:110
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ xmlwriter_WriteAttributeString()

static HRESULT WINAPI xmlwriter_WriteAttributeString ( IXmlWriter iface,
LPCWSTR  ns_prefix,
LPCWSTR  local_name,
LPCWSTR  ns_uri,
LPCWSTR  value 
)
static

Definition at line 630 of file writer.c.

632 {
633  static const WCHAR eqW[] = {'=','"'};
635 
636  TRACE("%p %s %s %s %s\n", This, debugstr_w(ns_prefix), debugstr_w(local_name),
637  debugstr_w(ns_uri), debugstr_w(value));
638 
639  switch (This->state)
640  {
642  return E_UNEXPECTED;
646  return WR_E_INVALIDACTION;
648  return MX_E_ENCODING;
649  default:
650  ;
651  }
652 
653  if (ns_prefix || ns_uri)
654  {
655  FIXME("namespaces are not supported.\n");
656  return E_NOTIMPL;
657  }
658 
660  write_output_buffer(This->output, local_name, -1);
661  write_output_buffer(This->output, eqW, ARRAY_SIZE(eqW));
662  write_output_buffer(This->output, value, -1);
664 
665  return S_OK;
666 }
static const WCHAR spaceW[]
Definition: writer.c:45
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, int len)
Definition: writer.c:251
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_UNEXPECTED
Definition: winerror.h:2456
static BSTR local_name(call_frame_t *frame, int ref)
Definition: engine.c:187
static const WCHAR quoteW[]
Definition: writer.c:46

◆ xmlwriter_WriteCData()

static HRESULT WINAPI xmlwriter_WriteCData ( IXmlWriter iface,
LPCWSTR  data 
)
static

Definition at line 678 of file writer.c.

679 {
681  int len;
682 
683  TRACE("%p %s\n", This, debugstr_w(data));
684 
685  switch (This->state)
686  {
688  return E_UNEXPECTED;
691  break;
695  return WR_E_INVALIDACTION;
697  return MX_E_ENCODING;
698  default:
699  ;
700  }
701 
702  len = data ? strlenW(data) : 0;
703 
705  if (!len)
706  write_cdata_section(This->output, NULL, 0);
707  else {
708  static const WCHAR cdatacloseW[] = {']',']','>',0};
709  while (len) {
710  const WCHAR *str = strstrW(data, cdatacloseW);
711  if (str) {
712  str += 2;
713  write_cdata_section(This->output, data, str - data);
714  len -= str - data;
715  data = str;
716  }
717  else {
718  write_cdata_section(This->output, data, len);
719  break;
720  }
721  }
722  }
723 
724  return S_OK;
725 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
static HRESULT writer_close_starttag(xmlwriter *writer)
Definition: writer.c:419
#define debugstr_w
Definition: kernel32.h:32
const WCHAR * str
#define strstrW(d, s)
Definition: unicode.h:32
smooth NULL
Definition: ftsmooth.c:416
static void write_cdata_section(xmlwriteroutput *output, const WCHAR *data, int len)
Definition: writer.c:668
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLsizei len
Definition: glext.h:6722
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define S_OK
Definition: intsafe.h:59
static void write_node_indent(xmlwriter *writer)
Definition: writer.c:440
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ xmlwriter_WriteCharEntity()

static HRESULT WINAPI xmlwriter_WriteCharEntity ( IXmlWriter iface,
WCHAR  ch 
)
static

Definition at line 727 of file writer.c.

728 {
729  static const WCHAR fmtW[] = {'&','#','x','%','x',';',0};
731  WCHAR bufW[16];
732 
733  TRACE("%p %#x\n", This, ch);
734 
735  switch (This->state)
736  {
738  return E_UNEXPECTED;
740  return MX_E_ENCODING;
743  break;
745  return WR_E_INVALIDACTION;
746  default:
747  ;
748  }
749 
750  sprintfW(bufW, fmtW, ch);
751  write_output_buffer(This->output, bufW, -1);
752 
753  return S_OK;
754 }
static HRESULT writer_close_starttag(xmlwriter *writer)
Definition: writer.c:419
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, int len)
Definition: writer.c:251
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define S_OK
Definition: intsafe.h:59
#define sprintfW
Definition: unicode.h:58
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ xmlwriter_WriteChars()

static HRESULT WINAPI xmlwriter_WriteChars ( IXmlWriter iface,
const WCHAR pwch,
UINT  cwch 
)
static

Definition at line 756 of file writer.c.

757 {
759 
760  FIXME("%p %s %d\n", This, wine_dbgstr_w(pwch), cwch);
761 
762  switch (This->state)
763  {
765  return E_UNEXPECTED;
767  return MX_E_ENCODING;
769  return WR_E_INVALIDACTION;
770  default:
771  ;
772  }
773 
774  return E_NOTIMPL;
775 }
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define FIXME(fmt,...)
Definition: debug.h:110
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ xmlwriter_WriteComment()

static HRESULT WINAPI xmlwriter_WriteComment ( IXmlWriter iface,
LPCWSTR  comment 
)
static

Definition at line 778 of file writer.c.

779 {
780  static const WCHAR copenW[] = {'<','!','-','-'};
781  static const WCHAR ccloseW[] = {'-','-','>'};
783 
784  TRACE("%p %s\n", This, debugstr_w(comment));
785 
786  switch (This->state)
787  {
789  return E_UNEXPECTED;
791  return MX_E_ENCODING;
794  break;
796  return WR_E_INVALIDACTION;
797  default:
798  ;
799  }
800 
802  write_output_buffer(This->output, copenW, ARRAY_SIZE(copenW));
803  if (comment) {
804  int len = strlenW(comment), i;
805 
806  /* Make sure there's no two hyphen sequences in a string, space is used as a separator to produce compliant
807  comment string */
808  if (len > 1) {
809  for (i = 0; i < len; i++) {
810  write_output_buffer(This->output, comment + i, 1);
811  if (comment[i] == '-' && (i + 1 < len) && comment[i+1] == '-')
813  }
814  }
815  else
816  write_output_buffer(This->output, comment, len);
817 
818  if (len && comment[len-1] == '-')
820  }
821  write_output_buffer(This->output, ccloseW, ARRAY_SIZE(ccloseW));
822 
823  return S_OK;
824 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
static HRESULT writer_close_starttag(xmlwriter *writer)
Definition: writer.c:419
static const WCHAR spaceW[]
Definition: writer.c:45
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
Definition: glfuncs.h:248
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, int len)
Definition: writer.c:251
Definition: id3.c:18
GLenum GLsizei len
Definition: glext.h:6722
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
static void write_node_indent(xmlwriter *writer)
Definition: writer.c:440
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ xmlwriter_WriteDocType()

static HRESULT WINAPI xmlwriter_WriteDocType ( IXmlWriter iface,
LPCWSTR  pwszName,
LPCWSTR  pwszPublicId,
LPCWSTR  pwszSystemId,
LPCWSTR  pwszSubset 
)
static

Definition at line 826 of file writer.c.

828 {
830 
831  FIXME("%p %s %s %s %s\n", This, wine_dbgstr_w(pwszName), wine_dbgstr_w(pwszPublicId),
832  wine_dbgstr_w(pwszSystemId), wine_dbgstr_w(pwszSubset));
833 
834  return E_NOTIMPL;
835 }
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define FIXME(fmt,...)
Definition: debug.h:110
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ xmlwriter_WriteElementString()

static HRESULT WINAPI xmlwriter_WriteElementString ( IXmlWriter iface,
LPCWSTR  prefix,
LPCWSTR  local_name,
LPCWSTR  uri,
LPCWSTR  value 
)
static

Definition at line 837 of file writer.c.

839 {
841 
842  TRACE("(%p)->(%s %s %s %s)\n", This, wine_dbgstr_w(prefix), wine_dbgstr_w(local_name),
844 
845  switch (This->state)
846  {
848  return E_UNEXPECTED;
850  return MX_E_ENCODING;
853  break;
855  return WR_E_INVALIDACTION;
856  default:
857  ;
858  }
859 
864 
865  if (value)
866  {
868  write_output_buffer(This->output, value, -1);
872  }
873  else
875 
876  This->state = XmlWriterState_Content;
877 
878  return S_OK;
879 }
static HRESULT writer_close_starttag(xmlwriter *writer)
Definition: writer.c:419
const char * uri
Definition: sec_mgr.c:1594
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
static const WCHAR closeelementW[]
Definition: writer.c:40
strval prefix
Definition: reader.c:257
static const WCHAR ltW[]
Definition: writer.c:43
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT write_encoding_bom(xmlwriter *writer)
Definition: writer.c:357
static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, int len)
Definition: writer.c:251
static HRESULT write_output_qname(xmlwriteroutput *output, const WCHAR *prefix, const WCHAR *local_name)
Definition: writer.c:296
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
static const WCHAR gtW[]
Definition: writer.c:44
#define S_OK
Definition: intsafe.h:59
static const WCHAR closetagW[]
Definition: writer.c:41
#define ARRAY_SIZE(a)
Definition: main.h:24
static void write_node_indent(xmlwriter *writer)
Definition: writer.c:440
#define E_UNEXPECTED
Definition: winerror.h:2456
static BSTR local_name(call_frame_t *frame, int ref)
Definition: engine.c:187

◆ xmlwriter_WriteEndDocument()

static HRESULT WINAPI xmlwriter_WriteEndDocument ( IXmlWriter iface)
static

Definition at line 881 of file writer.c.

882 {
884 
885  TRACE("%p\n", This);
886 
887  switch (This->state)
888  {
890  return E_UNEXPECTED;
894  return WR_E_INVALIDACTION;
896  return MX_E_ENCODING;
897  default:
898  ;
899  }
900 
901  /* empty element stack */
902  while (IXmlWriter_WriteEndElement(iface) == S_OK)
903  ;
904 
906  return S_OK;
907 }
#define TRACE(s)
Definition: solgame.cpp:4
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define S_OK
Definition: intsafe.h:59
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ xmlwriter_WriteEndElement()

static HRESULT WINAPI xmlwriter_WriteEndElement ( IXmlWriter iface)
static

Definition at line 909 of file writer.c.

910 {
912  struct element *element;
913 
914  TRACE("%p\n", This);
915 
916  switch (This->state)
917  {
919  return E_UNEXPECTED;
923  return WR_E_INVALIDACTION;
925  return MX_E_ENCODING;
926  default:
927  ;
928  }
929 
931  if (!element)
932  return WR_E_INVALIDACTION;
933 
935 
936  if (This->starttagopen)
937  {
939  This->starttagopen = FALSE;
940  }
941  else {
942  /* write full end tag */
947  }
948 
949  return S_OK;
950 }
static void writer_dec_indent(xmlwriter *writer)
Definition: writer.c:434
static const WCHAR closeelementW[]
Definition: writer.c:40
static struct element * pop_element(xmlwriter *writer)
Definition: writer.c:196
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int len
Definition: writer.c:86
static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, int len)
Definition: writer.c:251
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
static const WCHAR gtW[]
Definition: writer.c:44
#define S_OK
Definition: intsafe.h:59
static const WCHAR closetagW[]
Definition: writer.c:41
#define ARRAY_SIZE(a)
Definition: main.h:24
strval qname
Definition: reader.c:259
static void write_node_indent(xmlwriter *writer)
Definition: writer.c:440
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ xmlwriter_WriteEntityRef()

static HRESULT WINAPI xmlwriter_WriteEntityRef ( IXmlWriter iface,
LPCWSTR  pwszName 
)
static

Definition at line 952 of file writer.c.

953 {
955 
956  FIXME("%p %s\n", This, wine_dbgstr_w(pwszName));
957 
958  switch (This->state)
959  {
961  return E_UNEXPECTED;
963  return MX_E_ENCODING;
965  return WR_E_INVALIDACTION;
966  default:
967  ;
968  }
969 
970  return E_NOTIMPL;
971 }
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define FIXME(fmt,...)
Definition: debug.h:110
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ xmlwriter_WriteFullEndElement()

static HRESULT WINAPI xmlwriter_WriteFullEndElement ( IXmlWriter iface)
static

Definition at line 973 of file writer.c.

974 {
976  struct element *element;
977 
978  TRACE("%p\n", This);
979 
980  switch (This->state)
981  {
983  return E_UNEXPECTED;
987  return WR_E_INVALIDACTION;
989  return MX_E_ENCODING;
990  default:
991  ;
992  }
993 
995  if (!element)
996  return WR_E_INVALIDACTION;
997 
1000 
1001  /* don't force full end tag to the next line */
1002  if (This->state == XmlWriterState_ElemStarted)
1003  This->state = XmlWriterState_Content;
1004  else
1006 
1007  /* write full end tag */
1011 
1012  return S_OK;
1013 }
static void writer_dec_indent(xmlwriter *writer)
Definition: writer.c:434
static HRESULT writer_close_starttag(xmlwriter *writer)
Definition: writer.c:419
static const WCHAR closeelementW[]
Definition: writer.c:40
static struct element * pop_element(xmlwriter *writer)
Definition: writer.c:196
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int len
Definition: writer.c:86
static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, int len)
Definition: writer.c:251
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
static const WCHAR gtW[]
Definition: writer.c:44
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
strval qname
Definition: reader.c:259
static void write_node_indent(xmlwriter *writer)
Definition: writer.c:440
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ xmlwriter_WriteName()

static HRESULT WINAPI xmlwriter_WriteName ( IXmlWriter iface,
LPCWSTR  pwszName 
)
static

Definition at line 1015 of file writer.c.

1016 {
1018 
1019  FIXME("%p %s\n", This, wine_dbgstr_w(pwszName));
1020 
1021  switch (This->state)
1022  {
1024  return E_UNEXPECTED;
1025  case XmlWriterState_Ready:
1027  This->state = XmlWriterState_DocClosed;
1028  return WR_E_INVALIDACTION;
1030  return MX_E_ENCODING;
1031  default:
1032  ;
1033  }
1034 
1035  return E_NOTIMPL;
1036 }
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define FIXME(fmt,...)
Definition: debug.h:110
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ xmlwriter_WriteNmToken()

static HRESULT WINAPI xmlwriter_WriteNmToken ( IXmlWriter iface,
LPCWSTR  pwszNmToken 
)
static

Definition at line 1038 of file writer.c.

1039 {
1041 
1042  FIXME("%p %s\n", This, wine_dbgstr_w(pwszNmToken));
1043 
1044  switch (This->state)
1045  {
1047  return E_UNEXPECTED;
1048  case XmlWriterState_Ready:
1050  This->state = XmlWriterState_DocClosed;
1051  return WR_E_INVALIDACTION;
1053  return MX_E_ENCODING;
1054  default:
1055  ;
1056  }
1057 
1058  return E_NOTIMPL;
1059 }
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define FIXME(fmt,...)
Definition: debug.h:110
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ xmlwriter_WriteNode()

static HRESULT WINAPI xmlwriter_WriteNode ( IXmlWriter iface,
IXmlReader pReader,
BOOL  fWriteDefaultAttributes 
)
static

Definition at line 1061 of file writer.c.

1063 {
1065 
1066  FIXME("%p %p %d\n", This, pReader, fWriteDefaultAttributes);
1067 
1068  return E_NOTIMPL;
1069 }
#define FIXME(fmt,...)
Definition: debug.h:110
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ xmlwriter_WriteNodeShallow()

static HRESULT WINAPI xmlwriter_WriteNodeShallow ( IXmlWriter iface,
IXmlReader pReader,
BOOL  fWriteDefaultAttributes 
)
static

Definition at line 1071 of file writer.c.

1073 {
1075 
1076  FIXME("%p %p %d\n", This, pReader, fWriteDefaultAttributes);
1077 
1078  return E_NOTIMPL;
1079 }
#define FIXME(fmt,...)
Definition: debug.h:110
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ xmlwriter_WriteProcessingInstruction()

static HRESULT WINAPI xmlwriter_WriteProcessingInstruction ( IXmlWriter iface,
LPCWSTR  name,
LPCWSTR  text 
)
static

Definition at line 1081 of file writer.c.

1083 {
1085  static const WCHAR xmlW[] = {'x','m','l',0};
1086  static const WCHAR openpiW[] = {'<','?'};
1087 
1088  TRACE("(%p)->(%s %s)\n", This, wine_dbgstr_w(name), wine_dbgstr_w(text));
1089 
1090  switch (This->state)
1091  {
1093  return E_UNEXPECTED;
1095  return MX_E_ENCODING;
1097  if (!strcmpW(name, xmlW))
1098  return WR_E_INVALIDACTION;
1099  break;
1102  return WR_E_INVALIDACTION;
1103  default:
1104  ;
1105  }
1106 
1109  write_output_buffer(This->output, openpiW, ARRAY_SIZE(openpiW));
1110  write_output_buffer(This->output, name, -1);
1112  write_output_buffer(This->output, text, -1);
1114 
1115  if (!strcmpW(name, xmlW))
1117 
1118  return S_OK;
1119 }
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
const WCHAR * text
Definition: package.c:1827
static const WCHAR spaceW[]
Definition: writer.c:45
static const WCHAR xmlW[]
Definition: mxnamespace.c:61
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR closepiW[]
Definition: writer.c:42
static HRESULT write_encoding_bom(xmlwriter *writer)
Definition: writer.c:357
static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, int len)
Definition: writer.c:251
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
static void write_node_indent(xmlwriter *writer)
Definition: writer.c:440
#define E_UNEXPECTED
Definition: winerror.h:2456
Definition: name.c:36
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229

◆ xmlwriter_WriteQualifiedName()

static HRESULT WINAPI xmlwriter_WriteQualifiedName ( IXmlWriter iface,
LPCWSTR  pwszLocalName,
LPCWSTR  pwszNamespaceUri 
)
static

Definition at line 1121 of file writer.c.

1123 {
1125 
1126  FIXME("%p %s %s\n", This, wine_dbgstr_w(pwszLocalName), wine_dbgstr_w(pwszNamespaceUri));
1127 
1128  switch (This->state)
1129  {
1131  return E_UNEXPECTED;
1133  return MX_E_ENCODING;
1135  return WR_E_INVALIDACTION;
1136  default:
1137  ;
1138  }
1139 
1140  return E_NOTIMPL;
1141 }
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define FIXME(fmt,...)
Definition: debug.h:110
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ xmlwriter_WriteRaw()

static HRESULT WINAPI xmlwriter_WriteRaw ( IXmlWriter iface,
LPCWSTR  data 
)
static

Definition at line 1143 of file writer.c.

1144 {
1146 
1147  TRACE("%p %s\n", This, debugstr_w(data));
1148 
1149  if (!data)
1150  return S_OK;
1151 
1152  switch (This->state)
1153  {
1155  return E_UNEXPECTED;
1156  case XmlWriterState_Ready:
1158  /* fallthrough */
1161  break;
1163  return MX_E_ENCODING;
1164  default:
1165  This->state = XmlWriterState_DocClosed;
1166  return WR_E_INVALIDACTION;
1167  }
1168 
1169  write_output_buffer(This->output, data, -1);
1170  return S_OK;
1171 }
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, int len)
Definition: writer.c:251
static HRESULT write_xmldecl(xmlwriter *writer, XmlStandalone standalone)
Definition: writer.c:385
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define S_OK
Definition: intsafe.h:59
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ xmlwriter_WriteRawChars()

static HRESULT WINAPI xmlwriter_WriteRawChars ( IXmlWriter iface,
const WCHAR pwch,
UINT  cwch 
)
static

Definition at line 1173 of file writer.c.

1174 {
1176 
1177  FIXME("%p %s %d\n", This, wine_dbgstr_w(pwch), cwch);
1178 
1179  switch (This->state)
1180  {
1182  return E_UNEXPECTED;
1184  return MX_E_ENCODING;
1186  return WR_E_INVALIDACTION;
1187  default:
1188  ;
1189  }
1190 
1191  return E_NOTIMPL;
1192 }
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define FIXME(fmt,...)
Definition: debug.h:110
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ xmlwriter_WriteStartDocument()

static HRESULT WINAPI xmlwriter_WriteStartDocument ( IXmlWriter iface,
XmlStandalone  standalone 
)
static

Definition at line 1194 of file writer.c.

1195 {
1197 
1198  TRACE("(%p)->(%d)\n", This, standalone);
1199 
1200  switch (This->state)
1201  {
1203  return E_UNEXPECTED;
1206  return S_OK;
1207  case XmlWriterState_Ready:
1208  break;
1210  return MX_E_ENCODING;
1211  default:
1212  This->state = XmlWriterState_DocClosed;
1213  return WR_E_INVALIDACTION;
1214  }
1215 
1216  return write_xmldecl(This, standalone);
1217 }
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT write_xmldecl(xmlwriter *writer, XmlStandalone standalone)
Definition: writer.c:385
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define S_OK
Definition: intsafe.h:59
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ xmlwriter_WriteStartElement()

static HRESULT WINAPI xmlwriter_WriteStartElement ( IXmlWriter iface,
LPCWSTR  prefix,
LPCWSTR  local_name,
LPCWSTR  uri 
)
static

Definition at line 1219 of file writer.c.

1220 {
1222  struct element *element;
1223 
1224  TRACE("(%p)->(%s %s %s)\n", This, wine_dbgstr_w(prefix), wine_dbgstr_w(local_name), wine_dbgstr_w(uri));
1225 
1226  if (!local_name)
1227  return E_INVALIDARG;
1228 
1229  switch (This->state)
1230  {
1232  return E_UNEXPECTED;
1234  return MX_E_ENCODING;
1236  return WR_E_INVALIDACTION;
1237  default:
1238  ;
1239  }
1240 
1241  /* close pending element */
1242  if (This->starttagopen)
1244 
1246  if (!element)
1247  return E_OUTOFMEMORY;
1248 
1251 
1253  This->starttagopen = TRUE;
1254 
1256 
1260 
1261  return S_OK;
1262 }
#define TRUE
Definition: types.h:120
static void writer_inc_indent(xmlwriter *writer)
Definition: writer.c:429
const char * uri
Definition: sec_mgr.c:1594
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
strval prefix
Definition: reader.c:257
static const WCHAR ltW[]
Definition: writer.c:43
#define TRACE(s)
Definition: solgame.cpp:4
static void push_element(xmlwriter *writer, struct element *element)
Definition: writer.c:191
static HRESULT write_encoding_bom(xmlwriter *writer)
Definition: writer.c:357
static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, int len)
Definition: writer.c:251
static HRESULT write_output_qname(xmlwriteroutput *output, const WCHAR *prefix, const WCHAR *local_name)
Definition: writer.c:296
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
static const WCHAR gtW[]
Definition: writer.c:44
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
static void write_node_indent(xmlwriter *writer)
Definition: writer.c:440
#define E_UNEXPECTED
Definition: winerror.h:2456
static BSTR local_name(call_frame_t *frame, int ref)
Definition: engine.c:187
static struct element * alloc_element(xmlwriter *writer, const WCHAR *prefix, const WCHAR *local)
Definition: writer.c:160

◆ xmlwriter_WriteString()

static HRESULT WINAPI xmlwriter_WriteString ( IXmlWriter iface,
const WCHAR string 
)
static

Definition at line 1291 of file writer.c.

1292 {
1294 
1295  TRACE("%p %s\n", This, debugstr_w(string));
1296 
1297  if (!string)
1298  return S_OK;
1299 
1300  switch (This->state)
1301  {
1303  return E_UNEXPECTED;
1306  break;
1307  case XmlWriterState_Ready:
1309  This->state = XmlWriterState_DocClosed;
1310  return WR_E_INVALIDACTION;
1312  return MX_E_ENCODING;
1313  default:
1314  ;
1315  }
1316 
1317  write_escaped_string(This, string);
1318  return S_OK;
1319 }
static HRESULT writer_close_starttag(xmlwriter *writer)
Definition: writer.c:419
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
static void write_escaped_string(xmlwriter *writer, const WCHAR *string)
Definition: writer.c:1264
#define S_OK
Definition: intsafe.h:59
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ xmlwriter_WriteSurrogateCharEntity()

static HRESULT WINAPI xmlwriter_WriteSurrogateCharEntity ( IXmlWriter iface,
WCHAR  wchLow,
WCHAR  wchHigh 
)
static

Definition at line 1321 of file writer.c.

1322 {
1324 
1325  FIXME("%p %d %d\n", This, wchLow, wchHigh);
1326 
1327  return E_NOTIMPL;
1328 }
#define FIXME(fmt,...)
Definition: debug.h:110
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ xmlwriter_WriteWhitespace()

static HRESULT WINAPI xmlwriter_WriteWhitespace ( IXmlWriter iface,
LPCWSTR  pwszWhitespace 
)
static

Definition at line 1330 of file writer.c.

1331 {
1333 
1334  FIXME("%p %s\n", This, wine_dbgstr_w(pwszWhitespace));
1335 
1336  return E_NOTIMPL;
1337 }
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define FIXME(fmt,...)
Definition: debug.h:110
static xmlwriter * impl_from_IXmlWriter(IXmlWriter *iface)
Definition: writer.c:106
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ xmlwriteroutput_AddRef()

static ULONG WINAPI xmlwriteroutput_AddRef ( IXmlWriterOutput iface)
static

Definition at line 1408 of file writer.c.

1409 {
1412  TRACE("(%p)->(%d)\n", This, ref);
1413  return ref;
1414 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
static xmlwriteroutput * impl_from_IXmlWriterOutput(IXmlWriterOutput *iface)
Definition: writer.c:111
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ xmlwriteroutput_QueryInterface()

static HRESULT WINAPI xmlwriteroutput_QueryInterface ( IXmlWriterOutput iface,
REFIID  riid,
void **  ppvObject 
)
static

IXmlWriterOutput

Definition at line 1385 of file writer.c.

1386 {
1388 
1389  TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
1390 
1391  if (IsEqualGUID(riid, &IID_IXmlWriterOutput) ||
1393  {
1394  *ppvObject = iface;
1395  }
1396  else
1397  {
1398  WARN("interface %s not implemented\n", debugstr_guid(riid));
1399  *ppvObject = NULL;
1400  return E_NOINTERFACE;
1401  }
1402 
1403  IUnknown_AddRef(iface);
1404 
1405  return S_OK;
1406 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
static xmlwriteroutput * impl_from_IXmlWriterOutput(IXmlWriterOutput *iface)
Definition: writer.c:111
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ xmlwriteroutput_Release()

static ULONG WINAPI xmlwriteroutput_Release ( IXmlWriterOutput iface)
static

Definition at line 1416 of file writer.c.

1417 {
1419  LONG ref = InterlockedDecrement(&This->ref);
1420 
1421  TRACE("(%p)->(%d)\n", This, ref);
1422 
1423  if (ref == 0)
1424  {
1425  IMalloc *imalloc = This->imalloc;
1426  if (This->output) IUnknown_Release(This->output);
1427  if (This->stream) ISequentialStream_Release(This->stream);
1429  writeroutput_free(This, This->encoding_name);
1431  if (imalloc) IMalloc_Release(imalloc);
1432  }
1433 
1434  return ref;
1435 }
Definition: send.c:47
long LONG
Definition: pedump.c:60
static void writeroutput_free(xmlwriteroutput *output, void *mem)
Definition: writer.c:139
GLenum GLint ref
Definition: glext.h:6028
static xmlwriteroutput * impl_from_IXmlWriterOutput(IXmlWriterOutput *iface)
Definition: writer.c:111
#define TRACE(s)
Definition: solgame.cpp:4
static void free_output_buffer(xmlwriteroutput *output)
Definition: writer.c:227
#define InterlockedDecrement
Definition: armddk.h:52

Variable Documentation

◆ closeelementW

const WCHAR closeelementW[] = {'<','/'}
static

◆ closepiW

const WCHAR closepiW[] = {'?','>'}
static

◆ closetagW

const WCHAR closetagW[] = {' ','/','>'}
static

Definition at line 41 of file writer.c.

Referenced by xmlwriter_WriteElementString(), and xmlwriter_WriteEndElement().

◆ gtW

◆ ltW

const WCHAR ltW[] = {'<'}
static

◆ quoteW

const WCHAR quoteW[] = {'"'}
static

Definition at line 46 of file writer.c.

Referenced by write_output_buffer_quoted(), and xmlwriter_WriteAttributeString().

◆ spaceW

const WCHAR spaceW[] = {' '}
static

◆ xmlwriter_vtbl

const struct IXmlWriterVtbl xmlwriter_vtbl
static

Definition at line 1348 of file writer.c.

Referenced by CreateXmlWriter().

◆ xmlwriteroutputvtbl

static const struct IUnknownVtbl xmlwriteroutputvtbl
static
Initial value:
=
{
}
static HRESULT WINAPI xmlwriteroutput_QueryInterface(IXmlWriterOutput *iface, REFIID riid, void **ppvObject)
Definition: writer.c:1385
static ULONG WINAPI xmlwriteroutput_Release(IXmlWriterOutput *iface)
Definition: writer.c:1416
static ULONG WINAPI xmlwriteroutput_AddRef(IXmlWriterOutput *iface)
Definition: writer.c:1408

Definition at line 80 of file writer.c.

Referenced by create_writer_output(), and xmlwriter_SetOutput().