ReactOS 0.4.15-dev-8191-gbc6c731
saxreader.c File Reference
#include <stdio.h>
#include <assert.h>
#include "windows.h"
#include "ole2.h"
#include "msxml2.h"
#include "msxml2did.h"
#include "ocidl.h"
#include "dispex.h"
#include "wine/heap.h"
#include "wine/test.h"
Include dependency graph for saxreader.c:

Go to the source code of this file.

Classes

struct  msxmlsupported_data_t
 
struct  attribute_entry
 
struct  call_entry
 
struct  call_sequence
 
struct  saxlexicalhandler
 
struct  saxdeclhandler
 
struct  mxwriter_write_test_t
 
struct  mxwriter_stream_test_t
 
struct  saxreader_props_test_t
 
struct  feature_ns_entry_t
 
struct  enc_test_entry_t
 
struct  mxwriter_props_t
 
struct  writer_startendelement_t
 
struct  writer_startendelement2_t
 
struct  writer_characters_t
 
struct  addattribute_test_t
 

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define EXPECT_HR(hr, hr_exp)    ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp)
 
#define EXPECT_REF(obj, ref)   _expect_ref((IUnknown*)obj, ref, __LINE__)
 
#define CONTENT_HANDLER_INDEX   0
 
#define NUM_CALL_SEQUENCES   1
 
#define ok_sequence(seq, index, exp, contx, todo)    ok_sequence_(seq, index, (exp), (contx), (todo), __FILE__, __LINE__)
 

Typedefs

typedef enum _CH CH
 
typedef struct mxwriter_write_test_t mxwriter_write_test
 
typedef struct mxwriter_stream_test_t mxwriter_stream_test
 

Enumerations

enum  _CH {
  CH_ENDTEST , CH_PUTDOCUMENTLOCATOR , CH_STARTDOCUMENT , CH_ENDDOCUMENT ,
  CH_STARTPREFIXMAPPING , CH_ENDPREFIXMAPPING , CH_STARTELEMENT , CH_ENDELEMENT ,
  CH_CHARACTERS , CH_IGNORABLEWHITESPACE , CH_PROCESSINGINSTRUCTION , CH_SKIPPEDENTITY ,
  LH_STARTCDATA , LH_ENDCDATA , EH_ERROR , EH_FATALERROR ,
  EH_IGNORABLEWARNING , EVENT_LAST
}
 
enum  startendtype { StartElement = 0x001 , EndElement = 0x010 , StartEndElement = 0x011 , DisableEscaping = 0x100 }
 

Functions

static void _expect_ref (IUnknown *obj, ULONG ref, int line)
 
static LONG get_refcount (void *iface)
 
static BOOL is_clsid_supported (const GUID *clsid, const struct msxmlsupported_data_t *table)
 
static BSTR alloc_str_from_narrow (const char *str)
 
static BSTR _bstr_ (const char *str)
 
static void free_bstrs (void)
 
static void test_saxstr (const char *file, unsigned line, BSTR str, const char *expected, BOOL todo, int *failcount)
 
static void init_call_entry (ISAXLocator *locator, struct call_entry *call)
 
static void add_call (struct call_sequence **seq, int sequence_index, const struct call_entry *call)
 
static void flush_sequence (struct call_sequence **seg, int sequence_index)
 
static const charget_event_name (CH event)
 
static void compare_attributes (const struct call_entry *actual, const struct call_entry *expected, const char *context, BOOL todo, const char *file, int line, int *failcount)
 
static void ok_sequence_ (struct call_sequence **seq, int sequence_index, const struct call_entry *expected, const char *context, BOOL todo, const char *file, int line)
 
static void init_call_sequences (struct call_sequence **seq, int n)
 
static void set_expected_seq (struct call_entry *expected)
 
static HRESULT get_expected_ret (void)
 
static HRESULT WINAPI contentHandler_QueryInterface (ISAXContentHandler *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI contentHandler_AddRef (ISAXContentHandler *iface)
 
static ULONG WINAPI contentHandler_Release (ISAXContentHandler *iface)
 
static HRESULT WINAPI contentHandler_putDocumentLocator (ISAXContentHandler *iface, ISAXLocator *pLocator)
 
static HRESULT WINAPI contentHandler_startDocument (ISAXContentHandler *iface)
 
static HRESULT WINAPI contentHandler_endDocument (ISAXContentHandler *iface)
 
static HRESULT WINAPI contentHandler_startPrefixMapping (ISAXContentHandler *iface, const WCHAR *prefix, int prefix_len, const WCHAR *uri, int uri_len)
 
static HRESULT WINAPI contentHandler_endPrefixMapping (ISAXContentHandler *iface, const WCHAR *prefix, int len)
 
static HRESULT WINAPI contentHandler_startElement (ISAXContentHandler *iface, const WCHAR *uri, int uri_len, const WCHAR *localname, int local_len, const WCHAR *qname, int qname_len, ISAXAttributes *saxattr)
 
static HRESULT WINAPI contentHandler_endElement (ISAXContentHandler *iface, const WCHAR *uri, int uri_len, const WCHAR *localname, int local_len, const WCHAR *qname, int qname_len)
 
static HRESULT WINAPI contentHandler_characters (ISAXContentHandler *iface, const WCHAR *chars, int len)
 
static HRESULT WINAPI contentHandler_ignorableWhitespace (ISAXContentHandler *iface, const WCHAR *chars, int len)
 
static HRESULT WINAPI contentHandler_processingInstruction (ISAXContentHandler *iface, const WCHAR *target, int target_len, const WCHAR *data, int data_len)
 
static HRESULT WINAPI contentHandler_skippedEntity (ISAXContentHandler *iface, const WCHAR *name, int len)
 
static HRESULT WINAPI isaxerrorHandler_QueryInterface (ISAXErrorHandler *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI isaxerrorHandler_AddRef (ISAXErrorHandler *iface)
 
static ULONG WINAPI isaxerrorHandler_Release (ISAXErrorHandler *iface)
 
static HRESULT WINAPI isaxerrorHandler_error (ISAXErrorHandler *iface, ISAXLocator *pLocator, const WCHAR *pErrorMessage, HRESULT hrErrorCode)
 
static HRESULT WINAPI isaxerrorHandler_fatalError (ISAXErrorHandler *iface, ISAXLocator *pLocator, const WCHAR *message, HRESULT hr)
 
static HRESULT WINAPI isaxerrorHandler_ignorableWarning (ISAXErrorHandler *iface, ISAXLocator *pLocator, const WCHAR *pErrorMessage, HRESULT hrErrorCode)
 
static HRESULT WINAPI isaxattributes_QueryInterface (ISAXAttributes *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI isaxattributes_AddRef (ISAXAttributes *iface)
 
static ULONG WINAPI isaxattributes_Release (ISAXAttributes *iface)
 
static HRESULT WINAPI isaxattributes_getLength (ISAXAttributes *iface, int *length)
 
static HRESULT WINAPI isaxattributes_getURI (ISAXAttributes *iface, int nIndex, const WCHAR **pUrl, int *pUriSize)
 
static HRESULT WINAPI isaxattributes_getLocalName (ISAXAttributes *iface, int nIndex, const WCHAR **pLocalName, int *pLocalNameLength)
 
static HRESULT WINAPI isaxattributes_getQName (ISAXAttributes *iface, int index, const WCHAR **QName, int *QNameLength)
 
static HRESULT WINAPI isaxattributes_getName (ISAXAttributes *iface, int nIndex, const WCHAR **pUri, int *pUriLength, const WCHAR **pLocalName, int *pLocalNameSize, const WCHAR **pQName, int *pQNameLength)
 
static HRESULT WINAPI isaxattributes_getIndexFromName (ISAXAttributes *iface, const WCHAR *pUri, int cUriLength, const WCHAR *pLocalName, int cocalNameLength, int *index)
 
static HRESULT WINAPI isaxattributes_getIndexFromQName (ISAXAttributes *iface, const WCHAR *pQName, int nQNameLength, int *index)
 
static HRESULT WINAPI isaxattributes_getType (ISAXAttributes *iface, int nIndex, const WCHAR **pType, int *pTypeLength)
 
static HRESULT WINAPI isaxattributes_getTypeFromName (ISAXAttributes *iface, const WCHAR *pUri, int nUri, const WCHAR *pLocalName, int nLocalName, const WCHAR **pType, int *nType)
 
static HRESULT WINAPI isaxattributes_getTypeFromQName (ISAXAttributes *iface, const WCHAR *pQName, int nQName, const WCHAR **pType, int *nType)
 
static HRESULT WINAPI isaxattributes_getValue (ISAXAttributes *iface, int index, const WCHAR **value, int *nValue)
 
static HRESULT WINAPI isaxattributes_getValueFromName (ISAXAttributes *iface, const WCHAR *pUri, int nUri, const WCHAR *pLocalName, int nLocalName, const WCHAR **pValue, int *nValue)
 
static HRESULT WINAPI isaxattributes_getValueFromQName (ISAXAttributes *iface, const WCHAR *pQName, int nQName, const WCHAR **pValue, int *nValue)
 
static struct saxlexicalhandlerimpl_from_ISAXLexicalHandler (ISAXLexicalHandler *iface)
 
static HRESULT WINAPI isaxlexical_QueryInterface (ISAXLexicalHandler *iface, REFIID riid, void **out)
 
static ULONG WINAPI isaxlexical_AddRef (ISAXLexicalHandler *iface)
 
static ULONG WINAPI isaxlexical_Release (ISAXLexicalHandler *iface)
 
static HRESULT WINAPI isaxlexical_startDTD (ISAXLexicalHandler *iface, const WCHAR *pName, int nName, const WCHAR *pPublicId, int nPublicId, const WCHAR *pSystemId, int nSystemId)
 
static HRESULT WINAPI isaxlexical_endDTD (ISAXLexicalHandler *iface)
 
static HRESULT WINAPI isaxlexical_startEntity (ISAXLexicalHandler *iface, const WCHAR *pName, int nName)
 
static HRESULT WINAPI isaxlexical_endEntity (ISAXLexicalHandler *iface, const WCHAR *pName, int nName)
 
static HRESULT WINAPI isaxlexical_startCDATA (ISAXLexicalHandler *iface)
 
static HRESULT WINAPI isaxlexical_endCDATA (ISAXLexicalHandler *iface)
 
static HRESULT WINAPI isaxlexical_comment (ISAXLexicalHandler *iface, const WCHAR *pChars, int nChars)
 
static void init_saxlexicalhandler (struct saxlexicalhandler *handler, HRESULT hr)
 
static struct saxdeclhandlerimpl_from_ISAXDeclHandler (ISAXDeclHandler *iface)
 
static HRESULT WINAPI isaxdecl_QueryInterface (ISAXDeclHandler *iface, REFIID riid, void **out)
 
static ULONG WINAPI isaxdecl_AddRef (ISAXDeclHandler *iface)
 
static ULONG WINAPI isaxdecl_Release (ISAXDeclHandler *iface)
 
static HRESULT WINAPI isaxdecl_elementDecl (ISAXDeclHandler *iface, const WCHAR *pName, int nName, const WCHAR *pModel, int nModel)
 
static HRESULT WINAPI isaxdecl_attributeDecl (ISAXDeclHandler *iface, const WCHAR *pElementName, int nElementName, const WCHAR *pAttributeName, int nAttributeName, const WCHAR *pType, int nType, const WCHAR *pValueDefault, int nValueDefault, const WCHAR *pValue, int nValue)
 
static HRESULT WINAPI isaxdecl_internalEntityDecl (ISAXDeclHandler *iface, const WCHAR *pName, int nName, const WCHAR *pValue, int nValue)
 
static HRESULT WINAPI isaxdecl_externalEntityDecl (ISAXDeclHandler *iface, const WCHAR *pName, int nName, const WCHAR *pPublicId, int nPublicId, const WCHAR *pSystemId, int nSystemId)
 
static void init_saxdeclhandler (struct saxdeclhandler *handler, HRESULT hr)
 
static HRESULT WINAPI istream_QueryInterface (IStream *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI istream_AddRef (IStream *iface)
 
static ULONG WINAPI istream_Release (IStream *iface)
 
static HRESULT WINAPI istream_Read (IStream *iface, void *pv, ULONG cb, ULONG *pcbRead)
 
static HRESULT WINAPI istream_Write (IStream *iface, const void *pv, ULONG cb, ULONG *pcbWritten)
 
static HRESULT WINAPI istream_Seek (IStream *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
 
static HRESULT WINAPI istream_SetSize (IStream *iface, ULARGE_INTEGER libNewSize)
 
static HRESULT WINAPI istream_CopyTo (IStream *iface, IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *plibWritten)
 
static HRESULT WINAPI istream_Commit (IStream *iface, DWORD grfCommitFlags)
 
static HRESULT WINAPI istream_Revert (IStream *iface)
 
static HRESULT WINAPI istream_LockRegion (IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
 
static HRESULT WINAPI istream_UnlockRegion (IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
 
static HRESULT WINAPI istream_Stat (IStream *iface, STATSTG *pstatstg, DWORD grfStatFlag)
 
static HRESULT WINAPI istream_Clone (IStream *iface, IStream **ppstm)
 
static HRESULT WINAPI mxstream_Write (IStream *iface, const void *pv, ULONG cb, ULONG *pcbWritten)
 
static HRESULT WINAPI instream_Read (IStream *iface, void *pv, ULONG cb, ULONG *pcbRead)
 
static IStreamcreate_test_stream (const char *data, int len)
 
static void test_saxreader (void)
 
static void test_saxreader_properties (void)
 
static void test_saxreader_features (void)
 
static void test_saxreader_encoding (void)
 
static void test_mxwriter_handlers (void)
 
static void test_mxwriter_default_properties (const struct mxwriter_props_t *table)
 
static void test_mxwriter_properties (void)
 
static void test_mxwriter_flush (void)
 
static void test_mxwriter_startenddocument (void)
 
static void get_class_support_data (struct msxmlsupported_data_t *table, REFIID riid)
 
static void test_mxwriter_startendelement_batch (const struct writer_startendelement_t *table)
 
static void test_mxwriter_startendelement_batch2 (const struct writer_startendelement2_t *table)
 
static void test_mxwriter_startendelement (void)
 
static void test_mxwriter_characters (void)
 
static void test_mxwriter_stream (void)
 
static void test_mxwriter_encoding (void)
 
static void test_obj_dispex (IUnknown *obj)
 
static void test_saxreader_dispex (void)
 
static void test_mxwriter_dispex (void)
 
static void test_mxwriter_comment (void)
 
static void test_mxwriter_cdata (void)
 
static void test_mxwriter_pi (void)
 
static void test_mxwriter_ignorablespaces (void)
 
static void test_mxwriter_dtd (void)
 
static void test_mxattr_addAttribute (void)
 
static void test_mxattr_clear (void)
 
static void test_mxattr_dispex (void)
 
static void test_mxattr_qi (void)
 
static void test_mxattr_localname (void)
 
static void test_mxwriter_indent (void)
 
 START_TEST (saxreader)
 

Variables

static const WCHAR emptyW [] = {0}
 
static BSTR alloced_bstrs [512]
 
static int alloced_bstrs_count
 
static const charevent_names [EVENT_LAST]
 
static struct call_sequencesequences [NUM_CALL_SEQUENCES]
 
static const WCHAR szSimpleXML []
 
static const WCHAR carriage_ret_test []
 
static const WCHAR szUtf16XML []
 
static const CHAR szUtf16BOM [] = {0xff, 0xfe}
 
static const CHAR szUtf8XML []
 
static const char utf8xml2 []
 
static const char testXML []
 
static const char test_attributes []
 
static const char test_cdata_xml []
 
static const char test2_cdata_xml []
 
static const char test3_cdata_xml []
 
static struct call_entry content_handler_test1 []
 
static struct call_entry content_handler_test1_alternate []
 
static struct call_entry content_handler_test2 []
 
static struct call_entry content_handler_test2_alternate []
 
static struct call_entry content_handler_testerror []
 
static struct call_entry content_handler_testerror_alternate []
 
static struct call_entry content_handler_test_callback_rets []
 
static struct call_entry content_handler_test_callback_rets_alt []
 
static struct attribute_entry ch_attributes1 []
 
static struct attribute_entry ch_attributes2 []
 
static struct call_entry content_handler_test_attributes []
 
static struct attribute_entry ch_attributes_alt_4 []
 
static struct call_entry content_handler_test_attributes_alternate_4 []
 
static struct attribute_entry ch_attributes_alt_no_ns []
 
static struct call_entry content_handler_test_attributes_alt_no_ns []
 
static struct attribute_entry ch_attributes_alt_6 []
 
static struct attribute_entry ch_attributes2_6 []
 
static struct call_entry content_handler_test_attributes_alternate_6 []
 
static struct attribute_entry ch_attributes_no_prefix []
 
static struct call_entry content_handler_test_attributes_alt_no_prefix []
 
static struct call_entry content_handler_test_attributes_no_prefix []
 
static struct attribute_entry xmlspace_attrs []
 
static struct call_entry xmlspaceattr_test []
 
static struct call_entry xmlspaceattr_test_alternate []
 
static const char attribute_normalize []
 
static struct attribute_entry attribute_norm_attrs []
 
static struct call_entry attribute_norm []
 
static struct call_entry attribute_norm_alt []
 
static struct call_entry cdata_test []
 
static struct call_entry cdata_test2 []
 
static struct call_entry cdata_test3 []
 
static struct call_entry cdata_test_alt []
 
static struct call_entry cdata_test2_alt []
 
static struct call_entry cdata_test3_alt []
 
static struct attribute_entry read_test_attrs []
 
static struct call_entry read_test_seq []
 
static const char xmlspace_attr []
 
static struct call_entryexpectCall
 
static ISAXLocator * locator
 
static ISAXXMLReader * g_reader
 
int msxml_version
 
static ISAXAttributes * test_attr_ptr
 
static const ISAXContentHandlerVtbl contentHandlerVtbl
 
static ISAXContentHandler contentHandler = { &contentHandlerVtbl }
 
static const ISAXErrorHandlerVtbl errorHandlerVtbl
 
static ISAXErrorHandler errorHandler = { &errorHandlerVtbl }
 
static const ISAXAttributesVtbl SAXAttributesVtbl
 
static ISAXAttributes saxattributes = { &SAXAttributesVtbl }
 
static const ISAXLexicalHandlerVtbl SAXLexicalHandlerVtbl
 
static const ISAXDeclHandlerVtbl SAXDeclHandlerVtbl
 
static const mxwriter_write_testcurrent_write_test
 
static DWORD current_stream_test_index
 
static const IStreamVtbl mxstreamVtbl
 
static IStream mxstream = { &mxstreamVtbl }
 
static int read_cnt
 
static const IStreamVtbl instreamVtbl
 
static IStream instream = { &instreamVtbl }
 
static struct msxmlsupported_data_t reader_support_data []
 
static struct saxlexicalhandler lexicalhandler
 
static struct saxdeclhandler declhandler
 
static const struct saxreader_props_test_t props_test_data []
 
static const struct feature_ns_entry_t feature_ns_entry_data []
 
static const charfeature_names []
 
static const CHAR UTF8BOMTest []
 
static const struct enc_test_entry_t encoding_test_data []
 
static struct msxmlsupported_data_t mxwriter_support_data []
 
static struct msxmlsupported_data_t mxattributes_support_data []
 
static const struct mxwriter_props_t mxwriter_default_props []
 
static const char startelement_xml [] = "<uri:local a:attr1=\"a1\" attr2=\"a2\" attr3=\"&lt;&amp;&quot;&gt;\'\">"
 
static const char startendelement_xml [] = "<uri:local a:attr1=\"a1\" attr2=\"a2\" attr3=\"&lt;&amp;&quot;&gt;\'\"/>"
 
static const char startendelement_noescape_xml [] = "<uri:local a:attr1=\"a1\" attr2=\"a2\" attr3=\"<&\">\'\"/>"
 
static const struct writer_startendelement_t writer_startendelement []
 
static const struct writer_startendelement2_t writer_startendelement2 []
 
static const struct writer_characters_t writer_characters []
 
static const mxwriter_stream_test mxwriter_stream_tests []
 
static const charencoding_names []
 
static const addattribute_test_t addattribute_data []
 
static struct msxmlsupported_data_t saxattr_support_data []
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file saxreader.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 24 of file saxreader.c.

◆ CONTENT_HANDLER_INDEX

#define CONTENT_HANDLER_INDEX   0

Definition at line 242 of file saxreader.c.

◆ EXPECT_HR

#define EXPECT_HR (   hr,
  hr_exp 
)     ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp)

Definition at line 41 of file saxreader.c.

◆ EXPECT_REF

#define EXPECT_REF (   obj,
  ref 
)    _expect_ref((IUnknown*)obj, ref, __LINE__)

Definition at line 44 of file saxreader.c.

◆ NUM_CALL_SEQUENCES

#define NUM_CALL_SEQUENCES   1

Definition at line 243 of file saxreader.c.

◆ ok_sequence

#define ok_sequence (   seq,
  index,
  exp,
  contx,
  todo 
)     ok_sequence_(seq, index, (exp), (contx), (todo), __FILE__, __LINE__)

Definition at line 529 of file saxreader.c.

Typedef Documentation

◆ CH

typedef enum _CH CH

◆ mxwriter_stream_test

◆ mxwriter_write_test

Enumeration Type Documentation

◆ _CH

Enumerator
CH_ENDTEST 
CH_PUTDOCUMENTLOCATOR 
CH_STARTDOCUMENT 
CH_ENDDOCUMENT 
CH_STARTPREFIXMAPPING 
CH_ENDPREFIXMAPPING 
CH_STARTELEMENT 
CH_ENDELEMENT 
CH_CHARACTERS 
CH_IGNORABLEWHITESPACE 
CH_PROCESSINGINSTRUCTION 
CH_SKIPPEDENTITY 
LH_STARTCDATA 
LH_ENDCDATA 
EH_ERROR 
EH_FATALERROR 
EH_IGNORABLEWARNING 
EVENT_LAST 

Definition at line 162 of file saxreader.c.

162 {
177 EH_ERROR,
181} CH;
enum _CH CH
@ CH_PROCESSINGINSTRUCTION
Definition: saxreader.c:173
@ CH_ENDELEMENT
Definition: saxreader.c:170
@ CH_SKIPPEDENTITY
Definition: saxreader.c:174
@ CH_STARTPREFIXMAPPING
Definition: saxreader.c:167
@ EH_ERROR
Definition: saxreader.c:177
@ CH_IGNORABLEWHITESPACE
Definition: saxreader.c:172
@ CH_ENDDOCUMENT
Definition: saxreader.c:166
@ EH_IGNORABLEWARNING
Definition: saxreader.c:179
@ LH_STARTCDATA
Definition: saxreader.c:175
@ CH_ENDTEST
Definition: saxreader.c:163
@ EH_FATALERROR
Definition: saxreader.c:178
@ EVENT_LAST
Definition: saxreader.c:180
@ CH_PUTDOCUMENTLOCATOR
Definition: saxreader.c:164
@ LH_ENDCDATA
Definition: saxreader.c:176
@ CH_STARTELEMENT
Definition: saxreader.c:169
@ CH_CHARACTERS
Definition: saxreader.c:171
@ CH_ENDPREFIXMAPPING
Definition: saxreader.c:168
@ CH_STARTDOCUMENT
Definition: saxreader.c:165

◆ startendtype

Enumerator
StartElement 
EndElement 
StartEndElement 
DisableEscaping 

Definition at line 3524 of file saxreader.c.

3525{
3526 StartElement = 0x001,
3527 EndElement = 0x010,
3528 StartEndElement = 0x011,
3529 DisableEscaping = 0x100
3530};
@ StartEndElement
Definition: saxreader.c:3528
@ StartElement
Definition: saxreader.c:3526
@ DisableEscaping
Definition: saxreader.c:3529
@ EndElement
Definition: saxreader.c:3527

Function Documentation

◆ _bstr_()

◆ _expect_ref()

static void _expect_ref ( IUnknown obj,
ULONG  ref,
int  line 
)
static

Definition at line 45 of file saxreader.c.

46{
47 ULONG rc;
48 IUnknown_AddRef(obj);
49 rc = IUnknown_Release(obj);
50 ok_(__FILE__, line)(rc == ref, "expected refcount %d, got %d\n", ref, rc);
51}
#define ok_(x1, x2)
Definition: atltest.h:61
Definition: parser.c:49
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ add_call()

static void add_call ( struct call_sequence **  seq,
int  sequence_index,
const struct call_entry call 
)
static

Definition at line 253 of file saxreader.c.

255{
256 struct call_sequence *call_seq = seq[sequence_index];
257
258 if (!call_seq->sequence)
259 {
260 call_seq->size = 10;
261 call_seq->sequence = heap_alloc(call_seq->size * sizeof (struct call_entry));
262 }
263
264 if (call_seq->count == call_seq->size)
265 {
266 call_seq->size *= 2;
267 call_seq->sequence = heap_realloc(call_seq->sequence, call_seq->size * sizeof (struct call_entry));
268 }
269
270 assert(call_seq->sequence);
271
272 call_seq->sequence[call_seq->count].id = call->id;
273 call_seq->sequence[call_seq->count].line = call->line;
274 call_seq->sequence[call_seq->count].column = call->column;
275 call_seq->sequence[call_seq->count].arg1W = call->arg1W;
276 call_seq->sequence[call_seq->count].arg2W = call->arg2W;
277 call_seq->sequence[call_seq->count].arg3W = call->arg3W;
278 call_seq->sequence[call_seq->count].ret = call->ret;
279 call_seq->sequence[call_seq->count].attr_count = call->attr_count;
280 call_seq->sequence[call_seq->count].attributes = call->attributes;
281
282 call_seq->count++;
283}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
Definition: saxreader.c:216
BSTR arg3W
Definition: saxreader.c:232
int column
Definition: saxreader.c:219
CH id
Definition: saxreader.c:217
BSTR arg1W
Definition: saxreader.c:230
int attr_count
Definition: saxreader.c:227
BSTR arg2W
Definition: saxreader.c:231
HRESULT ret
Definition: saxreader.c:220
int line
Definition: saxreader.c:218
struct attribute_entry * attributes
Definition: saxreader.c:226
struct call_entry * sequence
Definition: saxreader.c:239
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

Referenced by contentHandler_characters(), contentHandler_endDocument(), contentHandler_endElement(), contentHandler_endPrefixMapping(), contentHandler_ignorableWhitespace(), contentHandler_processingInstruction(), contentHandler_putDocumentLocator(), contentHandler_skippedEntity(), contentHandler_startDocument(), contentHandler_startElement(), contentHandler_startPrefixMapping(), isaxerrorHandler_fatalError(), isaxlexical_endCDATA(), isaxlexical_startCDATA(), and ok_sequence_().

◆ alloc_str_from_narrow()

static BSTR alloc_str_from_narrow ( const char str)
static

Definition at line 80 of file saxreader.c.

81{
82 int len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
83 BSTR ret = SysAllocStringLen(NULL, len - 1); /* NUL character added automatically */
85 return ret;
86}
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
OLECHAR * BSTR
Definition: compat.h:2293
#define MultiByteToWideChar
Definition: compat.h:110
GLenum GLsizei len
Definition: glext.h:6722
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
int ret

Referenced by _bstr_().

◆ compare_attributes()

static void compare_attributes ( const struct call_entry actual,
const struct call_entry expected,
const char context,
BOOL  todo,
const char file,
int  line,
int failcount 
)
static

Definition at line 320 of file saxreader.c.

322{
323 int i, lenexp = 0;
324
325 /* attribute count is not stored for expected data */
326 if (expected->attributes)
327 {
328 struct attribute_entry *ptr = expected->attributes;
329 while (ptr->uri) { lenexp++; ptr++; };
330 }
331
332 /* check count first and exit earlier */
333 if (actual->attr_count != lenexp && todo)
334 {
335 (*failcount)++;
337 ok_(file, line) (FALSE, "%s: in event %s expecting attr count %d got %d\n",
338 context, get_event_name(actual->id), lenexp, actual->attr_count);
339 }
340 else
341 ok_(file, line) (actual->attr_count == lenexp, "%s: in event %s expecting attr count %d got %d\n",
342 context, get_event_name(actual->id), lenexp, actual->attr_count);
343
344 if (actual->attr_count != lenexp) return;
345
346 /* now compare all attributes strings */
347 for (i = 0; i < actual->attr_count; i++)
348 {
349 test_saxstr(file, line, actual->attributes[i].uriW, expected->attributes[i].uri, todo, failcount);
350 test_saxstr(file, line, actual->attributes[i].localW, expected->attributes[i].local, todo, failcount);
351 test_saxstr(file, line, actual->attributes[i].qnameW, expected->attributes[i].qname, todo, failcount);
352 test_saxstr(file, line, actual->attributes[i].valueW, expected->attributes[i].value, todo, failcount);
353 }
354}
#define FALSE
Definition: types.h:117
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
static PVOID ptr
Definition: dispmode.c:27
BOOL todo
Definition: filedlg.c:313
BOOL expected
Definition: store.c:2063
#define todo_wine
Definition: custom.c:79
static const char * get_event_name(CH event)
Definition: saxreader.c:315
static void test_saxstr(const char *file, unsigned line, BSTR str, const char *expected, BOOL todo, int *failcount)
Definition: saxreader.c:106
Definition: saxreader.c:203
Definition: http.c:7252
Definition: fci.c:127

Referenced by ok_sequence_().

◆ contentHandler_AddRef()

static ULONG WINAPI contentHandler_AddRef ( ISAXContentHandler *  iface)
static

Definition at line 1073 of file saxreader.c.

1075{
1076 return 2;
1077}

◆ contentHandler_characters()

static HRESULT WINAPI contentHandler_characters ( ISAXContentHandler *  iface,
const WCHAR chars,
int  len 
)
static

Definition at line 1298 of file saxreader.c.

1302{
1303 struct call_entry call;
1304
1305 ok(chars != NULL, "chars == NULL\n");
1306
1307 init_call_entry(locator, &call);
1308 call.id = CH_CHARACTERS;
1309 call.arg1W = SysAllocStringLen(chars, len);
1311
1312 return get_expected_ret();
1313}
#define ok(value,...)
Definition: atltest.h:57
static HRESULT get_expected_ret(void)
Definition: saxreader.c:1047
#define CONTENT_HANDLER_INDEX
Definition: saxreader.c:242
static void add_call(struct call_sequence **seq, int sequence_index, const struct call_entry *call)
Definition: saxreader.c:253
static void init_call_entry(ISAXLocator *locator, struct call_entry *call)
Definition: saxreader.c:246
static struct call_sequence * sequences[NUM_CALL_SEQUENCES]
Definition: saxreader.c:244

◆ contentHandler_endDocument()

static HRESULT WINAPI contentHandler_endDocument ( ISAXContentHandler *  iface)
static

Definition at line 1146 of file saxreader.c.

1148{
1149 struct call_entry call;
1150
1151 init_call_entry(locator, &call);
1152 call.id = CH_ENDDOCUMENT;
1154
1155 return get_expected_ret();
1156}

◆ contentHandler_endElement()

static HRESULT WINAPI contentHandler_endElement ( ISAXContentHandler *  iface,
const WCHAR uri,
int  uri_len,
const WCHAR localname,
int  local_len,
const WCHAR qname,
int  qname_len 
)
static

Definition at line 1276 of file saxreader.c.

1281{
1282 struct call_entry call;
1283
1284 ok(uri != NULL, "uri == NULL\n");
1285 ok(localname != NULL, "localname == NULL\n");
1286 ok(qname != NULL, "qname == NULL\n");
1287
1288 init_call_entry(locator, &call);
1289 call.id = CH_ENDELEMENT;
1290 call.arg1W = SysAllocStringLen(uri, uri_len);
1291 call.arg2W = SysAllocStringLen(localname, local_len);
1292 call.arg3W = SysAllocStringLen(qname, qname_len);
1294
1295 return get_expected_ret();
1296}
const char * uri
Definition: sec_mgr.c:1588

◆ contentHandler_endPrefixMapping()

static HRESULT WINAPI contentHandler_endPrefixMapping ( ISAXContentHandler *  iface,
const WCHAR prefix,
int  len 
)
static

Definition at line 1177 of file saxreader.c.

1180{
1181 struct call_entry call;
1182
1183 ok(prefix != NULL, "prefix == NULL\n");
1184
1185 init_call_entry(locator, &call);
1186 call.id = CH_ENDPREFIXMAPPING;
1187 call.arg1W = SysAllocStringLen(prefix, len);
1189
1190 return get_expected_ret();
1191}

◆ contentHandler_ignorableWhitespace()

static HRESULT WINAPI contentHandler_ignorableWhitespace ( ISAXContentHandler *  iface,
const WCHAR chars,
int  len 
)
static

Definition at line 1315 of file saxreader.c.

1318{
1319 struct call_entry call;
1320
1321 ok(chars != NULL, "chars == NULL\n");
1322
1323 init_call_entry(locator, &call);
1324 call.id = CH_IGNORABLEWHITESPACE;
1325 call.arg1W = SysAllocStringLen(chars, len);
1327
1328 return get_expected_ret();
1329}

◆ contentHandler_processingInstruction()

static HRESULT WINAPI contentHandler_processingInstruction ( ISAXContentHandler *  iface,
const WCHAR target,
int  target_len,
const WCHAR data,
int  data_len 
)
static

Definition at line 1331 of file saxreader.c.

1335{
1336 struct call_entry call;
1337
1338 ok(target != NULL, "target == NULL\n");
1339 ok(data != NULL, "data == NULL\n");
1340
1341 init_call_entry(locator, &call);
1342 call.id = CH_PROCESSINGINSTRUCTION;
1343 call.arg1W = SysAllocStringLen(target, target_len);
1344 call.arg2W = SysAllocStringLen(data, data_len);
1346
1347 return get_expected_ret();
1348}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum target
Definition: glext.h:7315

◆ contentHandler_putDocumentLocator()

static HRESULT WINAPI contentHandler_putDocumentLocator ( ISAXContentHandler *  iface,
ISAXLocator *  pLocator 
)
static

Definition at line 1085 of file saxreader.c.

1088{
1089 struct call_entry call;
1090 IUnknown *unk;
1091 HRESULT hr;
1092
1093 locator = pLocator;
1094
1095 init_call_entry(locator, &call);
1096 call.id = CH_PUTDOCUMENTLOCATOR;
1098
1099 hr = ISAXLocator_QueryInterface(pLocator, &IID_IVBSAXLocator, (void**)&unk);
1101
1102 if (msxml_version >= 6) {
1103 ISAXAttributes *attr, *attr1;
1104 IMXAttributes *mxattr;
1105
1106 EXPECT_REF(pLocator, 1);
1107 hr = ISAXLocator_QueryInterface(pLocator, &IID_ISAXAttributes, (void**)&attr);
1108 EXPECT_HR(hr, S_OK);
1109 EXPECT_REF(pLocator, 2);
1110 hr = ISAXLocator_QueryInterface(pLocator, &IID_ISAXAttributes, (void**)&attr1);
1111 EXPECT_HR(hr, S_OK);
1112 EXPECT_REF(pLocator, 3);
1113 ok(attr == attr1, "got %p, %p\n", attr, attr1);
1114
1115 hr = ISAXAttributes_QueryInterface(attr, &IID_IVBSAXAttributes, (void**)&unk);
1117
1118 hr = ISAXLocator_QueryInterface(pLocator, &IID_IVBSAXAttributes, (void**)&unk);
1120
1121 hr = ISAXAttributes_QueryInterface(attr, &IID_IMXAttributes, (void**)&mxattr);
1123
1124 ISAXAttributes_Release(attr);
1125 ISAXAttributes_Release(attr1);
1126 }
1127
1128 return get_expected_ret();
1129}
#define S_OK
Definition: intsafe.h:52
#define EXPECT_HR(hr, hr_exp)
Definition: saxreader.c:41
#define EXPECT_REF(obj, ref)
Definition: saxreader.c:44
int msxml_version
Definition: saxreader.c:1039
HRESULT hr
Definition: shlfolder.c:183
Definition: cookie.c:202
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ contentHandler_QueryInterface()

static HRESULT WINAPI contentHandler_QueryInterface ( ISAXContentHandler *  iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 1054 of file saxreader.c.

1058{
1059 *ppvObject = NULL;
1060
1061 if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ISAXContentHandler))
1062 {
1063 *ppvObject = iface;
1064 }
1065 else
1066 {
1067 return E_NOINTERFACE;
1068 }
1069
1070 return S_OK;
1071}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082

◆ contentHandler_Release()

static ULONG WINAPI contentHandler_Release ( ISAXContentHandler *  iface)
static

Definition at line 1079 of file saxreader.c.

1081{
1082 return 1;
1083}

◆ contentHandler_skippedEntity()

static HRESULT WINAPI contentHandler_skippedEntity ( ISAXContentHandler *  iface,
const WCHAR name,
int  len 
)
static

Definition at line 1350 of file saxreader.c.

1353{
1354 struct call_entry call;
1355
1356 ok(name != NULL, "name == NULL\n");
1357
1358 init_call_entry(locator, &call);
1359 call.id = CH_SKIPPEDENTITY;
1360 call.arg1W = SysAllocStringLen(name, len);
1362
1363 return get_expected_ret();
1364}
Definition: name.c:39

◆ contentHandler_startDocument()

static HRESULT WINAPI contentHandler_startDocument ( ISAXContentHandler *  iface)
static

Definition at line 1132 of file saxreader.c.

1134{
1135 struct call_entry call;
1136
1137 init_call_entry(locator, &call);
1138 call.id = CH_STARTDOCUMENT;
1140
1142
1143 return get_expected_ret();
1144}
static ISAXAttributes * test_attr_ptr
Definition: saxreader.c:1131

◆ contentHandler_startElement()

static HRESULT WINAPI contentHandler_startElement ( ISAXContentHandler *  iface,
const WCHAR uri,
int  uri_len,
const WCHAR localname,
int  local_len,
const WCHAR qname,
int  qname_len,
ISAXAttributes *  saxattr 
)
static

Definition at line 1193 of file saxreader.c.

1199{
1200 struct call_entry call;
1201 IMXAttributes *mxattr;
1202 HRESULT hr;
1203 int len;
1204
1205 ok(uri != NULL, "uri == NULL\n");
1206 ok(localname != NULL, "localname == NULL\n");
1207 ok(qname != NULL, "qname == NULL\n");
1208
1209 hr = ISAXAttributes_QueryInterface(saxattr, &IID_IMXAttributes, (void**)&mxattr);
1211
1212 init_call_entry(locator, &call);
1213 call.id = CH_STARTELEMENT;
1214 call.arg1W = SysAllocStringLen(uri, uri_len);
1215 call.arg2W = SysAllocStringLen(localname, local_len);
1216 call.arg3W = SysAllocStringLen(qname, qname_len);
1217
1218 if(!test_attr_ptr)
1219 test_attr_ptr = saxattr;
1220 ok(test_attr_ptr == saxattr, "Multiple ISAXAttributes instances are used (%p %p)\n", test_attr_ptr, saxattr);
1221
1222 /* store actual attributes */
1223 len = 0;
1224 hr = ISAXAttributes_getLength(saxattr, &len);
1225 EXPECT_HR(hr, S_OK);
1226
1227 if (len)
1228 {
1230 int i;
1231
1232 struct attribute_entry *attr;
1233 attr = heap_alloc_zero(len * sizeof(*attr));
1234
1235 v = VARIANT_TRUE;
1236 hr = ISAXXMLReader_getFeature(g_reader, _bstr_("http://xml.org/sax/features/namespaces"), &v);
1237 EXPECT_HR(hr, S_OK);
1238
1239 for (i = 0; i < len; i++)
1240 {
1241 const WCHAR *value;
1242 int value_len;
1243
1244 hr = ISAXAttributes_getName(saxattr, i, &uri, &uri_len,
1245 &localname, &local_len, &qname, &qname_len);
1246 EXPECT_HR(hr, S_OK);
1247
1248 hr = ISAXAttributes_getValue(saxattr, i, &value, &value_len);
1249 EXPECT_HR(hr, S_OK);
1250
1251 /* if 'namespaces' switched off uri and local name contains garbage */
1252 if (v == VARIANT_FALSE && msxml_version > 0)
1253 {
1254 attr[i].uriW = SysAllocStringLen(NULL, 0);
1255 attr[i].localW = SysAllocStringLen(NULL, 0);
1256 }
1257 else
1258 {
1259 attr[i].uriW = SysAllocStringLen(uri, uri_len);
1260 attr[i].localW = SysAllocStringLen(localname, local_len);
1261 }
1262
1263 attr[i].qnameW = SysAllocStringLen(qname, qname_len);
1264 attr[i].valueW = SysAllocStringLen(value, value_len);
1265 }
1266
1267 call.attributes = attr;
1268 call.attr_count = len;
1269 }
1270
1272
1273 return get_expected_ret();
1274}
short VARIANT_BOOL
Definition: compat.h:2290
const GLdouble * v
Definition: gl.h:2040
static BSTR _bstr_(const char *str)
Definition: saxreader.c:91
static ISAXXMLReader * g_reader
Definition: saxreader.c:1038
const char * value
Definition: saxreader.c:207
const char * qname
Definition: saxreader.c:206
Definition: pdh_main.c:94
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ contentHandler_startPrefixMapping()

static HRESULT WINAPI contentHandler_startPrefixMapping ( ISAXContentHandler *  iface,
const WCHAR prefix,
int  prefix_len,
const WCHAR uri,
int  uri_len 
)
static

Definition at line 1158 of file saxreader.c.

1162{
1163 struct call_entry call;
1164
1165 ok(prefix != NULL, "prefix == NULL\n");
1166 ok(uri != NULL, "uri == NULL\n");
1167
1168 init_call_entry(locator, &call);
1169 call.id = CH_STARTPREFIXMAPPING;
1170 call.arg1W = SysAllocStringLen(prefix, prefix_len);
1171 call.arg2W = SysAllocStringLen(uri, uri_len);
1173
1174 return get_expected_ret();
1175}

◆ create_test_stream()

static IStream * create_test_stream ( const char data,
int  len 
)
static

Definition at line 2120 of file saxreader.c.

2121{
2124 IStream *stream;
2125 ULONG written;
2126
2127 if (len == -1) len = strlen(data);
2129 size.QuadPart = len;
2130 IStream_SetSize(stream, size);
2131 IStream_Write(stream, data, len, &written);
2132 pos.QuadPart = 0;
2133 IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
2134
2135 return stream;
2136}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
GLsizeiptr size
Definition: glext.h:5919
Definition: parse.h:23

◆ flush_sequence()

static void flush_sequence ( struct call_sequence **  seg,
int  sequence_index 
)
inlinestatic

Definition at line 285 of file saxreader.c.

286{
287 int i;
288
289 struct call_sequence *call_seq = seg[sequence_index];
290
291 for (i = 0; i < call_seq->count; i++)
292 {
293 int j;
294
295 for (j = 0; j < call_seq->sequence[i].attr_count; j++)
296 {
297 SysFreeString(call_seq->sequence[i].attributes[j].uriW);
298 SysFreeString(call_seq->sequence[i].attributes[j].localW);
299 SysFreeString(call_seq->sequence[i].attributes[j].qnameW);
300 SysFreeString(call_seq->sequence[i].attributes[j].valueW);
301 }
302 heap_free(call_seq->sequence[i].attributes);
303 call_seq->sequence[i].attr_count = 0;
304
305 SysFreeString(call_seq->sequence[i].arg1W);
306 SysFreeString(call_seq->sequence[i].arg2W);
307 SysFreeString(call_seq->sequence[i].arg3W);
308 }
309
310 heap_free(call_seq->sequence);
311 call_seq->sequence = NULL;
312 call_seq->count = call_seq->size = 0;
313}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
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 GLint GLint j
Definition: glfuncs.h:250
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271

◆ free_bstrs()

◆ get_class_support_data()

static void get_class_support_data ( struct msxmlsupported_data_t table,
REFIID  riid 
)
static

Definition at line 3654 of file saxreader.c.

3655{
3656 while (table->clsid)
3657 {
3658 IUnknown *unk;
3659 HRESULT hr;
3660
3661 hr = CoCreateInstance(table->clsid, NULL, CLSCTX_INPROC_SERVER, riid, (void**)&unk);
3662 if (hr == S_OK) IUnknown_Release(unk);
3663
3664 table->supported = hr == S_OK;
3665 if (hr != S_OK) win_skip("class %s not supported\n", table->name);
3666
3667 table++;
3668 }
3669}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define win_skip
Definition: test.h:163
const WCHAR * name

Referenced by START_TEST().

◆ get_event_name()

static const char * get_event_name ( CH  event)
static

Definition at line 315 of file saxreader.c.

316{
317 return event_names[event];
318}
struct _cl_event * event
Definition: glext.h:7739
static const char * event_names[EVENT_LAST]
Definition: saxreader.c:183

Referenced by compare_attributes(), and ok_sequence_().

◆ get_expected_ret()

◆ get_refcount()

static LONG get_refcount ( void iface)
static

Definition at line 53 of file saxreader.c.

54{
55 IUnknown *unk = iface;
56 LONG ref;
57
58 ref = IUnknown_AddRef(unk);
59 IUnknown_Release(unk);
60 return ref-1;
61}
long LONG
Definition: pedump.c:60

Referenced by test_mxwriter_flush(), and test_saxreader_properties().

◆ impl_from_ISAXDeclHandler()

static struct saxdeclhandler * impl_from_ISAXDeclHandler ( ISAXDeclHandler *  iface)
inlinestatic

Definition at line 1819 of file saxreader.c.

1820{
1821 return CONTAINING_RECORD(iface, struct saxdeclhandler, ISAXDeclHandler_iface);
1822}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by isaxdecl_AddRef(), isaxdecl_QueryInterface(), and isaxdecl_Release().

◆ impl_from_ISAXLexicalHandler()

static struct saxlexicalhandler * impl_from_ISAXLexicalHandler ( ISAXLexicalHandler *  iface)
inlinestatic

Definition at line 1691 of file saxreader.c.

1692{
1693 return CONTAINING_RECORD(iface, struct saxlexicalhandler, ISAXLexicalHandler_iface);
1694}

Referenced by isaxlexical_AddRef(), isaxlexical_QueryInterface(), and isaxlexical_Release().

◆ init_call_entry()

◆ init_call_sequences()

static void init_call_sequences ( struct call_sequence **  seq,
int  n 
)
static

Definition at line 532 of file saxreader.c.

533{
534 int i;
535
536 for (i = 0; i < n; i++)
537 seq[i] = heap_alloc_zero(sizeof(struct call_sequence));
538}
GLdouble n
Definition: glext.h:7729

Referenced by START_TEST().

◆ init_saxdeclhandler()

static void init_saxdeclhandler ( struct saxdeclhandler handler,
HRESULT  hr 
)
static

Definition at line 1903 of file saxreader.c.

1904{
1905 handler->ISAXDeclHandler_iface.lpVtbl = &SAXDeclHandlerVtbl;
1906 handler->ref = 1;
1907 handler->qi_hr = hr;
1908}
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7482
static const ISAXDeclHandlerVtbl SAXDeclHandlerVtbl
Definition: saxreader.c:1892

Referenced by test_saxreader_properties().

◆ init_saxlexicalhandler()

static void init_saxlexicalhandler ( struct saxlexicalhandler handler,
HRESULT  hr 
)
static

Definition at line 1804 of file saxreader.c.

1805{
1806 handler->ISAXLexicalHandler_iface.lpVtbl = &SAXLexicalHandlerVtbl;
1807 handler->ref = 1;
1808 handler->qi_hr = hr;
1809}
static const ISAXLexicalHandlerVtbl SAXLexicalHandlerVtbl
Definition: saxreader.c:1790

Referenced by test_saxreader(), and test_saxreader_properties().

◆ instream_Read()

static HRESULT WINAPI instream_Read ( IStream iface,
void pv,
ULONG  cb,
ULONG pcbRead 
)
static

Definition at line 2070 of file saxreader.c.

2071{
2072 static const char *ret_str;
2073
2074 if(!read_cnt)
2075 ret_str = "<?xml version=\"1.0\" ?>\n<rootelem>";
2076 else if(read_cnt < 5)
2077 ret_str = "<elem attr=\"val\">text</elem>";
2078 else if(read_cnt == 5)
2079 ret_str = "</rootelem>\n";
2080 else
2081 ret_str = "";
2082
2083 read_cnt++;
2084 strcpy(pv, ret_str);
2085 *pcbRead = strlen(ret_str);
2086 return S_OK;
2087}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static int read_cnt
Definition: saxreader.c:2068

◆ is_clsid_supported()

static BOOL is_clsid_supported ( const GUID clsid,
const struct msxmlsupported_data_t table 
)
static

◆ isaxattributes_AddRef()

static ULONG WINAPI isaxattributes_AddRef ( ISAXAttributes *  iface)
static

Definition at line 1486 of file saxreader.c.

1487{
1488 return 2;
1489}

◆ isaxattributes_getIndexFromName()

static HRESULT WINAPI isaxattributes_getIndexFromName ( ISAXAttributes *  iface,
const WCHAR pUri,
int  cUriLength,
const WCHAR pLocalName,
int  cocalNameLength,
int index 
)
static

Definition at line 1560 of file saxreader.c.

1567{
1568 ok(0, "unexpected call\n");
1569 return E_NOTIMPL;
1570}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ isaxattributes_getIndexFromQName()

static HRESULT WINAPI isaxattributes_getIndexFromQName ( ISAXAttributes *  iface,
const WCHAR pQName,
int  nQNameLength,
int index 
)
static

Definition at line 1572 of file saxreader.c.

1577{
1578 ok(0, "unexpected call\n");
1579 return E_NOTIMPL;
1580}

◆ isaxattributes_getLength()

static HRESULT WINAPI isaxattributes_getLength ( ISAXAttributes *  iface,
int length 
)
static

Definition at line 1496 of file saxreader.c.

1497{
1498 *length = 3;
1499 return S_OK;
1500}
GLuint GLsizei GLsizei * length
Definition: glext.h:6040

◆ isaxattributes_getLocalName()

static HRESULT WINAPI isaxattributes_getLocalName ( ISAXAttributes *  iface,
int  nIndex,
const WCHAR **  pLocalName,
int pLocalNameLength 
)
static

Definition at line 1512 of file saxreader.c.

1517{
1518 ok(0, "unexpected call\n");
1519 return E_NOTIMPL;
1520}

◆ isaxattributes_getName()

static HRESULT WINAPI isaxattributes_getName ( ISAXAttributes *  iface,
int  nIndex,
const WCHAR **  pUri,
int pUriLength,
const WCHAR **  pLocalName,
int pLocalNameSize,
const WCHAR **  pQName,
int pQNameLength 
)
static

Definition at line 1546 of file saxreader.c.

1555{
1556 ok(0, "unexpected call\n");
1557 return E_NOTIMPL;
1558}

◆ isaxattributes_getQName()

static HRESULT WINAPI isaxattributes_getQName ( ISAXAttributes *  iface,
int  index,
const WCHAR **  QName,
int QNameLength 
)
static

Definition at line 1522 of file saxreader.c.

1527{
1528 static const WCHAR attrqnamesW[][15] = {{'a',':','a','t','t','r','1','j','u','n','k',0},
1529 {'a','t','t','r','2','j','u','n','k',0},
1530 {'a','t','t','r','3',0}};
1531 static const int attrqnamelen[] = {7, 5, 5};
1532
1533 ok(index >= 0 && index <= 2, "invalid index received %d\n", index);
1534
1535 if (index >= 0 && index <= 2) {
1536 *QName = attrqnamesW[index];
1537 *QNameLength = attrqnamelen[index];
1538 } else {
1539 *QName = NULL;
1540 *QNameLength = 0;
1541 }
1542
1543 return S_OK;
1544}
#define index(s, c)
Definition: various.h:29
GLuint index
Definition: glext.h:6031

◆ isaxattributes_getType()

static HRESULT WINAPI isaxattributes_getType ( ISAXAttributes *  iface,
int  nIndex,
const WCHAR **  pType,
int pTypeLength 
)
static

Definition at line 1582 of file saxreader.c.

1587{
1588 ok(0, "unexpected call\n");
1589 return E_NOTIMPL;
1590}

◆ isaxattributes_getTypeFromName()

static HRESULT WINAPI isaxattributes_getTypeFromName ( ISAXAttributes *  iface,
const WCHAR pUri,
int  nUri,
const WCHAR pLocalName,
int  nLocalName,
const WCHAR **  pType,
int nType 
)
static

Definition at line 1592 of file saxreader.c.

1600{
1601 ok(0, "unexpected call\n");
1602 return E_NOTIMPL;
1603}

◆ isaxattributes_getTypeFromQName()

static HRESULT WINAPI isaxattributes_getTypeFromQName ( ISAXAttributes *  iface,
const WCHAR pQName,
int  nQName,
const WCHAR **  pType,
int nType 
)
static

Definition at line 1605 of file saxreader.c.

1611{
1612 ok(0, "unexpected call\n");
1613 return E_NOTIMPL;
1614}

◆ isaxattributes_getURI()

static HRESULT WINAPI isaxattributes_getURI ( ISAXAttributes *  iface,
int  nIndex,
const WCHAR **  pUrl,
int pUriSize 
)
static

Definition at line 1502 of file saxreader.c.

1507{
1508 ok(0, "unexpected call\n");
1509 return E_NOTIMPL;
1510}

◆ isaxattributes_getValue()

static HRESULT WINAPI isaxattributes_getValue ( ISAXAttributes *  iface,
int  index,
const WCHAR **  value,
int nValue 
)
static

Definition at line 1616 of file saxreader.c.

1618{
1619 static const WCHAR attrvaluesW[][10] = {{'a','1','j','u','n','k',0},
1620 {'a','2','j','u','n','k',0},
1621 {'<','&','"','>','\'',0}};
1622 static const int attrvalueslen[] = {2, 2, 5};
1623
1624 ok(index >= 0 && index <= 2, "invalid index received %d\n", index);
1625
1626 if (index >= 0 && index <= 2) {
1627 *value = attrvaluesW[index];
1628 *nValue = attrvalueslen[index];
1629 } else {
1630 *value = NULL;
1631 *nValue = 0;
1632 }
1633
1634 return S_OK;
1635}

◆ isaxattributes_getValueFromName()

static HRESULT WINAPI isaxattributes_getValueFromName ( ISAXAttributes *  iface,
const WCHAR pUri,
int  nUri,
const WCHAR pLocalName,
int  nLocalName,
const WCHAR **  pValue,
int nValue 
)
static

Definition at line 1637 of file saxreader.c.

1645{
1646 ok(0, "unexpected call\n");
1647 return E_NOTIMPL;
1648}

◆ isaxattributes_getValueFromQName()

static HRESULT WINAPI isaxattributes_getValueFromQName ( ISAXAttributes *  iface,
const WCHAR pQName,
int  nQName,
const WCHAR **  pValue,
int nValue 
)
static

Definition at line 1650 of file saxreader.c.

1656{
1657 ok(0, "unexpected call\n");
1658 return E_NOTIMPL;
1659}

◆ isaxattributes_QueryInterface()

static HRESULT WINAPI isaxattributes_QueryInterface ( ISAXAttributes *  iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 1467 of file saxreader.c.

1471{
1472 *ppvObject = NULL;
1473
1474 if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ISAXAttributes))
1475 {
1476 *ppvObject = iface;
1477 }
1478 else
1479 {
1480 return E_NOINTERFACE;
1481 }
1482
1483 return S_OK;
1484}

◆ isaxattributes_Release()

static ULONG WINAPI isaxattributes_Release ( ISAXAttributes *  iface)
static

Definition at line 1491 of file saxreader.c.

1492{
1493 return 1;
1494}

◆ isaxdecl_AddRef()

static ULONG WINAPI isaxdecl_AddRef ( ISAXDeclHandler *  iface)
static

Definition at line 1849 of file saxreader.c.

1850{
1852 return InterlockedIncrement(&handler->ref);
1853}
#define InterlockedIncrement
Definition: armddk.h:53
static struct saxdeclhandler * impl_from_ISAXDeclHandler(ISAXDeclHandler *iface)
Definition: saxreader.c:1819

◆ isaxdecl_attributeDecl()

static HRESULT WINAPI isaxdecl_attributeDecl ( ISAXDeclHandler *  iface,
const WCHAR pElementName,
int  nElementName,
const WCHAR pAttributeName,
int  nAttributeName,
const WCHAR pType,
int  nType,
const WCHAR pValueDefault,
int  nValueDefault,
const WCHAR pValue,
int  nValue 
)
static

Definition at line 1868 of file saxreader.c.

1872{
1873 ok(0, "call not expected\n");
1874 return E_NOTIMPL;
1875}

◆ isaxdecl_elementDecl()

static HRESULT WINAPI isaxdecl_elementDecl ( ISAXDeclHandler *  iface,
const WCHAR pName,
int  nName,
const WCHAR pModel,
int  nModel 
)
static

Definition at line 1861 of file saxreader.c.

1863{
1864 ok(0, "call not expected\n");
1865 return E_NOTIMPL;
1866}

◆ isaxdecl_externalEntityDecl()

static HRESULT WINAPI isaxdecl_externalEntityDecl ( ISAXDeclHandler *  iface,
const WCHAR pName,
int  nName,
const WCHAR pPublicId,
int  nPublicId,
const WCHAR pSystemId,
int  nSystemId 
)
static

Definition at line 1884 of file saxreader.c.

1887{
1888 ok(0, "call not expected\n");
1889 return E_NOTIMPL;
1890}

◆ isaxdecl_internalEntityDecl()

static HRESULT WINAPI isaxdecl_internalEntityDecl ( ISAXDeclHandler *  iface,
const WCHAR pName,
int  nName,
const WCHAR pValue,
int  nValue 
)
static

Definition at line 1877 of file saxreader.c.

1879{
1880 ok(0, "call not expected\n");
1881 return E_NOTIMPL;
1882}

◆ isaxdecl_QueryInterface()

static HRESULT WINAPI isaxdecl_QueryInterface ( ISAXDeclHandler *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 1824 of file saxreader.c.

1825{
1827
1828 *out = NULL;
1829
1831 {
1832 *out = iface;
1833 ok(0, "got unexpected IID_IUnknown query\n");
1834 }
1835 else if (IsEqualGUID(riid, &IID_ISAXDeclHandler))
1836 {
1837 if (handler->qi_hr == E_NOINTERFACE) return handler->qi_hr;
1838 *out = iface;
1839 }
1840
1841 if (*out)
1842 ISAXDeclHandler_AddRef(iface);
1843 else
1844 return E_NOINTERFACE;
1845
1846 return S_OK;
1847}
static FILE * out
Definition: regtests2xml.c:44

◆ isaxdecl_Release()

static ULONG WINAPI isaxdecl_Release ( ISAXDeclHandler *  iface)
static

Definition at line 1855 of file saxreader.c.

1856{
1858 return InterlockedDecrement(&handler->ref);
1859}
#define InterlockedDecrement
Definition: armddk.h:52

◆ isaxerrorHandler_AddRef()

static ULONG WINAPI isaxerrorHandler_AddRef ( ISAXErrorHandler *  iface)
static

Definition at line 1405 of file saxreader.c.

1407{
1408 return 2;
1409}

◆ isaxerrorHandler_error()

static HRESULT WINAPI isaxerrorHandler_error ( ISAXErrorHandler *  iface,
ISAXLocator *  pLocator,
const WCHAR pErrorMessage,
HRESULT  hrErrorCode 
)
static

Definition at line 1417 of file saxreader.c.

1422{
1423 ok(0, "unexpected call\n");
1424 return S_OK;
1425}

◆ isaxerrorHandler_fatalError()

static HRESULT WINAPI isaxerrorHandler_fatalError ( ISAXErrorHandler *  iface,
ISAXLocator *  pLocator,
const WCHAR message,
HRESULT  hr 
)
static

Definition at line 1427 of file saxreader.c.

1432{
1433 struct call_entry call;
1434
1435 init_call_entry(locator, &call);
1436 call.id = EH_FATALERROR;
1437 call.ret = hr;
1438
1440
1442 return S_OK;
1443}

◆ isaxerrorHandler_ignorableWarning()

static HRESULT WINAPI isaxerrorHandler_ignorableWarning ( ISAXErrorHandler *  iface,
ISAXLocator *  pLocator,
const WCHAR pErrorMessage,
HRESULT  hrErrorCode 
)
static

Definition at line 1445 of file saxreader.c.

1450{
1451 ok(0, "unexpected call\n");
1452 return S_OK;
1453}

◆ isaxerrorHandler_QueryInterface()

static HRESULT WINAPI isaxerrorHandler_QueryInterface ( ISAXErrorHandler *  iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 1386 of file saxreader.c.

1390{
1391 *ppvObject = NULL;
1392
1393 if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ISAXErrorHandler))
1394 {
1395 *ppvObject = iface;
1396 }
1397 else
1398 {
1399 return E_NOINTERFACE;
1400 }
1401
1402 return S_OK;
1403}

◆ isaxerrorHandler_Release()

static ULONG WINAPI isaxerrorHandler_Release ( ISAXErrorHandler *  iface)
static

Definition at line 1411 of file saxreader.c.

1413{
1414 return 1;
1415}

◆ isaxlexical_AddRef()

static ULONG WINAPI isaxlexical_AddRef ( ISAXLexicalHandler *  iface)
static

Definition at line 1721 of file saxreader.c.

1722{
1724 return InterlockedIncrement(&handler->ref);
1725}
static struct saxlexicalhandler * impl_from_ISAXLexicalHandler(ISAXLexicalHandler *iface)
Definition: saxreader.c:1691

◆ isaxlexical_comment()

static HRESULT WINAPI isaxlexical_comment ( ISAXLexicalHandler *  iface,
const WCHAR pChars,
int  nChars 
)
static

Definition at line 1783 of file saxreader.c.

1785{
1786 ok(0, "call not expected\n");
1787 return E_NOTIMPL;
1788}

◆ isaxlexical_endCDATA()

static HRESULT WINAPI isaxlexical_endCDATA ( ISAXLexicalHandler *  iface)
static

Definition at line 1772 of file saxreader.c.

1773{
1774 struct call_entry call;
1775
1776 init_call_entry(locator, &call);
1777 call.id = LH_ENDCDATA;
1779
1780 return get_expected_ret();
1781}

◆ isaxlexical_endDTD()

static HRESULT WINAPI isaxlexical_endDTD ( ISAXLexicalHandler *  iface)
static

Definition at line 1741 of file saxreader.c.

1742{
1743 ok(0, "call not expected\n");
1744 return E_NOTIMPL;
1745}

◆ isaxlexical_endEntity()

static HRESULT WINAPI isaxlexical_endEntity ( ISAXLexicalHandler *  iface,
const WCHAR pName,
int  nName 
)
static

Definition at line 1754 of file saxreader.c.

1756{
1757 ok(0, "call not expected\n");
1758 return E_NOTIMPL;
1759}

◆ isaxlexical_QueryInterface()

static HRESULT WINAPI isaxlexical_QueryInterface ( ISAXLexicalHandler *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 1696 of file saxreader.c.

1697{
1699
1700 *out = NULL;
1701
1703 {
1704 *out = iface;
1705 ok(0, "got unexpected IID_IUnknown query\n");
1706 }
1707 else if (IsEqualGUID(riid, &IID_ISAXLexicalHandler))
1708 {
1709 if (handler->qi_hr == E_NOINTERFACE) return handler->qi_hr;
1710 *out = iface;
1711 }
1712
1713 if (*out)
1714 ISAXLexicalHandler_AddRef(iface);
1715 else
1716 return E_NOINTERFACE;
1717
1718 return S_OK;
1719}

◆ isaxlexical_Release()

static ULONG WINAPI isaxlexical_Release ( ISAXLexicalHandler *  iface)
static

Definition at line 1727 of file saxreader.c.

1728{
1730 return InterlockedDecrement(&handler->ref);
1731}

◆ isaxlexical_startCDATA()

static HRESULT WINAPI isaxlexical_startCDATA ( ISAXLexicalHandler *  iface)
static

Definition at line 1761 of file saxreader.c.

1762{
1763 struct call_entry call;
1764
1765 init_call_entry(locator, &call);
1766 call.id = LH_STARTCDATA;
1768
1769 return get_expected_ret();
1770}

◆ isaxlexical_startDTD()

static HRESULT WINAPI isaxlexical_startDTD ( ISAXLexicalHandler *  iface,
const WCHAR pName,
int  nName,
const WCHAR pPublicId,
int  nPublicId,
const WCHAR pSystemId,
int  nSystemId 
)
static

Definition at line 1733 of file saxreader.c.

1736{
1737 ok(0, "call not expected\n");
1738 return E_NOTIMPL;
1739}

◆ isaxlexical_startEntity()

static HRESULT WINAPI isaxlexical_startEntity ( ISAXLexicalHandler *  iface,
const WCHAR pName,
int  nName 
)
static

Definition at line 1747 of file saxreader.c.

1749{
1750 ok(0, "call not expected\n");
1751 return E_NOTIMPL;
1752}

◆ istream_AddRef()

static ULONG WINAPI istream_AddRef ( IStream iface)
static

Definition at line 1941 of file saxreader.c.

1942{
1943 return 2;
1944}

◆ istream_Clone()

static HRESULT WINAPI istream_Clone ( IStream iface,
IStream **  ppstm 
)
static

Definition at line 2014 of file saxreader.c.

2015{
2016 ok(0, "unexpected call\n");
2017 return E_NOTIMPL;
2018}

◆ istream_Commit()

static HRESULT WINAPI istream_Commit ( IStream iface,
DWORD  grfCommitFlags 
)
static

Definition at line 1983 of file saxreader.c.

1984{
1985 ok(0, "unexpected call\n");
1986 return E_NOTIMPL;
1987}

◆ istream_CopyTo()

static HRESULT WINAPI istream_CopyTo ( IStream iface,
IStream pstm,
ULARGE_INTEGER  cb,
ULARGE_INTEGER pcbRead,
ULARGE_INTEGER plibWritten 
)
static

Definition at line 1976 of file saxreader.c.

1978{
1979 ok(0, "unexpected call\n");
1980 return E_NOTIMPL;
1981}

◆ istream_LockRegion()

static HRESULT WINAPI istream_LockRegion ( IStream iface,
ULARGE_INTEGER  libOffset,
ULARGE_INTEGER  cb,
DWORD  dwLockType 
)
static

Definition at line 1995 of file saxreader.c.

1997{
1998 ok(0, "unexpected call\n");
1999 return E_NOTIMPL;
2000}

◆ istream_QueryInterface()

static HRESULT WINAPI istream_QueryInterface ( IStream iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 1927 of file saxreader.c.

1928{
1929 *ppvObject = NULL;
1930
1931 ok(!IsEqualGUID(riid, &IID_IPersistStream), "Did not expect QI for IPersistStream\n");
1932
1933 if(IsEqualGUID(riid, &IID_IStream) || IsEqualGUID(riid, &IID_IUnknown))
1934 *ppvObject = iface;
1935 else
1936 return E_NOINTERFACE;
1937
1938 return S_OK;
1939}
const GUID IID_IPersistStream
Definition: proxy.cpp:13

◆ istream_Read()

static HRESULT WINAPI istream_Read ( IStream iface,
void pv,
ULONG  cb,
ULONG pcbRead 
)
static

Definition at line 1951 of file saxreader.c.

1952{
1953 ok(0, "unexpected call\n");
1954 return E_NOTIMPL;
1955}

◆ istream_Release()

static ULONG WINAPI istream_Release ( IStream iface)
static

Definition at line 1946 of file saxreader.c.

1947{
1948 return 1;
1949}

◆ istream_Revert()

static HRESULT WINAPI istream_Revert ( IStream iface)
static

Definition at line 1989 of file saxreader.c.

1990{
1991 ok(0, "unexpected call\n");
1992 return E_NOTIMPL;
1993}

◆ istream_Seek()

static HRESULT WINAPI istream_Seek ( IStream iface,
LARGE_INTEGER  dlibMove,
DWORD  dwOrigin,
ULARGE_INTEGER plibNewPosition 
)
static

Definition at line 1963 of file saxreader.c.

1965{
1966 ok(0, "unexpected call\n");
1967 return E_NOTIMPL;
1968}

◆ istream_SetSize()

static HRESULT WINAPI istream_SetSize ( IStream iface,
ULARGE_INTEGER  libNewSize 
)
static

Definition at line 1970 of file saxreader.c.

1971{
1972 ok(0, "unexpected call\n");
1973 return E_NOTIMPL;
1974}

◆ istream_Stat()

static HRESULT WINAPI istream_Stat ( IStream iface,
STATSTG *  pstatstg,
DWORD  grfStatFlag 
)
static

Definition at line 2009 of file saxreader.c.

2010{
2011 return E_NOTIMPL;
2012}

◆ istream_UnlockRegion()

static HRESULT WINAPI istream_UnlockRegion ( IStream iface,
ULARGE_INTEGER  libOffset,
ULARGE_INTEGER  cb,
DWORD  dwLockType 
)
static

Definition at line 2002 of file saxreader.c.

2004{
2005 ok(0, "unexpected call\n");
2006 return E_NOTIMPL;
2007}

◆ istream_Write()

static HRESULT WINAPI istream_Write ( IStream iface,
const void pv,
ULONG  cb,
ULONG pcbWritten 
)
static

Definition at line 1957 of file saxreader.c.

1958{
1959 ok(0, "unexpected call\n");
1960 return E_NOTIMPL;
1961}

◆ mxstream_Write()

static HRESULT WINAPI mxstream_Write ( IStream iface,
const void pv,
ULONG  cb,
ULONG pcbWritten 
)
static

Definition at line 2020 of file saxreader.c.

2021{
2022 BOOL fail = FALSE;
2023
2024 ok(pv != NULL, "pv == NULL\n");
2025
2027 ok(0, "Too many Write calls made on test %d\n", current_stream_test_index);
2028 return E_FAIL;
2029 }
2030
2032
2033 ok(current_write_test->cb == cb, "Expected %d, but got %d on test %d\n",
2035
2036 if(!pcbWritten)
2037 ok(current_write_test->null_written, "pcbWritten was NULL on test %d\n", current_stream_test_index);
2038 else
2039 ok(!memcmp(current_write_test->data, pv, cb), "Unexpected data on test %d\n", current_stream_test_index);
2040
2042
2043 if(pcbWritten)
2044 *pcbWritten = cb;
2045
2046 return fail ? E_FAIL : S_OK;
2047}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define E_FAIL
Definition: ddrawi.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
static const mxwriter_write_test * current_write_test
Definition: saxreader.c:1924
static DWORD current_stream_test_index
Definition: saxreader.c:1925
const BYTE * data
Definition: saxreader.c:1912

◆ ok_sequence_()

static void ok_sequence_ ( struct call_sequence **  seq,
int  sequence_index,
const struct call_entry expected,
const char context,
BOOL  todo,
const char file,
int  line 
)
static

Definition at line 356 of file saxreader.c.

359{
360 struct call_sequence *call_seq = seq[sequence_index];
361 static const struct call_entry end_of_sequence = { CH_ENDTEST };
362 const struct call_entry *actual, *sequence;
363 int failcount = 0;
364
365 add_call(seq, sequence_index, &end_of_sequence);
366
367 sequence = call_seq->sequence;
368 actual = sequence;
369
370 while (expected->id != CH_ENDTEST && actual->id != CH_ENDTEST)
371 {
372 if (expected->id == actual->id)
373 {
374 if (expected->line != -1)
375 {
376 /* always test position data */
377 if (expected->line != actual->line && todo)
378 {
380 {
381 failcount++;
382 ok_(file, line) (FALSE,
383 "%s: in event %s expecting line %d got %d\n",
384 context, get_event_name(actual->id), expected->line, actual->line);
385 }
386 }
387 else
388 {
389 ok_(file, line) (expected->line == actual->line,
390 "%s: in event %s expecting line %d got %d\n",
391 context, get_event_name(actual->id), expected->line, actual->line);
392 }
393 }
394
395
396 if (expected->column != -1)
397 {
398 if (expected->column != actual->column && todo)
399 {
401 {
402 failcount++;
403 ok_(file, line) (FALSE,
404 "%s: in event %s expecting column %d got %d\n",
405 context, get_event_name(actual->id), expected->column, actual->column);
406 }
407 }
408 else
409 {
410 ok_(file, line) (expected->column == actual->column,
411 "%s: in event %s expecting column %d got %d\n",
412 context, get_event_name(actual->id), expected->column, actual->column);
413 }
414 }
415
416 switch (actual->id)
417 {
419 case CH_STARTDOCUMENT:
420 case CH_ENDDOCUMENT:
421 case LH_STARTCDATA:
422 case LH_ENDCDATA:
423 break;
425 /* prefix, uri */
426 test_saxstr(file, line, actual->arg1W, expected->arg1, todo, &failcount);
427 test_saxstr(file, line, actual->arg2W, expected->arg2, todo, &failcount);
428 break;
430 /* prefix */
431 test_saxstr(file, line, actual->arg1W, expected->arg1, todo, &failcount);
432 break;
433 case CH_STARTELEMENT:
434 /* compare attributes */
435 compare_attributes(actual, expected, context, todo, file, line, &failcount);
436 /* fallthrough */
437 case CH_ENDELEMENT:
438 /* uri, localname, qname */
439 test_saxstr(file, line, actual->arg1W, expected->arg1, todo, &failcount);
440 test_saxstr(file, line, actual->arg2W, expected->arg2, todo, &failcount);
441 test_saxstr(file, line, actual->arg3W, expected->arg3, todo, &failcount);
442 break;
443 case CH_CHARACTERS:
445 /* char data */
446 test_saxstr(file, line, actual->arg1W, expected->arg1, todo, &failcount);
447 break;
449 /* target, data */
450 test_saxstr(file, line, actual->arg1W, expected->arg1, todo, &failcount);
451 test_saxstr(file, line, actual->arg2W, expected->arg2, todo, &failcount);
452 break;
453 case CH_SKIPPEDENTITY:
454 /* name */
455 test_saxstr(file, line, actual->arg1W, expected->arg1, todo, &failcount);
456 break;
457 case EH_FATALERROR:
458 /* test return value only */
459 if (expected->ret != actual->ret && todo)
460 {
461 failcount++;
462 ok_(file, line) (FALSE,
463 "%s: in event %s expecting ret 0x%08x got 0x%08x\n",
464 context, get_event_name(actual->id), expected->ret, actual->ret);
465 }
466 else
467 ok_(file, line) (expected->ret == actual->ret,
468 "%s: in event %s expecting ret 0x%08x got 0x%08x\n",
469 context, get_event_name(actual->id), expected->ret, actual->ret);
470 break;
471 case EH_ERROR:
473 default:
474 ok(0, "%s: callback not handled, %s\n", context, get_event_name(actual->id));
475 }
476 expected++;
477 actual++;
478 }
479 else if (todo)
480 {
481 failcount++;
483 {
484 ok_(file, line) (FALSE, "%s: call %s was expected, but got call %s instead\n",
486 }
487
488 flush_sequence(seq, sequence_index);
489 return;
490 }
491 else
492 {
493 ok_(file, line) (FALSE, "%s: call %s was expected, but got call %s instead\n",
495 expected++;
496 actual++;
497 }
498 }
499
500 if (todo)
501 {
503 {
504 if (expected->id != CH_ENDTEST || actual->id != CH_ENDTEST)
505 {
506 failcount++;
507 ok_(file, line) (FALSE, "%s: the call sequence is not complete: expected %s - actual %s\n",
509 }
510 }
511 }
512 else if (expected->id != CH_ENDTEST || actual->id != CH_ENDTEST)
513 {
514 ok_(file, line) (FALSE, "%s: the call sequence is not complete: expected %s - actual %s\n",
516 }
517
518 if (todo && !failcount) /* succeeded yet marked todo */
519 {
521 {
522 ok_(file, line)(TRUE, "%s: marked \"todo_wine\" but succeeds\n", context);
523 }
524 }
525
526 flush_sequence(seq, sequence_index);
527}
static void flush_sequence(void)
Definition: SystemMenu.c:184
static struct recvd_message * sequence
Definition: SystemMenu.c:63
static void compare_attributes(const struct call_entry *actual, const struct call_entry *expected, const char *context, BOOL todo, const char *file, int line, int *failcount)
Definition: saxreader.c:320

◆ set_expected_seq()

static void set_expected_seq ( struct call_entry expected)
static

Definition at line 1041 of file saxreader.c.

1042{
1044}

Referenced by test_saxreader().

◆ START_TEST()

START_TEST ( saxreader  )

Definition at line 5754 of file saxreader.c.

5755{
5756 ISAXXMLReader *reader;
5757 HRESULT hr;
5758
5759 hr = CoInitialize(NULL);
5760 ok(hr == S_OK, "failed to init com\n");
5761
5762 hr = CoCreateInstance(&CLSID_SAXXMLReader, NULL, CLSCTX_INPROC_SERVER,
5763 &IID_ISAXXMLReader, (void**)&reader);
5764
5765 if(FAILED(hr))
5766 {
5767 win_skip("Failed to create SAXXMLReader instance\n");
5769 return;
5770 }
5771 ISAXXMLReader_Release(reader);
5772
5774
5775 get_class_support_data(reader_support_data, &IID_ISAXXMLReader);
5776
5782
5783 /* MXXMLWriter tests */
5785 if (is_clsid_supported(&CLSID_MXXMLWriter, mxwriter_support_data))
5786 {
5802 }
5803 else
5804 win_skip("MXXMLWriter not supported\n");
5805
5806 /* SAXAttributes tests */
5808 if (is_clsid_supported(&CLSID_SAXAttributes, mxattributes_support_data))
5809 {
5815 }
5816 else
5817 win_skip("SAXAttributes not supported\n");
5818
5820}
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define FAILED(hr)
Definition: intsafe.h:51
static void test_mxwriter_dispex(void)
Definition: saxreader.c:4662
static void test_mxattr_qi(void)
Definition: saxreader.c:5563
static void test_mxwriter_pi(void)
Definition: saxreader.c:4814
static void test_mxwriter_handlers(void)
Definition: saxreader.c:2951
static void test_mxwriter_flush(void)
Definition: saxreader.c:3250
static struct msxmlsupported_data_t mxwriter_support_data[]
Definition: saxreader.c:3000
static struct msxmlsupported_data_t reader_support_data[]
Definition: saxreader.c:2108
static void test_saxreader_properties(void)
Definition: saxreader.c:2569
static void test_mxwriter_properties(void)
Definition: saxreader.c:3099
static void test_mxattr_clear(void)
Definition: saxreader.c:5473
static struct msxmlsupported_data_t mxattributes_support_data[]
Definition: saxreader.c:3009
static void test_mxwriter_startenddocument(void)
Definition: saxreader.c:3450
static void test_mxwriter_comment(void)
Definition: saxreader.c:4690
static void test_mxattr_localname(void)
Definition: saxreader.c:5610
static void test_saxreader(void)
Definition: saxreader.c:2138
static void test_mxwriter_characters(void)
Definition: saxreader.c:3972
static void init_call_sequences(struct call_sequence **seq, int n)
Definition: saxreader.c:532
static void test_mxattr_addAttribute(void)
Definition: saxreader.c:5231
static void test_mxwriter_encoding(void)
Definition: saxreader.c:4395
static void test_mxwriter_stream(void)
Definition: saxreader.c:4252
static void test_saxreader_features(void)
Definition: saxreader.c:2795
static void test_saxreader_encoding(void)
Definition: saxreader.c:2905
static void test_mxwriter_ignorablespaces(void)
Definition: saxreader.c:4875
#define NUM_CALL_SEQUENCES
Definition: saxreader.c:243
static void test_mxwriter_indent(void)
Definition: saxreader.c:5697
static void get_class_support_data(struct msxmlsupported_data_t *table, REFIID riid)
Definition: saxreader.c:3654
static void test_mxwriter_startendelement(void)
Definition: saxreader.c:3835
static void test_saxreader_dispex(void)
Definition: saxreader.c:4592
static void test_mxwriter_dtd(void)
Definition: saxreader.c:4913
static void test_mxwriter_cdata(void)
Definition: saxreader.c:4752
static BOOL is_clsid_supported(const GUID *clsid, const struct msxmlsupported_data_t *table)
Definition: saxreader.c:70
static void test_mxattr_dispex(void)
Definition: saxreader.c:5542
Definition: reader.h:84

◆ test_mxattr_addAttribute()

static void test_mxattr_addAttribute ( void  )
static

Definition at line 5231 of file saxreader.c.

5232{
5234 int i = 0;
5235
5236 while (table->clsid)
5237 {
5238 ISAXAttributes *saxattr;
5239 IMXAttributes *mxattr;
5240 const WCHAR *value;
5241 int len, index;
5242 HRESULT hr;
5243
5245 {
5246 table++;
5247 i++;
5248 continue;
5249 }
5250
5251 hr = CoCreateInstance(table->clsid, NULL, CLSCTX_INPROC_SERVER,
5252 &IID_IMXAttributes, (void**)&mxattr);
5253 EXPECT_HR(hr, S_OK);
5254
5255 hr = IMXAttributes_QueryInterface(mxattr, &IID_ISAXAttributes, (void**)&saxattr);
5256 EXPECT_HR(hr, S_OK);
5257
5258 /* SAXAttributes40 and SAXAttributes60 both crash on this test */
5259 if (IsEqualGUID(table->clsid, &CLSID_SAXAttributes) ||
5260 IsEqualGUID(table->clsid, &CLSID_SAXAttributes30))
5261 {
5262 hr = ISAXAttributes_getLength(saxattr, NULL);
5264 }
5265
5266 len = -1;
5267 hr = ISAXAttributes_getLength(saxattr, &len);
5268 EXPECT_HR(hr, S_OK);
5269 ok(len == 0, "got %d\n", len);
5270
5271 hr = ISAXAttributes_getValue(saxattr, 0, &value, &len);
5273
5274 hr = ISAXAttributes_getValue(saxattr, 0, NULL, &len);
5275 ok(hr == E_POINTER /* win8 */ || hr == E_INVALIDARG, "got 0x%08x\n", hr);
5276
5277 hr = ISAXAttributes_getValue(saxattr, 0, &value, NULL);
5278 ok(hr == E_POINTER /* win8 */ || hr == E_INVALIDARG, "got 0x%08x\n", hr);
5279
5280 hr = ISAXAttributes_getValue(saxattr, 0, NULL, NULL);
5281 ok(hr == E_POINTER /* win8 */ || hr == E_INVALIDARG, "got 0x%08x\n", hr);
5282
5283 hr = ISAXAttributes_getType(saxattr, 0, &value, &len);
5285
5286 hr = ISAXAttributes_getType(saxattr, 0, NULL, &len);
5287 ok(hr == E_POINTER /* win8 */ || hr == E_INVALIDARG, "got 0x%08x\n", hr);
5288
5289 hr = ISAXAttributes_getType(saxattr, 0, &value, NULL);
5290 ok(hr == E_POINTER /* win8 */ || hr == E_INVALIDARG, "got 0x%08x\n", hr);
5291
5292 hr = ISAXAttributes_getType(saxattr, 0, NULL, NULL);
5293 ok(hr == E_POINTER /* win8 */ || hr == E_INVALIDARG, "got 0x%08x\n", hr);
5294
5295 hr = IMXAttributes_addAttribute(mxattr, _bstr_(table->uri), _bstr_(table->local),
5296 _bstr_(table->qname), _bstr_(table->type), _bstr_(table->value));
5297 ok(hr == table->hr, "%d: got 0x%08x, expected 0x%08x\n", i, hr, table->hr);
5298
5299 if (hr == S_OK)
5300 {
5301 /* SAXAttributes40 and SAXAttributes60 both crash on this test */
5302 if (IsEqualGUID(table->clsid, &CLSID_SAXAttributes) ||
5303 IsEqualGUID(table->clsid, &CLSID_SAXAttributes30))
5304 {
5305 hr = ISAXAttributes_getValue(saxattr, 0, NULL, &len);
5307
5308 hr = ISAXAttributes_getValue(saxattr, 0, &value, NULL);
5310
5311 hr = ISAXAttributes_getValue(saxattr, 0, NULL, NULL);
5313
5314 hr = ISAXAttributes_getType(saxattr, 0, NULL, &len);
5316
5317 hr = ISAXAttributes_getType(saxattr, 0, &value, NULL);
5319
5320 hr = ISAXAttributes_getType(saxattr, 0, NULL, NULL);
5322 }
5323
5324 len = -1;
5325 hr = ISAXAttributes_getValue(saxattr, 0, &value, &len);
5326 EXPECT_HR(hr, S_OK);
5327 ok(!lstrcmpW(_bstr_(table->value), value), "%d: got %s, expected %s\n", i, wine_dbgstr_w(value),
5328 table->value);
5329 ok(lstrlenW(value) == len, "%d: got wrong value length %d\n", i, len);
5330
5331 len = -1;
5332 value = (void*)0xdeadbeef;
5333 hr = ISAXAttributes_getType(saxattr, 0, &value, &len);
5334 EXPECT_HR(hr, S_OK);
5335
5336 if (table->type)
5337 {
5338 ok(!lstrcmpW(_bstr_(table->type), value), "%d: got %s, expected %s\n", i, wine_dbgstr_w(value),
5339 table->type);
5340 ok(lstrlenW(value) == len, "%d: got wrong type value length %d\n", i, len);
5341 }
5342 else
5343 {
5344 ok(*value == 0, "%d: got type value %s\n", i, wine_dbgstr_w(value));
5345 ok(len == 0, "%d: got wrong type value length %d\n", i, len);
5346 }
5347
5348 hr = ISAXAttributes_getIndexFromQName(saxattr, NULL, 0, NULL);
5349 if (IsEqualGUID(table->clsid, &CLSID_SAXAttributes) ||
5350 IsEqualGUID(table->clsid, &CLSID_SAXAttributes30))
5351 {
5353 }
5354 else
5356
5357 hr = ISAXAttributes_getIndexFromQName(saxattr, NULL, 0, &index);
5359
5360 index = -1;
5361 hr = ISAXAttributes_getIndexFromQName(saxattr, _bstr_("nonexistent"), 11, &index);
5363 ok(index == -1, "%d: got wrong index %d\n", i, index);
5364
5365 index = -1;
5366 hr = ISAXAttributes_getIndexFromQName(saxattr, _bstr_(table->qname), 0, &index);
5368 ok(index == -1, "%d: got wrong index %d\n", i, index);
5369
5370 index = -1;
5371 hr = ISAXAttributes_getIndexFromQName(saxattr, _bstr_(table->qname), strlen(table->qname), &index);
5372 EXPECT_HR(hr, S_OK);
5373 ok(index == 0, "%d: got wrong index %d\n", i, index);
5374
5375 index = -1;
5376 hr = ISAXAttributes_getIndexFromQName(saxattr, _bstr_(table->qname), strlen(table->qname)-1, &index);
5378 ok(index == -1, "%d: got wrong index %d\n", i, index);
5379
5380 if (IsEqualGUID(table->clsid, &CLSID_SAXAttributes40) ||
5381 IsEqualGUID(table->clsid, &CLSID_SAXAttributes60))
5382 {
5383 hr = ISAXAttributes_getValueFromQName(saxattr, NULL, 0, NULL, NULL);
5384 ok(hr == E_POINTER /* win8 */ || hr == E_INVALIDARG, "got 0x%08x\n", hr);
5385
5386 hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), 0, NULL, NULL);
5387 ok(hr == E_POINTER /* win8 */ || hr == E_INVALIDARG, "got 0x%08x\n", hr);
5388
5389 hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), 0, &value, NULL);
5390 ok(hr == E_POINTER /* win8 */ || hr == E_INVALIDARG, "got 0x%08x\n", hr);
5391
5392 hr = ISAXAttributes_getValueFromName(saxattr, NULL, 0, NULL, 0, NULL, NULL);
5393 ok(hr == E_POINTER /* win8 */ || hr == E_INVALIDARG, "got 0x%08x\n", hr);
5394
5395 hr = ISAXAttributes_getValueFromName(saxattr, _bstr_(table->uri), 0, NULL, 0, NULL, NULL);
5396 ok(hr == E_POINTER /* win8 */ || hr == E_INVALIDARG, "got 0x%08x\n", hr);
5397
5398 hr = ISAXAttributes_getValueFromName(saxattr, _bstr_(table->uri), 0, NULL, 0, &value, NULL);
5399 ok(hr == E_POINTER /* win8 */ || hr == E_INVALIDARG, "got 0x%08x\n", hr);
5400 }
5401 else
5402 {
5403 hr = ISAXAttributes_getValueFromQName(saxattr, NULL, 0, NULL, NULL);
5405
5406 hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), 0, NULL, NULL);
5408
5409 hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), 0, &value, NULL);
5411
5412 /* versions 4 and 6 crash */
5413 hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), strlen(table->qname), NULL, NULL);
5415
5416 hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), strlen(table->qname), NULL, &len);
5418
5419 hr = ISAXAttributes_getValueFromName(saxattr, NULL, 0, NULL, 0, NULL, NULL);
5421
5422 hr = ISAXAttributes_getValueFromName(saxattr, _bstr_(table->uri), 0, NULL, 0, NULL, NULL);
5424
5425 hr = ISAXAttributes_getValueFromName(saxattr, _bstr_(table->uri), 0, NULL, 0, &value, NULL);
5427
5428 hr = ISAXAttributes_getValueFromName(saxattr, _bstr_(table->uri), 0, _bstr_(table->local), 0, &value, NULL);
5430
5431 hr = ISAXAttributes_getValueFromName(saxattr, _bstr_(table->uri), 0, _bstr_(table->local), 0, NULL, &len);
5433
5434 hr = ISAXAttributes_getValueFromName(saxattr, _bstr_(table->uri), strlen(table->uri), _bstr_(table->local),
5435 strlen(table->local), NULL, NULL);
5437 }
5438
5439 hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), strlen(table->qname), &value, &len);
5440 EXPECT_HR(hr, S_OK);
5441 ok(!lstrcmpW(_bstr_(table->value), value), "%d: got %s, expected %s\n", i, wine_dbgstr_w(value),
5442 table->value);
5443 ok(lstrlenW(value) == len, "%d: got wrong value length %d\n", i, len);
5444
5445 if (table->uri) {
5446 hr = ISAXAttributes_getValueFromName(saxattr, _bstr_(table->uri), strlen(table->uri),
5447 _bstr_(table->local), strlen(table->local), &value, &len);
5448 EXPECT_HR(hr, S_OK);
5449 ok(!lstrcmpW(_bstr_(table->value), value), "%d: got %s, expected %s\n", i, wine_dbgstr_w(value),
5450 table->value);
5451 ok(lstrlenW(value) == len, "%d: got wrong value length %d\n", i, len);
5452 }
5453 }
5454
5455 len = -1;
5456 hr = ISAXAttributes_getLength(saxattr, &len);
5457 EXPECT_HR(hr, S_OK);
5458 if (table->hr == S_OK)
5459 ok(len == 1, "%d: got %d length, expected 1\n", i, len);
5460 else
5461 ok(len == 0, "%d: got %d length, expected 0\n", i, len);
5462
5463 ISAXAttributes_Release(saxattr);
5464 IMXAttributes_Release(mxattr);
5465
5466 table++;
5467 i++;
5468 }
5469
5470 free_bstrs();
5471}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define lstrlenW
Definition: compat.h:750
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4242
#define wine_dbgstr_w
Definition: kernel32.h:34
static void free_bstrs(void)
Definition: saxreader.c:98
static const addattribute_test_t addattribute_data[]
Definition: saxreader.c:5207
#define E_POINTER
Definition: winerror.h:2365

Referenced by START_TEST().

◆ test_mxattr_clear()

static void test_mxattr_clear ( void  )
static

Definition at line 5473 of file saxreader.c.

5474{
5475 ISAXAttributes *saxattr;
5476 IMXAttributes *mxattr;
5477 const WCHAR *ptr;
5478 HRESULT hr;
5479 int len;
5480
5481 hr = CoCreateInstance(&CLSID_SAXAttributes, NULL, CLSCTX_INPROC_SERVER,
5482 &IID_IMXAttributes, (void**)&mxattr);
5483 EXPECT_HR(hr, S_OK);
5484
5485 hr = IMXAttributes_QueryInterface(mxattr, &IID_ISAXAttributes, (void**)&saxattr);
5486 EXPECT_HR(hr, S_OK);
5487
5488 hr = ISAXAttributes_getQName(saxattr, 0, NULL, NULL);
5490
5491 hr = ISAXAttributes_getQName(saxattr, 0, &ptr, &len);
5493
5494 hr = IMXAttributes_clear(mxattr);
5495 EXPECT_HR(hr, S_OK);
5496
5497 hr = IMXAttributes_addAttribute(mxattr, _bstr_("uri"), _bstr_("local"),
5498 _bstr_("qname"), _bstr_("type"), _bstr_("value"));
5499 EXPECT_HR(hr, S_OK);
5500
5501 len = -1;
5502 hr = ISAXAttributes_getLength(saxattr, &len);
5503 EXPECT_HR(hr, S_OK);
5504 ok(len == 1, "got %d\n", len);
5505
5506 len = -1;
5507 hr = ISAXAttributes_getQName(saxattr, 0, NULL, &len);
5509 ok(len == -1, "got %d\n", len);
5510
5511 ptr = (void*)0xdeadbeef;
5512 hr = ISAXAttributes_getQName(saxattr, 0, &ptr, NULL);
5514 ok(ptr == (void*)0xdeadbeef, "got %p\n", ptr);
5515
5516 len = 0;
5517 hr = ISAXAttributes_getQName(saxattr, 0, &ptr, &len);
5518 EXPECT_HR(hr, S_OK);
5519 ok(len == 5, "got %d\n", len);
5520 ok(!lstrcmpW(ptr, _bstr_("qname")), "got %s\n", wine_dbgstr_w(ptr));
5521
5522 hr = IMXAttributes_clear(mxattr);
5523 EXPECT_HR(hr, S_OK);
5524
5525 len = -1;
5526 hr = ISAXAttributes_getLength(saxattr, &len);
5527 EXPECT_HR(hr, S_OK);
5528 ok(len == 0, "got %d\n", len);
5529
5530 len = -1;
5531 ptr = (void*)0xdeadbeef;
5532 hr = ISAXAttributes_getQName(saxattr, 0, &ptr, &len);
5534 ok(len == -1, "got %d\n", len);
5535 ok(ptr == (void*)0xdeadbeef, "got %p\n", ptr);
5536
5537 IMXAttributes_Release(mxattr);
5538 ISAXAttributes_Release(saxattr);
5539 free_bstrs();
5540}

Referenced by START_TEST().

◆ test_mxattr_dispex()

static void test_mxattr_dispex ( void  )
static

Definition at line 5542 of file saxreader.c.

5543{
5544 IMXAttributes *mxattr;
5545 IDispatchEx *dispex;
5546 IUnknown *unk;
5547 HRESULT hr;
5548
5549 hr = CoCreateInstance(&CLSID_SAXAttributes, NULL, CLSCTX_INPROC_SERVER,
5550 &IID_IMXAttributes, (void**)&mxattr);
5551 EXPECT_HR(hr, S_OK);
5552
5553 hr = IMXAttributes_QueryInterface(mxattr, &IID_IDispatchEx, (void**)&dispex);
5554 EXPECT_HR(hr, S_OK);
5555 hr = IDispatchEx_QueryInterface(dispex, &IID_IUnknown, (void**)&unk);
5556 test_obj_dispex(unk);
5557 IUnknown_Release(unk);
5558 IDispatchEx_Release(dispex);
5559
5560 IMXAttributes_Release(mxattr);
5561}
static void test_obj_dispex(IUnknown *obj)
Definition: saxreader.c:4537

Referenced by START_TEST().

◆ test_mxattr_localname()

static void test_mxattr_localname ( void  )
static

Definition at line 5610 of file saxreader.c.

5611{
5612 static const WCHAR localname1W[] = {'l','o','c','a','l','n','a','m','e','1',0};
5613 static const WCHAR localnameW[] = {'l','o','c','a','l','n','a','m','e',0};
5614 static const WCHAR uri1W[] = {'u','r','i','1',0};
5615 static const WCHAR uriW[] = {'u','r','i',0};
5616
5618
5619 while (table->clsid)
5620 {
5621 ISAXAttributes *saxattr;
5622 IMXAttributes *mxattr;
5623 HRESULT hr;
5624 int index;
5625
5627 {
5628 table++;
5629 continue;
5630 }
5631
5632 hr = CoCreateInstance(table->clsid, NULL, CLSCTX_INPROC_SERVER,
5633 &IID_IMXAttributes, (void**)&mxattr);
5634 EXPECT_HR(hr, S_OK);
5635
5636 hr = IMXAttributes_QueryInterface(mxattr, &IID_ISAXAttributes, (void**)&saxattr);
5637 EXPECT_HR(hr, S_OK);
5638
5639 hr = ISAXAttributes_getIndexFromName(saxattr, NULL, 0, NULL, 0, &index);
5641
5642 /* add some ambiguos attribute names */
5643 hr = IMXAttributes_addAttribute(mxattr, _bstr_("uri"), _bstr_("localname"),
5644 _bstr_("a:localname"), _bstr_(""), _bstr_("value"));
5645 EXPECT_HR(hr, S_OK);
5646 hr = IMXAttributes_addAttribute(mxattr, _bstr_("uri"), _bstr_("localname"),
5647 _bstr_("b:localname"), _bstr_(""), _bstr_("value"));
5648 EXPECT_HR(hr, S_OK);
5649
5650 index = -1;
5651 hr = ISAXAttributes_getIndexFromName(saxattr, uriW, lstrlenW(uriW), localnameW, lstrlenW(localnameW), &index);
5652 EXPECT_HR(hr, S_OK);
5653 ok(index == 0, "%s: got index %d\n", table->name, index);
5654
5655 index = -1;
5656 hr = ISAXAttributes_getIndexFromName(saxattr, uri1W, lstrlenW(uri1W), localnameW, lstrlenW(localnameW), &index);
5658 ok(index == -1, "%s: got index %d\n", table->name, index);
5659
5660 index = -1;
5661 hr = ISAXAttributes_getIndexFromName(saxattr, uriW, lstrlenW(uriW), localname1W, lstrlenW(localname1W), &index);
5663 ok(index == -1, "%s: got index %d\n", table->name, index);
5664
5665 if (IsEqualGUID(table->clsid, &CLSID_SAXAttributes) ||
5666 IsEqualGUID(table->clsid, &CLSID_SAXAttributes30))
5667 {
5668 hr = ISAXAttributes_getIndexFromName(saxattr, NULL, 0, NULL, 0, NULL);
5670
5671 hr = ISAXAttributes_getIndexFromName(saxattr, uriW, lstrlenW(uriW), localname1W, lstrlenW(localname1W), NULL);
5673 }
5674 else
5675 {
5676 hr = ISAXAttributes_getIndexFromName(saxattr, NULL, 0, NULL, 0, NULL);
5678
5679 hr = ISAXAttributes_getIndexFromName(saxattr, uriW, lstrlenW(uriW), localname1W, lstrlenW(localname1W), NULL);
5681 }
5682
5683 hr = ISAXAttributes_getIndexFromName(saxattr, uriW, lstrlenW(uriW), NULL, 0, &index);
5685
5686 hr = ISAXAttributes_getIndexFromName(saxattr, NULL, 0, localname1W, lstrlenW(localname1W), &index);
5688
5689 table++;
5690
5691 ISAXAttributes_Release(saxattr);
5692 IMXAttributes_Release(mxattr);
5693 free_bstrs();
5694 }
5695}
static struct msxmlsupported_data_t saxattr_support_data[]
Definition: saxreader.c:5601

Referenced by START_TEST().

◆ test_mxattr_qi()

static void test_mxattr_qi ( void  )
static

Definition at line 5563 of file saxreader.c.

5564{
5565 IVBSAXAttributes *vbsaxattr, *vbsaxattr2;
5566 ISAXAttributes *saxattr;
5567 IMXAttributes *mxattr;
5568 HRESULT hr;
5569
5570 hr = CoCreateInstance(&CLSID_SAXAttributes, NULL, CLSCTX_INPROC_SERVER,
5571 &IID_IMXAttributes, (void**)&mxattr);
5572 EXPECT_HR(hr, S_OK);
5573
5574 EXPECT_REF(mxattr, 1);
5575 hr = IMXAttributes_QueryInterface(mxattr, &IID_ISAXAttributes, (void**)&saxattr);
5576 EXPECT_HR(hr, S_OK);
5577
5578 EXPECT_REF(mxattr, 2);
5579 EXPECT_REF(saxattr, 2);
5580
5581 hr = IMXAttributes_QueryInterface(mxattr, &IID_IVBSAXAttributes, (void**)&vbsaxattr);
5582 EXPECT_HR(hr, S_OK);
5583
5584 EXPECT_REF(vbsaxattr, 3);
5585 EXPECT_REF(mxattr, 3);
5586 EXPECT_REF(saxattr, 3);
5587
5588 hr = ISAXAttributes_QueryInterface(saxattr, &IID_IVBSAXAttributes, (void**)&vbsaxattr2);
5589 EXPECT_HR(hr, S_OK);
5590
5591 EXPECT_REF(vbsaxattr, 4);
5592 EXPECT_REF(mxattr, 4);
5593 EXPECT_REF(saxattr, 4);
5594
5595 IMXAttributes_Release(mxattr);
5596 ISAXAttributes_Release(saxattr);
5597 IVBSAXAttributes_Release(vbsaxattr);
5598 IVBSAXAttributes_Release(vbsaxattr2);
5599}

Referenced by START_TEST().

◆ test_mxwriter_cdata()

static void test_mxwriter_cdata ( void  )
static

Definition at line 4752 of file saxreader.c.

4753{
4754 IVBSAXLexicalHandler *vblexical;
4755 ISAXContentHandler *content;
4756 ISAXLexicalHandler *lexical;
4757 IMXWriter *writer;
4758 VARIANT dest;
4759 HRESULT hr;
4760
4761 hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER,
4762 &IID_IMXWriter, (void**)&writer);
4763 EXPECT_HR(hr, S_OK);
4764
4765 hr = IMXWriter_QueryInterface(writer, &IID_ISAXContentHandler, (void**)&content);
4766 EXPECT_HR(hr, S_OK);
4767
4768 hr = IMXWriter_QueryInterface(writer, &IID_ISAXLexicalHandler, (void**)&lexical);
4769 EXPECT_HR(hr, S_OK);
4770
4771 hr = IMXWriter_QueryInterface(writer, &IID_IVBSAXLexicalHandler, (void**)&vblexical);
4772 EXPECT_HR(hr, S_OK);
4773
4774 hr = IMXWriter_put_omitXMLDeclaration(writer, VARIANT_TRUE);
4775 EXPECT_HR(hr, S_OK);
4776
4777 hr = ISAXContentHandler_startDocument(content);
4778 EXPECT_HR(hr, S_OK);
4779
4780 hr = ISAXLexicalHandler_startCDATA(lexical);
4781 EXPECT_HR(hr, S_OK);
4782
4783 V_VT(&dest) = VT_EMPTY;
4784 hr = IMXWriter_get_output(writer, &dest);
4785 EXPECT_HR(hr, S_OK);
4786 ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest));
4787 ok(!lstrcmpW(_bstr_("<![CDATA["), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
4789
4790 hr = IVBSAXLexicalHandler_startCDATA(vblexical);
4791 EXPECT_HR(hr, S_OK);
4792
4793 /* all these are escaped for text nodes */
4794 hr = ISAXContentHandler_characters(content, _bstr_("< > & \""), 7);
4795 EXPECT_HR(hr, S_OK);
4796
4797 hr = ISAXLexicalHandler_endCDATA(lexical);
4798 EXPECT_HR(hr, S_OK);
4799
4800 V_VT(&dest) = VT_EMPTY;
4801 hr = IMXWriter_get_output(writer, &dest);
4802 EXPECT_HR(hr, S_OK);
4803 ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest));
4804 ok(!lstrcmpW(_bstr_("<![CDATA[<![CDATA[< > & \"]]>"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
4806
4807 ISAXContentHandler_Release(content);
4808 ISAXLexicalHandler_Release(lexical);
4809 IVBSAXLexicalHandler_Release(vblexical);
4810 IMXWriter_Release(writer);
4811 free_bstrs();
4812}
content
Definition: atl_ax.c:994
@ VT_BSTR
Definition: compat.h:2303
@ VT_EMPTY
Definition: compat.h:2295
static char * dest
Definition: rtl.c:135
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648

Referenced by START_TEST().

◆ test_mxwriter_characters()

static void test_mxwriter_characters ( void  )
static

Definition at line 3972 of file saxreader.c.

3973{
3974 static const WCHAR chardataW[] = {'T','E','S','T','C','H','A','R','D','A','T','A',' ','.',0};
3975 static const WCHAR embedded_nullbytes[] = {'a',0,'b',0,0,0,'c',0};
3977 IVBSAXContentHandler *vb_content;
3978 ISAXContentHandler *content;
3979 IMXWriter *writer;
3980 VARIANT dest;
3981 BSTR str;
3982 HRESULT hr;
3983 int i = 0;
3984
3985 hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER,
3986 &IID_IMXWriter, (void**)&writer);
3987 EXPECT_HR(hr, S_OK);
3988
3989 hr = IMXWriter_QueryInterface(writer, &IID_ISAXContentHandler, (void**)&content);
3990 EXPECT_HR(hr, S_OK);
3991
3992 hr = IMXWriter_QueryInterface(writer, &IID_IVBSAXContentHandler, (void**)&vb_content);
3993 EXPECT_HR(hr, S_OK);
3994
3995 hr = IMXWriter_put_omitXMLDeclaration(writer, VARIANT_TRUE);
3996 EXPECT_HR(hr, S_OK);
3997
3998 hr = ISAXContentHandler_startDocument(content);
3999 EXPECT_HR(hr, S_OK);
4000
4001 hr = ISAXContentHandler_characters(content, NULL, 0);
4003
4004 hr = ISAXContentHandler_characters(content, chardataW, 0);
4005 EXPECT_HR(hr, S_OK);
4006
4007 str = _bstr_("VbChars");
4008 hr = IVBSAXContentHandler_characters(vb_content, &str);
4009 EXPECT_HR(hr, S_OK);
4010
4011 hr = ISAXContentHandler_characters(content, chardataW, ARRAY_SIZE(chardataW) - 1);
4012 EXPECT_HR(hr, S_OK);
4013
4014 V_VT(&dest) = VT_EMPTY;
4015 hr = IMXWriter_get_output(writer, &dest);
4016 EXPECT_HR(hr, S_OK);
4017 ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest));
4018 ok(!lstrcmpW(_bstr_("VbCharsTESTCHARDATA ."), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
4020
4021 hr = ISAXContentHandler_endDocument(content);
4022 EXPECT_HR(hr, S_OK);
4023
4024 ISAXContentHandler_Release(content);
4025 IVBSAXContentHandler_Release(vb_content);
4026 IMXWriter_Release(writer);
4027
4028 /* try empty characters data to see if element is closed */
4029 hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER,
4030 &IID_IMXWriter, (void**)&writer);
4031 EXPECT_HR(hr, S_OK);
4032
4033 hr = IMXWriter_QueryInterface(writer, &IID_ISAXContentHandler, (void**)&content);
4034 EXPECT_HR(hr, S_OK);
4035
4036 hr = IMXWriter_put_omitXMLDeclaration(writer, VARIANT_TRUE);
4037 EXPECT_HR(hr, S_OK);
4038
4039 hr = ISAXContentHandler_startDocument(content);
4040 EXPECT_HR(hr, S_OK);
4041
4042 hr = ISAXContentHandler_startElement(content, _bstr_(""), 0, _bstr_(""), 0, _bstr_("a"), 1, NULL);
4043 EXPECT_HR(hr, S_OK);
4044
4045 hr = ISAXContentHandler_characters(content, chardataW, 0);
4046 EXPECT_HR(hr, S_OK);
4047
4048 hr = ISAXContentHandler_endElement(content, _bstr_(""), 0, _bstr_(""), 0, _bstr_("a"), 1);
4049 EXPECT_HR(hr, S_OK);
4050
4051 V_VT(&dest) = VT_EMPTY;
4052 hr = IMXWriter_get_output(writer, &dest);
4053 EXPECT_HR(hr, S_OK);
4054 ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest));
4055 ok(!lstrcmpW(_bstr_("<a></a>"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
4057
4058 ISAXContentHandler_Release(content);
4059 IMXWriter_Release(writer);
4060
4061 /* test embedded null bytes */
4062 hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER,
4063 &IID_IMXWriter, (void**)&writer);
4064 EXPECT_HR(hr, S_OK);
4065
4066 hr = IMXWriter_QueryInterface(writer, &IID_ISAXContentHandler, (void**)&content);
4067 EXPECT_HR(hr, S_OK);
4068
4069 hr = IMXWriter_put_omitXMLDeclaration(writer, VARIANT_TRUE);
4070 EXPECT_HR(hr, S_OK);
4071
4072 hr = ISAXContentHandler_startDocument(content);
4073 EXPECT_HR(hr, S_OK);
4074
4075 hr = ISAXContentHandler_characters(content, embedded_nullbytes, ARRAY_SIZE(embedded_nullbytes));
4076 EXPECT_HR(hr, S_OK);
4077
4078 V_VT(&dest) = VT_EMPTY;
4079 hr = IMXWriter_get_output(writer, &dest);
4080 EXPECT_HR(hr, S_OK);
4081 ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest));
4082 ok(SysStringLen(V_BSTR(&dest)) == ARRAY_SIZE(embedded_nullbytes), "unexpected len %d\n", SysStringLen(V_BSTR(&dest)));
4083 ok(!memcmp(V_BSTR(&dest), embedded_nullbytes, ARRAY_SIZE(embedded_nullbytes)),
4084 "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
4086
4087 ISAXContentHandler_Release(content);
4088 IMXWriter_Release(writer);
4089
4090 hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER,
4091 &IID_IMXWriter, (void**)&writer);
4092 EXPECT_HR(hr, S_OK);
4093
4094 hr = IMXWriter_QueryInterface(writer, &IID_IVBSAXContentHandler, (void**)&vb_content);
4095 EXPECT_HR(hr, S_OK);
4096
4097 hr = IMXWriter_put_omitXMLDeclaration(writer, VARIANT_TRUE);
4098 EXPECT_HR(hr, S_OK);
4099
4100 hr = IVBSAXContentHandler_startDocument(vb_content);
4101 EXPECT_HR(hr, S_OK);
4102
4103 str = SysAllocStringLen(embedded_nullbytes, ARRAY_SIZE(embedded_nullbytes));
4104 hr = IVBSAXContentHandler_characters(vb_content, &str);
4105 EXPECT_HR(hr, S_OK);
4107
4108 V_VT(&dest) = VT_EMPTY;
4109 hr = IMXWriter_get_output(writer, &dest);
4110 EXPECT_HR(hr, S_OK);
4111 ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest));
4112 ok(SysStringLen(V_BSTR(&dest)) == ARRAY_SIZE(embedded_nullbytes), "unexpected len %d\n", SysStringLen(V_BSTR(&dest)));
4113 ok(!memcmp(V_BSTR(&dest), embedded_nullbytes, ARRAY_SIZE(embedded_nullbytes)),
4114 "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
4116
4117 IVBSAXContentHandler_Release(vb_content);
4118 IMXWriter_Release(writer);
4119
4120 /* batch tests */
4121 while (table->clsid)
4122 {
4123 ISAXContentHandler *content;
4124 IMXWriter *writer;
4125 VARIANT dest;
4126 HRESULT hr;
4127
4129 {
4130 table++;
4131 i++;
4132 continue;
4133 }
4134
4135 hr = CoCreateInstance(table->clsid, NULL, CLSCTX_INPROC_SERVER,
4136 &IID_IMXWriter, (void**)&writer);
4137 EXPECT_HR(hr, S_OK);
4138
4139 hr = IMXWriter_QueryInterface(writer, &IID_ISAXContentHandler, (void**)&content);
4140 EXPECT_HR(hr, S_OK);
4141
4142 hr = IMXWriter_put_omitXMLDeclaration(writer, VARIANT_TRUE);
4143 EXPECT_HR(hr, S_OK);
4144
4145 hr = ISAXContentHandler_startDocument(content);
4146 EXPECT_HR(hr, S_OK);
4147
4148 hr = ISAXContentHandler_characters(content, _bstr_(table->data), strlen(table->data));
4149 EXPECT_HR(hr, S_OK);
4150
4151 /* test output */
4152 if (hr == S_OK)
4153 {
4154 V_VT(&dest) = VT_EMPTY;
4155 hr = IMXWriter_get_output(writer, &dest);
4156 EXPECT_HR(hr, S_OK);
4157 ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest));
4158 ok(!lstrcmpW(_bstr_(table->output), V_BSTR(&dest)),
4159 "test %d: got wrong content %s, expected \"%s\"\n", i, wine_dbgstr_w(V_BSTR(&dest)), table->output);
4161 }
4162
4163 /* with disabled escaping */
4164 V_VT(&dest) = VT_EMPTY;
4165 hr = IMXWriter_put_output(writer, dest);
4166 EXPECT_HR(hr, S_OK);
4167
4168 hr = IMXWriter_put_disableOutputEscaping(writer, VARIANT_TRUE);
4169 EXPECT_HR(hr, S_OK);
4170
4171 hr = ISAXContentHandler_characters(content, _bstr_(table->data), strlen(table->data));
4172 EXPECT_HR(hr, S_OK);
4173
4174 /* test output */
4175 if (hr == S_OK)
4176 {
4177 V_VT(&dest) = VT_EMPTY;
4178 hr = IMXWriter_get_output(writer, &dest);
4179 EXPECT_HR(hr, S_OK);
4180 ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest));
4182 "test %d: got wrong content %s, expected \"%s\"\n", i, wine_dbgstr_w(V_BSTR(&dest)), table->data);
4184 }
4185
4186 ISAXContentHandler_Release(content);
4187 IMXWriter_Release(writer);
4188
4189 table++;
4190 i++;
4191 }
4192
4193 free_bstrs();
4194}
static const struct writer_characters_t writer_characters[]
Definition: saxreader.c:3964
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
BYTE * data

Referenced by START_TEST().

◆ test_mxwriter_comment()

static void test_mxwriter_comment ( void  )
static

Definition at line 4690 of file saxreader.c.

4691{
4692 static const WCHAR commentW[] = {'c','o','m','m','e','n','t',0};
4693 IVBSAXLexicalHandler *vblexical;
4694 ISAXContentHandler *content;
4695 ISAXLexicalHandler *lexical;
4696 IMXWriter *writer;
4697 VARIANT dest;
4698 HRESULT hr;
4699
4700 hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER,
4701 &IID_IMXWriter, (void**)&writer);
4702 EXPECT_HR(hr, S_OK);
4703
4704 hr = IMXWriter_QueryInterface(writer, &IID_ISAXContentHandler, (void**)&content);
4705 EXPECT_HR(hr, S_OK);
4706
4707 hr = IMXWriter_QueryInterface(writer, &IID_ISAXLexicalHandler, (void**)&lexical);
4708 EXPECT_HR(hr, S_OK);
4709
4710 hr = IMXWriter_QueryInterface(writer, &IID_IVBSAXLexicalHandler, (void**)&vblexical);
4711 EXPECT_HR(hr, S_OK);
4712
4713 hr = IMXWriter_put_omitXMLDeclaration(writer, VARIANT_TRUE);
4714 EXPECT_HR(hr, S_OK);
4715
4716 hr = ISAXContentHandler_startDocument(content);
4717 EXPECT_HR(hr, S_OK);
4718
4719 hr = ISAXLexicalHandler_comment(lexical, NULL, 0);
4721
4722 hr = IVBSAXLexicalHandler_comment(vblexical, NULL);
4724
4725 hr = ISAXLexicalHandler_comment(lexical, commentW, 0);
4726 EXPECT_HR(hr, S_OK);
4727
4728 V_VT(&dest) = VT_EMPTY;
4729 hr = IMXWriter_get_output(writer, &dest);
4730 EXPECT_HR(hr, S_OK);
4731 ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest));
4732 ok(!lstrcmpW(_bstr_("<!---->\r\n"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
4734
4735 hr = ISAXLexicalHandler_comment(lexical, commentW, ARRAY_SIZE(commentW) - 1);
4736 EXPECT_HR(hr, S_OK);
4737
4738 V_VT(&dest) = VT_EMPTY;
4739 hr = IMXWriter_get_output(writer, &dest);
4740 EXPECT_HR(hr, S_OK);
4741 ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest));
4742 ok(!lstrcmpW(_bstr_("<!---->\r\n<!--comment-->\r\n"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
4744
4745 ISAXContentHandler_Release(content);
4746 ISAXLexicalHandler_Release(lexical);
4747 IVBSAXLexicalHandler_Release(vblexical);
4748 IMXWriter_Release(writer);
4749 free_bstrs();
4750}
static const WCHAR commentW[]
Definition: reader.c:97

Referenced by START_TEST().

◆ test_mxwriter_default_properties()

static void test_mxwriter_default_properties ( const struct mxwriter_props_t table)
static

Definition at line 3038 of file saxreader.c.

3039{
3040 int i = 0;
3041
3042 while (table->clsid)
3043 {
3044 IMXWriter *writer;
3046 BSTR encoding;
3047 HRESULT hr;
3048
3050 {
3051 table++;
3052 i++;
3053 continue;
3054 }
3055
3056 hr = CoCreateInstance(table->clsid, NULL, CLSCTX_INPROC_SERVER,
3057 &IID_IMXWriter, (void**)&writer);
3058 EXPECT_HR(hr, S_OK);
3059
3060 b = !table->bom;
3061 hr = IMXWriter_get_byteOrderMark(writer, &b);
3062 EXPECT_HR(hr, S_OK);
3063 ok(table->bom == b, "test %d: got BOM %d, expected %d\n", i, b, table->bom);
3064
3065 b = !table->disable_escape;
3066 hr = IMXWriter_get_disableOutputEscaping(writer, &b);
3067 EXPECT_HR(hr, S_OK);
3068 ok(table->disable_escape == b, "test %d: got disable escape %d, expected %d\n", i, b,
3069 table->disable_escape);
3070
3071 b = !table->indent;
3072 hr = IMXWriter_get_indent(writer, &b);
3073 EXPECT_HR(hr, S_OK);
3074 ok(table->indent == b, "test %d: got indent %d, expected %d\n", i, b, table->indent);
3075
3076 b = !table->omitdecl;
3077 hr = IMXWriter_get_omitXMLDeclaration(writer, &b);
3078 EXPECT_HR(hr, S_OK);
3079 ok(table->omitdecl == b, "test %d: got omitdecl %d, expected %d\n", i, b, table->omitdecl);
3080
3081 b = !table->standalone;
3082 hr = IMXWriter_get_standalone(writer, &b);
3083 EXPECT_HR(hr, S_OK);
3084 ok(table->standalone == b, "test %d: got standalone %d, expected %d\n", i, b, table->standalone);
3085
3086 hr = IMXWriter_get_encoding(writer, &encoding);
3087 EXPECT_HR(hr, S_OK);
3088 ok(!lstrcmpW(encoding, _bstr_(table->encoding)), "test %d: got encoding %s, expected %s\n",
3089 i, wine_dbgstr_w(encoding), table->encoding);
3091
3092 IMXWriter_Release(writer);
3093
3094 table++;
3095 i++;
3096 }
3097}
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define b
Definition: ke_i.h:79
static char * encoding
Definition: xmllint.c:155

Referenced by test_mxwriter_properties().

◆ test_mxwriter_dispex()

static void test_mxwriter_dispex ( void  )
static

Definition at line 4662 of file saxreader.c.

4663{
4664 IDispatchEx *dispex;
4665 IMXWriter *writer;
4666 IUnknown *unk;
4667 HRESULT hr;
4668
4669 hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER,
4670 &IID_IMXWriter, (void**)&writer);
4671 EXPECT_HR(hr, S_OK);
4672
4673 hr = IMXWriter_QueryInterface(writer, &IID_IDispatchEx, (void**)&dispex);
4674 EXPECT_HR(hr, S_OK);
4675 hr = IDispatchEx_QueryInterface(dispex, &IID_IUnknown, (void**)&unk);
4676 test_obj_dispex(unk);
4677 IUnknown_Release(unk);
4678 IDispatchEx_Release(dispex);
4679 IMXWriter_Release(writer);
4680
4681 if (is_clsid_supported(&CLSID_MXXMLWriter60, mxwriter_support_data))
4682 {
4683 hr = CoCreateInstance(&CLSID_MXXMLWriter60, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&unk);
4684 ok(hr == S_OK, "got 0x%08x\n", hr);
4685 test_obj_dispex(unk);
4686 IUnknown_Release(unk);
4687 }
4688}

Referenced by START_TEST().

◆ test_mxwriter_dtd()

static void test_mxwriter_dtd ( void  )
static

Definition at line 4913 of file saxreader.c.

4914{
4915 static const WCHAR contentW[] = {'c','o','n','t','e','n','t'};
4916 static const WCHAR nameW[] = {'n','a','m','e'};
4917 static const WCHAR pubW[] = {'p','u','b'};
4918 static const WCHAR sysW[] = {'s','y','s'};
4919 IVBSAXLexicalHandler *vblexical;
4920 ISAXContentHandler *content;
4921 ISAXLexicalHandler *lexical;
4922 IVBSAXDeclHandler *vbdecl;
4923 ISAXDeclHandler *decl;
4924 ISAXDTDHandler *dtd;
4925 IMXWriter *writer;
4926 VARIANT dest;
4927 HRESULT hr;
4928
4929 hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER,
4930 &IID_IMXWriter, (void**)&writer);
4931 EXPECT_HR(hr, S_OK);
4932
4933 hr = IMXWriter_QueryInterface(writer, &IID_ISAXContentHandler, (void**)&content);
4934 EXPECT_HR(hr, S_OK);
4935
4936 hr = IMXWriter_QueryInterface(writer, &IID_ISAXLexicalHandler, (void**)&lexical);
4937 EXPECT_HR(hr, S_OK);
4938
4939 hr = IMXWriter_QueryInterface(writer, &IID_ISAXDeclHandler, (void**)&decl);
4940 EXPECT_HR(hr, S_OK);
4941
4942 hr = IMXWriter_QueryInterface(writer, &IID_IVBSAXDeclHandler, (void**)&vbdecl);
4943 EXPECT_HR(hr, S_OK);
4944
4945 hr = IMXWriter_QueryInterface(writer, &IID_IVBSAXLexicalHandler, (void**)&vblexical);
4946 EXPECT_HR(hr, S_OK);
4947
4948 hr = IMXWriter_put_omitXMLDeclaration(writer, VARIANT_TRUE);
4949 EXPECT_HR(hr, S_OK);
4950
4951 hr = ISAXContentHandler_startDocument(content);
4952 EXPECT_HR(hr, S_OK);
4953
4954 hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, NULL, 0, NULL, 0);
4956
4957 hr = IVBSAXLexicalHandler_startDTD(vblexical, NULL, NULL, NULL);
4959
4960 hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, pubW, ARRAY_SIZE(pubW), NULL, 0);
4962
4963 hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, NULL, 0, sysW, ARRAY_SIZE(sysW));