ReactOS  0.4.14-dev-815-ge410a12
reader.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include "windef.h"
#include "winbase.h"
#include "initguid.h"
#include "objbase.h"
#include "xmllite.h"
#include "xmllite_private.h"
#include "wine/debug.h"
#include "wine/list.h"
Include dependency graph for reader.c:

Go to the source code of this file.

Classes

struct  xml_encoding_data
 
struct  encoded_buffer
 
struct  xmlreaderinput
 
struct  strval
 
struct  reader_position
 
struct  attribute
 
struct  element
 
struct  ns
 
struct  xmlreader
 
struct  input_buffer
 

Macros

#define COBJMACROS
 

Typedefs

typedef struct input_buffer input_buffer
 

Enumerations

enum  XmlReaderInternalState {
  XmlReadInState_Initial, XmlReadInState_XmlDecl, XmlReadInState_Misc_DTD, XmlReadInState_DTD,
  XmlReadInState_DTD_Misc, XmlReadInState_Element, XmlReadInState_Content, XmlReadInState_MiscEnd,
  XmlReadInState_Eof
}
 
enum  XmlReaderResumeState {
  XmlReadResumeState_Initial, XmlReadResumeState_PITarget, XmlReadResumeState_PIBody, XmlReadResumeState_CDATA,
  XmlReadResumeState_Comment, XmlReadResumeState_STag, XmlReadResumeState_CharData, XmlReadResumeState_Whitespace
}
 
enum  XmlReaderResume { XmlReadResume_Name, XmlReadResume_Local, XmlReadResume_Body, XmlReadResume_Last }
 
enum  XmlReaderStringValue {
  StringValue_LocalName, StringValue_Prefix, StringValue_QualifiedName, StringValue_Value,
  StringValue_Last
}
 
enum  attribute_flags { ATTRIBUTE_NS_DEFINITION = 0x1, ATTRIBUTE_DEFAULT_NS_DEFINITION = 0x2 }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (xmllite)
 
 DEFINE_GUID (IID_IXmlReaderInput, 0x0b3ccc9b, 0x9214, 0x428b, 0xa2, 0xae, 0xef, 0x3a, 0xa8, 0x71, 0xaf, 0xda)
 
BOOL is_namestartchar (WCHAR ch)
 
static const chardebugstr_nodetype (XmlNodeType nodetype)
 
static const chardebugstr_reader_prop (XmlReaderProperty prop)
 
const WCHARget_encoding_name (xml_encoding encoding)
 
xml_encoding get_encoding_from_codepage (UINT codepage)
 
static xmlreaderimpl_from_IXmlReader (IXmlReader *iface)
 
static xmlreaderinputimpl_from_IXmlReaderInput (IXmlReaderInput *iface)
 
static voidreader_alloc (xmlreader *reader, size_t len)
 
static voidreader_alloc_zero (xmlreader *reader, size_t len)
 
static void reader_free (xmlreader *reader, void *mem)
 
static WCHARreader_get_ptr2 (const xmlreader *reader, UINT offset)
 
static WCHARreader_get_strptr (const xmlreader *reader, const strval *v)
 
static HRESULT reader_strvaldup (xmlreader *reader, const strval *src, strval *dest)
 
static voidreaderinput_alloc (xmlreaderinput *input, size_t len)
 
static voidreaderinput_realloc (xmlreaderinput *input, void *mem, size_t len)
 
static void readerinput_free (xmlreaderinput *input, void *mem)
 
static WCHARreaderinput_strdupW (xmlreaderinput *input, const WCHAR *str)
 
static void reader_free_strvalued (xmlreader *reader, strval *v)
 
static void reader_clear_attrs (xmlreader *reader)
 
static HRESULT reader_add_attr (xmlreader *reader, strval *prefix, strval *localname, strval *qname, strval *value, const struct reader_position *position, unsigned int flags)
 
static struct elementreader_get_element (xmlreader *reader)
 
static void reader_init_strvalue (UINT start, UINT len, strval *v)
 
static const chardebug_strval (const xmlreader *reader, const strval *v)
 
static void reader_init_cstrvalue (WCHAR *str, UINT len, strval *v)
 
static void reader_free_strvalue (xmlreader *reader, XmlReaderStringValue type)
 
static void reader_free_strvalues (xmlreader *reader)
 
static int strval_eq (const xmlreader *reader, const strval *str1, const strval *str2)
 
static void reader_clear_elements (xmlreader *reader)
 
static struct nsreader_lookup_ns (xmlreader *reader, const strval *prefix)
 
static HRESULT reader_inc_depth (xmlreader *reader)
 
static void reader_dec_depth (xmlreader *reader)
 
static HRESULT reader_push_ns (xmlreader *reader, const strval *prefix, const strval *uri, BOOL def)
 
static void reader_free_element (xmlreader *reader, struct element *element)
 
static void reader_mark_ns_nodes (xmlreader *reader, struct element *element)
 
static HRESULT reader_push_element (xmlreader *reader, strval *prefix, strval *localname, strval *qname, const struct reader_position *position)
 
static void reader_pop_ns_nodes (xmlreader *reader, struct element *element)
 
static void reader_pop_element (xmlreader *reader)
 
static void reader_set_strvalue (xmlreader *reader, XmlReaderStringValue type, const strval *value)
 
static int is_reader_pending (xmlreader *reader)
 
static HRESULT init_encoded_buffer (xmlreaderinput *input, encoded_buffer *buffer)
 
static void free_encoded_buffer (xmlreaderinput *input, encoded_buffer *buffer)
 
HRESULT get_code_page (xml_encoding encoding, UINT *cp)
 
xml_encoding parse_encoding_name (const WCHAR *name, int len)
 
static HRESULT alloc_input_buffer (xmlreaderinput *input)
 
static void free_input_buffer (input_buffer *buffer)
 
static void readerinput_release_stream (xmlreaderinput *readerinput)
 
static HRESULT readerinput_query_for_stream (xmlreaderinput *readerinput)
 
static HRESULT readerinput_growraw (xmlreaderinput *readerinput)
 
static void readerinput_grow (xmlreaderinput *readerinput, int length)
 
static BOOL readerinput_is_utf8 (xmlreaderinput *readerinput)
 
static HRESULT readerinput_detectencoding (xmlreaderinput *readerinput, xml_encoding *enc)
 
static int readerinput_get_utf8_convlen (xmlreaderinput *readerinput)
 
static int readerinput_get_convlen (xmlreaderinput *readerinput)
 
static void readerinput_shrinkraw (xmlreaderinput *readerinput, int len)
 
static void fixup_buffer_cr (encoded_buffer *buffer, int off)
 
static void readerinput_switchencoding (xmlreaderinput *readerinput, xml_encoding enc)
 
static void reader_shrink (xmlreader *reader)
 
static HRESULT reader_more (xmlreader *reader)
 
static UINT reader_get_cur (xmlreader *reader)
 
static WCHARreader_get_ptr (xmlreader *reader)
 
static int reader_cmp (xmlreader *reader, const WCHAR *str)
 
static void reader_update_position (xmlreader *reader, WCHAR ch)
 
static void reader_skipn (xmlreader *reader, int n)
 
static BOOL is_wchar_space (WCHAR ch)
 
static int reader_skipspaces (xmlreader *reader)
 
static HRESULT reader_parse_versionnum (xmlreader *reader, strval *val)
 
static HRESULT reader_parse_eq (xmlreader *reader)
 
static HRESULT reader_parse_versioninfo (xmlreader *reader)
 
static BOOL is_wchar_encname (WCHAR ch)
 
static HRESULT reader_parse_encname (xmlreader *reader, strval *val)
 
static HRESULT reader_parse_encdecl (xmlreader *reader)
 
static HRESULT reader_parse_sddecl (xmlreader *reader)
 
static HRESULT reader_parse_xmldecl (xmlreader *reader)
 
static HRESULT reader_parse_comment (xmlreader *reader)
 
static BOOL is_char (WCHAR ch)
 
BOOL is_pubchar (WCHAR ch)
 
BOOL is_ncnamechar (WCHAR ch)
 
BOOL is_namechar (WCHAR ch)
 
static XmlNodeType reader_get_nodetype (const xmlreader *reader)
 
static HRESULT reader_parse_name (xmlreader *reader, strval *name)
 
static HRESULT reader_parse_pitarget (xmlreader *reader, strval *target)
 
static HRESULT reader_parse_pi (xmlreader *reader)
 
static HRESULT reader_parse_whitespace (xmlreader *reader)
 
static HRESULT reader_parse_misc (xmlreader *reader)
 
static HRESULT reader_parse_sys_literal (xmlreader *reader, strval *literal)
 
static HRESULT reader_parse_pub_literal (xmlreader *reader, strval *literal)
 
static HRESULT reader_parse_externalid (xmlreader *reader)
 
static HRESULT reader_parse_dtd (xmlreader *reader)
 
static HRESULT reader_parse_local (xmlreader *reader, strval *local, BOOL check_for_separator)
 
static HRESULT reader_parse_qname (xmlreader *reader, strval *prefix, strval *local, strval *qname)
 
static WCHAR get_predefined_entity (const xmlreader *reader, const strval *name)
 
static HRESULT reader_parse_reference (xmlreader *reader)
 
static HRESULT reader_parse_attvalue (xmlreader *reader, strval *value)
 
static HRESULT reader_parse_attribute (xmlreader *reader)
 
static HRESULT reader_parse_stag (xmlreader *reader, strval *prefix, strval *local, strval *qname)
 
static HRESULT reader_parse_element (xmlreader *reader)
 
static HRESULT reader_parse_endtag (xmlreader *reader)
 
static HRESULT reader_parse_cdata (xmlreader *reader)
 
static HRESULT reader_parse_chardata (xmlreader *reader)
 
static HRESULT reader_parse_content (xmlreader *reader)
 
static HRESULT reader_parse_nextnode (xmlreader *reader)
 
static HRESULT WINAPI xmlreader_QueryInterface (IXmlReader *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI xmlreader_AddRef (IXmlReader *iface)
 
static void reader_clear_ns (xmlreader *reader)
 
static void reader_reset_parser (xmlreader *reader)
 
static ULONG WINAPI xmlreader_Release (IXmlReader *iface)
 
static HRESULT WINAPI xmlreader_SetInput (IXmlReader *iface, IUnknown *input)
 
static HRESULT WINAPI xmlreader_GetProperty (IXmlReader *iface, UINT property, LONG_PTR *value)
 
static HRESULT WINAPI xmlreader_SetProperty (IXmlReader *iface, UINT property, LONG_PTR value)
 
static HRESULT WINAPI xmlreader_Read (IXmlReader *iface, XmlNodeType *nodetype)
 
static HRESULT WINAPI xmlreader_GetNodeType (IXmlReader *iface, XmlNodeType *node_type)
 
static void reader_set_current_attribute (xmlreader *reader, struct attribute *attr)
 
static HRESULT reader_move_to_first_attribute (xmlreader *reader)
 
static HRESULT WINAPI xmlreader_MoveToFirstAttribute (IXmlReader *iface)
 
static HRESULT WINAPI xmlreader_MoveToNextAttribute (IXmlReader *iface)
 
static void reader_get_attribute_ns_uri (xmlreader *reader, struct attribute *attr, const WCHAR **uri, UINT *len)
 
static void reader_get_attribute_local_name (xmlreader *reader, struct attribute *attr, const WCHAR **name, UINT *len)
 
static HRESULT WINAPI xmlreader_MoveToAttributeByName (IXmlReader *iface, const WCHAR *local_name, const WCHAR *namespace_uri)
 
static HRESULT WINAPI xmlreader_MoveToElement (IXmlReader *iface)
 
static HRESULT WINAPI xmlreader_GetQualifiedName (IXmlReader *iface, LPCWSTR *name, UINT *len)
 
static struct nsreader_lookup_nsdef (xmlreader *reader)
 
static HRESULT WINAPI xmlreader_GetNamespaceUri (IXmlReader *iface, const WCHAR **uri, UINT *len)
 
static HRESULT WINAPI xmlreader_GetLocalName (IXmlReader *iface, LPCWSTR *name, UINT *len)
 
static HRESULT WINAPI xmlreader_GetPrefix (IXmlReader *iface, const WCHAR **ret, UINT *len)
 
static const strvalreader_get_value (xmlreader *reader, BOOL ensure_allocated)
 
static HRESULT WINAPI xmlreader_GetValue (IXmlReader *iface, const WCHAR **value, UINT *len)
 
static HRESULT WINAPI xmlreader_ReadValueChunk (IXmlReader *iface, WCHAR *buffer, UINT chunk_size, UINT *read)
 
static HRESULT WINAPI xmlreader_GetBaseUri (IXmlReader *iface, LPCWSTR *baseUri, UINT *baseUri_length)
 
static BOOL WINAPI xmlreader_IsDefault (IXmlReader *iface)
 
static BOOL WINAPI xmlreader_IsEmptyElement (IXmlReader *iface)
 
static HRESULT WINAPI xmlreader_GetLineNumber (IXmlReader *iface, UINT *line_number)
 
static HRESULT WINAPI xmlreader_GetLinePosition (IXmlReader *iface, UINT *line_position)
 
static HRESULT WINAPI xmlreader_GetAttributeCount (IXmlReader *iface, UINT *count)
 
static HRESULT WINAPI xmlreader_GetDepth (IXmlReader *iface, UINT *depth)
 
static BOOL WINAPI xmlreader_IsEOF (IXmlReader *iface)
 
static HRESULT WINAPI xmlreaderinput_QueryInterface (IXmlReaderInput *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI xmlreaderinput_AddRef (IXmlReaderInput *iface)
 
static ULONG WINAPI xmlreaderinput_Release (IXmlReaderInput *iface)
 
HRESULT WINAPI CreateXmlReader (REFIID riid, void **obj, IMalloc *imalloc)
 
HRESULT WINAPI CreateXmlReaderInputWithEncodingName (IUnknown *stream, IMalloc *imalloc, LPCWSTR encoding, BOOL hint, LPCWSTR base_uri, IXmlReaderInput **ppInput)
 

Variables

static const WCHAR usasciiW [] = {'U','S','-','A','S','C','I','I',0}
 
static const WCHAR utf16W [] = {'U','T','F','-','1','6',0}
 
static const WCHAR utf8W [] = {'U','T','F','-','8',0}
 
static const WCHAR dblquoteW [] = {'\"',0}
 
static const WCHAR quoteW [] = {'\'',0}
 
static const WCHAR ltW [] = {'<',0}
 
static const WCHAR gtW [] = {'>',0}
 
static const WCHAR commentW [] = {'<','!','-','-',0}
 
static const WCHAR piW [] = {'<','?',0}
 
static const struct xml_encoding_data xml_encoding_map []
 
static const struct IUnknownVtbl xmlreaderinputvtbl
 
static WCHAR emptyW [] = {0}
 
static WCHAR xmlW [] = {'x','m','l',0}
 
static WCHAR xmlnsW [] = {'x','m','l','n','s',0}
 
static const strval strval_empty = { emptyW }
 
static const strval strval_xml = { xmlW, 3 }
 
static const strval strval_xmlns = { xmlnsW, 5 }
 
static const struct IXmlReaderVtbl xmlreader_vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file reader.c.

Typedef Documentation

◆ input_buffer

Definition at line 189 of file reader.c.

Enumeration Type Documentation

◆ attribute_flags

Enumerator
ATTRIBUTE_NS_DEFINITION 
ATTRIBUTE_DEFAULT_NS_DEFINITION 

Definition at line 239 of file reader.c.

◆ XmlReaderInternalState

Enumerator
XmlReadInState_Initial 
XmlReadInState_XmlDecl 
XmlReadInState_Misc_DTD 
XmlReadInState_DTD 
XmlReadInState_DTD_Misc 
XmlReadInState_Element 
XmlReadInState_Content 
XmlReadInState_MiscEnd 
XmlReadInState_Eof 

Definition at line 44 of file reader.c.

◆ XmlReaderResume

Enumerator
XmlReadResume_Name 
XmlReadResume_Local 
XmlReadResume_Body 
XmlReadResume_Last 

Definition at line 72 of file reader.c.

73 {
74  XmlReadResume_Name, /* PITarget, name for NCName, prefix for QName */
75  XmlReadResume_Local, /* local for QName */
76  XmlReadResume_Body, /* PI body, comment text, CDATA text, CharData text */
XmlReaderResume
Definition: reader.c:72

◆ XmlReaderResumeState

Enumerator
XmlReadResumeState_Initial 
XmlReadResumeState_PITarget 
XmlReadResumeState_PIBody 
XmlReadResumeState_CDATA 
XmlReadResumeState_Comment 
XmlReadResumeState_STag 
XmlReadResumeState_CharData 
XmlReadResumeState_Whitespace 

Definition at line 59 of file reader.c.

◆ XmlReaderStringValue

Enumerator
StringValue_LocalName 
StringValue_Prefix 
StringValue_QualifiedName 
StringValue_Value 
StringValue_Last 

Definition at line 80 of file reader.c.

Function Documentation

◆ alloc_input_buffer()

static HRESULT alloc_input_buffer ( xmlreaderinput input)
static

Definition at line 776 of file reader.c.

777 {
779  HRESULT hr;
780 
781  input->buffer = NULL;
782 
783  buffer = readerinput_alloc(input, sizeof(*buffer));
784  if (!buffer) return E_OUTOFMEMORY;
785 
786  buffer->input = input;
787  buffer->code_page = ~0; /* code page is unknown at this point */
788  hr = init_encoded_buffer(input, &buffer->utf16);
789  if (hr != S_OK) {
791  return hr;
792  }
793 
794  hr = init_encoded_buffer(input, &buffer->encoded);
795  if (hr != S_OK) {
796  free_encoded_buffer(input, &buffer->utf16);
798  return hr;
799  }
800 
801  input->buffer = buffer;
802  return S_OK;
803 }
HRESULT hr
Definition: shlfolder.c:183
static HRESULT init_encoded_buffer(xmlreaderinput *input, encoded_buffer *buffer)
Definition: reader.c:714
GLuint buffer
Definition: glext.h:5915
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
static void readerinput_free(xmlreaderinput *input, void *mem)
Definition: reader.c:380
LONG HRESULT
Definition: typedefs.h:77
static void free_encoded_buffer(xmlreaderinput *input, encoded_buffer *buffer)
Definition: reader.c:729
static void * readerinput_alloc(xmlreaderinput *input, size_t len)
Definition: reader.c:370
#define S_OK
Definition: intsafe.h:59
GLenum GLenum GLenum input
Definition: glext.h:9031

Referenced by CreateXmlReaderInputWithEncodingName().

◆ CreateXmlReader()

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

Definition at line 3653 of file reader.c.

3654 {
3655  xmlreader *reader;
3656  HRESULT hr;
3657  int i;
3658 
3659  TRACE("(%s, %p, %p)\n", wine_dbgstr_guid(riid), obj, imalloc);
3660 
3661  if (imalloc)
3662  reader = IMalloc_Alloc(imalloc, sizeof(*reader));
3663  else
3664  reader = heap_alloc(sizeof(*reader));
3665  if (!reader)
3666  return E_OUTOFMEMORY;
3667 
3668  memset(reader, 0, sizeof(*reader));
3669  reader->IXmlReader_iface.lpVtbl = &xmlreader_vtbl;
3670  reader->ref = 1;
3671  reader->state = XmlReadState_Closed;
3672  reader->instate = XmlReadInState_Initial;
3673  reader->resumestate = XmlReadResumeState_Initial;
3674  reader->dtdmode = DtdProcessing_Prohibit;
3675  reader->imalloc = imalloc;
3676  if (imalloc) IMalloc_AddRef(imalloc);
3677  reader->nodetype = XmlNodeType_None;
3678  list_init(&reader->attrs);
3679  list_init(&reader->nsdef);
3680  list_init(&reader->ns);
3681  list_init(&reader->elements);
3682  reader->max_depth = 256;
3683 
3684  reader->chunk_read_off = 0;
3685  for (i = 0; i < StringValue_Last; i++)
3686  reader->strvalues[i] = strval_empty;
3687 
3688  hr = IXmlReader_QueryInterface(&reader->IXmlReader_iface, riid, obj);
3689  IXmlReader_Release(&reader->IXmlReader_iface);
3690 
3691  TRACE("returning iface %p, hr %#x\n", *obj, hr);
3692 
3693  return hr;
3694 }
static const struct IXmlReaderVtbl xmlreader_vtbl
Definition: reader.c:3563
static const strval strval_empty
Definition: reader.c:229
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
const char * wine_dbgstr_guid(const GUID *guid)
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
Definition: reader.h:83
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
#define memset(x, y, z)
Definition: compat.h:39

Referenced by test_attribute_by_name(), test_encoding_detection(), test_endoffile(), test_isemptyelement(), test_max_element_depth(), test_namespaceuri(), test_prefix(), test_read_attribute(), test_read_cdata(), test_read_charref(), test_read_comment(), test_read_element(), test_read_full(), test_read_pending(), test_read_pi(), test_read_public_dtd(), test_read_system_dtd(), test_read_text(), test_read_xmldeclaration(), test_reader_create(), test_reader_position(), test_reader_properties(), test_reader_state(), test_readerinput(), test_readvaluechunk(), and test_string_pointers().

◆ CreateXmlReaderInputWithEncodingName()

HRESULT WINAPI CreateXmlReaderInputWithEncodingName ( IUnknown stream,
IMalloc imalloc,
LPCWSTR  encoding,
BOOL  hint,
LPCWSTR  base_uri,
IXmlReaderInput **  ppInput 
)

Definition at line 3696 of file reader.c.

3702 {
3703  xmlreaderinput *readerinput;
3704  HRESULT hr;
3705 
3706  TRACE("%p %p %s %d %s %p\n", stream, imalloc, wine_dbgstr_w(encoding),
3707  hint, wine_dbgstr_w(base_uri), ppInput);
3708 
3709  if (!stream || !ppInput) return E_INVALIDARG;
3710 
3711  if (imalloc)
3712  readerinput = IMalloc_Alloc(imalloc, sizeof(*readerinput));
3713  else
3714  readerinput = heap_alloc(sizeof(*readerinput));
3715  if(!readerinput) return E_OUTOFMEMORY;
3716 
3717  readerinput->IXmlReaderInput_iface.lpVtbl = &xmlreaderinputvtbl;
3718  readerinput->ref = 1;
3719  readerinput->imalloc = imalloc;
3720  readerinput->stream = NULL;
3721  if (imalloc) IMalloc_AddRef(imalloc);
3722  readerinput->encoding = parse_encoding_name(encoding, -1);
3723  readerinput->hint = hint;
3724  readerinput->baseuri = readerinput_strdupW(readerinput, base_uri);
3725  readerinput->pending = 0;
3726 
3727  hr = alloc_input_buffer(readerinput);
3728  if (hr != S_OK)
3729  {
3730  readerinput_free(readerinput, readerinput->baseuri);
3731  readerinput_free(readerinput, readerinput);
3732  if (imalloc) IMalloc_Release(imalloc);
3733  return hr;
3734  }
3735  IUnknown_QueryInterface(stream, &IID_IUnknown, (void**)&readerinput->input);
3736 
3737  *ppInput = &readerinput->IXmlReaderInput_iface;
3738 
3739  TRACE("returning iface %p\n", *ppInput);
3740 
3741  return S_OK;
3742 }
xml_encoding encoding
Definition: reader.c:198
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
IUnknown * input
Definition: reader.c:196
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
WCHAR * baseuri
Definition: reader.c:200
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static WCHAR * readerinput_strdupW(xmlreaderinput *input, const WCHAR *str)
Definition: reader.c:385
static void readerinput_free(xmlreaderinput *input, void *mem)
Definition: reader.c:380
IMalloc * imalloc
Definition: reader.c:197
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
xml_encoding parse_encoding_name(const WCHAR *name, int len)
Definition: reader.c:747
Definition: parse.h:22
ISequentialStream * stream
Definition: reader.c:204
ed encoding
Definition: write.c:2839
unsigned int pending
Definition: reader.c:206
#define S_OK
Definition: intsafe.h:59
DWORD hint
Definition: vfdcmd.c:88
static HRESULT alloc_input_buffer(xmlreaderinput *input)
Definition: reader.c:776
static const struct IUnknownVtbl xmlreaderinputvtbl
Definition: reader.c:209
IXmlReaderInput IXmlReaderInput_iface
Definition: reader.c:193

Referenced by test_readerinput(), and xmlreader_SetInput().

◆ debug_strval()

static const char* debug_strval ( const xmlreader reader,
const strval v 
)
inlinestatic

◆ debugstr_nodetype()

static const char* debugstr_nodetype ( XmlNodeType  nodetype)
static

Definition at line 102 of file reader.c.

103 {
104  static const char * const type_names[] =
105  {
106  "None",
107  "Element",
108  "Attribute",
109  "Text",
110  "CDATA",
111  "",
112  "",
113  "ProcessingInstruction",
114  "Comment",
115  "",
116  "DocumentType",
117  "",
118  "",
119  "Whitespace",
120  "",
121  "EndElement",
122  "",
123  "XmlDeclaration"
124  };
125 
126  if (nodetype > _XmlNodeType_Last)
127  return wine_dbg_sprintf("unknown type=%d", nodetype);
128 
129  return type_names[nodetype];
130 }
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:271

Referenced by xmlreader_Read().

◆ debugstr_reader_prop()

static const char* debugstr_reader_prop ( XmlReaderProperty  prop)
static

Definition at line 132 of file reader.c.

133 {
134  static const char * const prop_names[] =
135  {
136  "MultiLanguage",
137  "ConformanceLevel",
138  "RandomAccess",
139  "XmlResolver",
140  "DtdProcessing",
141  "ReadState",
142  "MaxElementDepth",
143  "MaxEntityExpansion"
144  };
145 
146  if (prop > _XmlReaderProperty_Last)
147  return wine_dbg_sprintf("unknown property=%d", prop);
148 
149  return prop_names[prop];
150 }
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:271

Referenced by xmlreader_GetProperty(), and xmlreader_SetProperty().

◆ DEFINE_GUID()

DEFINE_GUID ( IID_IXmlReaderInput  ,
0x0b3ccc9b  ,
0x9214  ,
0x428b  ,
0xa2  ,
0xae  ,
0xef  ,
0x3a  ,
0xa8  ,
0x71  ,
0xaf  ,
0xda   
)

◆ fixup_buffer_cr()

static void fixup_buffer_cr ( encoded_buffer buffer,
int  off 
)
static

Definition at line 990 of file reader.c.

991 {
992  BOOL prev_cr = buffer->prev_cr;
993  const WCHAR *src;
994  WCHAR *dest;
995 
996  src = dest = (WCHAR*)buffer->data + off;
997  while ((const char*)src < buffer->data + buffer->written)
998  {
999  if (*src == '\r')
1000  {
1001  *dest++ = '\n';
1002  src++;
1003  prev_cr = TRUE;
1004  continue;
1005  }
1006  if(prev_cr && *src == '\n')
1007  src++;
1008  else
1009  *dest++ = *src++;
1010  prev_cr = FALSE;
1011  }
1012 
1013  buffer->written = (char*)dest - buffer->data;
1014  buffer->prev_cr = prev_cr;
1015  *dest = 0;
1016 }
#define TRUE
Definition: types.h:120
GLuint buffer
Definition: glext.h:5915
while(1)
Definition: macro.lex.yy.c:740
unsigned int BOOL
Definition: ntddk_ex.h:94
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum src
Definition: glext.h:6340
static char * dest
Definition: rtl.c:135
off
Definition: i386-dis.c:3909

Referenced by reader_more(), and readerinput_switchencoding().

◆ free_encoded_buffer()

static void free_encoded_buffer ( xmlreaderinput input,
encoded_buffer buffer 
)
static

Definition at line 729 of file reader.c.

730 {
731  readerinput_free(input, buffer->data);
732 }
GLuint buffer
Definition: glext.h:5915
static void readerinput_free(xmlreaderinput *input, void *mem)
Definition: reader.c:380
GLenum GLenum GLenum input
Definition: glext.h:9031

Referenced by alloc_input_buffer(), and free_input_buffer().

◆ free_input_buffer()

static void free_input_buffer ( input_buffer buffer)
static

Definition at line 805 of file reader.c.

806 {
807  free_encoded_buffer(buffer->input, &buffer->encoded);
808  free_encoded_buffer(buffer->input, &buffer->utf16);
809  readerinput_free(buffer->input, buffer);
810 }
GLuint buffer
Definition: glext.h:5915
static void readerinput_free(xmlreaderinput *input, void *mem)
Definition: reader.c:380
static void free_encoded_buffer(xmlreaderinput *input, encoded_buffer *buffer)
Definition: reader.c:729

Referenced by xmlreaderinput_Release().

◆ get_code_page()

HRESULT get_code_page ( xml_encoding  encoding,
UINT cp 
)

Definition at line 734 of file reader.c.

735 {
737  {
738  FIXME("unsupported encoding %d\n", encoding);
739  return E_NOTIMPL;
740  }
741 
743 
744  return S_OK;
745 }
#define FIXME(fmt,...)
Definition: debug.h:110
static const struct xml_encoding_data xml_encoding_map[]
Definition: reader.c:159
ed encoding
Definition: write.c:2839
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
POINT cp
Definition: magnifier.c:59

Referenced by readerinput_switchencoding().

◆ get_encoding_from_codepage()

xml_encoding get_encoding_from_codepage ( UINT  codepage)

Definition at line 170 of file reader.c.

171 {
172  int i;
173  for (i = 0; i < ARRAY_SIZE(xml_encoding_map); i++)
174  {
175  if (xml_encoding_map[i].cp == codepage) return xml_encoding_map[i].enc;
176  }
177  return XmlEncoding_Unknown;
178 }
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
int codepage
Definition: win_iconv.c:156
static const struct xml_encoding_data xml_encoding_map[]
Definition: reader.c:159
#define ARRAY_SIZE(a)
Definition: main.h:24
POINT cp
Definition: magnifier.c:59

Referenced by CreateXmlWriterOutputWithEncodingCodePage().

◆ get_encoding_name()

const WCHAR* get_encoding_name ( xml_encoding  encoding)

Definition at line 165 of file reader.c.

166 {
167  return xml_encoding_map[encoding].name;
168 }
static const struct xml_encoding_data xml_encoding_map[]
Definition: reader.c:159
ed encoding
Definition: write.c:2839

Referenced by get_output_encoding_name().

◆ get_predefined_entity()

static WCHAR get_predefined_entity ( const xmlreader reader,
const strval name 
)
static

Definition at line 2046 of file reader.c.

2047 {
2048  static const WCHAR entltW[] = {'l','t'};
2049  static const WCHAR entgtW[] = {'g','t'};
2050  static const WCHAR entampW[] = {'a','m','p'};
2051  static const WCHAR entaposW[] = {'a','p','o','s'};
2052  static const WCHAR entquotW[] = {'q','u','o','t'};
2053  static const strval lt = { (WCHAR*)entltW, 2 };
2054  static const strval gt = { (WCHAR*)entgtW, 2 };
2055  static const strval amp = { (WCHAR*)entampW, 3 };
2056  static const strval apos = { (WCHAR*)entaposW, 4 };
2057  static const strval quot = { (WCHAR*)entquotW, 4 };
2059 
2060  switch (*str)
2061  {
2062  case 'l':
2063  if (strval_eq(reader, name, &lt)) return '<';
2064  break;
2065  case 'g':
2066  if (strval_eq(reader, name, &gt)) return '>';
2067  break;
2068  case 'a':
2069  if (strval_eq(reader, name, &amp))
2070  return '&';
2071  else if (strval_eq(reader, name, &apos))
2072  return '\'';
2073  break;
2074  case 'q':
2075  if (strval_eq(reader, name, &quot)) return '\"';
2076  break;
2077  default:
2078  ;
2079  }
2080 
2081  return 0;
2082 }
static WCHAR * reader_get_strptr(const xmlreader *reader, const strval *v)
Definition: reader.c:348
const WCHAR * str
static int strval_eq(const xmlreader *reader, const strval *str1, const strval *str2)
Definition: reader.c:504
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: reader.h:83
Definition: reader.c:219
Definition: name.c:38

Referenced by reader_parse_reference().

◆ impl_from_IXmlReader()

◆ impl_from_IXmlReaderInput()

static xmlreaderinput* impl_from_IXmlReaderInput ( IXmlReaderInput iface)
inlinestatic

Definition at line 317 of file reader.c.

318 {
319  return CONTAINING_RECORD(iface, xmlreaderinput, IXmlReaderInput_iface);
320 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by xmlreader_SetInput(), xmlreaderinput_AddRef(), xmlreaderinput_QueryInterface(), and xmlreaderinput_Release().

◆ init_encoded_buffer()

static HRESULT init_encoded_buffer ( xmlreaderinput input,
encoded_buffer buffer 
)
static

Definition at line 714 of file reader.c.

715 {
716  const int initial_len = 0x2000;
717  buffer->data = readerinput_alloc(input, initial_len);
718  if (!buffer->data) return E_OUTOFMEMORY;
719 
720  memset(buffer->data, 0, 4);
721  buffer->cur = 0;
722  buffer->allocated = initial_len;
723  buffer->written = 0;
724  buffer->prev_cr = FALSE;
725 
726  return S_OK;
727 }
GLuint buffer
Definition: glext.h:5915
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static void * readerinput_alloc(xmlreaderinput *input, size_t len)
Definition: reader.c:370
#define S_OK
Definition: intsafe.h:59
GLenum GLenum GLenum input
Definition: glext.h:9031
#define memset(x, y, z)
Definition: compat.h:39

Referenced by alloc_input_buffer().

◆ is_char()

static BOOL is_char ( WCHAR  ch)
inlinestatic

Definition at line 1486 of file reader.c.

1487 {
1488  return (ch == '\t') || (ch == '\r') || (ch == '\n') ||
1489  (ch >= 0x20 && ch <= 0xd7ff) ||
1490  (ch >= 0xd800 && ch <= 0xdbff) || /* high surrogate */
1491  (ch >= 0xdc00 && ch <= 0xdfff) || /* low surrogate */
1492  (ch >= 0xe000 && ch <= 0xfffd);
1493 }

Referenced by reader_parse_reference(), and reader_parse_sys_literal().

◆ is_namechar()

BOOL is_namechar ( WCHAR  ch)

Definition at line 1553 of file reader.c.

1554 {
1555  return (ch == ':') || is_ncnamechar(ch);
1556 }
BOOL is_ncnamechar(WCHAR ch)
Definition: reader.c:1529

Referenced by is_valid_name(), and reader_parse_name().

◆ is_namestartchar()

BOOL is_namestartchar ( WCHAR  ch)

Definition at line 1509 of file reader.c.

1510 {
1511  return (ch == ':') || (ch >= 'A' && ch <= 'Z') ||
1512  (ch == '_') || (ch >= 'a' && ch <= 'z') ||
1513  (ch >= 0xc0 && ch <= 0xd6) ||
1514  (ch >= 0xd8 && ch <= 0xf6) ||
1515  (ch >= 0xf8 && ch <= 0x2ff) ||
1516  (ch >= 0x370 && ch <= 0x37d) ||
1517  (ch >= 0x37f && ch <= 0x1fff) ||
1518  (ch >= 0x200c && ch <= 0x200d) ||
1519  (ch >= 0x2070 && ch <= 0x218f) ||
1520  (ch >= 0x2c00 && ch <= 0x2fef) ||
1521  (ch >= 0x3001 && ch <= 0xd7ff) ||
1522  (ch >= 0xd800 && ch <= 0xdbff) || /* high surrogate */
1523  (ch >= 0xdc00 && ch <= 0xdfff) || /* low surrogate */
1524  (ch >= 0xf900 && ch <= 0xfdcf) ||
1525  (ch >= 0xfdf0 && ch <= 0xfffd);
1526 }

Referenced by is_valid_name(), reader_parse_name(), and readerinput_detectencoding().

◆ is_ncnamechar()

BOOL is_ncnamechar ( WCHAR  ch)

Definition at line 1529 of file reader.c.

1530 {
1531  return (ch >= 'A' && ch <= 'Z') ||
1532  (ch == '_') || (ch >= 'a' && ch <= 'z') ||
1533  (ch == '-') || (ch == '.') ||
1534  (ch >= '0' && ch <= '9') ||
1535  (ch == 0xb7) ||
1536  (ch >= 0xc0 && ch <= 0xd6) ||
1537  (ch >= 0xd8 && ch <= 0xf6) ||
1538  (ch >= 0xf8 && ch <= 0x2ff) ||
1539  (ch >= 0x300 && ch <= 0x36f) ||
1540  (ch >= 0x370 && ch <= 0x37d) ||
1541  (ch >= 0x37f && ch <= 0x1fff) ||
1542  (ch >= 0x200c && ch <= 0x200d) ||
1543  (ch >= 0x203f && ch <= 0x2040) ||
1544  (ch >= 0x2070 && ch <= 0x218f) ||
1545  (ch >= 0x2c00 && ch <= 0x2fef) ||
1546  (ch >= 0x3001 && ch <= 0xd7ff) ||
1547  (ch >= 0xd800 && ch <= 0xdbff) || /* high surrogate */
1548  (ch >= 0xdc00 && ch <= 0xdfff) || /* low surrogate */
1549  (ch >= 0xf900 && ch <= 0xfdcf) ||
1550  (ch >= 0xfdf0 && ch <= 0xfffd);
1551 }

Referenced by is_namechar(), is_valid_ncname(), reader_parse_local(), and reader_parse_qname().

◆ is_pubchar()

BOOL is_pubchar ( WCHAR  ch)

Definition at line 1496 of file reader.c.

1497 {
1498  return (ch == ' ') ||
1499  (ch >= 'a' && ch <= 'z') ||
1500  (ch >= 'A' && ch <= 'Z') ||
1501  (ch >= '0' && ch <= '9') ||
1502  (ch >= '-' && ch <= ';') || /* '()*+,-./:; */
1503  (ch == '=') || (ch == '?') ||
1504  (ch == '@') || (ch == '!') ||
1505  (ch >= '#' && ch <= '%') || /* #$% */
1506  (ch == '_') || (ch == '\r') || (ch == '\n');
1507 }

Referenced by is_valid_pubid(), and reader_parse_pub_literal().

◆ is_reader_pending()

static int is_reader_pending ( xmlreader reader)
inlinestatic

◆ is_wchar_encname()

static BOOL is_wchar_encname ( WCHAR  ch)
inlinestatic

Definition at line 1263 of file reader.c.

1264 {
1265  return ((ch >= 'A' && ch <= 'Z') ||
1266  (ch >= 'a' && ch <= 'z') ||
1267  (ch >= '0' && ch <= '9') ||
1268  (ch == '.') || (ch == '_') ||
1269  (ch == '-'));
1270 }

Referenced by reader_parse_encname().

◆ is_wchar_space()

static BOOL is_wchar_space ( WCHAR  ch)
inlinestatic

Definition at line 1168 of file reader.c.

1169 {
1170  return ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n';
1171 }

Referenced by reader_parse_attvalue(), reader_parse_chardata(), reader_parse_misc(), reader_parse_pi(), reader_parse_reference(), and reader_skipspaces().

◆ parse_encoding_name()

xml_encoding parse_encoding_name ( const WCHAR name,
int  len 
)

Definition at line 747 of file reader.c.

748 {
749  int min, max, n, c;
750 
751  if (!name) return XmlEncoding_Unknown;
752 
753  min = 0;
755 
756  while (min <= max)
757  {
758  n = (min+max)/2;
759 
760  if (len != -1)
762  else
764  if (!c)
765  return xml_encoding_map[n].enc;
766 
767  if (c > 0)
768  max = n-1;
769  else
770  min = n+1;
771  }
772 
773  return XmlEncoding_Unknown;
774 }
#define max(a, b)
Definition: svc.c:63
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
GLdouble n
Definition: glext.h:7729
static const struct xml_encoding_data xml_encoding_map[]
Definition: reader.c:159
const GLubyte * c
Definition: glext.h:8905
GLenum GLsizei len
Definition: glext.h:6722
#define wcsicmp
Definition: string.h:1152
#define ARRAY_SIZE(a)
Definition: main.h:24
#define min(a, b)
Definition: monoChain.cc:55
Definition: name.c:38
#define c
Definition: ke_i.h:80

Referenced by CreateXmlReaderInputWithEncodingName(), and reader_parse_encname().

◆ reader_add_attr()

static HRESULT reader_add_attr ( xmlreader reader,
strval prefix,
strval localname,
strval qname,
strval value,
const struct reader_position position,
unsigned int  flags 
)
static

Definition at line 426 of file reader.c.

428 {
429  struct attribute *attr;
430  HRESULT hr;
431 
432  attr = reader_alloc(reader, sizeof(*attr));
433  if (!attr) return E_OUTOFMEMORY;
434 
435  hr = reader_strvaldup(reader, localname, &attr->localname);
436  if (hr == S_OK)
437  {
439  if (hr != S_OK)
441  }
442  if (hr != S_OK)
443  {
445  return hr;
446  }
447 
448  if (prefix)
449  attr->prefix = *prefix;
450  else
451  memset(&attr->prefix, 0, sizeof(attr->prefix));
452  attr->qname = qname ? *qname : *localname;
453  attr->position = *position;
454  attr->flags = flags;
455  list_add_tail(&reader->attrs, &attr->entry);
456  reader->attr_count++;
457 
458  return S_OK;
459 }
HRESULT hr
Definition: shlfolder.c:183
WCHAR * value
Definition: cookie.c:204
static HRESULT reader_strvaldup(xmlreader *reader, const strval *src, strval *dest)
Definition: reader.c:353
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
strval localname
Definition: reader.c:249
static void * reader_alloc(xmlreader *reader, size_t len)
Definition: reader.c:323
static void reader_free(xmlreader *reader, void *mem)
Definition: reader.c:336
LONG HRESULT
Definition: typedefs.h:77
Definition: cookie.c:201
GLbitfield flags
Definition: glext.h:7161
__u8 attr
Definition: mkdosfs.c:359
#define S_OK
Definition: intsafe.h:59
static void reader_free_strvalued(xmlreader *reader, strval *v)
Definition: reader.c:401
Definition: reader.h:83
strval qname
Definition: reader.c:250
strval prefix
Definition: reader.c:248
#define memset(x, y, z)
Definition: compat.h:39
struct reader_position position
Definition: reader.c:252

Referenced by reader_parse_attribute(), reader_parse_encdecl(), reader_parse_externalid(), reader_parse_sddecl(), and reader_parse_versioninfo().

◆ reader_alloc()

static void* reader_alloc ( xmlreader reader,
size_t  len 
)
inlinestatic

Definition at line 323 of file reader.c.

324 {
325  return m_alloc(reader->imalloc, len);
326 }
static void * m_alloc(IMalloc *imalloc, size_t len)
GLenum GLsizei len
Definition: glext.h:6722
Definition: reader.h:83

Referenced by reader_add_attr(), reader_alloc_zero(), reader_get_value(), reader_push_ns(), reader_set_strvalue(), and reader_strvaldup().

◆ reader_alloc_zero()

static void* reader_alloc_zero ( xmlreader reader,
size_t  len 
)
inlinestatic

Definition at line 328 of file reader.c.

329 {
330  void *ret = reader_alloc(reader, len);
331  if (ret)
332  memset(ret, 0, len);
333  return ret;
334 }
static void * reader_alloc(xmlreader *reader, size_t len)
Definition: reader.c:323
int ret
GLenum GLsizei len
Definition: glext.h:6722
Definition: reader.h:83
#define memset(x, y, z)
Definition: compat.h:39

Referenced by reader_push_element().

◆ reader_clear_attrs()

static void reader_clear_attrs ( xmlreader reader)
static

Definition at line 410 of file reader.c.

411 {
412  struct attribute *attr, *attr2;
413  LIST_FOR_EACH_ENTRY_SAFE(attr, attr2, &reader->attrs, struct attribute, entry)
414  {
415  reader_free_strvalued(reader, &attr->localname);
418  }
419  list_init(&reader->attrs);
420  reader->attr_count = 0;
421  reader->attr = NULL;
422 }
WCHAR * value
Definition: cookie.c:204
smooth NULL
Definition: ftsmooth.c:416
static void reader_free(xmlreader *reader, void *mem)
Definition: reader.c:336
Definition: cookie.c:201
__u8 attr
Definition: mkdosfs.c:359
uint32_t entry
Definition: isohybrid.c:63
static void reader_free_strvalued(xmlreader *reader, strval *v)
Definition: reader.c:401
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
Definition: reader.h:83
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149

Referenced by reader_parse_nextnode(), and reader_reset_parser().

◆ reader_clear_elements()

static void reader_clear_elements ( xmlreader reader)
static

Definition at line 510 of file reader.c.

511 {
512  struct element *elem, *elem2;
513  LIST_FOR_EACH_ENTRY_SAFE(elem, elem2, &reader->elements, struct element, entry)
514  {
515  reader_free_strvalued(reader, &elem->prefix);
516  reader_free_strvalued(reader, &elem->localname);
519  }
520  list_init(&reader->elements);
521  reader_free_strvalued(reader, &reader->empty_element.localname);
522  reader_free_strvalued(reader, &reader->empty_element.qname);
523  reader->is_empty_element = FALSE;
524 }
static size_t elem
Definition: string.c:68
static void reader_free(xmlreader *reader, void *mem)
Definition: reader.c:336
uint32_t entry
Definition: isohybrid.c:63
static void reader_free_strvalued(xmlreader *reader, strval *v)
Definition: reader.c:401
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
Definition: reader.h:83
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149

Referenced by reader_reset_parser().

◆ reader_clear_ns()

static void reader_clear_ns ( xmlreader reader)
static

Definition at line 2712 of file reader.c.

2713 {
2714  struct ns *ns, *ns2;
2715 
2716  LIST_FOR_EACH_ENTRY_SAFE(ns, ns2, &reader->ns, struct ns, entry) {
2717  list_remove(&ns->entry);
2720  reader_free(reader, ns);
2721  }
2722 
2723  LIST_FOR_EACH_ENTRY_SAFE(ns, ns2, &reader->nsdef, struct ns, entry) {
2724  list_remove(&ns->entry);
2726  reader_free(reader, ns);
2727  }
2728 }
BSTR uri
Definition: mxnamespace.c:47
static void reader_free(xmlreader *reader, void *mem)
Definition: reader.c:336
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
Definition: mxnamespace.c:44
uint32_t entry
Definition: isohybrid.c:63
BSTR prefix
Definition: mxnamespace.c:46
struct list entry
Definition: reader.c:267
static void reader_free_strvalued(xmlreader *reader, strval *v)
Definition: reader.c:401
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
Definition: reader.h:83

Referenced by reader_reset_parser().

◆ reader_cmp()

static int reader_cmp ( xmlreader reader,
const WCHAR str 
)
static

Definition at line 1124 of file reader.c.

1125 {
1126  int i=0;
1127  const WCHAR *ptr = reader_get_ptr(reader);
1128  while (str[i])
1129  {
1130  if (!ptr[i])
1131  {
1134  }
1135  if (str[i] != ptr[i])
1136  return ptr[i] - str[i];
1137  i++;
1138  }
1139  return 0;
1140 }
static HRESULT reader_more(xmlreader *reader)
Definition: reader.c:1073
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1116
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
const WCHAR * str
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: reader.h:83

Referenced by reader_parse_chardata(), reader_parse_content(), reader_parse_dtd(), reader_parse_element(), reader_parse_encdecl(), reader_parse_endtag(), reader_parse_eq(), reader_parse_externalid(), reader_parse_misc(), reader_parse_sddecl(), reader_parse_stag(), reader_parse_versioninfo(), reader_parse_versionnum(), and reader_parse_xmldecl().

◆ reader_dec_depth()

static void reader_dec_depth ( xmlreader reader)
static

Definition at line 544 of file reader.c.

545 {
546  if (reader->depth)
547  reader->depth--;
548 }
Definition: reader.h:83

Referenced by reader_parse_nextnode(), and xmlreader_MoveToElement().

◆ reader_free()

static void reader_free ( xmlreader reader,
void mem 
)
inlinestatic

Definition at line 336 of file reader.c.

337 {
338  m_free(reader->imalloc, mem);
339 }
static void m_free(IMalloc *imalloc, void *mem)
Definition: reader.h:83
Definition: mem.c:156

Referenced by reader_add_attr(), reader_clear_attrs(), reader_clear_elements(), reader_clear_ns(), reader_free_element(), reader_free_strvalued(), reader_pop_ns_nodes(), reader_push_ns(), and xmlreader_Release().

◆ reader_free_element()

static void reader_free_element ( xmlreader reader,
struct element element 
)
static

Definition at line 580 of file reader.c.

581 {
586 }
strval prefix
Definition: reader.c:259
static void reader_free(xmlreader *reader, void *mem)
Definition: reader.c:336
strval localname
Definition: reader.c:260
static void reader_free_strvalued(xmlreader *reader, strval *v)
Definition: reader.c:401
strval qname
Definition: reader.c:261
Definition: reader.h:83

Referenced by reader_pop_element(), and reader_push_element().

◆ reader_free_strvalue()

static void reader_free_strvalue ( xmlreader reader,
XmlReaderStringValue  type 
)
static

Definition at line 490 of file reader.c.

491 {
492  reader_free_strvalued(reader, &reader->strvalues[type]);
493 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static void reader_free_strvalued(xmlreader *reader, strval *v)
Definition: reader.c:401
Definition: reader.h:83

Referenced by reader_free_strvalues(), and reader_set_strvalue().

◆ reader_free_strvalued()

static void reader_free_strvalued ( xmlreader reader,
strval v 
)
static

Definition at line 401 of file reader.c.

402 {
403  if (v->str != strval_empty.str)
404  {
405  reader_free(reader, v->str);
406  *v = strval_empty;
407  }
408 }
WCHAR * str
Definition: reader.c:221
static const strval strval_empty
Definition: reader.c:229
static void reader_free(xmlreader *reader, void *mem)
Definition: reader.c:336
const GLdouble * v
Definition: gl.h:2040
Definition: reader.h:83

Referenced by reader_add_attr(), reader_clear_attrs(), reader_clear_elements(), reader_clear_ns(), reader_free_element(), reader_free_strvalue(), reader_parse_stag(), reader_pop_ns_nodes(), and reader_push_ns().

◆ reader_free_strvalues()

static void reader_free_strvalues ( xmlreader reader)
static

Definition at line 495 of file reader.c.

496 {
497  int type;
498  for (type = 0; type < StringValue_Last; type++)
500 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static void reader_free_strvalue(xmlreader *reader, XmlReaderStringValue type)
Definition: reader.c:490
Definition: reader.h:83

Referenced by reader_reset_parser().

◆ reader_get_attribute_local_name()

static void reader_get_attribute_local_name ( xmlreader reader,
struct attribute attr,
const WCHAR **  name,
UINT len 
)
static

Definition at line 3048 of file reader.c.

3049 {
3051  {
3052  *name = xmlnsW;
3053  *len = 5;
3054  }
3055  else if (attr->flags & ATTRIBUTE_NS_DEFINITION)
3056  {
3057  const struct ns *ns = reader_lookup_ns(reader, &attr->localname);
3058  *name = ns->prefix.str;
3059  *len = ns->prefix.len;
3060  }
3061  else
3062  {
3063  *name = attr->localname.str;
3064  *len = attr->localname.len;
3065  }
3066 }
static WCHAR xmlnsW[]
Definition: reader.c:228
Definition: cookie.c:201
Definition: mxnamespace.c:44
GLenum GLsizei len
Definition: glext.h:6722
BSTR prefix
Definition: mxnamespace.c:46
static struct ns * reader_lookup_ns(xmlreader *reader, const strval *prefix)
Definition: reader.c:526
Definition: reader.h:83
Definition: name.c:38

Referenced by xmlreader_GetLocalName(), and xmlreader_MoveToAttributeByName().

◆ reader_get_attribute_ns_uri()

static void reader_get_attribute_ns_uri ( xmlreader reader,
struct attribute attr,
const WCHAR **  uri,
UINT len 
)
static

Definition at line 3006 of file reader.c.

3007 {
3008  static const WCHAR xmlns_uriW[] = {'h','t','t','p',':','/','/','w','w','w','.','w','3','.','o','r','g','/',
3009  '2','0','0','0','/','x','m','l','n','s','/',0};
3010  static const WCHAR xml_uriW[] = {'h','t','t','p',':','/','/','w','w','w','.','w','3','.','o','r','g','/',
3011  'X','M','L','/','1','9','9','8','/','n','a','m','e','s','p','a','c','e',0};
3012 
3013  /* Check for reserved prefixes first */
3014  if ((strval_eq(reader, &attr->prefix, &strval_empty) && strval_eq(reader, &attr->localname, &strval_xmlns)) ||
3015  strval_eq(reader, &attr->prefix, &strval_xmlns))
3016  {
3017  *uri = xmlns_uriW;
3018  *len = ARRAY_SIZE(xmlns_uriW) - 1;
3019  }
3020  else if (strval_eq(reader, &attr->prefix, &strval_xml))
3021  {
3022  *uri = xml_uriW;
3023  *len = ARRAY_SIZE(xml_uriW) - 1;
3024  }
3025  else
3026  {
3027  *uri = NULL;
3028  *len = 0;
3029  }
3030 
3031  if (!*uri)
3032  {
3033  struct ns *ns;
3034 
3035  if ((ns = reader_lookup_ns(reader, &attr->prefix)))
3036  {
3037  *uri = ns->uri.str;
3038  *len = ns->uri.len;
3039  }
3040  else
3041  {
3042  *uri = emptyW;
3043  *len = 0;
3044  }
3045  }
3046 }
static const strval strval_empty
Definition: reader.c:229
BSTR uri
Definition: mxnamespace.c:47
const char * uri
Definition: sec_mgr.c:1594
static WCHAR emptyW[]
Definition: reader.c:226
static const strval strval_xml
Definition: reader.c:230
smooth NULL
Definition: ftsmooth.c:416
static int strval_eq(const xmlreader *reader, const strval *str1, const strval *str2)
Definition: reader.c:504
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: cookie.c:201
static const strval strval_xmlns
Definition: reader.c:231
Definition: mxnamespace.c:44
GLenum GLsizei len
Definition: glext.h:6722
#define ARRAY_SIZE(a)
Definition: main.h:24
static struct ns * reader_lookup_ns(xmlreader *reader, const strval *prefix)
Definition: reader.c:526
Definition: reader.h:83

Referenced by xmlreader_GetNamespaceUri(), and xmlreader_MoveToAttributeByName().

◆ reader_get_cur()

◆ reader_get_element()

static struct element* reader_get_element ( xmlreader reader)
static

Definition at line 462 of file reader.c.

463 {
464  if (reader->is_empty_element)
465  return &reader->empty_element;
466 
467  return LIST_ENTRY(list_head(&reader->elements), struct element, entry);
468 }
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
uint32_t entry
Definition: isohybrid.c:63
Definition: reader.h:83
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by xmlreader_GetLineNumber(), xmlreader_GetLinePosition(), xmlreader_GetLocalName(), and xmlreader_GetQualifiedName().

◆ reader_get_nodetype()

static XmlNodeType reader_get_nodetype ( const xmlreader reader)
static

Definition at line 1558 of file reader.c.

1559 {
1560  /* When we're on attribute always return attribute type, container node type is kept.
1561  Note that container is not necessarily an element, and attribute doesn't mean it's
1562  an attribute in XML spec terms. */
1563  return reader->attr ? XmlNodeType_Attribute : reader->nodetype;
1564 }
Definition: reader.h:83

Referenced by reader_get_value(), reader_parse_nextnode(), xmlreader_GetLineNumber(), xmlreader_GetLinePosition(), xmlreader_GetLocalName(), xmlreader_GetNamespaceUri(), xmlreader_GetNodeType(), xmlreader_GetPrefix(), xmlreader_GetQualifiedName(), and xmlreader_IsEmptyElement().

◆ reader_get_ptr()

static WCHAR* reader_get_ptr ( xmlreader reader)
inlinestatic

◆ reader_get_ptr2()

static WCHAR* reader_get_ptr2 ( const xmlreader reader,
UINT  offset 
)
inlinestatic

Definition at line 342 of file reader.c.

343 {
344  encoded_buffer *buffer = &reader->input->buffer->utf16;
345  return (WCHAR*)buffer->data + offset;
346 }
GLintptr offset
Definition: glext.h:5920
GLuint buffer
Definition: glext.h:5915
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: reader.h:83

Referenced by reader_get_strptr(), reader_parse_pi(), and reader_parse_reference().

◆ reader_get_strptr()

static WCHAR* reader_get_strptr ( const xmlreader reader,
const strval v 
)
inlinestatic

Definition at line 348 of file reader.c.

349 {
350  return v->str ? v->str : reader_get_ptr2(reader, v->start);
351 }
static WCHAR * reader_get_ptr2(const xmlreader *reader, UINT offset)
Definition: reader.c:342
const GLdouble * v
Definition: gl.h:2040
Definition: reader.h:83

Referenced by debug_strval(), get_predefined_entity(), reader_get_value(), reader_parse_pitarget(), reader_set_strvalue(), reader_strvaldup(), strval_eq(), and xmlreader_ReadValueChunk().

◆ reader_get_value()

static const strval* reader_get_value ( xmlreader reader,
BOOL  ensure_allocated 
)
static

Definition at line 3349 of file reader.c.

3350 {
3351  strval *val;
3352 
3353  switch (reader_get_nodetype(reader))
3354  {
3357  case XmlNodeType_None:
3358  return &strval_empty;
3359  case XmlNodeType_Attribute:
3360  /* For namespace definition attributes return values from namespace list */
3362  {
3363  struct ns *ns;
3364 
3365  if (!(ns = reader_lookup_ns(reader, &reader->attr->localname)))
3367 
3368  return &ns->uri;
3369  }
3370  return &reader->attr->value;
3371  default:
3372  break;
3373  }
3374 
3375  val = &reader->strvalues[StringValue_Value];
3376  if (!val->str && ensure_allocated)
3377  {
3378  WCHAR *ptr = reader_alloc(reader, (val->len+1)*sizeof(WCHAR));
3379  if (!ptr) return NULL;
3380  memcpy(ptr, reader_get_strptr(reader, val), val->len*sizeof(WCHAR));
3381  ptr[val->len] = 0;
3382  val->str = ptr;
3383  }
3384 
3385  return val;
3386 }
static const strval strval_empty
Definition: reader.c:229
BSTR uri
Definition: mxnamespace.c:47
static WCHAR * reader_get_strptr(const xmlreader *reader, const strval *v)
Definition: reader.c:348
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
static void * reader_alloc(xmlreader *reader, size_t len)
Definition: reader.c:323
static XmlNodeType reader_get_nodetype(const xmlreader *reader)
Definition: reader.c:1558
GLuint GLfloat * val
Definition: glext.h:7180
static struct ns * reader_lookup_nsdef(xmlreader *reader)
Definition: reader.c:3199
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: mxnamespace.c:44
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static struct ns * reader_lookup_ns(xmlreader *reader, const strval *prefix)
Definition: reader.c:526
Definition: reader.h:83
Definition: reader.c:219

Referenced by xmlreader_GetValue(), and xmlreader_ReadValueChunk().

◆ reader_inc_depth()

static HRESULT reader_inc_depth ( xmlreader reader)
static

Definition at line 539 of file reader.c.

540 {
541  return (++reader->depth >= reader->max_depth && reader->max_depth) ? SC_E_MAXELEMENTDEPTH : S_OK;
542 }
#define S_OK
Definition: intsafe.h:59
Definition: reader.h:83

Referenced by reader_move_to_first_attribute(), and reader_parse_nextnode().

◆ reader_init_cstrvalue()

static void reader_init_cstrvalue ( WCHAR str,
UINT  len,
strval v 
)
inlinestatic

Definition at line 483 of file reader.c.

484 {
485  v->start = 0;
486  v->len = len;
487  v->str = str;
488 }
const WCHAR * str
GLenum GLsizei len
Definition: glext.h:6722
const GLdouble * v
Definition: gl.h:2040

Referenced by reader_parse_externalid().

◆ reader_init_strvalue()

static void reader_init_strvalue ( UINT  start,
UINT  len,
strval v 
)
inlinestatic

◆ reader_lookup_ns()

static struct ns* reader_lookup_ns ( xmlreader reader,
const strval prefix 
)
static

Definition at line 526 of file reader.c.

527 {
528  struct list *nslist = prefix ? &reader->ns : &reader->nsdef;
529  struct ns *ns;
530 
531  LIST_FOR_EACH_ENTRY_REV(ns, nslist, struct ns, entry) {
532  if (strval_eq(reader, prefix, &ns->prefix))
533  return ns;
534  }
535 
536  return NULL;
537 }
smooth NULL
Definition: ftsmooth.c:416
static int strval_eq(const xmlreader *reader, const strval *str1, const strval *str2)
Definition: reader.c:504
Definition: mxnamespace.c:44
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
BSTR prefix
Definition: mxnamespace.c:46
Definition: reader.h:83
#define LIST_FOR_EACH_ENTRY_REV(elem, list, type, field)
Definition: list.h:222

Referenced by reader_get_attribute_local_name(), reader_get_attribute_ns_uri(), reader_get_value(), xmlreader_GetNamespaceUri(), and xmlreader_GetPrefix().

◆ reader_lookup_nsdef()

static struct ns* reader_lookup_nsdef ( xmlreader reader)
static

Definition at line 3199 of file reader.c.

3200 {
3201  if (list_empty(&reader->nsdef))
3202  return NULL;
3203 
3204  return LIST_ENTRY(list_head(&reader->nsdef), struct ns, entry);
3205 }
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
smooth NULL
Definition: ftsmooth.c:416
Definition: mxnamespace.c:44
uint32_t entry
Definition: isohybrid.c:63
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
Definition: list.h:143
Definition: reader.h:83
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by reader_get_value(), and xmlreader_GetNamespaceUri().

◆ reader_mark_ns_nodes()

static void reader_mark_ns_nodes ( xmlreader reader,
struct element element 
)
static

Definition at line 588 of file reader.c.

589 {
590  struct ns *ns;
591 
592  LIST_FOR_EACH_ENTRY(ns, &reader->ns, struct ns, entry) {
593  if (ns->element)
594  break;
595  ns->element = element;
596  }
597 
598  LIST_FOR_EACH_ENTRY(ns, &reader->nsdef, struct ns, entry) {
599  if (ns->element)
600  break;
601  ns->element = element;
602  }
603 }
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
Definition: mxnamespace.c:44
uint32_t entry
Definition: isohybrid.c:63
Definition: reader.h:83
struct element * element
Definition: reader.c:270

Referenced by reader_parse_stag(), and reader_push_element().

◆ reader_more()

static HRESULT reader_more ( xmlreader reader)
static

Definition at line 1073 of file reader.c.

1074 {
1075  xmlreaderinput *readerinput = reader->input;
1076  encoded_buffer *src = &readerinput->buffer->encoded;
1077  encoded_buffer *dest = &readerinput->buffer->utf16;
1078  UINT cp = readerinput->buffer->code_page;
1079  int len, dest_len, prev_len;
1080  HRESULT hr;
1081  WCHAR *ptr;
1082 
1083  /* get some raw data from stream first */
1084  hr = readerinput_growraw(readerinput);
1085  len = readerinput_get_convlen(readerinput);
1086  prev_len = dest->written / sizeof(WCHAR);
1087 
1088  /* just copy for UTF-16 case */
1089  if (cp == 1200)
1090  {
1091  readerinput_grow(readerinput, len);
1092  memcpy(dest->data + dest->written, src->data + src->cur, len);
1093  dest->written += len*sizeof(WCHAR);
1094  }
1095  else
1096  {
1097  dest_len = MultiByteToWideChar(cp, 0, src->data + src->cur, len, NULL, 0);
1098  readerinput_grow(readerinput, dest_len);
1099  ptr = (WCHAR*)(dest->data + dest->written);
1100  MultiByteToWideChar(cp, 0, src->data + src->cur, len, ptr, dest_len);
1101  ptr[dest_len] = 0;
1102  dest->written += dest_len*sizeof(WCHAR);
1103  /* get rid of processed data */
1104  readerinput_shrinkraw(readerinput, len);
1105  }
1106 
1107  fixup_buffer_cr(dest, prev_len);
1108  return hr;
1109 }
static void fixup_buffer_cr(encoded_buffer *buffer, int off)
Definition: reader.c:990
HRESULT hr
Definition: shlfolder.c:183
static void readerinput_grow(xmlreaderinput *readerinput, int length)
Definition: reader.c:865
static int readerinput_get_convlen(xmlreaderinput *readerinput)
Definition: reader.c:958
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
encoded_buffer encoded
Definition: reader.c:307
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static void readerinput_shrinkraw(xmlreaderinput *readerinput, int len)
Definition: reader.c:975
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
encoded_buffer utf16
Definition: reader.c:306
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
#define MultiByteToWideChar
Definition: compat.h:100
input_buffer * buffer
Definition: reader.c:205
POINT cp
Definition: magnifier.c:59
static HRESULT readerinput_growraw(xmlreaderinput *readerinput)
Definition: reader.c:835
static char * dest
Definition: rtl.c:135
UINT code_page
Definition: reader.c:308

Referenced by reader_cmp(), reader_get_ptr(), and reader_parse_misc().

◆ reader_move_to_first_attribute()

static HRESULT reader_move_to_first_attribute ( xmlreader reader)
static

Definition at line 2965 of file reader.c.

2966 {
2967  if (!reader->attr_count)
2968  return S_FALSE;
2969 
2970  if (!reader->attr)
2972 
2974 
2975  return S_OK;
2976 }
static void reader_set_current_attribute(xmlreader *reader, struct attribute *attr)
Definition: reader.c:2956
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
#define S_FALSE
Definition: winerror.h:2357
uint32_t entry
Definition: isohybrid.c:63
static HRESULT reader_inc_depth(xmlreader *reader)
Definition: reader.c:539
#define S_OK
Definition: intsafe.h:59
Definition: reader.h:83
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by xmlreader_MoveToFirstAttribute(), and xmlreader_MoveToNextAttribute().

◆ reader_parse_attribute()

static HRESULT reader_parse_attribute ( xmlreader reader)
static

Definition at line 2235 of file reader.c.

2236 {
2237  struct reader_position position = reader->position;
2238  strval prefix, local, qname, value;
2239  enum attribute_flags flags = 0;
2240  HRESULT hr;
2241 
2242  hr = reader_parse_qname(reader, &prefix, &local, &qname);
2243  if (FAILED(hr)) return hr;
2244 
2245  if (strval_eq(reader, &prefix, &strval_xmlns))
2247 
2248  if (strval_eq(reader, &qname, &strval_xmlns))
2250 
2252  if (FAILED(hr)) return hr;
2253 
2255  if (FAILED(hr)) return hr;
2256 
2259 
2260  TRACE("%s=%s\n", debug_strval(reader, &local), debug_strval(reader, &value));
2261  return reader_add_attr(reader, &prefix, &local, &qname, &value, &position, flags);
2262 }
HRESULT hr
Definition: shlfolder.c:183
static const char * debug_strval(const xmlreader *reader, const strval *v)
Definition: reader.c:477
static HRESULT reader_parse_eq(xmlreader *reader)
Definition: reader.c:1215
static int strval_eq(const xmlreader *reader, const strval *str1, const strval *str2)
Definition: reader.c:504
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static HRESULT reader_push_ns(xmlreader *reader, const strval *prefix, const strval *uri, BOOL def)
Definition: reader.c:550
GLbitfield flags
Definition: glext.h:7161
static HRESULT reader_parse_attvalue(xmlreader *reader, strval *value)
Definition: reader.c:2188
static const strval strval_xmlns
Definition: reader.c:231
static HRESULT reader_add_attr(xmlreader *reader, strval *prefix, strval *localname, strval *qname, strval *value, const struct reader_position *position, unsigned int flags)
Definition: reader.c:426
GLsizei const GLfloat * value
Definition: glext.h:6069
#define local
Definition: zutil.h:30
static HRESULT reader_parse_qname(xmlreader *reader, strval *prefix, strval *local, strval *qname)
Definition: reader.c:1974
attribute_flags
Definition: reader.c:239
Definition: reader.h:83
Definition: reader.c:219

Referenced by reader_parse_stag().

◆ reader_parse_attvalue()

static HRESULT reader_parse_attvalue ( xmlreader reader,
strval value 
)
static

Definition at line 2188 of file reader.c.

2189 {
2190  WCHAR *ptr, quote;
2191  UINT start;
2192 
2194 
2195  /* skip opening quote */
2196  quote = *ptr;
2197  if (quote != '\"' && quote != '\'') return WC_E_QUOTE;
2198  reader_skipn(reader, 1);
2199 
2202  while (*ptr)
2203  {
2204  if (*ptr == '<') return WC_E_LESSTHAN;
2205 
2206  if (*ptr == quote)
2207  {
2209  /* skip closing quote */
2210  reader_skipn(reader, 1);
2211  return S_OK;
2212  }
2213 
2214  if (*ptr == '&')
2215  {
2217  if (FAILED(hr)) return hr;
2218  }
2219  else
2220  {
2221  /* replace all whitespace chars with ' ' */
2222  if (is_wchar_space(*ptr)) *ptr = ' ';
2223  reader_skipn(reader, 1);
2224  }
2226  }
2227 
2228  return WC_E_QUOTE;
2229 }
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1116
HRESULT hr
Definition: shlfolder.c:183
static BOOL is_wchar_space(WCHAR ch)
Definition: reader.c:1168
static PVOID ptr
Definition: dispmode.c:27
#define quote
Definition: macro.lex.yy.c:531
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1111
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static void reader_init_strvalue(UINT start, UINT len, strval *v)
Definition: reader.c:470
static HRESULT reader_parse_reference(xmlreader *reader)
Definition: reader.c:2087
#define S_OK
Definition: intsafe.h:59
GLuint start
Definition: gl.h:1545
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1156

Referenced by reader_parse_attribute().

◆ reader_parse_cdata()

static HRESULT reader_parse_cdata ( xmlreader reader)
static

Definition at line 2401 of file reader.c.

2402 {
2403  WCHAR *ptr;
2404  UINT start;
2405 
2406  if (reader->resumestate == XmlReadResumeState_CDATA)
2407  {
2408  start = reader->resume[XmlReadResume_Body];
2410  }
2411  else
2412  {
2413  /* skip markup '<![CDATA[' */
2414  reader_skipn(reader, 9);
2418  reader->nodetype = XmlNodeType_CDATA;
2419  reader->resume[XmlReadResume_Body] = start;
2420  reader->resumestate = XmlReadResumeState_CDATA;
2422  }
2423 
2424  while (*ptr)
2425  {
2426  if (*ptr == ']' && *(ptr+1) == ']' && *(ptr+2) == '>')
2427  {
2428  strval value;
2429 
2431 
2432  /* skip ']]>' */
2433  reader_skipn(reader, 3);
2434  TRACE("%s\n", debug_strval(reader, &value));
2435 
2437  reader->resume[XmlReadResume_Body] = 0;
2438  reader->resumestate = XmlReadResumeState_Initial;
2439  return S_OK;
2440  }
2441  else
2442  {
2443  reader_skipn(reader, 1);
2444  ptr++;
2445  }
2446  }
2447 
2448  return S_OK;
2449 }
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1116
static const char * debug_strval(const xmlreader *reader, const strval *v)
Definition: reader.c:477
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1111
static void reader_set_strvalue(xmlreader *reader, XmlReaderStringValue type, const strval *value)
Definition: reader.c:675
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void reader_init_strvalue(UINT start, UINT len, strval *v)
Definition: reader.c:470
GLsizei const GLfloat * value
Definition: glext.h:6069
#define S_OK
Definition: intsafe.h:59
GLuint start
Definition: gl.h:1545
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
static void reader_shrink(xmlreader *reader)
Definition: reader.c:1057
Definition: reader.c:219
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1156

Referenced by reader_parse_content().

◆ reader_parse_chardata()

static HRESULT reader_parse_chardata ( xmlreader reader)
static

Definition at line 2452 of file reader.c.

2453 {
2454  struct reader_position position;
2455  WCHAR *ptr;
2456  UINT start;
2457 
2458  if (reader->resumestate == XmlReadResumeState_CharData)
2459  {
2460  start = reader->resume[XmlReadResume_Body];
2462  }
2463  else
2464  {
2468  /* There's no text */
2469  if (!*ptr || *ptr == '<') return S_OK;
2471  reader->resume[XmlReadResume_Body] = start;
2472  reader->resumestate = XmlReadResumeState_CharData;
2474  }
2475 
2476  position = reader->position;
2477  while (*ptr)
2478  {
2479  static const WCHAR ampW[] = {'&',0};
2480 
2481  /* CDATA closing sequence ']]>' is not allowed */
2482  if (ptr[0] == ']' && ptr[1] == ']' && ptr[2] == '>')
2483  return WC_E_CDSECTEND;
2484 
2485  /* Found next markup part */
2486  if (ptr[0] == '<')
2487  {
2488  strval value;
2489 
2490  reader->empty_element.position = position;
2493  reader->resume[XmlReadResume_Body] = 0;
2494  reader->resumestate = XmlReadResumeState_Initial;
2495  return S_OK;
2496  }
2497 
2498  /* this covers a case when text has leading whitespace chars */
2499  if (!is_wchar_space(*ptr)) reader->nodetype = XmlNodeType_Text;
2500 
2501  if (!reader_cmp(reader, ampW))
2503  else
2504  reader_skipn(reader, 1);
2505 
2507  }
2508 
2509  return S_OK;
2510 }
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1116
static BOOL is_wchar_space(WCHAR ch)
Definition: reader.c:1168
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1111
static void reader_set_strvalue(xmlreader *reader, XmlReaderStringValue type, const strval *value)
Definition: reader.c:675
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void reader_init_strvalue(UINT start, UINT len, strval *v)
Definition: reader.c:470
static HRESULT reader_parse_reference(xmlreader *reader)
Definition: reader.c:2087
GLsizei const GLfloat * value
Definition: glext.h:6069
#define S_OK
Definition: intsafe.h:59
GLuint start
Definition: gl.h:1545
static int reader_cmp(xmlreader *reader, const WCHAR *str)
Definition: reader.c:1124
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
static void reader_shrink(xmlreader *reader)
Definition: reader.c:1057
Definition: reader.c:219
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1156

Referenced by reader_parse_content().

◆ reader_parse_comment()

static HRESULT reader_parse_comment ( xmlreader reader)
static

Definition at line 1427 of file reader.c.

1428 {
1429  WCHAR *ptr;
1430  UINT start;
1431 
1432  if (reader->resumestate == XmlReadResumeState_Comment)
1433  {
1434  start = reader->resume[XmlReadResume_Body];
1436  }
1437  else
1438  {
1439  /* skip '<!--' */
1440  reader_skipn(reader, 4);
1444  reader->nodetype = XmlNodeType_Comment;
1445  reader->resume[XmlReadResume_Body] = start;
1446  reader->resumestate = XmlReadResumeState_Comment;
1448  }
1449 
1450  /* will exit when there's no more data, it won't attempt to
1451  read more from stream */
1452  while (*ptr)
1453  {
1454  if (ptr[0] == '-')
1455  {
1456  if (ptr[1] == '-')
1457  {
1458  if (ptr[2] == '>')
1459  {
1460  strval value;
1461 
1463  TRACE("%s\n", debug_strval(reader, &value));
1464 
1465  /* skip rest of markup '->' */
1466  reader_skipn(reader, 3);
1467 
1469  reader->resume[XmlReadResume_Body] = 0;
1470  reader->resumestate = XmlReadResumeState_Initial;
1471  return S_OK;
1472  }
1473  else
1474  return WC_E_COMMENT;
1475  }
1476  }
1477 
1478  reader_skipn(reader, 1);
1479  ptr++;
1480  }
1481 
1482  return S_OK;
1483 }
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1116
static const char * debug_strval(const xmlreader *reader, const strval *v)
Definition: reader.c:477
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1111
static void reader_set_strvalue(xmlreader *reader, XmlReaderStringValue type, const strval *value)
Definition: reader.c:675
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void reader_init_strvalue(UINT start, UINT len, strval *v)
Definition: reader.c:470
GLsizei const GLfloat * value
Definition: glext.h:6069
#define S_OK
Definition: intsafe.h:59
GLuint start
Definition: gl.h:1545
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
static void reader_shrink(xmlreader *reader)
Definition: reader.c:1057
Definition: reader.c:219
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1156

Referenced by reader_parse_content(), and reader_parse_misc().

◆ reader_parse_content()

static HRESULT reader_parse_content ( xmlreader reader)
static

Definition at line 2513 of file reader.c.

2514 {
2515  static const WCHAR cdstartW[] = {'<','!','[','C','D','A','T','A','[',0};
2516  static const WCHAR etagW[] = {'<','/',0};
2517 
2518  if (reader->resumestate != XmlReadResumeState_Initial)
2519  {
2520  switch (reader->resumestate)
2521  {
2523  return reader_parse_cdata(reader);
2525  return reader_parse_comment(reader);
2528  return reader_parse_pi(reader);
2530  return reader_parse_chardata(reader);
2531  default:
2532  ERR("unknown resume state %d\n", reader->resumestate);
2533  }
2534  }
2535 
2537 
2538  /* handle end tag here, it indicates end of content as well */
2539  if (!reader_cmp(reader, etagW))
2540  return reader_parse_endtag(reader);
2541 
2542  if (!reader_cmp(reader, commentW))
2543  return reader_parse_comment(reader);
2544 
2545  if (!reader_cmp(reader, piW))
2546  return reader_parse_pi(reader);
2547 
2548  if (!reader_cmp(reader, cdstartW))
2549  return reader_parse_cdata(reader);
2550 
2551  if (!reader_cmp(reader, ltW))
2552  return reader_parse_element(reader);
2553 
2554  /* what's left must be CharData */
2555  return reader_parse_chardata(reader);
2556 }
static HRESULT reader_parse_comment(xmlreader *reader)
Definition: reader.c:1427
static HRESULT reader_parse_endtag(xmlreader *reader)
Definition: reader.c:2361
static const WCHAR ltW[]
Definition: reader.c:95
static HRESULT reader_parse_chardata(xmlreader *reader)
Definition: reader.c:2452
__wchar_t WCHAR
Definition: xmlstorage.h:180
static HRESULT reader_parse_cdata(xmlreader *reader)
Definition: reader.c:2401
static const WCHAR commentW[]
Definition: reader.c:97
#define ERR(fmt,...)
Definition: debug.h:109
static HRESULT reader_parse_pi(xmlreader *reader)
Definition: reader.c:1637
static int reader_cmp(xmlreader *reader, const WCHAR *str)
Definition: reader.c:1124
Definition: reader.h:83
static void reader_shrink(xmlreader *reader)
Definition: reader.c:1057
static const WCHAR piW[]
Definition: reader.c:98
static HRESULT reader_parse_element(xmlreader *reader)
Definition: reader.c:2315

Referenced by reader_parse_nextnode().

◆ reader_parse_dtd()

static HRESULT reader_parse_dtd ( xmlreader reader)
static

Definition at line 1886 of file reader.c.

1887 {
1888  static const WCHAR doctypeW[] = {'<','!','D','O','C','T','Y','P','E',0};
1889  strval name;
1890  WCHAR *cur;
1891  HRESULT hr;
1892 
1893  /* check if we have "<!DOCTYPE" */
1894  if (reader_cmp(reader, doctypeW)) return S_FALSE;
1896 
1897  /* DTD processing is not allowed by default */
1898  if (reader->dtdmode == DtdProcessing_Prohibit) return WC_E_DTDPROHIBITED;
1899 
1900  reader_skipn(reader, 9);
1902 
1903  /* name */
1905  if (FAILED(hr)) return WC_E_DECLDOCTYPE;
1906 
1908 
1910  if (FAILED(hr)) return hr;
1911 
1913 
1914  cur = reader_get_ptr(reader);
1915  if (*cur != '>')
1916  {
1917  FIXME("internal subset parsing not implemented\n");
1918  return E_NOTIMPL;
1919  }
1920 
1921  /* skip '>' */
1922  reader_skipn(reader, 1);
1923 
1924  reader->nodetype = XmlNodeType_DocumentType;
1927 
1928  return S_OK;
1929 }
static HRESULT reader_parse_externalid(xmlreader *reader)
Definition: reader.c:1833
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1116
HRESULT hr
Definition: shlfolder.c:183
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_FALSE
Definition: winerror.h:2357
static void reader_set_strvalue(xmlreader *reader, XmlReaderStringValue type, const strval *value)
Definition: reader.c:675
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
static int reader_cmp(xmlreader *reader, const WCHAR *str)
Definition: reader.c:1124
Definition: reader.h:83
static void reader_shrink(xmlreader *reader)
Definition: reader.c:1057
Definition: reader.c:219
Definition: name.c:38
static int reader_skipspaces(xmlreader *reader)
Definition: reader.c:1174
static HRESULT reader_parse_name(xmlreader *reader, strval *name)
Definition: reader.c:1571
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1156
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by reader_parse_nextnode().

◆ reader_parse_element()

static HRESULT reader_parse_element ( xmlreader reader)
static

Definition at line 2315 of file reader.c.

2316 {
2317  HRESULT hr;
2318 
2319  switch (reader->resumestate)
2320  {
2322  /* check if we are really on element */
2323  if (reader_cmp(reader, ltW)) return S_FALSE;
2324 
2325  /* skip '<' */
2326  reader_skipn(reader, 1);
2327 
2329  reader->resumestate = XmlReadResumeState_STag;
2331  {
2332  strval qname, prefix, local;
2333 
2334  /* this handles empty elements too */
2335  hr = reader_parse_stag(reader, &prefix, &local, &qname);
2336  if (FAILED(hr)) return hr;
2337 
2338  /* FIXME: need to check for defined namespace to reject invalid prefix */
2339 
2340  /* if we got empty element and stack is empty go straight to Misc */
2341  if (reader->is_empty_element && list_empty(&reader->elements))
2342  reader->instate = XmlReadInState_MiscEnd;
2343  else
2344  reader->instate = XmlReadInState_Content;
2345 
2346  reader->nodetype = XmlNodeType_Element;
2347  reader->resumestate = XmlReadResumeState_Initial;
2351  break;
2352  }
2353  default:
2354  hr = E_FAIL;
2355  }
2356 
2357  return hr;
2358 }
static const strval strval_empty
Definition: reader.c:229
HRESULT hr
Definition: shlfolder.c:183
#define E_FAIL
Definition: ddrawi.h:102
static const WCHAR ltW[]
Definition: reader.c:95
#define S_FALSE
Definition: winerror.h:2357
static void reader_set_strvalue(xmlreader *reader, XmlReaderStringValue type, const strval *value)
Definition: reader.c:675
LONG HRESULT
Definition: typedefs.h:77
#define local
Definition: zutil.h:30
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
Definition: list.h:143
static int reader_cmp(xmlreader *reader, const WCHAR *str)
Definition: reader.c:1124
static HRESULT reader_parse_stag(xmlreader *reader, strval *prefix, strval *local, strval *qname)
Definition: reader.c:2266
Definition: reader.h:83
static void reader_shrink(xmlreader *reader)
Definition: reader.c:1057
Definition: reader.c:219
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1156

Referenced by reader_parse_content(), and reader_parse_nextnode().

◆ reader_parse_encdecl()

static HRESULT reader_parse_encdecl ( xmlreader reader)
static

Definition at line 1303 of file reader.c.

1304 {
1305  static const WCHAR encodingW[] = {'e','n','c','o','d','i','n','g',0};
1306  struct reader_position position;
1307  strval name, val;
1308  HRESULT hr;
1309 
1310  if (!reader_skipspaces(reader)) return S_FALSE;
1311 
1312  position = reader->position;
1313  if (reader_cmp(reader, encodingW)) return S_FALSE;
1314  name.str = reader_get_ptr(reader);
1315  name.start = reader_get_cur(reader);
1316  name.len = 8;
1317  /* skip 'encoding' */
1318  reader_skipn(reader, 8);
1319 
1321  if (FAILED(hr)) return hr;
1322 
1324  return WC_E_QUOTE;
1325  /* skip "'"|'"' */
1326  reader_skipn(reader, 1);
1327 
1329  if (FAILED(hr)) return hr;
1330 
1332  return WC_E_QUOTE;
1333 
1334  /* skip "'"|'"' */
1335  reader_skipn(reader, 1);
1336 
1337  return reader_add_attr(reader, NULL, &name, NULL, &val, &position, 0);
1338 }
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1116
HRESULT hr
Definition: shlfolder.c:183
static HRESULT reader_parse_eq(xmlreader *reader)
Definition: reader.c:1215
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1111
GLuint GLfloat * val
Definition: glext.h:7180
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static HRESULT reader_add_attr(xmlreader *reader, strval *prefix, strval *localname, strval *qname, strval *value, const struct reader_position *position, unsigned int flags)
Definition: reader.c:426
static int reader_cmp(xmlreader *reader, const WCHAR *str)
Definition: reader.c:1124
static const WCHAR quoteW[]
Definition: reader.c:94
Definition: reader.h:83
static const WCHAR dblquoteW[]
Definition: reader.c:93
Definition: reader.c:219
Definition: name.c:38
static int reader_skipspaces(xmlreader *reader)
Definition: reader.c:1174
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1156
static HRESULT reader_parse_encname(xmlreader *reader, strval *val)
Definition: reader.c:1273
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by reader_parse_xmldecl().

◆ reader_parse_encname()

static HRESULT reader_parse_encname ( xmlreader reader,
strval val 
)
static

Definition at line 1273 of file reader.c.

1274 {
1276  xml_encoding enc;
1277  int len;
1278 
1279  if ((*start < 'A' || *start > 'Z') && (*start < 'a' || *start > 'z'))
1280  return WC_E_ENCNAME;
1281 
1282  val->start = reader_get_cur(reader);
1283 
1284  ptr = start;
1285  while (is_wchar_encname(*++ptr))
1286  ;
1287 
1288  len = ptr - start;
1289  enc = parse_encoding_name(start, len);
1290  TRACE("encoding name %s\n", debugstr_wn(start, len));
1291  val->str = start;
1292  val->len = len;
1293 
1294  if (enc == XmlEncoding_Unknown)
1295  return WC_E_ENCNAME;
1296 
1297  /* skip encoding name */
1299  return S_OK;
1300 }
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1116
static PVOID ptr
Definition: dispmode.c:27
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1111
GLuint GLfloat * val
Definition: glext.h:7180
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
xml_encoding parse_encoding_name(const WCHAR *name, int len)
Definition: reader.c:747
GLenum GLsizei len
Definition: glext.h:6722
#define debugstr_wn
Definition: kernel32.h:33
#define S_OK
Definition: intsafe.h:59
GLuint start
Definition: gl.h:1545
static BOOL is_wchar_encname(WCHAR ch)
Definition: reader.c:1263
Definition: reader.h:83
xml_encoding
Definition: mxwriter.c:53
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1156

Referenced by reader_parse_encdecl().

◆ reader_parse_endtag()

static HRESULT reader_parse_endtag ( xmlreader reader)
static

Definition at line 2361 of file reader.c.

2362 {
2363  struct reader_position position;
2364  strval prefix, local, qname;
2365  struct element *element;
2366  HRESULT hr;
2367 
2368  /* skip '</' */
2369  reader_skipn(reader, 2);
2370 
2371  position = reader->position;
2373  if (FAILED(hr)) return hr;
2374 
2376 
2377  if (reader_cmp(reader, gtW)) return WC_E_GREATERTHAN;
2378 
2379  /* skip '>' */
2380  reader_skipn(reader, 1);
2381 
2382  /* Element stack should never be empty at this point, cause we shouldn't get to
2383  content parsing if it's empty. */
2384  element = LIST_ENTRY(list_head(&reader->elements), struct element, entry);
2385  if (!strval_eq(reader, &element->qname, &qname)) return WC_E_ELEMENTMATCH;
2386 
2387  /* update position stored for start tag, we won't be using it */
2389 
2390  reader->nodetype = XmlNodeType_EndElement;
2391  reader->is_empty_element = FALSE;
2393 
2394  return S_OK;
2395 }
HRESULT hr
Definition: shlfolder.c:183
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
strval prefix
Definition: reader.c:259
static void reader_set_strvalue(xmlreader *reader, XmlReaderStringValue type, const strval *value)
Definition: reader.c:675
static int strval_eq(const xmlreader *reader, const strval *str1, const strval *str2)
Definition: reader.c:504
LONG HRESULT
Definition: typedefs.h:77
struct reader_position position
Definition: reader.c:262
static const WCHAR gtW[]
Definition: reader.c:96
uint32_t entry
Definition: isohybrid.c:63
#define local
Definition: zutil.h:30
#define S_OK
Definition: intsafe.h:59
static HRESULT reader_parse_qname(xmlreader *reader, strval *prefix, strval *local, strval *qname)
Definition: reader.c:1974
static int reader_cmp(xmlreader *reader, const WCHAR *str)
Definition: reader.c:1124
strval qname
Definition: reader.c:261
Definition: reader.h:83
Definition: reader.c:219
#define LIST_ENTRY(type)
Definition: queue.h:175
static int reader_skipspaces(xmlreader *reader)
Definition: reader.c:1174
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1156

Referenced by reader_parse_content().

◆ reader_parse_eq()

static HRESULT reader_parse_eq ( xmlreader reader)
static

Definition at line 1215 of file reader.c.

1216 {
1217  static const WCHAR eqW[] = {'=',0};
1219  if (reader_cmp(reader, eqW)) return WC_E_EQUAL;
1220  /* skip '=' */
1221  reader_skipn(reader, 1);
1223  return S_OK;
1224 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define S_OK
Definition: intsafe.h:59
static int reader_cmp(xmlreader *reader, const WCHAR *str)
Definition: reader.c:1124
Definition: reader.h:83
static int reader_skipspaces(xmlreader *reader)
Definition: reader.c:1174
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1156

Referenced by reader_parse_attribute(), reader_parse_encdecl(), reader_parse_sddecl(), and reader_parse_versioninfo().

◆ reader_parse_externalid()

static HRESULT reader_parse_externalid ( xmlreader reader)
static

Definition at line 1833 of file reader.c.

1834 {
1835  static WCHAR systemW[] = {'S','Y','S','T','E','M',0};
1836  static WCHAR publicW[] = {'P','U','B','L','I','C',0};
1837  struct reader_position position = reader->position;
1838  strval name, sys;
1839  HRESULT hr;
1840  int cnt;
1841 
1842  if (!reader_cmp(reader, publicW)) {
1843  strval pub;
1844 
1845  /* public id */
1846  reader_skipn(reader, 6);
1847  cnt = reader_skipspaces(reader);
1848  if (!cnt) return WC_E_WHITESPACE;
1849 
1851  if (FAILED(hr)) return hr;
1852 
1854  hr = reader_add_attr(reader, NULL, &name, NULL, &pub, &position, 0);
1855  if (FAILED(hr)) return hr;
1856 
1857  cnt = reader_skipspaces(reader);
1858  if (!cnt) return S_OK;
1859 
1860  /* optional system id */
1862  if (FAILED(hr)) return S_OK;
1863 
1865  hr = reader_add_attr(reader, NULL, &name, NULL, &sys, &position, 0);
1866  if (FAILED(hr)) return hr;
1867 
1868  return S_OK;
1869  } else if (!reader_cmp(reader, systemW)) {
1870  /* system id */
1871  reader_skipn(reader, 6);
1872  cnt = reader_skipspaces(reader);
1873  if (!cnt) return WC_E_WHITESPACE;
1874 
1876  if (FAILED(hr)) return hr;
1877 
1879  return reader_add_attr(reader, NULL, &name, NULL, &sys, &position, 0);
1880  }
1881 
1882  return S_FALSE;
1883 }
HRESULT hr
Definition: shlfolder.c:183
static void reader_init_cstrvalue(WCHAR *str, UINT len, strval *v)
Definition: reader.c:483
#define lstrlenW
Definition: compat.h:415
static HRESULT reader_parse_pub_literal(xmlreader *reader, strval *literal)
Definition: reader.c:1808
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
static HRESULT reader_parse_sys_literal(xmlreader *reader, strval *literal)
Definition: reader.c:1782
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static HRESULT reader_add_attr(xmlreader *reader, strval *prefix, strval *localname, strval *qname, strval *value, const struct reader_position *position, unsigned int flags)
Definition: reader.c:426
static const WCHAR publicW[]
Definition: mxwriter.c:49
#define S_OK
Definition: intsafe.h:59
static int reader_cmp(xmlreader *reader, const WCHAR *str)
Definition: reader.c:1124
Definition: reader.h:83
Definition: reader.c:219
Definition: name.c:38
static const WCHAR systemW[]
Definition: mxwriter.c:50
static int reader_skipspaces(xmlreader *reader)
Definition: reader.c:1174
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1156
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by reader_parse_dtd().

◆ reader_parse_local()

static HRESULT reader_parse_local ( xmlreader reader,
strval local,
BOOL  check_for_separator 
)
static

Definition at line 1932 of file reader.c.

1933 {
1934  WCHAR *ptr;
1935  UINT start;
1936 
1937  if (reader->resume[XmlReadResume_Local])
1938  {
1939  start = reader->resume[XmlReadResume_Local];
1941  }
1942  else
1943  {
1946  }
1947 
1948  while (is_ncnamechar(*ptr))
1949  {
1950  reader_skipn(reader, 1);
1952  }
1953 
1954  if (check_for_separator && *ptr == ':')
1955  return NC_E_QNAMECOLON;
1956 
1958  {
1959  reader->resume[XmlReadResume_Local] = start;
1960  return E_PENDING;
1961  }
1962  else
1963  reader->resume[XmlReadResume_Local] = 0;
1964 
1966 
1967  return S_OK;
1968 }
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1116
static int is_reader_pending(xmlreader *reader)
Definition: reader.c:709
static PVOID ptr
Definition: dispmode.c:27
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1111
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void reader_init_strvalue(UINT start, UINT len, strval *v)
Definition: reader.c:470
BOOL is_ncnamechar(WCHAR ch)
Definition: reader.c:1529
#define local
Definition: zutil.h:30
#define S_OK
Definition: intsafe.h:59
GLuint start
Definition: gl.h:1545
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
#define E_PENDING
Definition: dinput.h:172
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1156

Referenced by reader_parse_qname().

◆ reader_parse_misc()

static HRESULT reader_parse_misc ( xmlreader reader)
static

Definition at line 1738 of file reader.c.

1739 {
1740  HRESULT hr = S_FALSE;
1741 
1742  if (reader->resumestate != XmlReadResumeState_Initial)
1743  {
1744  hr = reader_more(reader);
1745  if (FAILED(hr)) return hr;
1746 
1747  /* finish current node */
1748  switch (reader->resumestate)
1749  {
1752  return reader_parse_pi(reader);
1754  return reader_parse_comment(reader);
1757  default:
1758  ERR("unknown resume state %d\n", reader->resumestate);
1759  }
1760  }
1761 
1762  while (1)
1763  {
1764  const WCHAR *cur = reader_get_ptr(reader);
1765 
1766  if (is_wchar_space(*cur))
1768  else if (!reader_cmp(reader, commentW))
1770  else if (!reader_cmp(reader, piW))
1772  else
1773  break;
1774 
1775  if (hr != S_FALSE) return hr;
1776  }
1777 
1778  return hr;
1779 }
static HRESULT reader_more(xmlreader *reader)
Definition: reader.c:1073
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1116
HRESULT hr
Definition: shlfolder.c:183
static HRESULT reader_parse_comment(xmlreader *reader)
Definition: reader.c:1427
static BOOL is_wchar_space(WCHAR ch)
Definition: reader.c:1168
#define S_FALSE
Definition: winerror.h:2357
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR commentW[]
Definition: reader.c:97
#define ERR(fmt,...)
Definition: debug.h:109
static HRESULT reader_parse_pi(xmlreader *reader)
Definition: reader.c:1637
static HRESULT reader_parse_whitespace(xmlreader *reader)
Definition: reader.c:1703
static int reader_cmp(xmlreader *reader, const WCHAR *str)
Definition: reader.c:1124
Definition: reader.h:83
static const WCHAR piW[]
Definition: reader.c:98

Referenced by reader_parse_nextnode().

◆ reader_parse_name()

static HRESULT reader_parse_name ( xmlreader reader,
strval name 
)
static

Definition at line 1571 of file reader.c.

1572 {
1573  WCHAR *ptr;
1574  UINT start;
1575 
1576  if (reader->resume[XmlReadResume_Name])
1577  {
1578  start = reader->resume[XmlReadResume_Name];
1580  }
1581  else
1582  {
1585  if (!is_namestartchar(*ptr)) return WC_E_NAMECHARACTER;
1586  }
1587 
1588  while (is_namechar(*ptr))
1589  {
1590  reader_skipn(reader, 1);
1592  }
1593 
1595  {
1596  reader->resume[XmlReadResume_Name] = start;
1597  return E_PENDING;
1598  }
1599  else
1600  reader->resume[XmlReadResume_Name] = 0;
1601 
1603  TRACE("name %s:%d\n", debug_strval(reader, name), name->len);
1604 
1605  return S_OK;
1606 }
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1116
static const char * debug_strval(const xmlreader *reader, const strval *v)
Definition: reader.c:477
static int is_reader_pending(xmlreader *reader)
Definition: reader.c:709
static PVOID ptr
Definition: dispmode.c:27
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1111
BOOL is_namechar(WCHAR ch)
Definition: reader.c:1553
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void reader_init_strvalue(UINT start, UINT len, strval *v)
Definition: reader.c:470
#define S_OK
Definition: intsafe.h:59
GLuint start
Definition: gl.h:1545
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
Definition: name.c:38
BOOL is_namestartchar(WCHAR ch)
Definition: reader.c:1509
#define E_PENDING
Definition: dinput.h:172
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1156

Referenced by reader_parse_dtd(), reader_parse_pitarget(), and reader_parse_reference().

◆ reader_parse_nextnode()

static HRESULT reader_parse_nextnode ( xmlreader reader)
static

Definition at line 2558 of file reader.c.

2559 {
2561  HRESULT hr;
2562 
2563  if (!is_reader_pending(reader))
2564  {
2565  reader->chunk_read_off = 0;
2567  }
2568 
2569  /* When moving from EndElement or empty element, pop its own namespace definitions */
2570  switch (nodetype)
2571  {
2572  case XmlNodeType_Attribute:
2574  /* fallthrough */
2575  case XmlNodeType_Element:
2576  if (reader->is_empty_element)
2577  reader_pop_ns_nodes(reader, &reader->empty_element);
2578  else if (FAILED(hr = reader_inc_depth(reader)))
2579  return hr;
2580  break;
2584  break;
2585  default:
2586  ;
2587  }
2588 
2589  for (;;)
2590  {
2591  switch (reader->instate)
2592  {
2593  /* if it's a first call for a new input we need to detect stream encoding */
2595  {
2596  xml_encoding enc;
2597 
2598  hr = readerinput_growraw(reader->input);
2599  if (FAILED(hr)) return hr;
2600 
2601  reader->position.line_number = 1;
2602  reader->position.line_position = 1;
2603 
2604  /* try to detect encoding by BOM or data and set input code page */
2605  hr = readerinput_detectencoding(reader->input, &enc);
2606  TRACE("detected encoding %s, 0x%08x\n", enc == XmlEncoding_Unknown ? "(unknown)" :
2608  if (FAILED(hr)) return hr;
2609 
2610  /* always switch first time cause we have to put something in */
2611  readerinput_switchencoding(reader->input, enc);
2612 
2613  /* parse xml declaration */
2615  if (FAILED(hr)) return hr;
2616 
2617  readerinput_shrinkraw(reader->input, -1);
2618  reader->instate = XmlReadInState_Misc_DTD;
2619  if (hr == S_OK) return hr;
2620  }
2621  break;
2624  if (FAILED(hr)) return hr;
2625 
2626  if (hr == S_FALSE)
2627  reader->instate = XmlReadInState_DTD;
2628  else
2629  return hr;
2630  break;
2631  case XmlReadInState_DTD:
2633  if (FAILED(hr)) return hr;
2634 
2635  if (hr == S_OK)
2636  {
2637  reader->instate = XmlReadInState_DTD_Misc;
2638  return hr;
2639  }
2640  else
2641  reader->instate = XmlReadInState_Element;
2642  break;
2645  if (FAILED(hr)) return hr;
2646 
2647  if (hr == S_FALSE)
2648  reader->instate = XmlReadInState_Element;
2649  else
2650  return hr;
2651  break;
2653  return reader_parse_element(reader);
2655  return reader_parse_content(reader);
2658  if (hr != S_FALSE) return hr;
2659 
2660  if (*reader_get_ptr(reader))
2661  {
2662  WARN("found garbage in the end of XML\n");
2663  return WC_E_SYNTAX;
2664  }
2665 
2666  reader->instate = XmlReadInState_Eof;
2667  reader->state = XmlReadState_EndOfFile;
2668  reader->nodetype = XmlNodeType_None;
2669  return hr;
2670  case XmlReadInState_Eof:
2671  return S_FALSE;
2672  default:
2673  FIXME("internal state %d not handled\n", reader->instate);
2674  return E_NOTIMPL;
2675  }
2676  }
2677 
2678  return E_NOTIMPL;
2679 }
static HRESULT reader_parse_dtd(xmlreader *reader)
Definition: reader.c:1886
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1116
HRESULT hr
Definition: shlfolder.c:183
static void reader_pop_ns_nodes(xmlreader *reader, struct element *element)
Definition: reader.c:630
#define WARN(fmt,...)
Definition: debug.h:111
static HRESULT reader_parse_misc(xmlreader *reader)
Definition: reader.c:1738
XmlNodeType
Definition: xmllite.idl:23
static void reader_clear_attrs(xmlreader *reader)
Definition: reader.c:410
static HRESULT readerinput_detectencoding(xmlreaderinput *readerinput, xml_encoding *enc)
Definition: reader.c:898
static int is_reader_pending(xmlreader *reader)
Definition: reader.c:709
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_FALSE
Definition: winerror.h:2357
static const struct xml_encoding_data xml_encoding_map[]
Definition: reader.c:159
static XmlNodeType reader_get_nodetype(const xmlreader *reader)
Definition: reader.c:1558
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static HRESULT reader_parse_xmldecl(xmlreader *reader)
Definition: reader.c:1385
static void reader_pop_element(xmlreader *reader)
Definition: reader.c:655
static void reader_dec_depth(xmlreader *reader)
Definition: reader.c:544
static void readerinput_shrinkraw(xmlreaderinput *readerinput, int len)
Definition: reader.c:975
static void readerinput_switchencoding(xmlreaderinput *readerinput, xml_encoding enc)
Definition: reader.c:1019
static HRESULT reader_inc_depth(xmlreader *reader)
Definition: reader.c:539
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT reader_parse_content(xmlreader *reader)
Definition: reader.c:2513
Definition: reader.h:83
Definition: name.c:38
static HRESULT readerinput_growraw(xmlreaderinput *readerinput)
Definition: reader.c:835
xml_encoding
Definition: mxwriter.c:53
static HRESULT reader_parse_element(xmlreader *reader)
Definition: reader.c:2315

Referenced by xmlreader_Read().

◆ reader_parse_pi()

static HRESULT reader_parse_pi ( xmlreader reader)
static

Definition at line 1637 of file reader.c.

1638 {
1639  strval target;
1640  WCHAR *ptr;
1641  UINT start;
1642  HRESULT hr;
1643 
1644  switch (reader->resumestate)
1645  {
1647  /* skip '<?' */
1648  reader_skipn(reader, 2);
1650  reader->resumestate = XmlReadResumeState_PITarget;
1653  if (FAILED(hr)) return hr;
1657  reader->resumestate = XmlReadResumeState_PIBody;
1659  default:
1660  ;
1661  }
1662 
1663  start = reader->resume[XmlReadResume_Body];
1665  while (*ptr)
1666  {
1667  if (ptr[0] == '?')
1668  {
1669  if (ptr[1] == '>')
1670  {
1671  UINT cur = reader_get_cur(reader);
1672  strval value;
1673 
1674  /* strip all leading whitespace chars */
1675  while (start < cur)
1676  {
1678  if (!is_wchar_space(*ptr)) break;
1679  start++;
1680  }
1681 
1683 
1684  /* skip '?>' */
1685  reader_skipn(reader, 2);
1686  TRACE("%s\n", debug_strval(reader, &value));
1688  reader->resumestate = XmlReadResumeState_Initial;
1689  reader->resume[XmlReadResume_Body] = 0;
1691  return S_OK;
1692  }
1693  }
1694 
1695  reader_skipn(reader, 1);
1697  }
1698 
1699  return S_OK;
1700 }
static const strval strval_empty
Definition: reader.c:229
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1116
HRESULT hr
Definition: shlfolder.c:183
static const char * debug_strval(const xmlreader *reader, const strval *v)
Definition: reader.c:477
static BOOL is_wchar_space(WCHAR ch)
Definition: reader.c:1168
static HRESULT reader_parse_pitarget(xmlreader *reader, strval *target)
Definition: reader.c:1609
static WCHAR * reader_get_ptr2(const xmlreader *reader, UINT offset)
Definition: reader.c:342
static PVOID ptr
Definition: dispmode.c:27
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1111
static void reader_set_strvalue(xmlreader *reader, XmlReaderStringValue type, const strval *value)
Definition: reader.c:675
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static void reader_init_strvalue(UINT start, UINT len, strval *v)
Definition: reader.c:470
GLsizei const GLfloat * value
Definition: glext.h:6069
#define S_OK
Definition: intsafe.h:59
GLuint start
Definition: gl.h:1545
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
static void reader_shrink(xmlreader *reader)
Definition: reader.c:1057
Definition: reader.c:219
GLenum target
Definition: glext.h:7315
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1156

Referenced by reader_parse_content(), and reader_parse_misc().

◆ reader_parse_pitarget()

static HRESULT reader_parse_pitarget ( xmlreader reader,
strval target 
)
static

Definition at line 1609 of file reader.c.

1610 {
1611  static const WCHAR xmlW[] = {'x','m','l'};
1612  static const strval xmlval = { (WCHAR*)xmlW, 3 };
1613  strval name;
1614  WCHAR *ptr;
1615  HRESULT hr;
1616  UINT i;
1617 
1619  if (FAILED(hr)) return is_reader_pending(reader) ? E_PENDING : WC_E_PI;
1620 
1621  /* now that we got name check for illegal content */
1622  if (strval_eq(reader, &name, &xmlval))
1623  return WC_E_LEADINGXML;
1624 
1625  /* PITarget can't be a qualified name */
1627  for (i = 0; i < name.len; i++)
1628  if (ptr[i] == ':')
1629  return i ? NC_E_NAMECOLON : WC_E_PI;
1630 
1631  TRACE("pitarget %s:%d\n", debug_strval(reader, &name), name.len);
1632  *target = name;
1633  return S_OK;
1634 }
static WCHAR xmlW[]
Definition: reader.c:227
HRESULT hr
Definition: shlfolder.c:183
static const char * debug_strval(const xmlreader *reader, const strval *v)
Definition: reader.c:477
static WCHAR * reader_get_strptr(const xmlreader *reader, const strval *v)
Definition: reader.c:348
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 int is_reader_pending(xmlreader *reader)
Definition: reader.c:709
static PVOID ptr
Definition: dispmode.c:27
static int strval_eq(const xmlreader *reader, const strval *str1, const strval *str2)
Definition: reader.c:504
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
Definition: reader.c:219
Definition: name.c:38
GLenum target
Definition: glext.h:7315
#define E_PENDING
Definition: dinput.h:172
static HRESULT reader_parse_name(xmlreader *reader, strval *name)
Definition: reader.c:1571
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by reader_parse_pi().

◆ reader_parse_pub_literal()

static HRESULT reader_parse_pub_literal ( xmlreader reader,
strval literal 
)
static

Definition at line 1808 of file reader.c.

1809 {
1810  WCHAR *cur = reader_get_ptr(reader), quote;
1811  UINT start;
1812 
1813  if (*cur != '"' && *cur != '\'') return WC_E_QUOTE;
1814 
1815  quote = *cur;
1816  reader_skipn(reader, 1);
1817 
1819  cur = reader_get_ptr(reader);
1820  while (is_pubchar(*cur) && *cur != quote)
1821  {
1822  reader_skipn(reader, 1);
1823  cur = reader_get_ptr(reader);
1824  }
1826  if (*cur == quote) reader_skipn(reader, 1);
1827 
1828  TRACE("%s\n", debug_strval(reader, literal));
1829  return S_OK;
1830 }
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1116
BOOL is_pubchar(WCHAR ch)
Definition: reader.c:1496
static const char * debug_strval(const xmlreader *reader, const strval *v)
Definition: reader.c:477
#define quote
Definition: macro.lex.yy.c:531
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1111
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void reader_init_strvalue(UINT start, UINT len, strval *v)
Definition: reader.c:470
#define S_OK
Definition: intsafe.h:59
GLuint start
Definition: gl.h:1545
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1156

Referenced by reader_parse_externalid().

◆ reader_parse_qname()

static HRESULT reader_parse_qname ( xmlreader reader,
strval prefix,
strval local,
strval qname 
)
static

Definition at line 1974 of file reader.c.

1975 {
1976  WCHAR *ptr;
1977  UINT start;
1978  HRESULT hr;
1979 
1980  if (reader->resume[XmlReadResume_Name])
1981  {
1982  start = reader->resume[XmlReadResume_Name];
1984  }
1985  else
1986  {
1989  reader->resume[XmlReadResume_Name] = start;
1990  if (!is_ncnamechar(*ptr)) return NC_E_QNAMECHARACTER;
1991  }
1992 
1993  if (reader->resume[XmlReadResume_Local])
1994  {
1996  if (FAILED(hr)) return hr;
1997 
1999  local->start - reader->resume[XmlReadResume_Name] - 1,
2000  prefix);
2001  }
2002  else
2003  {
2004  /* skip prefix part */
2005  while (is_ncnamechar(*ptr))
2006  {
2007  reader_skipn(reader, 1);
2009  }
2010 
2011  if (is_reader_pending(reader)) return E_PENDING;
2012 
2013  /* got a qualified name */
2014  if (*ptr == ':')
2015  {
2017 
2018  /* skip ':' */
2019  reader_skipn(reader, 1);
2021  if (FAILED(hr)) return hr;
2022  }
2023  else
2024  {
2026  reader_init_strvalue(0, 0, prefix);
2027  }
2028  }
2029 
2030  if (prefix->len)
2031  TRACE("qname %s:%s\n", debug_strval(reader, prefix), debug_strval(reader, local));
2032  else
2033  TRACE("ncname %s\n", debug_strval(reader, loca