summaryrefslogtreecommitdiffstats
path: root/contrib/libs/libxml/xmlstring.c
diff options
context:
space:
mode:
authororivej <[email protected]>2022-02-10 16:45:01 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:45:01 +0300
commit2d37894b1b037cf24231090eda8589bbb44fb6fc (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/libxml/xmlstring.c
parent718c552901d703c502ccbefdfc3c9028d608b947 (diff)
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/libxml/xmlstring.c')
-rw-r--r--contrib/libs/libxml/xmlstring.c150
1 files changed, 75 insertions, 75 deletions
diff --git a/contrib/libs/libxml/xmlstring.c b/contrib/libs/libxml/xmlstring.c
index 45ff75a0b09..8d2e06f66cd 100644
--- a/contrib/libs/libxml/xmlstring.c
+++ b/contrib/libs/libxml/xmlstring.c
@@ -130,7 +130,7 @@ xmlCharStrdup(const char *cur) {
int
xmlStrcmp(const xmlChar *str1, const xmlChar *str2) {
- register int tmp;
+ register int tmp;
if (str1 == str2) return(0);
if (str1 == NULL) return(-1);
@@ -204,7 +204,7 @@ xmlStrQEqual(const xmlChar *pref, const xmlChar *name, const xmlChar *str) {
int
xmlStrncmp(const xmlChar *str1, const xmlChar *str2, int len) {
- register int tmp;
+ register int tmp;
if (len <= 0) return(0);
if (str1 == str2) return(0);
@@ -269,7 +269,7 @@ static const xmlChar casemap[256] = {
int
xmlStrcasecmp(const xmlChar *str1, const xmlChar *str2) {
- register int tmp;
+ register int tmp;
if (str1 == str2) return(0);
if (str1 == NULL) return(-1);
@@ -294,7 +294,7 @@ xmlStrcasecmp(const xmlChar *str1, const xmlChar *str2) {
int
xmlStrncasecmp(const xmlChar *str1, const xmlChar *str2, int len) {
- register int tmp;
+ register int tmp;
if (len <= 0) return(0);
if (str1 == str2) return(0);
@@ -440,8 +440,8 @@ xmlStrlen(const xmlChar *str) {
* 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.
+ * Returns a new xmlChar *, the original @cur is reallocated and should
+ * not be freed.
*/
xmlChar *
@@ -457,8 +457,8 @@ xmlStrncat(xmlChar *cur, const xmlChar *add, int len) {
return(xmlStrndup(add, len));
size = xmlStrlen(cur);
- if (size < 0)
- return(NULL);
+ if (size < 0)
+ return(NULL);
ret = (xmlChar *) xmlRealloc(cur, (size + len + 1) * sizeof(xmlChar));
if (ret == NULL) {
xmlErrMemory(NULL, NULL);
@@ -486,19 +486,19 @@ xmlStrncatNew(const xmlChar *str1, const xmlChar *str2, int len) {
int size;
xmlChar *ret;
- if (len < 0) {
+ if (len < 0) {
len = xmlStrlen(str2);
- if (len < 0)
- return(NULL);
- }
+ if (len < 0)
+ return(NULL);
+ }
if ((str2 == NULL) || (len == 0))
return(xmlStrdup(str1));
if (str1 == NULL)
return(xmlStrndup(str2, len));
size = xmlStrlen(str1);
- if (size < 0)
- return(NULL);
+ if (size < 0)
+ return(NULL);
ret = (xmlChar *) xmlMalloc((size + len + 1) * sizeof(xmlChar));
if (ret == NULL) {
xmlErrMemory(NULL, NULL);
@@ -519,8 +519,8 @@ xmlStrncatNew(const xmlChar *str1, const xmlChar *str2, int len) {
* 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.
+ * Returns a new xmlChar * containing the concatenated string. The original
+ * @cur is reallocated and should not be freed.
*/
xmlChar *
xmlStrcat(xmlChar *cur, const xmlChar *add) {
@@ -546,7 +546,7 @@ xmlStrcat(xmlChar *cur, const xmlChar *add) {
* Returns the number of characters written to @buf or -1 if an error occurs.
*/
int XMLCDECL
-xmlStrPrintf(xmlChar *buf, int len, const char *msg, ...) {
+xmlStrPrintf(xmlChar *buf, int len, const char *msg, ...) {
va_list args;
int ret;
@@ -574,7 +574,7 @@ xmlStrPrintf(xmlChar *buf, int len, const char *msg, ...) {
* Returns the number of characters written to @buf or -1 if an error occurs.
*/
int
-xmlStrVPrintf(xmlChar *buf, int len, const char *msg, va_list ap) {
+xmlStrVPrintf(xmlChar *buf, int len, const char *msg, va_list ap) {
int ret;
if((buf == NULL) || (msg == NULL)) {
@@ -823,7 +823,7 @@ xmlCheckUTF8(const unsigned char *utf)
* @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
+ * the behaviour is not guaranteed if the input string is not UTF-8
*
* Returns the storage size of
* the first 'len' characters of ARRAY
@@ -845,7 +845,7 @@ xmlUTF8Strsize(const xmlChar *utf, int len) {
break;
if ( (ch = *ptr++) & 0x80)
while ((ch<<=1) & 0x80 ) {
- if (*ptr == 0) break;
+ if (*ptr == 0) break;
ptr++;
}
}
@@ -988,60 +988,60 @@ xmlUTF8Strsub(const xmlChar *utf, int start, int len) {
return(xmlUTF8Strndup(utf, len));
}
-/**
- * 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.
- */
-xmlChar *
-xmlEscapeFormatString(xmlChar **msg)
-{
- xmlChar *msgPtr = NULL;
- xmlChar *result = NULL;
- xmlChar *resultPtr = NULL;
- size_t count = 0;
- size_t msgLen = 0;
- size_t resultLen = 0;
-
- if (!msg || !*msg)
- return(NULL);
-
- for (msgPtr = *msg; *msgPtr != '\0'; ++msgPtr) {
- ++msgLen;
- if (*msgPtr == '%')
- ++count;
- }
-
- if (count == 0)
- return(*msg);
-
- resultLen = msgLen + count + 1;
- result = (xmlChar *) xmlMallocAtomic(resultLen * sizeof(xmlChar));
- if (result == NULL) {
- /* Clear *msg to prevent format string vulnerabilities in
- out-of-memory situations. */
- xmlFree(*msg);
- *msg = NULL;
- xmlErrMemory(NULL, NULL);
- return(NULL);
- }
-
- for (msgPtr = *msg, resultPtr = result; *msgPtr != '\0'; ++msgPtr, ++resultPtr) {
- *resultPtr = *msgPtr;
- if (*msgPtr == '%')
- *(++resultPtr) = '%';
- }
- result[resultLen - 1] = '\0';
-
- xmlFree(*msg);
- *msg = result;
-
- return *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.
+ */
+xmlChar *
+xmlEscapeFormatString(xmlChar **msg)
+{
+ xmlChar *msgPtr = NULL;
+ xmlChar *result = NULL;
+ xmlChar *resultPtr = NULL;
+ size_t count = 0;
+ size_t msgLen = 0;
+ size_t resultLen = 0;
+
+ if (!msg || !*msg)
+ return(NULL);
+
+ for (msgPtr = *msg; *msgPtr != '\0'; ++msgPtr) {
+ ++msgLen;
+ if (*msgPtr == '%')
+ ++count;
+ }
+
+ if (count == 0)
+ return(*msg);
+
+ resultLen = msgLen + count + 1;
+ result = (xmlChar *) xmlMallocAtomic(resultLen * sizeof(xmlChar));
+ if (result == NULL) {
+ /* Clear *msg to prevent format string vulnerabilities in
+ out-of-memory situations. */
+ xmlFree(*msg);
+ *msg = NULL;
+ xmlErrMemory(NULL, NULL);
+ return(NULL);
+ }
+
+ for (msgPtr = *msg, resultPtr = result; *msgPtr != '\0'; ++msgPtr, ++resultPtr) {
+ *resultPtr = *msgPtr;
+ if (*msgPtr == '%')
+ *(++resultPtr) = '%';
+ }
+ result[resultLen - 1] = '\0';
+
+ xmlFree(*msg);
+ *msg = result;
+
+ return *msg;
+}
+
#define bottom_xmlstring
#include "elfgcchack.h"