ReactOS  0.4.15-dev-3217-gc6d1646
xmlstring.c File Reference
#include "libxml.h"
#include <stdlib.h>
#include <string.h>
#include <libxml/xmlmemory.h>
#include <libxml/parserInternals.h>
#include <libxml/xmlstring.h>
#include "elfgcchack.h"
Include dependency graph for xmlstring.c:

Go to the source code of this file.

Macros

#define IN_LIBXML
 

Functions

xmlCharxmlStrndup (const xmlChar *cur, int len)
 
xmlCharxmlStrdup (const xmlChar *cur)
 
xmlCharxmlCharStrndup (const char *cur, int len)
 
xmlCharxmlCharStrdup (const char *cur)
 
int xmlStrcmp (const xmlChar *str1, const xmlChar *str2)
 
int xmlStrEqual (const xmlChar *str1, const xmlChar *str2)
 

: the localname of the QName

xmlStrQEqual: @pref: the prefix of the QName

@str: the second xmlChar *

Check if a QName is Equal to a given string

Returns 1 if they are equal, 0 if they are different

#define bottom_xmlstring
 
static const xmlChar casemap [256]
 
int xmlStrQEqual (const xmlChar *pref, const xmlChar *name, const xmlChar *str)
 
int xmlStrncmp (const xmlChar *str1, const xmlChar *str2, int len)
 
int xmlStrcasecmp (const xmlChar *str1, const xmlChar *str2)
 
int xmlStrncasecmp (const xmlChar *str1, const xmlChar *str2, int len)
 
const xmlCharxmlStrchr (const xmlChar *str, xmlChar val)
 
const xmlCharxmlStrstr (const xmlChar *str, const xmlChar *val)
 
const xmlCharxmlStrcasestr (const xmlChar *str, const xmlChar *val)
 
xmlCharxmlStrsub (const xmlChar *str, int start, int len)
 
int xmlStrlen (const xmlChar *str)
 
xmlCharxmlStrncat (xmlChar *cur, const xmlChar *add, int len)
 
xmlCharxmlStrncatNew (const xmlChar *str1, const xmlChar *str2, int len)
 
xmlCharxmlStrcat (xmlChar *cur, const xmlChar *add)
 
int XMLCDECL xmlStrPrintf (xmlChar *buf, int len, const char *msg,...)
 
int xmlStrVPrintf (xmlChar *buf, int len, const char *msg, va_list ap)
 
int xmlUTF8Size (const xmlChar *utf)
 
int xmlUTF8Charcmp (const xmlChar *utf1, const xmlChar *utf2)
 
int xmlUTF8Strlen (const xmlChar *utf)
 
int xmlGetUTF8Char (const unsigned char *utf, int *len)
 
int xmlCheckUTF8 (const unsigned char *utf)
 
int xmlUTF8Strsize (const xmlChar *utf, int len)
 
xmlCharxmlUTF8Strndup (const xmlChar *utf, int len)
 
const xmlCharxmlUTF8Strpos (const xmlChar *utf, int pos)
 
int xmlUTF8Strloc (const xmlChar *utf, const xmlChar *utfchar)
 
xmlCharxmlUTF8Strsub (const xmlChar *utf, int start, int len)
 
xmlCharxmlEscapeFormatString (xmlChar **msg)
 

Macro Definition Documentation

◆ bottom_xmlstring

#define bottom_xmlstring

Definition at line 1049 of file xmlstring.c.

◆ IN_LIBXML

#define IN_LIBXML

Definition at line 16 of file xmlstring.c.

Function Documentation

◆ xmlCharStrdup()

xmlChar* xmlCharStrdup ( const char cur)

xmlCharStrdup: @cur: the input char *

a strdup for char's to xmlChar's

Returns a new xmlChar * or NULL

Definition at line 113 of file xmlstring.c.

113  {
114  const char *p = cur;
115 
116  if (cur == NULL) return(NULL);
117  while (*p != '\0') p++; /* non input consuming */
118  return(xmlCharStrndup(cur, p - cur));
119 }
FxCollectionEntry * cur
#define NULL
Definition: types.h:112
xmlChar * xmlCharStrndup(const char *cur, int len)
Definition: xmlstring.c:85
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by xmlParseDocument(), xmlParseExtParsedEnt(), xmlParseTextDecl(), and xmlPosixStrdup().

◆ xmlCharStrndup()

xmlChar* xmlCharStrndup ( const char cur,
int  len 
)

xmlCharStrndup: @cur: the input char * @len: the len of @cur

a strndup for char's to xmlChar's

Returns a new xmlChar * or NULL

Definition at line 85 of file xmlstring.c.

85  {
86  int i;
87  xmlChar *ret;
88 
89  if ((cur == NULL) || (len < 0)) return(NULL);
90  ret = (xmlChar *) xmlMallocAtomic((len + 1) * sizeof(xmlChar));
91  if (ret == NULL) {
93  return(NULL);
94  }
95  for (i = 0;i < len;i++) {
96  ret[i] = (xmlChar) cur[i];
97  if (ret[i] == 0) return(ret);
98  }
99  ret[len] = 0;
100  return(ret);
101 }
XMLPUBVAR xmlMallocFunc xmlMallocAtomic
Definition: globals.h:248
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum GLsizei len
Definition: glext.h:6722
FxCollectionEntry * cur
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 NULL
Definition: types.h:112

Referenced by xmlCharStrdup().

◆ xmlCheckUTF8()

int xmlCheckUTF8 ( const unsigned char utf)

xmlCheckUTF8: @utf: Pointer to putative UTF-8 encoded string.

Checks @utf for being valid UTF-8. @utf is assumed to be null-terminated. This function is not super-strict, as it will allow longer UTF-8 sequences than necessary. Note that Java is capable of producing these sequences if provoked. Also note, this routine checks for the 4-byte maximum size, but does not check for 0x10ffff maximum value.

Return value: true if @utf is valid.

Definition at line 784 of file xmlstring.c.

785 {
786  int ix;
787  unsigned char c;
788 
789  if (utf == NULL)
790  return(0);
791  /*
792  * utf is a string of 1, 2, 3 or 4 bytes. The valid strings
793  * are as follows (in "bit format"):
794  * 0xxxxxxx valid 1-byte
795  * 110xxxxx 10xxxxxx valid 2-byte
796  * 1110xxxx 10xxxxxx 10xxxxxx valid 3-byte
797  * 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx valid 4-byte
798  */
799  for (ix = 0; (c = utf[ix]);) { /* string is 0-terminated */
800  if ((c & 0x80) == 0x00) { /* 1-byte code, starts with 10 */
801  ix++;
802  } else if ((c & 0xe0) == 0xc0) {/* 2-byte code, starts with 110 */
803  if ((utf[ix+1] & 0xc0 ) != 0x80)
804  return 0;
805  ix += 2;
806  } else if ((c & 0xf0) == 0xe0) {/* 3-byte code, starts with 1110 */
807  if (((utf[ix+1] & 0xc0) != 0x80) ||
808  ((utf[ix+2] & 0xc0) != 0x80))
809  return 0;
810  ix += 3;
811  } else if ((c & 0xf8) == 0xf0) {/* 4-byte code, starts with 11110 */
812  if (((utf[ix+1] & 0xc0) != 0x80) ||
813  ((utf[ix+2] & 0xc0) != 0x80) ||
814  ((utf[ix+3] & 0xc0) != 0x80))
815  return 0;
816  ix += 4;
817  } else /* unknown encoding */
818  return 0;
819  }
820  return(1);
821 }
const GLubyte * c
Definition: glext.h:8905
#define NULL
Definition: types.h:112
#define c
Definition: ke_i.h:80

◆ xmlEscapeFormatString()

xmlChar* xmlEscapeFormatString ( xmlChar **  msg)

xmlEscapeFormatString: @msg: a pointer to the string in which to escape '' characters. Must be a heap-allocated buffer created by libxml2 that may be returned, or that may be freed and replaced.

Replaces the string pointed to by 'msg' with an escaped string. Returns the same string with all '' characters escaped.

Definition at line 1004 of file xmlstring.c.

1005 {
1006  xmlChar *msgPtr = NULL;
1007  xmlChar *result = NULL;
1008  xmlChar *resultPtr = NULL;
1009  size_t count = 0;
1010  size_t msgLen = 0;
1011  size_t resultLen = 0;
1012 
1013  if (!msg || !*msg)
1014  return(NULL);
1015 
1016  for (msgPtr = *msg; *msgPtr != '\0'; ++msgPtr) {
1017  ++msgLen;
1018  if (*msgPtr == '%')
1019  ++count;
1020  }
1021 
1022  if (count == 0)
1023  return(*msg);
1024 
1025  resultLen = msgLen + count + 1;
1026  result = (xmlChar *) xmlMallocAtomic(resultLen * sizeof(xmlChar));
1027  if (result == NULL) {
1028  /* Clear *msg to prevent format string vulnerabilities in
1029  out-of-memory situations. */
1030  xmlFree(*msg);
1031  *msg = NULL;
1033  return(NULL);
1034  }
1035 
1036  for (msgPtr = *msg, resultPtr = result; *msgPtr != '\0'; ++msgPtr, ++resultPtr) {
1037  *resultPtr = *msgPtr;
1038  if (*msgPtr == '%')
1039  *(++resultPtr) = '%';
1040  }
1041  result[resultLen - 1] = '\0';
1042 
1043  xmlFree(*msg);
1044  *msg = result;
1045 
1046  return *msg;
1047 }
XMLPUBVAR xmlMallocFunc xmlMallocAtomic
Definition: globals.h:248
GLuint64EXT * result
Definition: glext.h:11304
GLuint GLuint GLsizei count
Definition: gl.h:1545
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
unsigned char xmlChar
Definition: xmlstring.h:28
#define NULL
Definition: types.h:112
#define msg(x)
Definition: auth_time.c:54

◆ xmlGetUTF8Char()

int xmlGetUTF8Char ( const unsigned char utf,
int len 
)

xmlGetUTF8Char: @utf: a sequence of UTF-8 encoded bytes @len: a pointer to the minimum number of bytes present in the sequence. This is used to assure the next character is completely contained within the sequence.

Read the first UTF8 character from @utf

Returns the char value or -1 in case of error, and sets *len to the actual number of bytes consumed (0 in case of error)

Definition at line 713 of file xmlstring.c.

713  {
714  unsigned int c;
715 
716  if (utf == NULL)
717  goto error;
718  if (len == NULL)
719  goto error;
720  if (*len < 1)
721  goto error;
722 
723  c = utf[0];
724  if (c & 0x80) {
725  if (*len < 2)
726  goto error;
727  if ((utf[1] & 0xc0) != 0x80)
728  goto error;
729  if ((c & 0xe0) == 0xe0) {
730  if (*len < 3)
731  goto error;
732  if ((utf[2] & 0xc0) != 0x80)
733  goto error;
734  if ((c & 0xf0) == 0xf0) {
735  if (*len < 4)
736  goto error;
737  if ((c & 0xf8) != 0xf0 || (utf[3] & 0xc0) != 0x80)
738  goto error;
739  *len = 4;
740  /* 4-byte code */
741  c = (utf[0] & 0x7) << 18;
742  c |= (utf[1] & 0x3f) << 12;
743  c |= (utf[2] & 0x3f) << 6;
744  c |= utf[3] & 0x3f;
745  } else {
746  /* 3-byte code */
747  *len = 3;
748  c = (utf[0] & 0xf) << 12;
749  c |= (utf[1] & 0x3f) << 6;
750  c |= utf[2] & 0x3f;
751  }
752  } else {
753  /* 2-byte code */
754  *len = 2;
755  c = (utf[0] & 0x1f) << 6;
756  c |= utf[1] & 0x3f;
757  }
758  } else {
759  /* 1-byte code */
760  *len = 1;
761  }
762  return(c);
763 
764 error:
765  if (len != NULL)
766  *len = 0;
767  return(-1);
768 }
#define error(str)
Definition: mkdosfs.c:1605
const GLubyte * c
Definition: glext.h:8905
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112
#define c
Definition: ke_i.h:80

Referenced by xmlCharEncOutFunc().

◆ xmlStrcasecmp()

int xmlStrcasecmp ( const xmlChar str1,
const xmlChar str2 
)

xmlStrcasecmp: @str1: the first xmlChar * @str2: the second xmlChar *

a strcasecmp for xmlChar's

Returns the integer result of the comparison

Definition at line 274 of file xmlstring.c.

274  {
275  register int tmp;
276 
277  if (str1 == str2) return(0);
278  if (str1 == NULL) return(-1);
279  if (str2 == NULL) return(1);
280  do {
281  tmp = casemap[*str1++] - casemap[*str2];
282  if (tmp != 0) return(tmp);
283  } while (*str2++ != 0);
284  return 0;
285 }
static const xmlChar casemap[256]
Definition: xmlstring.c:228
#define NULL
Definition: types.h:112

Referenced by xmlParseEncodingDecl(), xsltApplyStylesheetInternal(), xsltDocumentElem(), xsltGetHTMLIDs(), and xsltParseStylesheetPI().

◆ xmlStrcasestr()

const xmlChar* xmlStrcasestr ( const xmlChar str,
const xmlChar val 
)

xmlStrcasestr: @str: the xmlChar * array (haystack) @val: the xmlChar to search (needle)

a case-ignoring strstr for xmlChar's

Returns the xmlChar * for the first occurrence or NULL.

Definition at line 372 of file xmlstring.c.

372  {
373  int n;
374 
375  if (str == NULL) return(NULL);
376  if (val == NULL) return(NULL);
377  n = xmlStrlen(val);
378 
379  if (n == 0) return(str);
380  while (*str != 0) { /* non input consuming */
381  if (casemap[*str] == casemap[*val])
382  if (!xmlStrncasecmp(str, val, n)) return(str);
383  str++;
384  }
385  return(NULL);
386 }
int xmlStrncasecmp(const xmlChar *str1, const xmlChar *str2, int len)
Definition: xmlstring.c:299
GLdouble n
Definition: glext.h:7729
static const xmlChar casemap[256]
Definition: xmlstring.c:228
const WCHAR * str
GLuint GLfloat * val
Definition: glext.h:7180
int xmlStrlen(const xmlChar *str)
Definition: xmlstring.c:425
#define NULL
Definition: types.h:112

◆ xmlStrcat()

xmlChar* xmlStrcat ( xmlChar cur,
const xmlChar add 
)

xmlStrcat: @cur: the original xmlChar * array @add: the xmlChar * array added

a strcat for array of xmlChar's. Since they are supposed to be encoded in UTF-8 or an encoding with 8bit based chars, we assume a termination mark of '0'.

Returns a new xmlChar * containing the concatenated string. The original @cur is reallocated and should not be freed.

Definition at line 529 of file xmlstring.c.

529  {
530  const xmlChar *p = add;
531 
532  if (add == NULL) return(cur);
533  if (cur == NULL)
534  return(xmlStrdup(add));
535 
536  while (*p != 0) p++; /* non input consuming */
537  return(xmlStrncat(cur, add, p - add));
538 }
xmlChar * xmlStrncat(xmlChar *cur, const xmlChar *add, int len)
Definition: xmlstring.c:451
unsigned char xmlChar
Definition: xmlstring.h:28
FxCollectionEntry * cur
#define NULL
Definition: types.h:112
GLfloat GLfloat p
Definition: glext.h:8902
xmlChar * xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66

Referenced by xmllintExternalEntityLoader(), xmlURIEscape(), xsltAddKey(), xsltAttrTemplateValueProcessNode(), xsltEvalAVT(), xsltFormatNumberConversion(), and xsltReverseCompMatch().

◆ xmlStrchr()

const xmlChar* xmlStrchr ( const xmlChar str,
xmlChar  val 
)

xmlStrchr: @str: the xmlChar * array @val: the xmlChar to search

a strchr for xmlChar's

Returns the xmlChar * for the first occurrence or NULL.

Definition at line 324 of file xmlstring.c.

324  {
325  if (str == NULL) return(NULL);
326  while (*str != 0) { /* non input consuming */
327  if (*str == val) return((xmlChar *) str);
328  str++;
329  }
330  return(NULL);
331 }
const WCHAR * str
GLuint GLfloat * val
Definition: glext.h:7180
unsigned char xmlChar
Definition: xmlstring.h:28
#define NULL
Definition: types.h:112

Referenced by xmlBufWriteQuotedString(), xmlParseAttValueComplex(), xmlParseEntityDecl(), xmlParseEntityRef(), xmlParseNotationDecl(), xmlParsePITarget(), xmlParseReference(), xmlParserEntityCheck(), xmlParseStringEntityRef(), xmlURIEscapeStr(), xsltCompileAttr(), and xsltEvalStaticAttrValueTemplate().

◆ xmlStrcmp()

int xmlStrcmp ( const xmlChar str1,
const xmlChar str2 
)

xmlStrcmp: @str1: the first xmlChar * @str2: the second xmlChar *

a strcmp for xmlChar's

Returns the integer result of the comparison

Definition at line 132 of file xmlstring.c.

132  {
133  if (str1 == str2) return(0);
134  if (str1 == NULL) return(-1);
135  if (str2 == NULL) return(1);
136 #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
137  return(strcmp((const char *)str1, (const char *)str2));
138 #else
139  do {
140  int tmp = *str1++ - *str2;
141  if (tmp != 0) return(tmp);
142  } while (*str2++ != 0);
143  return 0;
144 #endif
145 }
#define NULL
Definition: types.h:112
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by xmlBuildRelativeURI(), xmlCreateEntityParserCtxtInternal(), xsltDefaultSortFunction(), and xsltLocaleStrcmp().

◆ xmlStrdup()

xmlChar* xmlStrdup ( const xmlChar cur)

xmlStrdup: @cur: the input xmlChar *

a strdup for array of xmlChar's. Since they are supposed to be encoded in UTF-8 or an encoding with 8bit based chars, we assume a termination mark of '0'.

Returns a new xmlChar * or NULL

Definition at line 66 of file xmlstring.c.

66  {
67  const xmlChar *p = cur;
68 
69  if (cur == NULL) return(NULL);
70  while (*p != 0) p++; /* non input consuming */
71  return(xmlStrndup(cur, p - cur));
72 }
xmlChar * xmlStrndup(const xmlChar *cur, int len)
Definition: xmlstring.c:41
unsigned char xmlChar
Definition: xmlstring.h:28
FxCollectionEntry * cur
#define NULL
Definition: types.h:112
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by xmlAddAttributeDecl(), xmlAddElementDecl(), xmlAddID(), xmlAddNotationDecl(), xmlAddRef(), xmlBuildRelativeURI(), xmlBuildURI(), xmlCanonicPath(), xmlCopyDocElementContent(), xmlCreateEnumeration(), xmlCtxtResetPush(), xmlCtxtUseOptionsInternal(), xmlDoRead(), xmlGetDtdElementDesc2(), xmlHashAddEntry3(), xmlHashUpdateEntry3(), xmlInitializeGlobalState(), xmllintExternalEntityLoader(), xmlNewDocElementContent(), xmlNewEntityInputStream(), xmlNewInputFromFile(), xmlParseExternalEntityPrivate(), xmlParseInNodeContext(), xmlPathToURI(), xmlSAX2AttributeNs(), xmlSAX2EndDocument(), xmlSAX2StartDocument(), xmlSAX2StartElementNs(), xmlSAX2Text(), xmlSplitQName(), xmlStrcat(), xmlStrncatNew(), xmlSwitchEncoding(), xmlURIEscapeStr(), xsltAddKey(), xsltApplyStylesheetInternal(), xsltAttribute(), xsltAttrListTemplateProcess(), xsltAttrTemplateProcess(), xsltCheckWrite(), xsltCompileStepPattern(), xsltCopyText(), xsltDocumentElem(), xsltElement(), xsltElementAvailableFunction(), xsltFormatNumberConversion(), xsltFunctionAvailableFunction(), xsltGetNsProp(), xsltGetQNameURI(), xsltKeyFunction(), xsltNewDecimalFormat(), xsltNewExtDef(), xsltNewKeyDef(), xsltNewKeyTable(), xsltParseStylesheetKey(), xsltParseStylesheetOutput(), xsltParseStylesheetProcess(), xsltParseStylesheetTemplate(), xsltReverseCompMatch(), and xsltSystemPropertyFunction().

◆ xmlStrEqual()

int xmlStrEqual ( const xmlChar str1,
const xmlChar str2 
)

xmlStrEqual: @str1: the first xmlChar * @str2: the second xmlChar *

Check if both strings are equal of have same content. Should be a bit more readable and faster than xmlStrcmp()

Returns 1 if they are equal, 0 if they are different

Definition at line 159 of file xmlstring.c.

159  {
160  if (str1 == str2) return(1);
161  if (str1 == NULL) return(0);
162  if (str2 == NULL) return(0);
163 #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
164  return(strcmp((const char *)str1, (const char *)str2) == 0);
165 #else
166  do {
167  if (*str1++ != *str2) return(0);
168  } while (*str2++);
169  return(1);
170 #endif
171 }
#define NULL
Definition: types.h:112
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by exclPrefixPush(), xmlAddAttributeDecl(), xmlBuildRelativeURI(), xmlHashAddEntry3(), xmlHashLookup3(), xmlHashRemoveEntry3(), xmlHashScanFull3(), xmlHashUpdateEntry3(), xmlIsID(), xmlIsXHTML(), xmlParseAttribute2(), xmlParseDocument(), xmlParseEntityDecl(), xmlParseEnumerationType(), xmlParseExternalEntityPrivate(), xmlParseNotationType(), xmlParsePI(), xmlParsePITarget(), xmlParseStartTag2(), xmlParseXMLDecl(), xmlSaveUri(), xmlSAX2AttributeDecl(), xmlSAX2StartElementNs(), xmlStrQEqual(), xsltApplyFallbacks(), xsltApplySequenceConstructor(), xsltApplyStylesheetInternal(), xsltApplyTemplates(), xsltApplyXSLTTemplate(), xsltAttribute(), xsltAttributeComp(), xsltAttrListTemplateProcess(), xsltAttrTemplateProcess(), xsltCheckExtPrefix(), xsltCheckExtURI(), xsltCheckInstructionElement(), xsltCheckParentElement(), xsltCheckRead(), xsltCheckTopLevelElement(), xsltCheckWrite(), xsltCompileIdKeyPattern(), xsltCompileStepPattern(), xsltCopyNamespaceList(), xsltCopyNamespaceListInternal(), xsltCopyTree(), xsltDecimalFormatGetByName(), xsltDecimalFormatGetByQName(), xsltDefaultSortFunction(), xsltDocumentComp(), xsltDocumentElem(), xsltDocumentFunction(), xsltDocumentFunctionLoadDocument(), xsltElement(), xsltFindElemSpaceHandling(), xsltGatherNamespaces(), xsltGetCNsProp(), xsltGetInheritedNsList(), xsltGetKey(), xsltGetNsProp(), xsltGetSpecialNamespace(), xsltInitAllDocKeys(), xsltInitCtxtKey(), xsltInitDocKeyTable(), xsltLoadDocument(), xsltLoadStyleDocument(), xsltLoadStylesheetPI(), xsltMessage(), xsltNamespaceAlias(), xsltNumberComp(), xsltNumberFormat(), xsltParseStylesheetExcludePrefix(), xsltParseStylesheetExtPrefix(), xsltParseStylesheetImport(), xsltParseStylesheetInclude(), xsltParseStylesheetOutput(), xsltParseStylesheetPreserveSpace(), xsltParseStylesheetProcess(), xsltParseStylesheetStripSpace(), xsltParseStylesheetTop(), xsltParseTemplateContent(), xsltPreprocessStylesheet(), xsltProcessUserParamInternal(), xsltRegisterExtPrefix(), xsltRegisterGlobalVariable(), xsltSaveResultTo(), xsltSaveResultToFd(), xsltSaveResultToFile(), xsltSaveResultToFilename(), xsltSaveResultToString(), xsltShallowCopyNsNode(), xsltSortComp(), xsltStylePreCompute(), xsltSystemPropertyFunction(), xsltTestCompMatch(), xsltTestCompMatchCount(), xsltTestPredicateMatch(), xsltTextComp(), and xsltValueOfComp().

◆ xmlStrlen()

int xmlStrlen ( const xmlChar str)

xmlStrlen: @str: the xmlChar * array

length of a xmlChar's string

Returns the number of xmlChar contained in the ARRAY.

Definition at line 425 of file xmlstring.c.

425  {
426  int len = 0;
427 
428  if (str == NULL) return(0);
429  while (*str != 0) { /* non input consuming */
430  str++;
431  len++;
432  }
433  return(len);
434 }
const WCHAR * str
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112

Referenced by xmlAddDefAttrs(), xmlBufAdd(), xmlBufAddHead(), xmlBuildRelativeURI(), xmlCanonicPath(), xmlCreateDocParserCtxt(), xmlNewEntityInputStream(), xmlNewStringInputStream(), xmlParseAttValueComplex(), xmlParseBalancedChunkMemoryInternal(), xmlParseReference(), xmlParseStartTag2(), xmlReportError(), xmlSAX2Text(), xmlSnprintfElementContent(), xmlStrcasestr(), xmlStringDecodeEntities(), xmlStringLenDecodeEntities(), xmlStrncat(), xmlStrncatNew(), xmlStrstr(), xmlURIEscapeStr(), xsltAddTextString(), xsltComment(), xsltCopyText(), xsltCopyTextString(), xsltFormatNumberConversion(), xsltMessage(), and xsltNumberComp().

◆ xmlStrncasecmp()

int xmlStrncasecmp ( const xmlChar str1,
const xmlChar str2,
int  len 
)

xmlStrncasecmp: @str1: the first xmlChar * @str2: the second xmlChar * @len: the max comparison length

a strncasecmp for xmlChar's

Returns the integer result of the comparison

Definition at line 299 of file xmlstring.c.

299  {
300  register int tmp;
301 
302  if (len <= 0) return(0);
303  if (str1 == str2) return(0);
304  if (str1 == NULL) return(-1);
305  if (str2 == NULL) return(1);
306  do {
307  tmp = casemap[*str1++] - casemap[*str2];
308  if (tmp != 0 || --len == 0) return(tmp);
309  } while (*str2++ != 0);
310  return 0;
311 }
static const xmlChar casemap[256]
Definition: xmlstring.c:228
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112

Referenced by xmlStrcasestr(), and xsltElementComp().

◆ xmlStrncat()

xmlChar* xmlStrncat ( xmlChar cur,
const xmlChar add,
int  len 
)

xmlStrncat: @cur: the original xmlChar * array @add: the xmlChar * array added @len: the length of @add

a strncat for array of xmlChar's, it will extend @cur with the len first bytes of @add. Note that if @len < 0 then this is an API error and NULL will be returned.

Returns a new xmlChar *, the original @cur is reallocated and should not be freed.

Definition at line 451 of file xmlstring.c.

451  {
452  int size;
453  xmlChar *ret;
454 
455  if ((add == NULL) || (len == 0))
456  return(cur);
457  if (len < 0)
458  return(NULL);
459  if (cur == NULL)
460  return(xmlStrndup(add, len));
461 
462  size = xmlStrlen(cur);
463  if (size < 0)
464  return(NULL);
465  ret = (xmlChar *) xmlRealloc(cur, (size + len + 1) * sizeof(xmlChar));
466  if (ret == NULL) {
468  return(cur);
469  }
470  memcpy(&ret[size], add, len * sizeof(xmlChar));
471  ret[size + len] = 0;
472  return(ret);
473 }
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
GLsizeiptr size
Definition: glext.h:5919
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
xmlChar * xmlStrndup(const xmlChar *cur, int len)
Definition: xmlstring.c:41
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
FxCollectionEntry * cur
int xmlStrlen(const xmlChar *str)
Definition: xmlstring.c:425
#define NULL
Definition: types.h:112

Referenced by xmlStrcat(), xsltAddKey(), xsltAttrTemplateValueProcessNode(), and xsltCompileAttr().

◆ xmlStrncatNew()

xmlChar* xmlStrncatNew ( const xmlChar str1,
const xmlChar str2,
int  len 
)

xmlStrncatNew: @str1: first xmlChar string @str2: second xmlChar string @len: the len of @str2 or < 0

same as xmlStrncat, but creates a new string. The original two strings are not freed. If @len is < 0 then the length will be calculated automatically.

Returns a new xmlChar * or NULL

Definition at line 488 of file xmlstring.c.

488  {
489  int size;
490  xmlChar *ret;
491 
492  if (len < 0) {
493  len = xmlStrlen(str2);
494  if (len < 0)
495  return(NULL);
496  }
497  if ((str2 == NULL) || (len == 0))
498  return(xmlStrdup(str1));
499  if (str1 == NULL)
500  return(xmlStrndup(str2, len));
501 
502  size = xmlStrlen(str1);
503  if (size < 0)
504  return(NULL);
505  ret = (xmlChar *) xmlMalloc((size + len + 1) * sizeof(xmlChar));
506  if (ret == NULL) {
508  return(xmlStrndup(str1, size));
509  }
510  memcpy(ret, str1, size * sizeof(xmlChar));
511  memcpy(&ret[size], str2, len * sizeof(xmlChar));
512  ret[size + len] = 0;
513  return(ret);
514 }
GLsizeiptr size
Definition: glext.h:5919
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
xmlChar * xmlStrndup(const xmlChar *cur, int len)
Definition: xmlstring.c:41
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
int xmlStrlen(const xmlChar *str)
Definition: xmlstring.c:425
#define NULL
Definition: types.h:112
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
xmlChar * xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66

◆ xmlStrncmp()

int xmlStrncmp ( const xmlChar str1,
const xmlChar str2,
int  len 
)

xmlStrncmp: @str1: the first xmlChar * @str2: the second xmlChar * @len: the max comparison length

a strncmp for xmlChar's

Returns the integer result of the comparison

Definition at line 212 of file xmlstring.c.

212  {
213  if (len <= 0) return(0);
214  if (str1 == str2) return(0);
215  if (str1 == NULL) return(-1);
216  if (str2 == NULL) return(1);
217 #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
218  return(strncmp((const char *)str1, (const char *)str2, len));
219 #else
220  do {
221  int tmp = *str1++ - *str2;
222  if (tmp != 0 || --len == 0) return(tmp);
223  } while (*str2++ != 0);
224  return 0;
225 #endif
226 }
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112

Referenced by xmlDictExists(), xmlDictLookup(), xmlStrstr(), xmlUTF8Charcmp(), xmlUTF8Strloc(), xsltFormatNumberConversion(), and xsltUTF8Charcmp().

◆ xmlStrndup()

xmlChar* xmlStrndup ( const xmlChar cur,
int  len 
)

xmlStrndup: @cur: the input xmlChar * @len: the len of @cur

a strndup for array of xmlChar's

Returns a new xmlChar * or NULL

Definition at line 41 of file xmlstring.c.

41  {
42  xmlChar *ret;
43 
44  if ((cur == NULL) || (len < 0)) return(NULL);
45  ret = (xmlChar *) xmlMallocAtomic((len + 1) * sizeof(xmlChar));
46  if (ret == NULL) {
48  return(NULL);
49  }
50  memcpy(ret, cur, len * sizeof(xmlChar));
51  ret[len] = 0;
52  return(ret);
53 }
XMLPUBVAR xmlMallocFunc xmlMallocAtomic
Definition: globals.h:248
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
FxCollectionEntry * cur
#define NULL
Definition: types.h:112

Referenced by parsePath(), xmlAttrNormalizeSpace2(), xmlNewDocElementContent(), xmlParseAttribute2(), xmlParseAttValueInternal(), xmlParseNmtoken(), xmlParseStringName(), xmlSAX2AttributeNs(), xmlSAX2TextNode(), xmlSplitQName(), xmlStrdup(), xmlStrncat(), xmlStrncatNew(), xmlStrsub(), xsltAttrTemplateValueProcessNode(), xsltCompileAttr(), xsltCompilePatternInternal(), xsltCompileStepPattern(), xsltDocumentElem(), xsltGetQNameURI2(), xsltNumberFormatTokenize(), xsltParseStylesheetExcludePrefix(), xsltParseStylesheetExtPrefix(), xsltParseStylesheetOutput(), xsltParseStylesheetPI(), xsltParseStylesheetPreserveSpace(), xsltParseStylesheetStripSpace(), xsltSaveResultToString(), xsltScanLiteral(), and xsltScanNCName().

◆ xmlStrPrintf()

int XMLCDECL xmlStrPrintf ( xmlChar buf,
int  len,
const char msg,
  ... 
)

xmlStrPrintf: @buf: the result buffer. @len: the result buffer length. @msg: the message with printf formatting. ...: extra parameters for the message.

Formats @msg and places result into @buf.

Returns the number of characters written to @buf or -1 if an error occurs.

Definition at line 552 of file xmlstring.c.

552  {
553  va_list args;
554  int ret;
555 
556  if((buf == NULL) || (msg == NULL)) {
557  return(-1);
558  }
559 
560  va_start(args, msg);
561  ret = vsnprintf((char *) buf, len, (const char *) msg, args);
562  va_end(args);
563  buf[len - 1] = 0; /* be safe ! */
564 
565  return(ret);
566 }
#define vsnprintf
Definition: tif_win32.c:406
#define args
Definition: format.c:66
Definition: match.c:390
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
va_start(ap, x)
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112
#define msg(x)
Definition: auth_time.c:54

◆ xmlStrQEqual()

int xmlStrQEqual ( const xmlChar pref,
const xmlChar name,
const xmlChar str 
)

Definition at line 185 of file xmlstring.c.

185  {
186  if (pref == NULL) return(xmlStrEqual(name, str));
187  if (name == NULL) return(0);
188  if (str == NULL) return(0);
189 
190  do {
191  if (*pref++ != *str) return(0);
192  } while ((*str++) && (*pref));
193  if (*str++ != ':') return(0);
194  do {
195  if (*name++ != *str) return(0);
196  } while (*str++);
197  return(1);
198 }
int xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:159
const WCHAR * str
#define NULL
Definition: types.h:112
Definition: name.c:38

Referenced by xmlDictQLookup(), and xmlHashQLookup3().

◆ xmlStrstr()

const xmlChar* xmlStrstr ( const xmlChar str,
const xmlChar val 
)

xmlStrstr: @str: the xmlChar * array (haystack) @val: the xmlChar to search (needle)

a strstr for xmlChar's

Returns the xmlChar * for the first occurrence or NULL.

Definition at line 344 of file xmlstring.c.

344  {
345  int n;
346 
347  if (str == NULL) return(NULL);
348  if (val == NULL) return(NULL);
349  n = xmlStrlen(val);
350 
351  if (n == 0) return(str);
352  while (*str != 0) { /* non input consuming */
353  if (*str == *val) {
354  if (!xmlStrncmp(str, val, n)) return((const xmlChar *) str);
355  }
356  str++;
357  }
358  return(NULL);
359 }
GLdouble n
Definition: glext.h:7729
const WCHAR * str
GLuint GLfloat * val
Definition: glext.h:7180
unsigned char xmlChar
Definition: xmlstring.h:28
int xmlStrlen(const xmlChar *str)
Definition: xmlstring.c:425
#define NULL
Definition: types.h:112
int xmlStrncmp(const xmlChar *str1, const xmlChar *str2, int len)
Definition: xmlstring.c:212

Referenced by xmlCanonicPath(), xsltComment(), xsltProcessingInstruction(), and xsltSystemPropertyFunction().

◆ xmlStrsub()

xmlChar* xmlStrsub ( const xmlChar str,
int  start,
int  len 
)

xmlStrsub: @str: the xmlChar * array (haystack) @start: the index of the first char (zero based) @len: the length of the substring

Extract a substring of a given string

Returns the xmlChar * for the first occurrence or NULL.

Definition at line 400 of file xmlstring.c.

400  {
401  int i;
402 
403  if (str == NULL) return(NULL);
404  if (start < 0) return(NULL);
405  if (len < 0) return(NULL);
406 
407  for (i = 0;i < start;i++) {
408  if (*str == 0) return(NULL);
409  str++;
410  }
411  if (*str == 0) return(NULL);
412  return(xmlStrndup(str, len));
413 }
const WCHAR * str
xmlChar * xmlStrndup(const xmlChar *cur, int len)
Definition: xmlstring.c:41
GLenum GLsizei len
Definition: glext.h:6722
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
GLuint start
Definition: gl.h:1545
#define NULL
Definition: types.h:112

◆ xmlStrVPrintf()

int xmlStrVPrintf ( xmlChar buf,
int  len,
const char msg,
va_list  ap 
)

xmlStrVPrintf: @buf: the result buffer. @len: the result buffer length. @msg: the message with printf formatting. @ap: extra parameters for the message.

Formats @msg and places result into @buf.

Returns the number of characters written to @buf or -1 if an error occurs.

Definition at line 580 of file xmlstring.c.

580  {
581  int ret;
582 
583  if((buf == NULL) || (msg == NULL)) {
584  return(-1);
585  }
586 
587  ret = vsnprintf((char *) buf, len, (const char *) msg, ap);
588  buf[len - 1] = 0; /* be safe ! */
589 
590  return(ret);
591 }
#define vsnprintf
Definition: tif_win32.c:406
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112
#define msg(x)
Definition: auth_time.c:54
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32

◆ xmlUTF8Charcmp()

int xmlUTF8Charcmp ( const xmlChar utf1,
const xmlChar utf2 
)

xmlUTF8Charcmp: @utf1: pointer to first UTF8 char @utf2: pointer to second UTF8 char

compares the two UCS4 values

returns result of the compare as with xmlStrncmp

Definition at line 649 of file xmlstring.c.

649  {
650 
651  if (utf1 == NULL ) {
652  if (utf2 == NULL)
653  return 0;
654  return -1;
655  }
656  return xmlStrncmp(utf1, utf2, xmlUTF8Size(utf1));
657 }
int xmlUTF8Size(const xmlChar *utf)
Definition: xmlstring.c:618
#define NULL
Definition: types.h:112
int xmlStrncmp(const xmlChar *str1, const xmlChar *str2, int len)
Definition: xmlstring.c:212

◆ xmlUTF8Size()

int xmlUTF8Size ( const xmlChar utf)

xmlUTF8Size: @utf: pointer to the UTF8 character

calculates the internal size of a UTF8 character

returns the numbers of bytes in the character, -1 on format error

Definition at line 618 of file xmlstring.c.

618  {
619  xmlChar mask;
620  int len;
621 
622  if (utf == NULL)
623  return -1;
624  if (*utf < 0x80)
625  return 1;
626  /* check valid UTF8 character */
627  if (!(*utf & 0x40))
628  return -1;
629  /* determine number of bytes in char */
630  len = 2;
631  for (mask=0x20; mask != 0; mask>>=1) {
632  if (!(*utf & mask))
633  return len;
634  len++;
635  }
636  return -1;
637 }
GLenum GLint GLuint mask
Definition: glext.h:6028
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112

Referenced by xmlUTF8Charcmp().

◆ xmlUTF8Strlen()

int xmlUTF8Strlen ( const xmlChar utf)

xmlUTF8Strlen: @utf: a sequence of UTF-8 encoded bytes

compute the length of an UTF8 string, it doesn't do a full UTF8 checking of the content of the string.

Returns the number of characters in the string or -1 in case of error

Definition at line 669 of file xmlstring.c.

669  {
670  int ret = 0;
671 
672  if (utf == NULL)
673  return(-1);
674 
675  while (*utf != 0) {
676  if (utf[0] & 0x80) {
677  if ((utf[1] & 0xc0) != 0x80)
678  return(-1);
679  if ((utf[0] & 0xe0) == 0xe0) {
680  if ((utf[2] & 0xc0) != 0x80)
681  return(-1);
682  if ((utf[0] & 0xf0) == 0xf0) {
683  if ((utf[0] & 0xf8) != 0xf0 || (utf[3] & 0xc0) != 0x80)
684  return(-1);
685  utf += 4;
686  } else {
687  utf += 3;
688  }
689  } else {
690  utf += 2;
691  }
692  } else {
693  utf++;
694  }
695  ret++;
696  }
697  return(ret);
698 }
int ret
#define NULL
Definition: types.h:112

◆ xmlUTF8Strloc()

int xmlUTF8Strloc ( const xmlChar utf,
const xmlChar utfchar 
)

xmlUTF8Strloc: @utf: the input UTF8 * @utfchar: the UTF8 character to be found

a function to provide the relative location of a UTF8 char

Returns the relative character position of the desired char or -1 if not found

Definition at line 930 of file xmlstring.c.

930  {
931  int i, size;
932  xmlChar ch;
933 
934  if (utf==NULL || utfchar==NULL) return -1;
935  size = xmlUTF8Strsize(utfchar, 1);
936  for(i=0; (ch=*utf) != 0; i++) {
937  if (xmlStrncmp(utf, utfchar, size)==0)
938  return(i);
939  utf++;
940  if ( ch & 0x80 ) {
941  /* if not simple ascii, verify proper format */
942  if ( (ch & 0xc0) != 0xc0 )
943  return(-1);
944  /* then skip over remaining bytes for this char */
945  while ( (ch <<= 1) & 0x80 )
946  if ( (*utf++ & 0xc0) != 0x80 )
947  return(-1);
948  }
949  }
950 
951  return(-1);
952 }
int xmlUTF8Strsize(const xmlChar *utf, int len)
Definition: xmlstring.c:836
GLsizeiptr size
Definition: glext.h:5919
unsigned char xmlChar
Definition: xmlstring.h:28
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 NULL
Definition: types.h:112
int xmlStrncmp(const xmlChar *str1, const xmlChar *str2, int len)
Definition: xmlstring.c:212

Referenced by xsltFormatNumberConversion().

◆ xmlUTF8Strndup()

xmlChar* xmlUTF8Strndup ( const xmlChar utf,
int  len 
)

xmlUTF8Strndup: @utf: the input UTF8 * @len: the len of @utf (in chars)

a strndup for array of UTF8's

Returns a new UTF8 * or NULL

Definition at line 869 of file xmlstring.c.

869  {
870  xmlChar *ret;
871  int i;
872 
873  if ((utf == NULL) || (len < 0)) return(NULL);
874  i = xmlUTF8Strsize(utf, len);
875  ret = (xmlChar *) xmlMallocAtomic((i + 1) * sizeof(xmlChar));
876  if (ret == NULL) {
878  "malloc of %ld byte failed\n",
879  (len + 1) * (long)sizeof(xmlChar));
880  return(NULL);
881  }
882  memcpy(ret, utf, i * sizeof(xmlChar));
883  ret[i] = 0;
884  return(ret);
885 }
XMLPUBVAR xmlMallocFunc xmlMallocAtomic
Definition: globals.h:248
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
int xmlUTF8Strsize(const xmlChar *utf, int len)
Definition: xmlstring.c:836
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
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 NULL
Definition: types.h:112
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlUTF8Strsub().

◆ xmlUTF8Strpos()

const xmlChar* xmlUTF8Strpos ( const xmlChar utf,
int  pos 
)

xmlUTF8Strpos: @utf: the input UTF8 * @pos: the position of the desired UTF8 char (in chars)

a function to provide the equivalent of fetching a character from a string array

Returns a pointer to the UTF8 character or NULL

Definition at line 898 of file xmlstring.c.

898  {
899  xmlChar ch;
900 
901  if (utf == NULL) return(NULL);
902  if (pos < 0)
903  return(NULL);
904  while (pos--) {
905  if ((ch=*utf++) == 0) return(NULL);
906  if ( ch & 0x80 ) {
907  /* if not simple ascii, verify proper format */
908  if ( (ch & 0xc0) != 0xc0 )
909  return(NULL);
910  /* then skip over remaining bytes for this char */
911  while ( (ch <<= 1) & 0x80 )
912  if ( (*utf++ & 0xc0) != 0x80 )
913  return(NULL);
914  }
915  }
916  return((xmlChar *)utf);
917 }
unsigned char xmlChar
Definition: xmlstring.h:28
#define NULL
Definition: types.h:112

Referenced by xsltFormatNumberConversion().

◆ xmlUTF8Strsize()

int xmlUTF8Strsize ( const xmlChar utf,
int  len 
)

xmlUTF8Strsize: @utf: a sequence of UTF-8 encoded bytes @len: the number of characters in the array

storage size of an UTF8 string the behaviour is not guaranteed if the input string is not UTF-8

Returns the storage size of the first 'len' characters of ARRAY

Definition at line 836 of file xmlstring.c.

836  {
837  const xmlChar *ptr=utf;
838  xmlChar ch;
839 
840  if (utf == NULL)
841  return(0);
842 
843  if (len <= 0)
844  return(0);
845 
846  while ( len-- > 0) {
847  if ( !*ptr )
848  break;
849  if ( (ch = *ptr++) & 0x80)
850  while ((ch<<=1) & 0x80 ) {
851  if (*ptr == 0) break;
852  ptr++;
853  }
854  }
855  return (ptr - utf);
856 }
static PVOID ptr
Definition: dispmode.c:27
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112

Referenced by xmlUTF8Strloc(), xmlUTF8Strndup(), xsltFormatNumberConversion(), xsltFormatNumberPreSuffix(), and xsltUTF8Charcmp().

◆ xmlUTF8Strsub()

xmlChar* xmlUTF8Strsub ( const xmlChar utf,
int  start,
int  len 
)

xmlUTF8Strsub: @utf: a sequence of UTF-8 encoded bytes @start: relative pos of first char @len: total number to copy

Create a substring from a given UTF-8 string Note: positions are given in units of UTF-8 chars

Returns a pointer to a newly created string or NULL if any problem

Definition at line 967 of file xmlstring.c.

967  {
968  int i;
969  xmlChar ch;
970 
971  if (utf == NULL) return(NULL);
972  if (start < 0) return(NULL);
973  if (len < 0) return(NULL);
974 
975  /*
976  * Skip over any leading chars
977  */
978  for (i = 0;i < start;i++) {
979  if ((ch=*utf++) == 0) return(NULL);
980  if ( ch & 0x80 ) {
981  /* if not simple ascii, verify proper format */
982  if ( (ch & 0xc0) != 0xc0 )
983  return(NULL);
984  /* then skip over remaining bytes for this char */
985  while ( (ch <<= 1) & 0x80 )
986  if ( (*utf++ & 0xc0) != 0x80 )
987  return(NULL);
988  }
989  }
990 
991  return(xmlUTF8Strndup(utf, len));
992 }
xmlChar * xmlUTF8Strndup(const xmlChar *utf, int len)
Definition: xmlstring.c:869
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum GLsizei len
Definition: glext.h:6722
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
GLuint start
Definition: gl.h:1545
#define NULL
Definition: types.h:112

Variable Documentation

◆ casemap

const xmlChar casemap[256]
static

Definition at line 228 of file xmlstring.c.

Referenced by xmlStrcasecmp(), xmlStrcasestr(), and xmlStrncasecmp().