33 #define MAX_URI_LENGTH 1024 * 1024 43 "Memory allocation failed : %s\n",
extra);
49 "Memory allocation failed\n");
58 #define IS_ALPHA(x) (IS_LOWALPHA(x) || IS_UPALPHA(x)) 67 #define IS_LOWALPHA(x) (((x) >= 'a') && ((x) <= 'z')) 74 #define IS_UPALPHA(x) (((x) >= 'A') && ((x) <= 'Z')) 82 #define IS_DIGIT(x) (((x) >= '0') && ((x) <= '9')) 88 #define IS_ALPHANUM(x) (IS_ALPHA(x) || IS_DIGIT(x)) 94 #define IS_MARK(x) (((x) == '-') || ((x) == '_') || ((x) == '.') || \ 95 ((x) == '!') || ((x) == '~') || ((x) == '*') || ((x) == '\'') || \ 96 ((x) == '(') || ((x) == ')')) 102 #define IS_UNWISE(p) \ 103 (((*(p) == '{')) || ((*(p) == '}')) || ((*(p) == '|')) || \ 104 ((*(p) == '\\')) || ((*(p) == '^')) || ((*(p) == '[')) || \ 105 ((*(p) == ']')) || ((*(p) == '`'))) 111 #define IS_RESERVED(x) (((x) == ';') || ((x) == '/') || ((x) == '?') || \ 112 ((x) == ':') || ((x) == '@') || ((x) == '&') || ((x) == '=') || \ 113 ((x) == '+') || ((x) == '$') || ((x) == ',') || ((x) == '[') || \ 120 #define IS_UNRESERVED(x) (IS_ALPHANUM(x) || IS_MARK(x)) 126 #define NEXT(p) ((*p == '%')? p += 3 : p++) 138 #define STRNDUP(s, n) (char *) xmlStrndup((const xmlChar *)(s), (n)) 146 #define ISA_DIGIT(p) ((*(p) >= '0') && (*(p) <= '9')) 147 #define ISA_ALPHA(p) (((*(p) >= 'a') && (*(p) <= 'z')) || \ 148 ((*(p) >= 'A') && (*(p) <= 'Z'))) 149 #define ISA_HEXDIG(p) \ 150 (ISA_DIGIT(p) || ((*(p) >= 'a') && (*(p) <= 'f')) || \ 151 ((*(p) >= 'A') && (*(p) <= 'F'))) 157 #define ISA_SUB_DELIM(p) \ 158 (((*(p) == '!')) || ((*(p) == '$')) || ((*(p) == '&')) || \ 159 ((*(p) == '(')) || ((*(p) == ')')) || ((*(p) == '*')) || \ 160 ((*(p) == '+')) || ((*(p) == ',')) || ((*(p) == ';')) || \ 161 ((*(p) == '=')) || ((*(p) == '\''))) 166 #define ISA_GEN_DELIM(p) \ 167 (((*(p) == ':')) || ((*(p) == '/')) || ((*(p) == '?')) || \ 168 ((*(p) == '#')) || ((*(p) == '[')) || ((*(p) == ']')) || \ 174 #define ISA_RESERVED(p) (ISA_GEN_DELIM(p) || (ISA_SUB_DELIM(p))) 179 #define ISA_UNRESERVED(p) \ 180 ((ISA_ALPHA(p)) || (ISA_DIGIT(p)) || ((*(p) == '-')) || \ 181 ((*(p) == '.')) || ((*(p) == '_')) || ((*(p) == '~'))) 186 #define ISA_PCT_ENCODED(p) \ 187 ((*(p) == '%') && (ISA_HEXDIG(p + 1)) && (ISA_HEXDIG(p + 2))) 192 #define ISA_PCHAR(p) \ 193 (ISA_UNRESERVED(p) || ISA_PCT_ENCODED(p) || ISA_SUB_DELIM(p) || \ 194 ((*(p) == ':')) || ((*(p) == '@'))) 254 (*
cur ==
'[') || (*
cur ==
']') ||
260 if (
uri->cleanup & 2)
296 if (
uri->cleanup & 2)
370 if (
uri->cleanup & 2)
407 else if ((*
cur ==
'2') && (*(
cur + 1) >=
'0') &&
410 else if ((*
cur ==
'2') && (*(
cur + 1) ==
'5') &&
411 (*(
cur + 2) >=
'0') && (*(
cur + 1) <=
'5'))
445 while ((*
cur !=
']') && (*
cur != 0))
486 if (
uri->cleanup & 2)
520 if ((
ret != 0) || (*
cur !=
'@'))
525 if (
ret != 0)
return(
ret);
529 if (
ret != 0)
return(
ret);
588 while (*
cur ==
'/') {
591 if (
ret != 0)
return(
ret);
596 if (
uri->cleanup & 2)
633 while (*
cur ==
'/') {
636 if (
ret != 0)
return(
ret);
642 if (
uri->cleanup & 2)
675 if (
ret != 0)
return(
ret);
676 while (*
cur ==
'/') {
679 if (
ret != 0)
return(
ret);
684 if (
uri->cleanup & 2)
717 if (
ret != 0)
return(
ret);
718 while (*
cur ==
'/') {
721 if (
ret != 0)
return(
ret);
726 if (
uri->cleanup & 2)
761 if ((*
cur ==
'/') && (*(
cur + 1) ==
'/')) {
764 if (
ret != 0)
return(
ret);
768 if (
ret != 0)
return(
ret);
771 }
else if (*
cur ==
'/') {
773 if (
ret != 0)
return(
ret);
776 if (
ret != 0)
return(
ret);
808 if ((*
str ==
'/') && (*(
str + 1) ==
'/')) {
811 if (
ret != 0)
return(
ret);
813 if (
ret != 0)
return(
ret);
814 }
else if (*
str ==
'/') {
816 if (
ret != 0)
return(
ret);
819 if (
ret != 0)
return(
ret);
831 if (
ret != 0)
return(
ret);
836 if (
ret != 0)
return(
ret);
863 if (
ret != 0)
return(
ret);
869 if (
ret != 0)
return(
ret);
873 if (
ret != 0)
return(
ret);
878 if (
ret != 0)
return(
ret);
1106 int val = *(
unsigned char *)
p++;
1107 int hi =
val / 0x10, lo =
val % 0x10;
1109 ret[
len++] = hi + (hi > 9?
'A'-10 :
'0');
1110 ret[
len++] = lo + (lo > 9?
'A'-10 :
'0');
1114 if ((
uri->server !=
NULL) || (
uri->port == -1)) {
1131 ((*(
p) ==
';')) || ((*(
p) ==
':')) ||
1132 ((*(
p) ==
'&')) || ((*(
p) ==
'=')) ||
1133 ((*(
p) ==
'+')) || ((*(
p) ==
'$')) ||
1137 int val = *(
unsigned char *)
p++;
1138 int hi =
val / 0x10, lo =
val % 0x10;
1140 ret[
len++] = hi + (hi > 9?
'A'-10 :
'0');
1141 ret[
len++] = lo + (lo > 9?
'A'-10 :
'0');
1161 if (
uri->port > 0) {
1170 }
else if (
uri->authority !=
NULL) {
1186 ((*(
p) ==
'$')) || ((*(
p) ==
',')) || ((*(
p) ==
';')) ||
1187 ((*(
p) ==
':')) || ((*(
p) ==
'@')) || ((*(
p) ==
'&')) ||
1188 ((*(
p) ==
'=')) || ((*(
p) ==
'+')))
1191 int val = *(
unsigned char *)
p++;
1192 int hi =
val / 0x10, lo =
val % 0x10;
1194 ret[
len++] = hi + (hi > 9?
'A'-10 :
'0');
1195 ret[
len++] = lo + (lo > 9?
'A'-10 :
'0');
1198 }
else if (
uri->scheme !=
NULL) {
1213 (((
p[1] >=
'a') && (
p[1] <=
'z')) ||
1214 ((
p[1] >=
'A') && (
p[1] <=
'Z'))) &&
1233 ((*(
p) ==
';')) || ((*(
p) ==
'@')) || ((*(
p) ==
'&')) ||
1234 ((*(
p) ==
'=')) || ((*(
p) ==
'+')) || ((*(
p) ==
'$')) ||
1238 int val = *(
unsigned char *)
p++;
1239 int hi =
val / 0x10, lo =
val % 0x10;
1241 ret[
len++] = hi + (hi > 9?
'A'-10 :
'0');
1242 ret[
len++] = lo + (lo > 9?
'A'-10 :
'0');
1262 }
else if (
uri->query !=
NULL) {
1279 int val = *(
unsigned char *)
p++;
1280 int hi =
val / 0x10, lo =
val % 0x10;
1282 ret[
len++] = hi + (hi > 9?
'A'-10 :
'0');
1283 ret[
len++] = lo + (lo > 9?
'A'-10 :
'0');
1305 int val = *(
unsigned char *)
p++;
1306 int hi =
val / 0x10, lo =
val % 0x10;
1308 ret[
len++] = hi + (hi > 9?
'A'-10 :
'0');
1309 ret[
len++] = lo + (lo > 9?
'A'-10 :
'0');
1424 while (
cur[0] ==
'/')
1435 while (
cur[0] !=
'\0') {
1440 if ((
cur[0] ==
'.') && (
cur[1] ==
'/')) {
1443 while (
cur[0] ==
'/')
1452 if ((
cur[0] ==
'.') && (
cur[1] ==
'\0'))
1456 while (
cur[0] !=
'/') {
1462 while ((
cur[0] ==
'/') && (
cur[1] ==
'/'))
1472 while (
cur[0] ==
'/')
1504 while ((segp[0] !=
'/') && (segp[0] !=
'\0'))
1510 if (segp[0] ==
'\0')
1517 if (((
cur[0] ==
'.') && (
cur[1] ==
'.') && (segp ==
cur+3))
1518 || ((segp[0] !=
'.') || (segp[1] !=
'.')
1519 || ((segp[2] !=
'/') && (segp[2] !=
'\0')))) {
1532 if (segp[2] ==
'\0') {
1540 while ((*tmp++ = *segp++) != 0)
1545 while ((segp >
path) && ((--segp)[0] ==
'/'))
1574 if (
path[0] ==
'/') {
1576 while ((
cur[0] ==
'/') && (
cur[1] ==
'.') && (
cur[2] ==
'.')
1577 && ((
cur[3] ==
'/') || (
cur[3] ==
'\0')))
1582 while (
cur[0] !=
'\0')
1592 if (((
c >=
'0') && (
c <=
'9')) ||
1593 ((
c >=
'a') && (
c <=
'f')) ||
1594 ((
c >=
'A') && (
c <=
'F')))
1636 if ((*
in >=
'0') && (*
in <=
'9'))
1638 else if ((*
in >=
'a') && (*
in <=
'f'))
1639 *
out = (*
in -
'a') + 10;
1640 else if ((*
in >=
'A') && (*
in <=
'F'))
1641 *
out = (*
in -
'A') + 10;
1643 if ((*
in >=
'0') && (*
in <=
'9'))
1645 else if ((*
in >=
'a') && (*
in <=
'f'))
1646 *
out = *
out * 16 + (*
in -
'a') + 10;
1647 else if ((*
in >=
'A') && (*
in <=
'F'))
1648 *
out = *
out * 16 + (*
in -
'A') + 10;
1751 #define NULLCHK(p) if(!p) { \ 1752 xmlURIErrMemory("escaping URI value\n"); \ 1785 if (
uri->authority) {
1828 if (
uri->query_raw) {
1832 else if (
uri->query) {
1848 if (
uri->fragment) {
2042 if ((
ref->path !=
NULL) && (
ref->path[0] ==
'/')) {
2095 if (
ref->path !=
NULL &&
ref->path[0] != 0) {
2102 while (
ref->path[indx] != 0) {
2175 int remove_path = 0;
2177 if ((URI ==
NULL) || (*URI == 0))
2187 if (URI[0] !=
'.') {
2204 if (
base[0] !=
'.') {
2231 ref->path = (
char *)
"/";
2249 if ((*rptr ==
'.') && (rptr[1] ==
'/'))
2251 if ((*bptr ==
'.') && (bptr[1] ==
'/'))
2253 else if ((*bptr ==
'/') && (*rptr !=
'/'))
2255 while ((bptr[
pos] == rptr[
pos]) && (bptr[
pos] != 0))
2258 if (bptr[
pos] == rptr[
pos]) {
2268 for (; ix > 0; ix--) {
2269 if (rptr[ix - 1] ==
'/')
2277 for (; bptr[ix] != 0; ix++) {
2278 if (bptr[ix] ==
'/')
2285 if (nbslash == 0 && !uptr[0]) {
2314 for (; nbslash>0; nbslash--) {
2323 if ((vptr >
val) && (
len > 0) &&
2324 (uptr[0] ==
'/') && (vptr[-1] ==
'/')) {
2345 if (remove_path != 0)
2366 #define IS_WINDOWS_PATH(p) \ 2368 (((p[0] >= 'a') && (p[0] <= 'z')) || \ 2369 ((p[0] >= 'A') && (p[0] <= 'Z'))) && \ 2370 (p[1] == ':') && ((p[2] == '/') || (p[2] == '\\'))) 2378 #if defined(_WIN32) && !defined(__CYGWIN__) 2397 if ((
path[0] ==
'\\') && (
path[1] ==
'\\') && (
path[2] ==
'?') &&
2403 if ((
path[0] ==
'/') && (
path[1] ==
'/') && (
path[2] !=
'/'))
2413 if (absuri !=
NULL) {
2425 if ((
l <= 0) || (
l > 20))
2426 goto path_processing;
2428 for (
j = 0;
j <
l;
j++) {
2430 if (!(((
c >=
'a') && (
c <=
'z')) || ((
c >=
'A') && (
c <=
'Z'))))
2431 goto path_processing;
2436 if (escURI !=
NULL) {
2450 #if defined(_WIN32) && !defined(__CYGWIN__) 2482 while (*
p !=
'\0') {
2529 #if defined(_WIN32) && !defined(__CYGWIN__) 2541 while (*
ret !=
'\0') {
2548 temp.path = (
char *) cal;
static int xmlParse3986PathNoScheme(xmlURIPtr uri, const char **str)
xmlChar * xmlURIEscapeStr(const xmlChar *str, const xmlChar *list)
XMLPUBVAR xmlMallocFunc xmlMallocAtomic
xmlChar * xmlBuildURI(const xmlChar *URI, const xmlChar *base)
XMLPUBFUN const xmlChar *XMLCALL xmlStrstr(const xmlChar *str, const xmlChar *val)
static int xmlParse3986Authority(xmlURIPtr uri, const char **str)
static int xmlParse3986Fragment(xmlURIPtr uri, const char **str)
static int is_hex(char c)
ACPI_SIZE strlen(const char *String)
xmlChar * xmlSaveUri(xmlURIPtr uri)
GLsizei const GLchar ** path
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
XMLPUBFUN int XMLCALL xmlStrlen(const xmlChar *str)
xmlURIPtr xmlParseURIRaw(const char *str, int raw)
static int xmlParse3986DecOctet(const char **str)
XMLPUBFUN const xmlChar *XMLCALL xmlStrchr(const xmlChar *str, xmlChar val)
xmlChar * xmlCanonicPath(const xmlChar *path)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
XMLPUBFUN xmlChar *XMLCALL xmlStrcat(xmlChar *cur, const xmlChar *add)
#define IS_WINDOWS_PATH(p)
static void xmlCleanURI(xmlURIPtr uri)
static int xmlParse3986URI(xmlURIPtr uri, const char *str)
int xmlNormalizeURIPath(char *path)
XMLPUBVAR xmlReallocFunc xmlRealloc
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
static int xmlParse3986PathAbEmpty(xmlURIPtr uri, const char **str)
xmlURIPtr xmlCreateURI(void)
static int xmlParse3986Host(xmlURIPtr uri, const char **str)
XMLPUBVAR xmlFreeFunc xmlFree
static xmlChar * xmlSaveUriRealloc(xmlChar *ret, int *max)
static int xmlParse3986Scheme(xmlURIPtr uri, const char **str)
xmlChar * xmlBuildRelativeURI(const xmlChar *URI, const xmlChar *base)
static int xmlParse3986PathAbsolute(xmlURIPtr uri, const char **str)
#define memcpy(s1, s2, n)
int xmlParseURIReference(xmlURIPtr uri, const char *str)
#define ISA_PCT_ENCODED(p)
#define ISA_UNRESERVED(p)
XMLPUBVAR xmlStrdupFunc xmlMemStrdup
static int xmlParse3986Segment(const char **str, char forbid, int empty)
xmlURIPtr xmlParseURI(const char *str)
static int xmlParse3986PathRootless(xmlURIPtr uri, const char **str)
static int xmlParse3986RelativeRef(xmlURIPtr uri, const char *str)
xmlChar * xmlURIEscape(const xmlChar *str)
void xmlFreeURI(xmlURIPtr uri)
static int xmlParse3986Port(xmlURIPtr uri, const char **str)
static void xmlURIErrMemory(const char *extra)
XMLPUBVAR xmlMallocFunc xmlMalloc
static int xmlParse3986HierPart(xmlURIPtr uri, const char **str)
static int xmlParse3986Query(xmlURIPtr uri, const char **str)
static int xmlParse3986URIReference(xmlURIPtr uri, const char *str)
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
static int xmlParse3986Userinfo(xmlURIPtr uri, const char **str)
char * xmlURIUnescapeString(const char *str, int len, char *target)
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
void xmlPrintURI(FILE *stream, xmlURIPtr uri)
xmlChar * xmlPathToURI(const xmlChar *path)
XMLPUBFUN int XMLCALL xmlStrcmp(const xmlChar *str1, const xmlChar *str2)