ReactOS  0.4.14-dev-376-gaedba84
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 "wine/unicode.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)
 
static 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)
 
static BOOL is_pubchar (WCHAR ch)
 
static BOOL is_ncnamechar (WCHAR ch)
 
static 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 187 of file reader.c.

Enumeration Type Documentation

◆ attribute_flags

Enumerator
ATTRIBUTE_NS_DEFINITION 
ATTRIBUTE_DEFAULT_NS_DEFINITION 

Definition at line 237 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 42 of file reader.c.

◆ XmlReaderResume

Enumerator
XmlReadResume_Name 
XmlReadResume_Local 
XmlReadResume_Body 
XmlReadResume_Last 

Definition at line 70 of file reader.c.

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

◆ XmlReaderResumeState

Enumerator
XmlReadResumeState_Initial 
XmlReadResumeState_PITarget 
XmlReadResumeState_PIBody 
XmlReadResumeState_CDATA 
XmlReadResumeState_Comment 
XmlReadResumeState_STag 
XmlReadResumeState_CharData 
XmlReadResumeState_Whitespace 

Definition at line 57 of file reader.c.

◆ XmlReaderStringValue

Enumerator
StringValue_LocalName 
StringValue_Prefix 
StringValue_QualifiedName 
StringValue_Value 
StringValue_Last 

Definition at line 78 of file reader.c.

Function Documentation

◆ alloc_input_buffer()

static HRESULT alloc_input_buffer ( xmlreaderinput input)
static

Definition at line 774 of file reader.c.

775 {
777  HRESULT hr;
778 
779  input->buffer = NULL;
780 
781  buffer = readerinput_alloc(input, sizeof(*buffer));
782  if (!buffer) return E_OUTOFMEMORY;
783 
784  buffer->input = input;
785  buffer->code_page = ~0; /* code page is unknown at this point */
786  hr = init_encoded_buffer(input, &buffer->utf16);
787  if (hr != S_OK) {
789  return hr;
790  }
791 
792  hr = init_encoded_buffer(input, &buffer->encoded);
793  if (hr != S_OK) {
794  free_encoded_buffer(input, &buffer->utf16);
796  return hr;
797  }
798 
799  input->buffer = buffer;
800  return S_OK;
801 }
HRESULT hr
Definition: shlfolder.c:183
static HRESULT init_encoded_buffer(xmlreaderinput *input, encoded_buffer *buffer)
Definition: reader.c:712
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:378
LONG HRESULT
Definition: typedefs.h:77
static void free_encoded_buffer(xmlreaderinput *input, encoded_buffer *buffer)
Definition: reader.c:727
static void * readerinput_alloc(xmlreaderinput *input, size_t len)
Definition: reader.c:368
#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 3651 of file reader.c.

3652 {
3653  xmlreader *reader;
3654  HRESULT hr;
3655  int i;
3656 
3657  TRACE("(%s, %p, %p)\n", wine_dbgstr_guid(riid), obj, imalloc);
3658 
3659  if (imalloc)
3660  reader = IMalloc_Alloc(imalloc, sizeof(*reader));
3661  else
3662  reader = heap_alloc(sizeof(*reader));
3663  if (!reader)
3664  return E_OUTOFMEMORY;
3665 
3666  memset(reader, 0, sizeof(*reader));
3667  reader->IXmlReader_iface.lpVtbl = &xmlreader_vtbl;
3668  reader->ref = 1;
3669  reader->state = XmlReadState_Closed;
3670  reader->instate = XmlReadInState_Initial;
3671  reader->resumestate = XmlReadResumeState_Initial;
3672  reader->dtdmode = DtdProcessing_Prohibit;
3673  reader->imalloc = imalloc;
3674  if (imalloc) IMalloc_AddRef(imalloc);
3675  reader->nodetype = XmlNodeType_None;
3676  list_init(&reader->attrs);
3677  list_init(&reader->nsdef);
3678  list_init(&reader->ns);
3679  list_init(&reader->elements);
3680  reader->max_depth = 256;
3681 
3682  reader->chunk_read_off = 0;
3683  for (i = 0; i < StringValue_Last; i++)
3684  reader->strvalues[i] = strval_empty;
3685 
3686  hr = IXmlReader_QueryInterface(&reader->IXmlReader_iface, riid, obj);
3687  IXmlReader_Release(&reader->IXmlReader_iface);
3688 
3689  TRACE("returning iface %p, hr %#x\n", *obj, hr);
3690 
3691  return hr;
3692 }
static const struct IXmlReaderVtbl xmlreader_vtbl
Definition: reader.c:3561
static const strval strval_empty
Definition: reader.c:227
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 3694 of file reader.c.

3700 {
3701  xmlreaderinput *readerinput;
3702  HRESULT hr;
3703 
3704  TRACE("%p %p %s %d %s %p\n", stream, imalloc, wine_dbgstr_w(encoding),
3705  hint, wine_dbgstr_w(base_uri), ppInput);
3706 
3707  if (!stream || !ppInput) return E_INVALIDARG;
3708 
3709  if (imalloc)
3710  readerinput = IMalloc_Alloc(imalloc, sizeof(*readerinput));
3711  else
3712  readerinput = heap_alloc(sizeof(*readerinput));
3713  if(!readerinput) return E_OUTOFMEMORY;
3714 
3715  readerinput->IXmlReaderInput_iface.lpVtbl = &xmlreaderinputvtbl;
3716  readerinput->ref = 1;
3717  readerinput->imalloc = imalloc;
3718  readerinput->stream = NULL;
3719  if (imalloc) IMalloc_AddRef(imalloc);
3720  readerinput->encoding = parse_encoding_name(encoding, -1);
3721  readerinput->hint = hint;
3722  readerinput->baseuri = readerinput_strdupW(readerinput, base_uri);
3723  readerinput->pending = 0;
3724 
3725  hr = alloc_input_buffer(readerinput);
3726  if (hr != S_OK)
3727  {
3728  readerinput_free(readerinput, readerinput->baseuri);
3729  readerinput_free(readerinput, readerinput);
3730  if (imalloc) IMalloc_Release(imalloc);
3731  return hr;
3732  }
3733  IUnknown_QueryInterface(stream, &IID_IUnknown, (void**)&readerinput->input);
3734 
3735  *ppInput = &readerinput->IXmlReaderInput_iface;
3736 
3737  TRACE("returning iface %p\n", *ppInput);
3738 
3739  return S_OK;
3740 }
xml_encoding encoding
Definition: reader.c:196
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
IUnknown * input
Definition: reader.c:194
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
WCHAR * baseuri
Definition: reader.c:198
#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:383
static void readerinput_free(xmlreaderinput *input, void *mem)
Definition: reader.c:378
IMalloc * imalloc
Definition: reader.c:195
#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:745
Definition: parse.h:22
ISequentialStream * stream
Definition: reader.c:202
ed encoding
Definition: write.c:2839
unsigned int pending
Definition: reader.c:204
#define S_OK
Definition: intsafe.h:59
DWORD hint
Definition: vfdcmd.c:88
static HRESULT alloc_input_buffer(xmlreaderinput *input)
Definition: reader.c:774
static const struct IUnknownVtbl xmlreaderinputvtbl
Definition: reader.c:207
IXmlReaderInput IXmlReaderInput_iface
Definition: reader.c:191

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 100 of file reader.c.

101 {
102  static const char * const type_names[] =
103  {
104  "None",
105  "Element",
106  "Attribute",
107  "Text",
108  "CDATA",
109  "",
110  "",
111  "ProcessingInstruction",
112  "Comment",
113  "",
114  "DocumentType",
115  "",
116  "",
117  "Whitespace",
118  "",
119  "EndElement",
120  "",
121  "XmlDeclaration"
122  };
123 
124  if (nodetype > _XmlNodeType_Last)
125  return wine_dbg_sprintf("unknown type=%d", nodetype);
126 
127  return type_names[nodetype];
128 }
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 130 of file reader.c.

131 {
132  static const char * const prop_names[] =
133  {
134  "MultiLanguage",
135  "ConformanceLevel",
136  "RandomAccess",
137  "XmlResolver",
138  "DtdProcessing",
139  "ReadState",
140  "MaxElementDepth",
141  "MaxEntityExpansion"
142  };
143 
144  if (prop > _XmlReaderProperty_Last)
145  return wine_dbg_sprintf("unknown property=%d", prop);
146 
147  return prop_names[prop];
148 }
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 988 of file reader.c.

989 {
990  BOOL prev_cr = buffer->prev_cr;
991  const WCHAR *src;
992  WCHAR *dest;
993 
994  src = dest = (WCHAR*)buffer->data + off;
995  while ((const char*)src < buffer->data + buffer->written)
996  {
997  if (*src == '\r')
998  {
999  *dest++ = '\n';
1000  src++;
1001  prev_cr = TRUE;
1002  continue;
1003  }
1004  if(prev_cr && *src == '\n')
1005  src++;
1006  else
1007  *dest++ = *src++;
1008  prev_cr = FALSE;
1009  }
1010 
1011  buffer->written = (char*)dest - buffer->data;
1012  buffer->prev_cr = prev_cr;
1013  *dest = 0;
1014 }
#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 727 of file reader.c.

728 {
729  readerinput_free(input, buffer->data);
730 }
GLuint buffer
Definition: glext.h:5915
static void readerinput_free(xmlreaderinput *input, void *mem)
Definition: reader.c:378
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 803 of file reader.c.

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

Referenced by xmlreaderinput_Release().

◆ get_code_page()

HRESULT get_code_page ( xml_encoding  encoding,
UINT cp 
)

Definition at line 732 of file reader.c.

733 {
735  {
736  FIXME("unsupported encoding %d\n", encoding);
737  return E_NOTIMPL;
738  }
739 
741 
742  return S_OK;
743 }
#define FIXME(fmt,...)
Definition: debug.h:110
static const struct xml_encoding_data xml_encoding_map[]
Definition: reader.c:157
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 168 of file reader.c.

169 {
170  int i;
171  for (i = 0; i < ARRAY_SIZE(xml_encoding_map); i++)
172  {
173  if (xml_encoding_map[i].cp == codepage) return xml_encoding_map[i].enc;
174  }
175  return XmlEncoding_Unknown;
176 }
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:157
#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 163 of file reader.c.

164 {
165  return xml_encoding_map[encoding].name;
166 }
static const struct xml_encoding_data xml_encoding_map[]
Definition: reader.c:157
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 2044 of file reader.c.

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

Referenced by reader_parse_reference().

◆ impl_from_IXmlReader()

◆ impl_from_IXmlReaderInput()

static xmlreaderinput* impl_from_IXmlReaderInput ( IXmlReaderInput iface)
inlinestatic

Definition at line 315 of file reader.c.

316 {
317  return CONTAINING_RECORD(iface, xmlreaderinput, IXmlReaderInput_iface);
318 }
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 712 of file reader.c.

713 {
714  const int initial_len = 0x2000;
715  buffer->data = readerinput_alloc(input, initial_len);
716  if (!buffer->data) return E_OUTOFMEMORY;
717 
718  memset(buffer->data, 0, 4);
719  buffer->cur = 0;
720  buffer->allocated = initial_len;
721  buffer->written = 0;
722  buffer->prev_cr = FALSE;
723 
724  return S_OK;
725 }
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:368
#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 1484 of file reader.c.

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

Referenced by reader_parse_reference(), and reader_parse_sys_literal().

◆ is_namechar()

static BOOL is_namechar ( WCHAR  ch)
inlinestatic

Definition at line 1551 of file reader.c.

1552 {
1553  return (ch == ':') || is_ncnamechar(ch);
1554 }
static BOOL is_ncnamechar(WCHAR ch)
Definition: reader.c:1527

Referenced by reader_parse_name().

◆ is_namestartchar()

static BOOL is_namestartchar ( WCHAR  ch)
inlinestatic

Definition at line 1507 of file reader.c.

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

Referenced by reader_parse_name(), and readerinput_detectencoding().

◆ is_ncnamechar()

static BOOL is_ncnamechar ( WCHAR  ch)
inlinestatic

Definition at line 1527 of file reader.c.

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

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

◆ is_pubchar()

static BOOL is_pubchar ( WCHAR  ch)
inlinestatic

Definition at line 1494 of file reader.c.

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

Referenced by 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 1261 of file reader.c.

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

Referenced by reader_parse_encname().

◆ is_wchar_space()

static BOOL is_wchar_space ( WCHAR  ch)
inlinestatic

Definition at line 1166 of file reader.c.

1167 {
1168  return ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n';
1169 }

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 745 of file reader.c.

746 {
747  int min, max, n, c;
748 
749  if (!name) return XmlEncoding_Unknown;
750 
751  min = 0;
753 
754  while (min <= max)
755  {
756  n = (min+max)/2;
757 
758  if (len != -1)
760  else
762  if (!c)
763  return xml_encoding_map[n].enc;
764 
765  if (c > 0)
766  max = n-1;
767  else
768  min = n+1;
769  }
770 
771  return XmlEncoding_Unknown;
772 }
#define max(a, b)
Definition: svc.c:63
GLdouble n
Definition: glext.h:7729
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
static const struct xml_encoding_data xml_encoding_map[]
Definition: reader.c:157
const GLubyte * c
Definition: glext.h:8905
GLenum GLsizei len
Definition: glext.h:6722
#define strcmpiW(s1, s2)
Definition: unicode.h:39
#define ARRAY_SIZE(a)
Definition: main.h:24
#define min(a, b)
Definition: monoChain.cc:55
Definition: name.c:36
#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 424 of file reader.c.

426 {
427  struct attribute *attr;
428  HRESULT hr;
429 
430  attr = reader_alloc(reader, sizeof(*attr));
431  if (!attr) return E_OUTOFMEMORY;
432 
433  hr = reader_strvaldup(reader, localname, &attr->localname);
434  if (hr == S_OK)
435  {
437  if (hr != S_OK)
439  }
440  if (hr != S_OK)
441  {
443  return hr;
444  }
445 
446  if (prefix)
447  attr->prefix = *prefix;
448  else
449  memset(&attr->prefix, 0, sizeof(attr->prefix));
450  attr->qname = qname ? *qname : *localname;
451  attr->position = *position;
452  attr->flags = flags;
453  list_add_tail(&reader->attrs, &attr->entry);
454  reader->attr_count++;
455 
456  return S_OK;
457 }
HRESULT hr
Definition: shlfolder.c:183
WCHAR * value
Definition: cookie.c:173
static HRESULT reader_strvaldup(xmlreader *reader, const strval *src, strval *dest)
Definition: reader.c:351
__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:247
static void * reader_alloc(xmlreader *reader, size_t len)
Definition: reader.c:321
static void reader_free(xmlreader *reader, void *mem)
Definition: reader.c:334
LONG HRESULT
Definition: typedefs.h:77
Definition: cookie.c:170
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:399
Definition: reader.h:83
strval qname
Definition: reader.c:248
strval prefix
Definition: reader.c:246
#define memset(x, y, z)
Definition: compat.h:39
struct reader_position position
Definition: reader.c:250

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 321 of file reader.c.

322 {
323  return m_alloc(reader->imalloc, len);
324 }
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 326 of file reader.c.

327 {
328  void *ret = reader_alloc(reader, len);
329  if (ret)
330  memset(ret, 0, len);
331  return ret;
332 }
static void * reader_alloc(xmlreader *reader, size_t len)
Definition: reader.c:321
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 408 of file reader.c.

409 {
410  struct attribute *attr, *attr2;
411  LIST_FOR_EACH_ENTRY_SAFE(attr, attr2, &reader->attrs, struct attribute, entry)
412  {
413  reader_free_strvalued(reader, &attr->localname);
416  }
417  list_init(&reader->attrs);
418  reader->attr_count = 0;
419  reader->attr = NULL;
420 }
WCHAR * value
Definition: cookie.c:173
smooth NULL
Definition: ftsmooth.c:416
static void reader_free(xmlreader *reader, void *mem)
Definition: reader.c:334
Definition: cookie.c:170
__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:399
#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 508 of file reader.c.

509 {
510  struct element *elem, *elem2;
511  LIST_FOR_EACH_ENTRY_SAFE(elem, elem2, &reader->elements, struct element, entry)
512  {
513  reader_free_strvalued(reader, &elem->prefix);
514  reader_free_strvalued(reader, &elem->localname);
517  }
518  list_init(&reader->elements);
519  reader_free_strvalued(reader, &reader->empty_element.localname);
520  reader_free_strvalued(reader, &reader->empty_element.qname);
521  reader->is_empty_element = FALSE;
522 }
static size_t elem
Definition: string.c:68
static void reader_free(xmlreader *reader, void *mem)
Definition: reader.c:334
uint32_t entry
Definition: isohybrid.c:63
static void reader_free_strvalued(xmlreader *reader, strval *v)
Definition: reader.c:399
#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 2710 of file reader.c.

2711 {
2712  struct ns *ns, *ns2;
2713 
2714  LIST_FOR_EACH_ENTRY_SAFE(ns, ns2, &reader->ns, struct ns, entry) {
2715  list_remove(&ns->entry);
2718  reader_free(reader, ns);
2719  }
2720 
2721  LIST_FOR_EACH_ENTRY_SAFE(ns, ns2, &reader->nsdef, struct ns, entry) {
2722  list_remove(&ns->entry);
2724  reader_free(reader, ns);
2725  }
2726 }
BSTR uri
Definition: mxnamespace.c:47
static void reader_free(xmlreader *reader, void *mem)
Definition: reader.c:334
__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:265
static void reader_free_strvalued(xmlreader *reader, strval *v)
Definition: reader.c:399
#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 1122 of file reader.c.

1123 {
1124  int i=0;
1125  const WCHAR *ptr = reader_get_ptr(reader);
1126  while (str[i])
1127  {
1128  if (!ptr[i])
1129  {
1132  }
1133  if (str[i] != ptr[i])
1134  return ptr[i] - str[i];
1135  i++;
1136  }
1137  return 0;
1138 }
static HRESULT reader_more(xmlreader *reader)
Definition: reader.c:1071
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1114
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 542 of file reader.c.

543 {
544  if (reader->depth)
545  reader->depth--;
546 }
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 334 of file reader.c.

335 {
336  m_free(reader->imalloc, mem);
337 }
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 578 of file reader.c.

579 {
584 }
strval prefix
Definition: reader.c:257
static void reader_free(xmlreader *reader, void *mem)
Definition: reader.c:334
strval localname
Definition: reader.c:258
static void reader_free_strvalued(xmlreader *reader, strval *v)
Definition: reader.c:399
strval qname
Definition: reader.c:259
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 488 of file reader.c.

489 {
490  reader_free_strvalued(reader, &reader->strvalues[type]);
491 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static void reader_free_strvalued(xmlreader *reader, strval *v)
Definition: reader.c:399
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 399 of file reader.c.

400 {
401  if (v->str != strval_empty.str)
402  {
403  reader_free(reader, v->str);
404  *v = strval_empty;
405  }
406 }
WCHAR * str
Definition: reader.c:219
static const strval strval_empty
Definition: reader.c:227
static void reader_free(xmlreader *reader, void *mem)
Definition: reader.c:334
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 493 of file reader.c.

494 {
495  int type;
496  for (type = 0; type < StringValue_Last; type++)
498 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static void reader_free_strvalue(xmlreader *reader, XmlReaderStringValue type)
Definition: reader.c:488
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 3046 of file reader.c.

3047 {
3049  {
3050  *name = xmlnsW;
3051  *len = 5;
3052  }
3053  else if (attr->flags & ATTRIBUTE_NS_DEFINITION)
3054  {
3055  const struct ns *ns = reader_lookup_ns(reader, &attr->localname);
3056  *name = ns->prefix.str;
3057  *len = ns->prefix.len;
3058  }
3059  else
3060  {
3061  *name = attr->localname.str;
3062  *len = attr->localname.len;
3063  }
3064 }
static WCHAR xmlnsW[]
Definition: reader.c:226
Definition: cookie.c:170
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:524
Definition: reader.h:83
Definition: name.c:36

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 3004 of file reader.c.

3005 {
3006  static const WCHAR xmlns_uriW[] = {'h','t','t','p',':','/','/','w','w','w','.','w','3','.','o','r','g','/',
3007  '2','0','0','0','/','x','m','l','n','s','/',0};
3008  static const WCHAR xml_uriW[] = {'h','t','t','p',':','/','/','w','w','w','.','w','3','.','o','r','g','/',
3009  'X','M','L','/','1','9','9','8','/','n','a','m','e','s','p','a','c','e',0};
3010 
3011  /* Check for reserved prefixes first */
3012  if ((strval_eq(reader, &attr->prefix, &strval_empty) && strval_eq(reader, &attr->localname, &strval_xmlns)) ||
3013  strval_eq(reader, &attr->prefix, &strval_xmlns))
3014  {
3015  *uri = xmlns_uriW;
3016  *len = ARRAY_SIZE(xmlns_uriW) - 1;
3017  }
3018  else if (strval_eq(reader, &attr->prefix, &strval_xml))
3019  {
3020  *uri = xml_uriW;
3021  *len = ARRAY_SIZE(xml_uriW) - 1;
3022  }
3023  else
3024  {
3025  *uri = NULL;
3026  *len = 0;
3027  }
3028 
3029  if (!*uri)
3030  {
3031  struct ns *ns;
3032 
3033  if ((ns = reader_lookup_ns(reader, &attr->prefix)))
3034  {
3035  *uri = ns->uri.str;
3036  *len = ns->uri.len;
3037  }
3038  else
3039  {
3040  *uri = emptyW;
3041  *len = 0;
3042  }
3043  }
3044 }
static const strval strval_empty
Definition: reader.c:227
BSTR uri
Definition: mxnamespace.c:47
const char * uri
Definition: sec_mgr.c:1594
static WCHAR emptyW[]
Definition: reader.c:224
static const strval strval_xml
Definition: reader.c:228
smooth NULL
Definition: ftsmooth.c:416
static int strval_eq(const xmlreader *reader, const strval *str1, const strval *str2)
Definition: reader.c:502
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: cookie.c:170
static const strval strval_xmlns
Definition: reader.c:229
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:524
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 460 of file reader.c.

461 {
462  if (reader->is_empty_element)
463  return &reader->empty_element;
464 
465  return LIST_ENTRY(list_head(&reader->elements), struct element, entry);
466 }
__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 1556 of file reader.c.

1557 {
1558  /* When we're on attribute always return attribute type, container node type is kept.
1559  Note that container is not necessarily an element, and attribute doesn't mean it's
1560  an attribute in XML spec terms. */
1561  return reader->attr ? XmlNodeType_Attribute : reader->nodetype;
1562 }
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 340 of file reader.c.

341 {
342  encoded_buffer *buffer = &reader->input->buffer->utf16;
343  return (WCHAR*)buffer->data + offset;
344 }
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 346 of file reader.c.

347 {
348  return v->str ? v->str : reader_get_ptr2(reader, v->start);
349 }
static WCHAR * reader_get_ptr2(const xmlreader *reader, UINT offset)
Definition: reader.c:340
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 3347 of file reader.c.

3348 {
3349  strval *val;
3350 
3351  switch (reader_get_nodetype(reader))
3352  {
3355  case XmlNodeType_None:
3356  return &strval_empty;
3357  case XmlNodeType_Attribute:
3358  /* For namespace definition attributes return values from namespace list */
3360  {
3361  struct ns *ns;
3362 
3363  if (!(ns = reader_lookup_ns(reader, &reader->attr->localname)))
3365 
3366  return &ns->uri;
3367  }
3368  return &reader->attr->value;
3369  default:
3370  break;
3371  }
3372 
3373  val = &reader->strvalues[StringValue_Value];
3374  if (!val->str && ensure_allocated)
3375  {
3376  WCHAR *ptr = reader_alloc(reader, (val->len+1)*sizeof(WCHAR));
3377  if (!ptr) return NULL;
3378  memcpy(ptr, reader_get_strptr(reader, val), val->len*sizeof(WCHAR));
3379  ptr[val->len] = 0;
3380  val->str = ptr;
3381  }
3382 
3383  return val;
3384 }
static const strval strval_empty
Definition: reader.c:227
BSTR uri
Definition: mxnamespace.c:47
static WCHAR * reader_get_strptr(const xmlreader *reader, const strval *v)
Definition: reader.c:346
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:321
static XmlNodeType reader_get_nodetype(const xmlreader *reader)
Definition: reader.c:1556
GLuint GLfloat * val
Definition: glext.h:7180
static struct ns * reader_lookup_nsdef(xmlreader *reader)
Definition: reader.c:3197
__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:524
Definition: reader.h:83
Definition: reader.c:217

Referenced by xmlreader_GetValue(), and xmlreader_ReadValueChunk().

◆ reader_inc_depth()

static HRESULT reader_inc_depth ( xmlreader reader)
static

Definition at line 537 of file reader.c.

538 {
539  return (++reader->depth >= reader->max_depth && reader->max_depth) ? SC_E_MAXELEMENTDEPTH : S_OK;
540 }
#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 481 of file reader.c.

482 {
483  v->start = 0;
484  v->len = len;
485  v->str = str;
486 }
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 524 of file reader.c.

525 {
526  struct list *nslist = prefix ? &reader->ns : &reader->nsdef;
527  struct ns *ns;
528 
529  LIST_FOR_EACH_ENTRY_REV(ns, nslist, struct ns, entry) {
530  if (strval_eq(reader, prefix, &ns->prefix))
531  return ns;
532  }
533 
534  return NULL;
535 }
smooth NULL
Definition: ftsmooth.c:416
static int strval_eq(const xmlreader *reader, const strval *str1, const strval *str2)
Definition: reader.c:502
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 3197 of file reader.c.

3198 {
3199  if (list_empty(&reader->nsdef))
3200  return NULL;
3201 
3202  return LIST_ENTRY(list_head(&reader->nsdef), struct ns, entry);
3203 }
__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 586 of file reader.c.

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

Referenced by reader_parse_stag(), and reader_push_element().

◆ reader_more()

static HRESULT reader_more ( xmlreader reader)
static

Definition at line 1071 of file reader.c.

1072 {
1073  xmlreaderinput *readerinput = reader->input;
1074  encoded_buffer *src = &readerinput->buffer->encoded;
1075  encoded_buffer *dest = &readerinput->buffer->utf16;
1076  UINT cp = readerinput->buffer->code_page;
1077  int len, dest_len, prev_len;
1078  HRESULT hr;
1079  WCHAR *ptr;
1080 
1081  /* get some raw data from stream first */
1082  hr = readerinput_growraw(readerinput);
1083  len = readerinput_get_convlen(readerinput);
1084  prev_len = dest->written / sizeof(WCHAR);
1085 
1086  /* just copy for UTF-16 case */
1087  if (cp == 1200)
1088  {
1089  readerinput_grow(readerinput, len);
1090  memcpy(dest->data + dest->written, src->data + src->cur, len);
1091  dest->written += len*sizeof(WCHAR);
1092  }
1093  else
1094  {
1095  dest_len = MultiByteToWideChar(cp, 0, src->data + src->cur, len, NULL, 0);
1096  readerinput_grow(readerinput, dest_len);
1097  ptr = (WCHAR*)(dest->data + dest->written);
1098  MultiByteToWideChar(cp, 0, src->data + src->cur, len, ptr, dest_len);
1099  ptr[dest_len] = 0;
1100  dest->written += dest_len*sizeof(WCHAR);
1101  /* get rid of processed data */
1102  readerinput_shrinkraw(readerinput, len);
1103  }
1104 
1105  fixup_buffer_cr(dest, prev_len);
1106  return hr;
1107 }
static void fixup_buffer_cr(encoded_buffer *buffer, int off)
Definition: reader.c:988
HRESULT hr
Definition: shlfolder.c:183
static void readerinput_grow(xmlreaderinput *readerinput, int length)
Definition: reader.c:863
static int readerinput_get_convlen(xmlreaderinput *readerinput)
Definition: reader.c:956
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:305
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static void readerinput_shrinkraw(xmlreaderinput *readerinput, int len)
Definition: reader.c:973
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
encoded_buffer utf16
Definition: reader.c:304
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
#define MultiByteToWideChar
Definition: compat.h:100
input_buffer * buffer
Definition: reader.c:203
POINT cp
Definition: magnifier.c:59
static HRESULT readerinput_growraw(xmlreaderinput *readerinput)
Definition: reader.c:833
static char * dest
Definition: rtl.c:135
UINT code_page
Definition: reader.c:306

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 2963 of file reader.c.

2964 {
2965  if (!reader->attr_count)
2966  return S_FALSE;
2967 
2968  if (!reader->attr)
2970 
2972 
2973  return S_OK;
2974 }
static void reader_set_current_attribute(xmlreader *reader, struct attribute *attr)
Definition: reader.c:2954
__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:537
#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 2233 of file reader.c.

2234 {
2235  struct reader_position position = reader->position;
2236  strval prefix, local, qname, value;
2237  enum attribute_flags flags = 0;
2238  HRESULT hr;
2239 
2240  hr = reader_parse_qname(reader, &prefix, &local, &qname);
2241  if (FAILED(hr)) return hr;
2242 
2243  if (strval_eq(reader, &prefix, &strval_xmlns))
2245 
2246  if (strval_eq(reader, &qname, &strval_xmlns))
2248 
2250  if (FAILED(hr)) return hr;
2251 
2253  if (FAILED(hr)) return hr;
2254 
2257 
2258  TRACE("%s=%s\n", debug_strval(reader, &local), debug_strval(reader, &value));
2259  return reader_add_attr(reader, &prefix, &local, &qname, &value, &position, flags);
2260 }
HRESULT hr
Definition: shlfolder.c:183
static const char * debug_strval(const xmlreader *reader, const strval *v)
Definition: reader.c:475
static HRESULT reader_parse_eq(xmlreader *reader)
Definition: reader.c:1213
static int strval_eq(const xmlreader *reader, const strval *str1, const strval *str2)
Definition: reader.c:502
#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:548
GLbitfield flags
Definition: glext.h:7161
static HRESULT reader_parse_attvalue(xmlreader *reader, strval *value)
Definition: reader.c:2186
static const strval strval_xmlns
Definition: reader.c:229
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:424
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:1972
attribute_flags
Definition: reader.c:237
Definition: reader.h:83
Definition: reader.c:217

Referenced by reader_parse_stag().

◆ reader_parse_attvalue()

static HRESULT reader_parse_attvalue ( xmlreader reader,
strval value 
)
static

Definition at line 2186 of file reader.c.

2187 {
2188  WCHAR *ptr, quote;
2189  UINT start;
2190 
2192 
2193  /* skip opening quote */
2194  quote = *ptr;
2195  if (quote != '\"' && quote != '\'') return WC_E_QUOTE;
2196  reader_skipn(reader, 1);
2197 
2200  while (*ptr)
2201  {
2202  if (*ptr == '<') return WC_E_LESSTHAN;
2203 
2204  if (*ptr == quote)
2205  {
2207  /* skip closing quote */
2208  reader_skipn(reader, 1);
2209  return S_OK;
2210  }
2211 
2212  if (*ptr == '&')
2213  {
2215  if (FAILED(hr)) return hr;
2216  }
2217  else
2218  {
2219  /* replace all whitespace chars with ' ' */
2220  if (is_wchar_space(*ptr)) *ptr = ' ';
2221  reader_skipn(reader, 1);
2222  }
2224  }
2225 
2226  return WC_E_QUOTE;
2227 }
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1114
HRESULT hr
Definition: shlfolder.c:183
static BOOL is_wchar_space(WCHAR ch)
Definition: reader.c:1166
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:1109
__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:468
static HRESULT reader_parse_reference(xmlreader *reader)
Definition: reader.c:2085
#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:1154

Referenced by reader_parse_attribute().

◆ reader_parse_cdata()

static HRESULT reader_parse_cdata ( xmlreader reader)
static

Definition at line 2399 of file reader.c.

2400 {
2401  WCHAR *ptr;
2402  UINT start;
2403 
2404  if (reader->resumestate == XmlReadResumeState_CDATA)
2405  {
2406  start = reader->resume[XmlReadResume_Body];
2408  }
2409  else
2410  {
2411  /* skip markup '<![CDATA[' */
2412  reader_skipn(reader, 9);
2416  reader->nodetype = XmlNodeType_CDATA;
2417  reader->resume[XmlReadResume_Body] = start;
2418  reader->resumestate = XmlReadResumeState_CDATA;
2420  }
2421 
2422  while (*ptr)
2423  {
2424  if (*ptr == ']' && *(ptr+1) == ']' && *(ptr+2) == '>')
2425  {
2426  strval value;
2427 
2429 
2430  /* skip ']]>' */
2431  reader_skipn(reader, 3);
2432  TRACE("%s\n", debug_strval(reader, &value));
2433 
2435  reader->resume[XmlReadResume_Body] = 0;
2436  reader->resumestate = XmlReadResumeState_Initial;
2437  return S_OK;
2438  }
2439  else
2440  {
2441  reader_skipn(reader, 1);
2442  ptr++;
2443  }
2444  }
2445 
2446  return S_OK;
2447 }
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1114
static const char * debug_strval(const xmlreader *reader, const strval *v)
Definition: reader.c:475
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1109
static void reader_set_strvalue(xmlreader *reader, XmlReaderStringValue type, const strval *value)
Definition: reader.c:673
#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:468
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:1055
Definition: reader.c:217
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1154

Referenced by reader_parse_content().

◆ reader_parse_chardata()

static HRESULT reader_parse_chardata ( xmlreader reader)
static

Definition at line 2450 of file reader.c.

2451 {
2452  struct reader_position position;
2453  WCHAR *ptr;
2454  UINT start;
2455 
2456  if (reader->resumestate == XmlReadResumeState_CharData)
2457  {
2458  start = reader->resume[XmlReadResume_Body];
2460  }
2461  else
2462  {
2466  /* There's no text */
2467  if (!*ptr || *ptr == '<') return S_OK;
2469  reader->resume[XmlReadResume_Body] = start;
2470  reader->resumestate = XmlReadResumeState_CharData;
2472  }
2473 
2474  position = reader->position;
2475  while (*ptr)
2476  {
2477  static const WCHAR ampW[] = {'&',0};
2478 
2479  /* CDATA closing sequence ']]>' is not allowed */
2480  if (ptr[0] == ']' && ptr[1] == ']' && ptr[2] == '>')
2481  return WC_E_CDSECTEND;
2482 
2483  /* Found next markup part */
2484  if (ptr[0] == '<')
2485  {
2486  strval value;
2487 
2488  reader->empty_element.position = position;
2491  reader->resume[XmlReadResume_Body] = 0;
2492  reader->resumestate = XmlReadResumeState_Initial;
2493  return S_OK;
2494  }
2495 
2496  /* this covers a case when text has leading whitespace chars */
2497  if (!is_wchar_space(*ptr)) reader->nodetype = XmlNodeType_Text;
2498 
2499  if (!reader_cmp(reader, ampW))
2501  else
2502  reader_skipn(reader, 1);
2503 
2505  }
2506 
2507  return S_OK;
2508 }
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1114
static BOOL is_wchar_space(WCHAR ch)
Definition: reader.c:1166
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1109
static void reader_set_strvalue(xmlreader *reader, XmlReaderStringValue type, const strval *value)
Definition: reader.c:673
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void reader_init_strvalue(UINT start, UINT len, strval *v)
Definition: reader.c:468
static HRESULT reader_parse_reference(xmlreader *reader)
Definition: reader.c:2085
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:1122
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
static void reader_shrink(xmlreader *reader)
Definition: reader.c:1055
Definition: reader.c:217
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1154

Referenced by reader_parse_content().

◆ reader_parse_comment()

static HRESULT reader_parse_comment ( xmlreader reader)
static

Definition at line 1425 of file reader.c.

1426 {
1427  WCHAR *ptr;
1428  UINT start;
1429 
1430  if (reader->resumestate == XmlReadResumeState_Comment)
1431  {
1432  start = reader->resume[XmlReadResume_Body];
1434  }
1435  else
1436  {
1437  /* skip '<!--' */
1438  reader_skipn(reader, 4);
1442  reader->nodetype = XmlNodeType_Comment;
1443  reader->resume[XmlReadResume_Body] = start;
1444  reader->resumestate = XmlReadResumeState_Comment;
1446  }
1447 
1448  /* will exit when there's no more data, it won't attempt to
1449  read more from stream */
1450  while (*ptr)
1451  {
1452  if (ptr[0] == '-')
1453  {
1454  if (ptr[1] == '-')
1455  {
1456  if (ptr[2] == '>')
1457  {
1458  strval value;
1459 
1461  TRACE("%s\n", debug_strval(reader, &value));
1462 
1463  /* skip rest of markup '->' */
1464  reader_skipn(reader, 3);
1465 
1467  reader->resume[XmlReadResume_Body] = 0;
1468  reader->resumestate = XmlReadResumeState_Initial;
1469  return S_OK;
1470  }
1471  else
1472  return WC_E_COMMENT;
1473  }
1474  }
1475 
1476  reader_skipn(reader, 1);
1477  ptr++;
1478  }
1479 
1480  return S_OK;
1481 }
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1114
static const char * debug_strval(const xmlreader *reader, const strval *v)
Definition: reader.c:475
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1109
static void reader_set_strvalue(xmlreader *reader, XmlReaderStringValue type, const strval *value)
Definition: reader.c:673
#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:468
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:1055
Definition: reader.c:217
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1154

Referenced by reader_parse_content(), and reader_parse_misc().

◆ reader_parse_content()

static HRESULT reader_parse_content ( xmlreader reader)
static

Definition at line 2511 of file reader.c.

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

Referenced by reader_parse_nextnode().

◆ reader_parse_dtd()

static HRESULT reader_parse_dtd ( xmlreader reader)
static

Definition at line 1884 of file reader.c.

1885 {
1886  static const WCHAR doctypeW[] = {'<','!','D','O','C','T','Y','P','E',0};
1887  strval name;
1888  WCHAR *cur;
1889  HRESULT hr;
1890 
1891  /* check if we have "<!DOCTYPE" */
1892  if (reader_cmp(reader, doctypeW)) return S_FALSE;
1894 
1895  /* DTD processing is not allowed by default */
1896  if (reader->dtdmode == DtdProcessing_Prohibit) return WC_E_DTDPROHIBITED;
1897 
1898  reader_skipn(reader, 9);
1900 
1901  /* name */
1903  if (FAILED(hr)) return WC_E_DECLDOCTYPE;
1904 
1906 
1908  if (FAILED(hr)) return hr;
1909 
1911 
1912  cur = reader_get_ptr(reader);
1913  if (*cur != '>')
1914  {
1915  FIXME("internal subset parsing not implemented\n");
1916  return E_NOTIMPL;
1917  }
1918 
1919  /* skip '>' */
1920  reader_skipn(reader, 1);
1921 
1922  reader->nodetype = XmlNodeType_DocumentType;
1925 
1926  return S_OK;
1927 }
static HRESULT reader_parse_externalid(xmlreader *reader)
Definition: reader.c:1831
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1114
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:673
__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:1122
Definition: reader.h:83
static void reader_shrink(xmlreader *reader)
Definition: reader.c:1055
Definition: reader.c:217
Definition: name.c:36
static int reader_skipspaces(xmlreader *reader)
Definition: reader.c:1172
static HRESULT reader_parse_name(xmlreader *reader, strval *name)
Definition: reader.c:1569
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1154
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 2313 of file reader.c.

2314 {
2315  HRESULT hr;
2316 
2317  switch (reader->resumestate)
2318  {
2320  /* check if we are really on element */
2321  if (reader_cmp(reader, ltW)) return S_FALSE;
2322 
2323  /* skip '<' */
2324  reader_skipn(reader, 1);
2325 
2327  reader->resumestate = XmlReadResumeState_STag;
2329  {
2330  strval qname, prefix, local;
2331 
2332  /* this handles empty elements too */
2333  hr = reader_parse_stag(reader, &prefix, &local, &qname);
2334  if (FAILED(hr)) return hr;
2335 
2336  /* FIXME: need to check for defined namespace to reject invalid prefix */
2337 
2338  /* if we got empty element and stack is empty go straight to Misc */
2339  if (reader->is_empty_element && list_empty(&reader->elements))
2340  reader->instate = XmlReadInState_MiscEnd;
2341  else
2342  reader->instate = XmlReadInState_Content;
2343 
2344  reader->nodetype = XmlNodeType_Element;
2345  reader->resumestate = XmlReadResumeState_Initial;
2349  break;
2350  }
2351  default:
2352  hr = E_FAIL;
2353  }
2354 
2355  return hr;
2356 }
static const strval strval_empty
Definition: reader.c:227
HRESULT hr
Definition: shlfolder.c:183
#define E_FAIL
Definition: ddrawi.h:102
static const WCHAR ltW[]
Definition: reader.c:93
#define S_FALSE
Definition: winerror.h:2357
static void reader_set_strvalue(xmlreader *reader, XmlReaderStringValue type, const strval *value)
Definition: reader.c:673
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:1122
static HRESULT reader_parse_stag(xmlreader *reader, strval *prefix, strval *local, strval *qname)
Definition: reader.c:2264
Definition: reader.h:83
static void reader_shrink(xmlreader *reader)
Definition: reader.c:1055
Definition: reader.c:217
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1154

Referenced by reader_parse_content(), and reader_parse_nextnode().

◆ reader_parse_encdecl()

static HRESULT reader_parse_encdecl ( xmlreader reader)
static

Definition at line 1301 of file reader.c.

1302 {
1303  static const WCHAR encodingW[] = {'e','n','c','o','d','i','n','g',0};
1304  struct reader_position position;
1305  strval name, val;
1306  HRESULT hr;
1307 
1308  if (!reader_skipspaces(reader)) return S_FALSE;
1309 
1310  position = reader->position;
1311  if (reader_cmp(reader, encodingW)) return S_FALSE;
1312  name.str = reader_get_ptr(reader);
1313  name.start = reader_get_cur(reader);
1314  name.len = 8;
1315  /* skip 'encoding' */
1316  reader_skipn(reader, 8);
1317 
1319  if (FAILED(hr)) return hr;
1320 
1322  return WC_E_QUOTE;
1323  /* skip "'"|'"' */
1324  reader_skipn(reader, 1);
1325 
1327  if (FAILED(hr)) return hr;
1328 
1330  return WC_E_QUOTE;
1331 
1332  /* skip "'"|'"' */
1333  reader_skipn(reader, 1);
1334 
1335  return reader_add_attr(reader, NULL, &name, NULL, &val, &position, 0);
1336 }
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1114
HRESULT hr
Definition: shlfolder.c:183
static HRESULT reader_parse_eq(xmlreader *reader)
Definition: reader.c:1213
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1109
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:424
static int reader_cmp(xmlreader *reader, const WCHAR *str)
Definition: reader.c:1122
static const WCHAR quoteW[]
Definition: reader.c:92
Definition: reader.h:83
static const WCHAR dblquoteW[]
Definition: reader.c:91
Definition: reader.c:217
Definition: name.c:36
static int reader_skipspaces(xmlreader *reader)
Definition: reader.c:1172
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1154
static HRESULT reader_parse_encname(xmlreader *reader, strval *val)
Definition: reader.c:1271
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 1271 of file reader.c.

1272 {
1274  xml_encoding enc;
1275  int len;
1276 
1277  if ((*start < 'A' || *start > 'Z') && (*start < 'a' || *start > 'z'))
1278  return WC_E_ENCNAME;
1279 
1280  val->start = reader_get_cur(reader);
1281 
1282  ptr = start;
1283  while (is_wchar_encname(*++ptr))
1284  ;
1285 
1286  len = ptr - start;
1287  enc = parse_encoding_name(start, len);
1288  TRACE("encoding name %s\n", debugstr_wn(start, len));
1289  val->str = start;
1290  val->len = len;
1291 
1292  if (enc == XmlEncoding_Unknown)
1293  return WC_E_ENCNAME;
1294 
1295  /* skip encoding name */
1297  return S_OK;
1298 }
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1114
static PVOID ptr
Definition: dispmode.c:27
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1109
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:745
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:1261
Definition: reader.h:83
xml_encoding
Definition: mxwriter.c:53
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1154

Referenced by reader_parse_encdecl().

◆ reader_parse_endtag()

static HRESULT reader_parse_endtag ( xmlreader reader)
static

Definition at line 2359 of file reader.c.

2360 {
2361  struct reader_position position;
2362  strval prefix, local, qname;
2363  struct element *element;
2364  HRESULT hr;
2365 
2366  /* skip '</' */
2367  reader_skipn(reader, 2);
2368 
2369  position = reader->position;
2371  if (FAILED(hr)) return hr;
2372 
2374 
2375  if (reader_cmp(reader, gtW)) return WC_E_GREATERTHAN;
2376 
2377  /* skip '>' */
2378  reader_skipn(reader, 1);
2379 
2380  /* Element stack should never be empty at this point, cause we shouldn't get to
2381  content parsing if it's empty. */
2382  element = LIST_ENTRY(list_head(&reader->elements), struct element, entry);
2383  if (!strval_eq(reader, &element->qname, &qname)) return WC_E_ELEMENTMATCH;
2384 
2385  /* update position stored for start tag, we won't be using it */
2387 
2388  reader->nodetype = XmlNodeType_EndElement;
2389  reader->is_empty_element = FALSE;
2391 
2392  return S_OK;
2393 }
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:257
static void reader_set_strvalue(xmlreader *reader, XmlReaderStringValue type, const strval *value)
Definition: reader.c:673
static int strval_eq(const xmlreader *reader, const strval *str1, const strval *str2)
Definition: reader.c:502
LONG HRESULT
Definition: typedefs.h:77
struct reader_position position
Definition: reader.c:260
static const WCHAR gtW[]
Definition: reader.c:94
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:1972
static int reader_cmp(xmlreader *reader, const WCHAR *str)
Definition: reader.c:1122
strval qname
Definition: reader.c:259
Definition: reader.h:83
Definition: reader.c:217
#define LIST_ENTRY(type)
Definition: queue.h:175
static int reader_skipspaces(xmlreader *reader)
Definition: reader.c:1172
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1154

Referenced by reader_parse_content().

◆ reader_parse_eq()

static HRESULT reader_parse_eq ( xmlreader reader)
static

Definition at line 1213 of file reader.c.

1214 {
1215  static const WCHAR eqW[] = {'=',0};
1217  if (reader_cmp(reader, eqW)) return WC_E_EQUAL;
1218  /* skip '=' */
1219  reader_skipn(reader, 1);
1221  return S_OK;
1222 }
__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:1122
Definition: reader.h:83
static int reader_skipspaces(xmlreader *reader)
Definition: reader.c:1172
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1154

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 1831 of file reader.c.

1832 {
1833  static WCHAR systemW[] = {'S','Y','S','T','E','M',0};
1834  static WCHAR publicW[] = {'P','U','B','L','I','C',0};
1835  struct reader_position position = reader->position;
1836  strval name, sys;
1837  HRESULT hr;
1838  int cnt;
1839 
1840  if (!reader_cmp(reader, publicW)) {
1841  strval pub;
1842 
1843  /* public id */
1844  reader_skipn(reader, 6);
1845  cnt = reader_skipspaces(reader);
1846  if (!cnt) return WC_E_WHITESPACE;
1847 
1849  if (FAILED(hr)) return hr;
1850 
1852  hr = reader_add_attr(reader, NULL, &name, NULL, &pub, &position, 0);
1853  if (FAILED(hr)) return hr;
1854 
1855  cnt = reader_skipspaces(reader);
1856  if (!cnt) return S_OK;
1857 
1858  /* optional system id */
1860  if (FAILED(hr)) return S_OK;
1861 
1863  hr = reader_add_attr(reader, NULL, &name, NULL, &sys, &position, 0);
1864  if (FAILED(hr)) return hr;
1865 
1866  return S_OK;
1867  } else if (!reader_cmp(reader, systemW)) {
1868  /* system id */
1869  reader_skipn(reader, 6);
1870  cnt = reader_skipspaces(reader);
1871  if (!cnt) return WC_E_WHITESPACE;
1872 
1874  if (FAILED(hr)) return hr;
1875 
1877  return reader_add_attr(reader, NULL, &name, NULL, &sys, &position, 0);
1878  }
1879 
1880  return S_FALSE;
1881 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
HRESULT hr
Definition: shlfolder.c:183
static void reader_init_cstrvalue(WCHAR *str, UINT len, strval *v)
Definition: reader.c:481
static HRESULT reader_parse_pub_literal(xmlreader *reader, strval *literal)
Definition: reader.c:1806
#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:1780
__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:424
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:1122
Definition: reader.h:83
Definition: reader.c:217
Definition: name.c:36
static const WCHAR systemW[]
Definition: mxwriter.c:50
static int reader_skipspaces(xmlreader *reader)
Definition: reader.c:1172
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1154
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 1930 of file reader.c.

1931 {
1932  WCHAR *ptr;
1933  UINT start;
1934 
1935  if (reader->resume[XmlReadResume_Local])
1936  {
1937  start = reader->resume[XmlReadResume_Local];
1939  }
1940  else
1941  {
1944  }
1945 
1946  while (is_ncnamechar(*ptr))
1947  {
1948  reader_skipn(reader, 1);
1950  }
1951 
1952  if (check_for_separator && *ptr == ':')
1953  return NC_E_QNAMECOLON;
1954 
1956  {
1957  reader->resume[XmlReadResume_Local] = start;
1958  return E_PENDING;
1959  }
1960  else
1961  reader->resume[XmlReadResume_Local] = 0;
1962 
1964 
1965  return S_OK;
1966 }
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1114
static int is_reader_pending(xmlreader *reader)
Definition: reader.c:707
static PVOID ptr
Definition: dispmode.c:27
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1109
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void reader_init_strvalue(UINT start, UINT len, strval *v)
Definition: reader.c:468
#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
static BOOL is_ncnamechar(WCHAR ch)
Definition: reader.c:1527
#define E_PENDING
Definition: dinput.h:172
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1154

Referenced by reader_parse_qname().

◆ reader_parse_misc()

static HRESULT reader_parse_misc ( xmlreader reader)
static

Definition at line 1736 of file reader.c.

1737 {
1738  HRESULT hr = S_FALSE;
1739 
1740  if (reader->resumestate != XmlReadResumeState_Initial)
1741  {
1742  hr = reader_more(reader);
1743  if (FAILED(hr)) return hr;
1744 
1745  /* finish current node */
1746  switch (reader->resumestate)
1747  {
1750  return reader_parse_pi(reader);
1752  return reader_parse_comment(reader);
1755  default:
1756  ERR("unknown resume state %d\n", reader->resumestate);
1757  }
1758  }
1759 
1760  while (1)
1761  {
1762  const WCHAR *cur = reader_get_ptr(reader);
1763 
1764  if (is_wchar_space(*cur))
1766  else if (!reader_cmp(reader, commentW))
1768  else if (!reader_cmp(reader, piW))
1770  else
1771  break;
1772 
1773  if (hr != S_FALSE) return hr;
1774  }
1775 
1776  return hr;
1777 }
static HRESULT reader_more(xmlreader *reader)
Definition: reader.c:1071
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1114
HRESULT hr
Definition: shlfolder.c:183
static HRESULT reader_parse_comment(xmlreader *reader)
Definition: reader.c:1425
static BOOL is_wchar_space(WCHAR ch)
Definition: reader.c:1166
#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:95
#define ERR(fmt,...)
Definition: debug.h:109
static HRESULT reader_parse_pi(xmlreader *reader)
Definition: reader.c:1635
static HRESULT reader_parse_whitespace(xmlreader *reader)
Definition: reader.c:1701
static int reader_cmp(xmlreader *reader, const WCHAR *str)
Definition: reader.c:1122
Definition: reader.h:83
static const WCHAR piW[]
Definition: reader.c:96

Referenced by reader_parse_nextnode().

◆ reader_parse_name()

static HRESULT reader_parse_name ( xmlreader reader,
strval name 
)
static

Definition at line 1569 of file reader.c.

1570 {
1571  WCHAR *ptr;
1572  UINT start;
1573 
1574  if (reader->resume[XmlReadResume_Name])
1575  {
1576  start = reader->resume[XmlReadResume_Name];
1578  }
1579  else
1580  {
1583  if (!is_namestartchar(*ptr)) return WC_E_NAMECHARACTER;
1584  }
1585 
1586  while (is_namechar(*ptr))
1587  {
1588  reader_skipn(reader, 1);
1590  }
1591 
1593  {
1594  reader->resume[XmlReadResume_Name] = start;
1595  return E_PENDING;
1596  }
1597  else
1598  reader->resume[XmlReadResume_Name] = 0;
1599 
1601  TRACE("name %s:%d\n", debug_strval(reader, name), name->len);
1602 
1603  return S_OK;
1604 }
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1114
static const char * debug_strval(const xmlreader *reader, const strval *v)
Definition: reader.c:475
static int is_reader_pending(xmlreader *reader)
Definition: reader.c:707
static PVOID ptr
Definition: dispmode.c:27
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1109
#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:468
#define S_OK
Definition: intsafe.h:59
GLuint start
Definition: gl.h:1545
static BOOL is_namechar(WCHAR ch)
Definition: reader.c:1551
unsigned int UINT
Definition: ndis.h:50
static BOOL is_namestartchar(WCHAR ch)
Definition: reader.c:1507
Definition: reader.h:83
Definition: name.c:36
#define E_PENDING
Definition: dinput.h:172
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1154

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 2556 of file reader.c.

2557 {
2559  HRESULT hr;
2560 
2561  if (!is_reader_pending(reader))
2562  {
2563  reader->chunk_read_off = 0;
2565  }
2566 
2567  /* When moving from EndElement or empty element, pop its own namespace definitions */
2568  switch (nodetype)
2569  {
2570  case XmlNodeType_Attribute:
2572  /* fallthrough */
2573  case XmlNodeType_Element:
2574  if (reader->is_empty_element)
2575  reader_pop_ns_nodes(reader, &reader->empty_element);
2576  else if (FAILED(hr = reader_inc_depth(reader)))
2577  return hr;
2578  break;
2582  break;
2583  default:
2584  ;
2585  }
2586 
2587  for (;;)
2588  {
2589  switch (reader->instate)
2590  {
2591  /* if it's a first call for a new input we need to detect stream encoding */
2593  {
2594  xml_encoding enc;
2595 
2596  hr = readerinput_growraw(reader->input);
2597  if (FAILED(hr)) return hr;
2598 
2599  reader->position.line_number = 1;
2600  reader->position.line_position = 1;
2601 
2602  /* try to detect encoding by BOM or data and set input code page */
2603  hr = readerinput_detectencoding(reader->input, &enc);
2604  TRACE("detected encoding %s, 0x%08x\n", enc == XmlEncoding_Unknown ? "(unknown)" :
2606  if (FAILED(hr)) return hr;
2607 
2608  /* always switch first time cause we have to put something in */
2609  readerinput_switchencoding(reader->input, enc);
2610 
2611  /* parse xml declaration */
2613  if (FAILED(hr)) return hr;
2614 
2615  readerinput_shrinkraw(reader->input, -1);
2616  reader->instate = XmlReadInState_Misc_DTD;
2617  if (hr == S_OK) return hr;
2618  }
2619  break;
2622  if (FAILED(hr)) return hr;
2623 
2624  if (hr == S_FALSE)
2625  reader->instate = XmlReadInState_DTD;
2626  else
2627  return hr;
2628  break;
2629  case XmlReadInState_DTD:
2631  if (FAILED(hr)) return hr;
2632 
2633  if (hr == S_OK)
2634  {
2635  reader->instate = XmlReadInState_DTD_Misc;
2636  return hr;
2637  }
2638  else
2639  reader->instate = XmlReadInState_Element;
2640  break;
2643  if (FAILED(hr)) return hr;
2644 
2645  if (hr == S_FALSE)
2646  reader->instate = XmlReadInState_Element;
2647  else
2648  return hr;
2649  break;
2651  return reader_parse_element(reader);
2653  return reader_parse_content(reader);
2656  if (hr != S_FALSE) return hr;
2657 
2658  if (*reader_get_ptr(reader))
2659  {
2660  WARN("found garbage in the end of XML\n");
2661  return WC_E_SYNTAX;
2662  }
2663 
2664  reader->instate = XmlReadInState_Eof;
2665  reader->state = XmlReadState_EndOfFile;
2666  reader->nodetype = XmlNodeType_None;
2667  return hr;
2668  case XmlReadInState_Eof:
2669  return S_FALSE;
2670  default:
2671  FIXME("internal state %d not handled\n", reader->instate);
2672  return E_NOTIMPL;
2673  }
2674  }
2675 
2676  return E_NOTIMPL;
2677 }
static HRESULT reader_parse_dtd(xmlreader *reader)
Definition: reader.c:1884
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1114
HRESULT hr
Definition: shlfolder.c:183
static void reader_pop_ns_nodes(xmlreader *reader, struct element *element)
Definition: reader.c:628
#define WARN(fmt,...)
Definition: debug.h:111
static HRESULT reader_parse_misc(xmlreader *reader)
Definition: reader.c:1736
XmlNodeType
Definition: xmllite.idl:23
static void reader_clear_attrs(xmlreader *reader)
Definition: reader.c:408
static HRESULT readerinput_detectencoding(xmlreaderinput *readerinput, xml_encoding *enc)
Definition: reader.c:896
static int is_reader_pending(xmlreader *reader)
Definition: reader.c:707
#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:157
static XmlNodeType reader_get_nodetype(const xmlreader *reader)
Definition: reader.c:1556
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static HRESULT reader_parse_xmldecl(xmlreader *reader)
Definition: reader.c:1383
static void reader_pop_element(xmlreader *reader)
Definition: reader.c:653
static void reader_dec_depth(xmlreader *reader)
Definition: reader.c:542
static void readerinput_shrinkraw(xmlreaderinput *readerinput, int len)
Definition: reader.c:973
static void readerinput_switchencoding(xmlreaderinput *readerinput, xml_encoding enc)
Definition: reader.c:1017
static HRESULT reader_inc_depth(xmlreader *reader)
Definition: reader.c:537
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT reader_parse_content(xmlreader *reader)
Definition: reader.c:2511
Definition: reader.h:83
Definition: name.c:36
static HRESULT readerinput_growraw(xmlreaderinput *readerinput)
Definition: reader.c:833
xml_encoding
Definition: mxwriter.c:53
static HRESULT reader_parse_element(xmlreader *reader)
Definition: reader.c:2313

Referenced by xmlreader_Read().

◆ reader_parse_pi()

static HRESULT reader_parse_pi ( xmlreader reader)
static

Definition at line 1635 of file reader.c.

1636 {
1637  strval target;
1638  WCHAR *ptr;
1639  UINT start;
1640  HRESULT hr;
1641 
1642  switch (reader->resumestate)
1643  {
1645  /* skip '<?' */
1646  reader_skipn(reader, 2);
1648  reader->resumestate = XmlReadResumeState_PITarget;
1651  if (FAILED(hr)) return hr;
1655  reader->resumestate = XmlReadResumeState_PIBody;
1657  default:
1658  ;
1659  }
1660 
1661  start = reader->resume[XmlReadResume_Body];
1663  while (*ptr)
1664  {
1665  if (ptr[0] == '?')
1666  {
1667  if (ptr[1] == '>')
1668  {
1669  UINT cur = reader_get_cur(reader);
1670  strval value;
1671 
1672  /* strip all leading whitespace chars */
1673  while (start < cur)
1674  {
1676  if (!is_wchar_space(*ptr)) break;
1677  start++;
1678  }
1679 
1681 
1682  /* skip '?>' */
1683  reader_skipn(reader, 2);
1684  TRACE("%s\n", debug_strval(reader, &value));
1686  reader->resumestate = XmlReadResumeState_Initial;
1687  reader->resume[XmlReadResume_Body] = 0;
1689  return S_OK;
1690  }
1691  }
1692 
1693  reader_skipn(reader, 1);
1695  }
1696 
1697  return S_OK;
1698 }
static const strval strval_empty
Definition: reader.c:227
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1114
HRESULT hr
Definition: shlfolder.c:183
static const char * debug_strval(const xmlreader *reader, const strval *v)
Definition: reader.c:475
static BOOL is_wchar_space(WCHAR ch)
Definition: reader.c:1166
static HRESULT reader_parse_pitarget(xmlreader *reader, strval *target)
Definition: reader.c:1607
static WCHAR * reader_get_ptr2(const xmlreader *reader, UINT offset)
Definition: reader.c:340
static PVOID ptr
Definition: dispmode.c:27
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1109
static void reader_set_strvalue(xmlreader *reader, XmlReaderStringValue type, const strval *value)
Definition: reader.c:673
#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:468
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:1055
Definition: reader.c:217
GLenum target
Definition: glext.h:7315
static void reader_skipn(xmlreader *reader, int n)
Definition: reader.c:1154

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 1607 of file reader.c.

1608 {
1609  static const WCHAR xmlW[] = {'x','m','l'};
1610  static const strval xmlval = { (WCHAR*)xmlW, 3 };
1611  strval name;
1612  WCHAR *ptr;
1613  HRESULT hr;
1614  UINT i;
1615 
1617  if (FAILED(hr)) return is_reader_pending(reader) ? E_PENDING : WC_E_PI;
1618 
1619  /* now that we got name check for illegal content */
1620  if (strval_eq(reader, &name, &xmlval))
1621  return WC_E_LEADINGXML;
1622 
1623  /* PITarget can't be a qualified name */
1625  for (i = 0; i < name.len; i++)
1626  if (ptr[i] == ':')
1627  return i ? NC_E_NAMECOLON : WC_E_PI;
1628 
1629  TRACE("pitarget %s:%d\n", debug_strval(reader, &name), name.len);
1630  *target = name;
1631  return S_OK;
1632 }
static WCHAR xmlW[]
Definition: reader.c:225
HRESULT hr
Definition: shlfolder.c:183
static const char * debug_strval(const xmlreader *reader, const strval *v)
Definition: reader.c:475
static WCHAR * reader_get_strptr(const xmlreader *reader, const strval *v)
Definition: reader.c:346
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:707
static PVOID ptr
Definition: dispmode.c:27
static int strval_eq(const xmlreader *reader, const strval *str1, const strval *str2)
Definition: reader.c:502
#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:217
Definition: name.c:36
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:1569
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 1806 of file reader.c.

1807 {
1808  WCHAR *cur = reader_get_ptr(reader), quote;
1809  UINT start;
1810 
1811  if (*cur != '"' && *cur != '\'') return WC_E_QUOTE;
1812 
1813  quote = *cur;
1814  reader_skipn(reader, 1);
1815 
1817  cur = reader_get_ptr(reader);
1818  while (is_pubchar(*cur) && *cur != quote)
1819  {
1820  reader_skipn(reader, 1);
1821  cur = reader_get_ptr(reader);
1822  }
1824  if (*cur == quote) reader_skipn(reader, 1);
1825 
1826  TRACE("%s\n", debug_strval(reader, literal));
1827  return S_OK;
1828 }
static WCHAR * reader_get_ptr(xmlreader *reader)
Definition: reader.c:1114
static const char * debug_strval(const xmlreader *reader, const strval *v)
Definition: reader.c:475
#define quote
Definition: macro.lex.yy.c:531
static BOOL is_pubchar(WCHAR ch)
Definition: reader.c:1494
static UINT reader_get_cur(xmlreader *reader)
Definition: reader.c:1109
#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:468
#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:1154

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 1972 of file reader.c.

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