Index: third_party/libxml/src/triostr.c |
diff --git a/third_party/libxml/src/triostr.c b/third_party/libxml/src/triostr.c |
index 30d13ac0624176632f87fadcd32f9ca0fcef6f45..123bbebee24a843f30167b7b331cb26bc5254deb 100644 |
--- a/third_party/libxml/src/triostr.c |
+++ b/third_party/libxml/src/triostr.c |
@@ -52,7 +52,9 @@ |
# define BOOLEAN_T int |
#endif |
-#if defined(TRIO_COMPILER_SUPPORTS_C99) |
+#ifdef __VMS |
+# define USE_STRTOD |
+#elif defined(TRIO_COMPILER_SUPPORTS_C99) |
# define USE_STRTOD |
# define USE_STRTOF |
#elif defined(TRIO_COMPILER_MSVC) |
@@ -78,6 +80,10 @@ |
# else |
# define strcasecmp(x,y) strcmpi(x,y) |
# endif |
+#elif defined(TRIO_PLATFORM_OS400) |
+# define USE_STRCASECMP |
+# define USE_STRNCASECMP |
+# include <strings.h> |
#endif |
#if !(defined(TRIO_PLATFORM_SUNOS)) |
@@ -165,11 +171,11 @@ TRIO_ARGS1((string), |
#if !defined(TRIO_MINIMAL) |
/** |
Append @p source at the end of @p target. |
- |
+ |
@param target Target string. |
@param source Source string. |
@return Boolean value indicating success or failure. |
- |
+ |
@pre @p target must point to a memory chunk with sufficient room to |
contain the @p target string and @p source string. |
@pre No boundary checking is performed, so insufficient memory will |
@@ -184,7 +190,7 @@ TRIO_ARGS2((target, source), |
{ |
assert(target); |
assert(source); |
- |
+ |
return (strcat(target, source) != NULL); |
} |
#endif /* !defined(TRIO_MINIMAL) */ |
@@ -192,12 +198,12 @@ TRIO_ARGS2((target, source), |
#if !defined(TRIO_MINIMAL) |
/** |
Append at most @p max characters from @p source to @p target. |
- |
+ |
@param target Target string. |
@param max Maximum number of characters to append. |
@param source Source string. |
@return Boolean value indicating success or failure. |
- |
+ |
@pre @p target must point to a memory chuck with sufficient room to |
contain the @p target string and the @p source string (at most @p max |
characters). |
@@ -213,12 +219,12 @@ TRIO_ARGS3((target, max, source), |
TRIO_CONST char *source) |
{ |
size_t length; |
- |
+ |
assert(target); |
assert(source); |
length = trio_length(target); |
- |
+ |
if (max > length) |
{ |
strncat(target, source, max - length - 1); |
@@ -244,7 +250,7 @@ TRIO_ARGS2((string, substring), |
{ |
assert(string); |
assert(substring); |
- |
+ |
return (0 != strstr(string, substring)); |
} |
#endif /* !defined(TRIO_MINIMAL) */ |
@@ -253,11 +259,11 @@ TRIO_ARGS2((string, substring), |
#if !defined(TRIO_MINIMAL) |
/** |
Copy @p source to @p target. |
- |
+ |
@param target Target string. |
@param source Source string. |
@return Boolean value indicating success or failure. |
- |
+ |
@pre @p target must point to a memory chunk with sufficient room to |
contain the @p source string. |
@pre No boundary checking is performed, so insufficient memory will |
@@ -272,7 +278,7 @@ TRIO_ARGS2((target, source), |
{ |
assert(target); |
assert(source); |
- |
+ |
(void)strcpy(target, source); |
return TRUE; |
} |
@@ -281,12 +287,12 @@ TRIO_ARGS2((target, source), |
/** |
Copy at most @p max characters from @p source to @p target. |
- |
+ |
@param target Target string. |
@param max Maximum number of characters to append. |
@param source Source string. |
@return Boolean value indicating success or failure. |
- |
+ |
@pre @p target must point to a memory chunk with sufficient room to |
contain the @p source string (at most @p max characters). |
@pre No boundary checking is performed, so insufficient memory will |
@@ -336,10 +342,10 @@ TRIO_ARGS2((source, size), |
/** |
Duplicate @p source. |
- |
+ |
@param source Source string. |
@return A copy of the @p source string. |
- |
+ |
@post @p target will be zero terminated. |
*/ |
TRIO_STRING_PUBLIC char * |
@@ -354,11 +360,11 @@ TRIO_ARGS1((source), |
#if !defined(TRIO_MINIMAL) |
/** |
Duplicate at most @p max characters of @p source. |
- |
+ |
@param source Source string. |
@param max Maximum number of characters to duplicate. |
@return A copy of the @p source string. |
- |
+ |
@post @p target will be zero terminated. |
*/ |
TRIO_STRING_PUBLIC char * |
@@ -383,11 +389,11 @@ trio_duplicate_max TRIO_ARGS2((source, max), |
/** |
Compare if two strings are equal. |
- |
+ |
@param first First string. |
@param second Second string. |
@return Boolean indicating whether the two strings are equal or not. |
- |
+ |
Case-insensitive comparison. |
*/ |
TRIO_STRING_PUBLIC int |
@@ -422,11 +428,11 @@ TRIO_ARGS2((first, second), |
/** |
Compare if two strings are equal. |
- |
+ |
@param first First string. |
@param second Second string. |
@return Boolean indicating whether the two strings are equal or not. |
- |
+ |
Case-sensitive comparison. |
*/ |
TRIO_STRING_PUBLIC int |
@@ -449,12 +455,12 @@ TRIO_ARGS2((first, second), |
#if !defined(TRIO_MINIMAL) |
/** |
Compare if two strings up until the first @p max characters are equal. |
- |
+ |
@param first First string. |
@param max Maximum number of characters to compare. |
@param second Second string. |
@return Boolean indicating whether the two strings are equal or not. |
- |
+ |
Case-sensitive comparison. |
*/ |
TRIO_STRING_PUBLIC int |
@@ -478,7 +484,7 @@ TRIO_ARGS3((first, max, second), |
/** |
Compare if two strings are equal. |
- |
+ |
@param first First string. |
@param second Second string. |
@return Boolean indicating whether the two strings are equal or not. |
@@ -504,12 +510,12 @@ TRIO_ARGS2((first, second), |
/** |
Compare if two strings up until the first @p max characters are equal. |
- |
+ |
@param first First string. |
@param max Maximum number of characters to compare. |
@param second Second string. |
@return Boolean indicating whether the two strings are equal or not. |
- |
+ |
Case-insensitive comparison. |
*/ |
TRIO_STRING_PUBLIC int |
@@ -558,7 +564,7 @@ TRIO_ARGS1((error_number), |
int error_number) |
{ |
#if defined(USE_STRERROR) |
- |
+ |
return strerror(error_number); |
#elif defined(USE_SYS_ERRLIST) |
@@ -569,11 +575,11 @@ TRIO_ARGS1((error_number), |
return ((error_number < 0) || (error_number >= sys_nerr)) |
? "unknown" |
: sys_errlist[error_number]; |
- |
+ |
#else |
- |
+ |
return "unknown"; |
- |
+ |
#endif |
} |
@@ -603,7 +609,7 @@ TRIO_ARGS4((target, max, format, datetime), |
assert(format); |
assert(datetime); |
assert(max > 0); |
- |
+ |
return strftime(target, max, format, datetime); |
} |
#endif /* !defined(TRIO_MINIMAL) */ |
@@ -630,7 +636,7 @@ TRIO_ARGS2((string, type), |
char ch; |
assert(string); |
- |
+ |
switch (type) |
{ |
case TRIO_HASH_PLAIN: |
@@ -719,7 +725,7 @@ TRIO_ARGS1((target), |
@return Boolean value indicating success or failure. |
Case-insensitive comparison. |
- |
+ |
The following wildcards can be used |
@li @c * Match any number of characters. |
@li @c ? Match a single character. |
@@ -732,7 +738,7 @@ TRIO_ARGS2((string, pattern), |
{ |
assert(string); |
assert(pattern); |
- |
+ |
for (; ('*' != *pattern); ++pattern, ++string) |
{ |
if (NIL == *string) |
@@ -757,7 +763,7 @@ TRIO_ARGS2((string, pattern), |
} |
} |
while (*string++); |
- |
+ |
return FALSE; |
} |
#endif /* !defined(TRIO_MINIMAL) */ |
@@ -772,7 +778,7 @@ TRIO_ARGS2((string, pattern), |
@return Boolean value indicating success or failure. |
Case-sensitive comparison. |
- |
+ |
The following wildcards can be used |
@li @c * Match any number of characters. |
@li @c ? Match a single character. |
@@ -785,7 +791,7 @@ TRIO_ARGS2((string, pattern), |
{ |
assert(string); |
assert(pattern); |
- |
+ |
for (; ('*' != *pattern); ++pattern, ++string) |
{ |
if (NIL == *string) |
@@ -810,7 +816,7 @@ TRIO_ARGS2((string, pattern), |
} |
} |
while (*string++); |
- |
+ |
return FALSE; |
} |
#endif /* !defined(TRIO_MINIMAL) */ |
@@ -837,7 +843,7 @@ TRIO_ARGS3((target, source, Function), |
assert(target); |
assert(source); |
assert(Function); |
- |
+ |
while (*source != NIL) |
{ |
*target++ = Function(*source++); |
@@ -894,7 +900,7 @@ TRIO_ARGS3((string, max, substring), |
assert(string); |
assert(substring); |
- |
+ |
size = trio_length(substring); |
if (size <= max) |
{ |
@@ -929,7 +935,7 @@ TRIO_ARGS2((string, delimiters), |
TRIO_CONST char *delimiters) |
{ |
assert(delimiters); |
- |
+ |
return strtok(string, delimiters); |
} |
#endif /* !defined(TRIO_MINIMAL) */ |
@@ -1064,7 +1070,7 @@ TRIO_ARGS2((source, endp), |
} |
} |
} |
- |
+ |
value = integer + fraction; |
if (exponent != 0) |
{ |
@@ -1146,7 +1152,7 @@ TRIO_ARGS3((string, endp, base), |
{ |
assert(string); |
assert((base >= 2) && (base <= 36)); |
- |
+ |
return strtol(string, endp, base); |
} |
@@ -1164,16 +1170,16 @@ TRIO_ARGS1((source), |
int source) |
{ |
#if defined(USE_TOLOWER) |
- |
+ |
return tolower(source); |
- |
+ |
#else |
/* Does not handle locales or non-contiguous alphabetic characters */ |
return ((source >= (int)'A') && (source <= (int)'Z')) |
? source - 'A' + 'a' |
: source; |
- |
+ |
#endif |
} |
#endif /* !defined(TRIO_MINIMAL) */ |
@@ -1195,7 +1201,7 @@ TRIO_ARGS3((string, endp, base), |
{ |
assert(string); |
assert((base >= 2) && (base <= 36)); |
- |
+ |
return strtoul(string, endp, base); |
} |
#endif /* !defined(TRIO_MINIMAL) */ |
@@ -1213,16 +1219,16 @@ TRIO_ARGS1((source), |
int source) |
{ |
#if defined(USE_TOUPPER) |
- |
+ |
return toupper(source); |
- |
+ |
#else |
/* Does not handle locales or non-contiguous alphabetic characters */ |
return ((source >= (int)'a') && (source <= (int)'z')) |
? source - 'a' + 'A' |
: source; |
- |
+ |
#endif |
} |
@@ -1266,7 +1272,7 @@ TRIO_STRING_PRIVATE trio_string_t * |
TrioStringAlloc(TRIO_NOARGS) |
{ |
trio_string_t *self; |
- |
+ |
self = (trio_string_t *)TRIO_MALLOC(sizeof(trio_string_t)); |
if (self) |
{ |
@@ -1297,7 +1303,7 @@ TRIO_ARGS2((self, delta), |
new_size = (delta == 0) |
? ( (self->allocated == 0) ? 1 : self->allocated * 2 ) |
: self->allocated + delta; |
- |
+ |
new_content = (char *)TRIO_REALLOC(self->content, new_size); |
if (new_content) |
{ |
@@ -1334,7 +1340,7 @@ TRIO_ARGS2((self, length), |
#if !defined(TRIO_MINIMAL) |
/** |
Create a new dynamic string. |
- |
+ |
@param initial_size Initial size of the buffer. |
@return Newly allocated dynamic string, or NULL if memory allocation failed. |
*/ |
@@ -1367,7 +1373,7 @@ TRIO_ARGS1((initial_size), |
/** |
Deallocate the dynamic string and its contents. |
- |
+ |
@param self Dynamic string |
*/ |
TRIO_STRING_PUBLIC void |
@@ -1376,7 +1382,7 @@ TRIO_ARGS1((self), |
trio_string_t *self) |
{ |
assert(self); |
- |
+ |
if (self) |
{ |
trio_destroy(self->content); |
@@ -1388,11 +1394,11 @@ TRIO_ARGS1((self), |
#if !defined(TRIO_MINIMAL) |
/** |
Get a pointer to the content. |
- |
+ |
@param self Dynamic string. |
@param offset Offset into content. |
@return Pointer to the content. |
- |
+ |
@p Offset can be zero, positive, or negative. If @p offset is zero, |
then the start of the content will be returned. If @p offset is positive, |
then a pointer to @p offset number of characters from the beginning of the |
@@ -1407,7 +1413,7 @@ TRIO_ARGS2((self, offset), |
int offset) |
{ |
char *result = NULL; |
- |
+ |
assert(self); |
if (self->content != NULL) |
@@ -1440,10 +1446,10 @@ TRIO_ARGS2((self, offset), |
/** |
Extract the content. |
- |
+ |
@param self Dynamic String |
@return Content of dynamic string. |
- |
+ |
The content is removed from the dynamic string. This enables destruction |
of the dynamic string without deallocation of the content. |
*/ |
@@ -1453,7 +1459,7 @@ TRIO_ARGS1((self), |
trio_string_t *self) |
{ |
char *result; |
- |
+ |
assert(self); |
result = self->content; |
@@ -1467,13 +1473,13 @@ TRIO_ARGS1((self), |
#if !defined(TRIO_MINIMAL) |
/** |
Set the content of the dynamic string. |
- |
+ |
@param self Dynamic String |
@param buffer The new content. |
- |
+ |
Sets the content of the dynamic string to a copy @p buffer. |
An existing content will be deallocated first, if necessary. |
- |
+ |
@remark |
This function will make a copy of @p buffer. |
You are responsible for deallocating @p buffer yourself. |
@@ -1521,7 +1527,7 @@ TRIO_ARGS1((self), |
#if !defined(TRIO_MINIMAL) |
/** |
Append the second string to the first. |
- |
+ |
@param self Dynamic string to be modified. |
@param other Dynamic string to copy from. |
@return Boolean value indicating success or failure. |
@@ -1533,7 +1539,7 @@ TRIO_ARGS2((self, other), |
trio_string_t *other) |
{ |
size_t length; |
- |
+ |
assert(self); |
assert(other); |
@@ -1543,7 +1549,7 @@ TRIO_ARGS2((self, other), |
trio_copy(&self->content[self->length], other->content); |
self->length = length; |
return TRUE; |
- |
+ |
error: |
return FALSE; |
} |
@@ -1561,7 +1567,7 @@ TRIO_ARGS2((self, other), |
TRIO_CONST char *other) |
{ |
size_t length; |
- |
+ |
assert(self); |
assert(other); |
@@ -1571,7 +1577,7 @@ TRIO_ARGS2((self, other), |
trio_copy(&self->content[self->length], other); |
self->length = length; |
return TRUE; |
- |
+ |
error: |
return FALSE; |
} |
@@ -1597,7 +1603,7 @@ TRIO_ARGS2((self, character), |
self->content[self->length] = character; |
self->length++; |
return TRUE; |
- |
+ |
error: |
return FALSE; |
} |
@@ -1606,7 +1612,7 @@ TRIO_ARGS2((self, character), |
#if !defined(TRIO_MINIMAL) |
/** |
Search for the first occurrence of second parameter in the first. |
- |
+ |
@param self Dynamic string to be modified. |
@param other Dynamic string to copy from. |
@return Boolean value indicating success or failure. |
@@ -1691,7 +1697,7 @@ TRIO_ARGS1((other), |
trio_string_t *other) |
{ |
trio_string_t *self; |
- |
+ |
assert(other); |
self = TrioStringAlloc(); |
@@ -1722,7 +1728,7 @@ TRIO_ARGS1((other), |
TRIO_CONST char *other) |
{ |
trio_string_t *self; |
- |
+ |
assert(other); |
self = TrioStringAlloc(); |