Synchronize with trunk r58457.
[reactos.git] / lib / 3rdparty / libxml2 / triostr.c
index 30d13ac..e507645 100644 (file)
@@ -165,11 +165,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 +184,7 @@ TRIO_ARGS2((target, source),
 {
   assert(target);
   assert(source);
-  
+
   return (strcat(target, source) != NULL);
 }
 #endif /* !defined(TRIO_MINIMAL) */
@@ -192,12 +192,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 +213,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 +244,7 @@ TRIO_ARGS2((string, substring),
 {
   assert(string);
   assert(substring);
-  
+
   return (0 != strstr(string, substring));
 }
 #endif /* !defined(TRIO_MINIMAL) */
@@ -253,11 +253,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 +272,7 @@ TRIO_ARGS2((target, source),
 {
   assert(target);
   assert(source);
-     
+
   (void)strcpy(target, source);
   return TRUE;
 }
@@ -281,12 +281,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 +336,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 +354,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 +383,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 +422,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 +449,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 +478,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 +504,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 +558,7 @@ TRIO_ARGS1((error_number),
           int error_number)
 {
 #if defined(USE_STRERROR)
-  
+
   return strerror(error_number);
 
 #elif defined(USE_SYS_ERRLIST)
@@ -569,11 +569,11 @@ TRIO_ARGS1((error_number),
   return ((error_number < 0) || (error_number >= sys_nerr))
     ? "unknown"
     : sys_errlist[error_number];
+
 #else
-  
+
   return "unknown";
-  
+
 #endif
 }
 
@@ -603,7 +603,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 +630,7 @@ TRIO_ARGS2((string, type),
   char ch;
 
   assert(string);
-  
+
   switch (type)
     {
     case TRIO_HASH_PLAIN:
@@ -719,7 +719,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 +732,7 @@ TRIO_ARGS2((string, pattern),
 {
   assert(string);
   assert(pattern);
-  
+
   for (; ('*' != *pattern); ++pattern, ++string)
     {
       if (NIL == *string)
@@ -757,7 +757,7 @@ TRIO_ARGS2((string, pattern),
        }
     }
   while (*string++);
-  
+
   return FALSE;
 }
 #endif /* !defined(TRIO_MINIMAL) */
@@ -772,7 +772,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 +785,7 @@ TRIO_ARGS2((string, pattern),
 {
   assert(string);
   assert(pattern);
-  
+
   for (; ('*' != *pattern); ++pattern, ++string)
     {
       if (NIL == *string)
@@ -810,7 +810,7 @@ TRIO_ARGS2((string, pattern),
        }
     }
   while (*string++);
-  
+
   return FALSE;
 }
 #endif /* !defined(TRIO_MINIMAL) */
@@ -837,7 +837,7 @@ TRIO_ARGS3((target, source, Function),
   assert(target);
   assert(source);
   assert(Function);
-  
+
   while (*source != NIL)
     {
       *target++ = Function(*source++);
@@ -894,7 +894,7 @@ TRIO_ARGS3((string, max, substring),
 
   assert(string);
   assert(substring);
-  
+
   size = trio_length(substring);
   if (size <= max)
     {
@@ -929,7 +929,7 @@ TRIO_ARGS2((string, delimiters),
           TRIO_CONST char *delimiters)
 {
   assert(delimiters);
-  
+
   return strtok(string, delimiters);
 }
 #endif /* !defined(TRIO_MINIMAL) */
@@ -1064,7 +1064,7 @@ TRIO_ARGS2((source, endp),
            }
        }
     }
-  
+
   value = integer + fraction;
   if (exponent != 0)
     {
@@ -1146,7 +1146,7 @@ TRIO_ARGS3((string, endp, base),
 {
   assert(string);
   assert((base >= 2) && (base <= 36));
-  
+
   return strtol(string, endp, base);
 }
 
@@ -1164,16 +1164,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 +1195,7 @@ TRIO_ARGS3((string, endp, base),
 {
   assert(string);
   assert((base >= 2) && (base <= 36));
-  
+
   return strtoul(string, endp, base);
 }
 #endif /* !defined(TRIO_MINIMAL) */
@@ -1213,16 +1213,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 +1266,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 +1297,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 +1334,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 +1367,7 @@ TRIO_ARGS1((initial_size),
 
 /**
    Deallocate the dynamic string and its contents.
-   
+
    @param self Dynamic string
 */
 TRIO_STRING_PUBLIC void
@@ -1376,7 +1376,7 @@ TRIO_ARGS1((self),
           trio_string_t *self)
 {
   assert(self);
-  
+
   if (self)
     {
       trio_destroy(self->content);
@@ -1388,11 +1388,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 +1407,7 @@ TRIO_ARGS2((self, offset),
           int offset)
 {
   char *result = NULL;
-  
+
   assert(self);
 
   if (self->content != NULL)
@@ -1440,10 +1440,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 +1453,7 @@ TRIO_ARGS1((self),
           trio_string_t *self)
 {
   char *result;
-  
+
   assert(self);
 
   result = self->content;
@@ -1467,13 +1467,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 +1521,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 +1533,7 @@ TRIO_ARGS2((self, other),
           trio_string_t *other)
 {
   size_t length;
-  
+
   assert(self);
   assert(other);
 
@@ -1543,7 +1543,7 @@ TRIO_ARGS2((self, other),
   trio_copy(&self->content[self->length], other->content);
   self->length = length;
   return TRUE;
-  
+
  error:
   return FALSE;
 }
@@ -1561,7 +1561,7 @@ TRIO_ARGS2((self, other),
           TRIO_CONST char *other)
 {
   size_t length;
-  
+
   assert(self);
   assert(other);
 
@@ -1571,7 +1571,7 @@ TRIO_ARGS2((self, other),
   trio_copy(&self->content[self->length], other);
   self->length = length;
   return TRUE;
-  
+
  error:
   return FALSE;
 }
@@ -1597,7 +1597,7 @@ TRIO_ARGS2((self, character),
   self->content[self->length] = character;
   self->length++;
   return TRUE;
-  
+
  error:
   return FALSE;
 }
@@ -1606,7 +1606,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 +1691,7 @@ TRIO_ARGS1((other),
           trio_string_t *other)
 {
   trio_string_t *self;
-  
+
   assert(other);
 
   self = TrioStringAlloc();
@@ -1722,7 +1722,7 @@ TRIO_ARGS1((other),
           TRIO_CONST char *other)
 {
   trio_string_t *self;
-  
+
   assert(other);
 
   self = TrioStringAlloc();