X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=xmlstring.c;h=a37220d7808b0db5530e7239e5b107aacde26cb4;hb=4e8fa1efca3c71ef7e0c515afb175e849a97d416;hp=910f244485d1303461681103cd1457d989a5e521;hpb=f1203bb16d4c806ad871c24d097983c3fa550048;p=platform%2Fupstream%2Flibxml2.git diff --git a/xmlstring.c b/xmlstring.c index 910f244..a37220d 100644 --- a/xmlstring.c +++ b/xmlstring.c @@ -3,7 +3,7 @@ * * This module provides various utility functions for manipulating * the xmlChar* type. All functions named xmlStr* have been moved here - * from the parser.c file (their original home). + * from the parser.c file (their original home). * * See Copyright for the status of this software. * @@ -40,7 +40,7 @@ xmlChar * xmlStrndup(const xmlChar *cur, int len) { xmlChar *ret; - + if ((cur == NULL) || (len < 0)) return(NULL); ret = (xmlChar *) xmlMallocAtomic((len + 1) * sizeof(xmlChar)); if (ret == NULL) { @@ -85,7 +85,7 @@ xmlChar * xmlCharStrndup(const char *cur, int len) { int i; xmlChar *ret; - + if ((cur == NULL) || (len < 0)) return(NULL); ret = (xmlChar *) xmlMallocAtomic((len + 1) * sizeof(xmlChar)); if (ret == NULL) { @@ -170,7 +170,7 @@ xmlStrEqual(const xmlChar *str1, const xmlChar *str2) { * @name: the localname of the QName * @str: the second xmlChar * * - * Check if a QName is Equal to a given string + * Check if a QName is Equal to a given string * * Returns 1 if they are equal, 0 if they are different */ @@ -340,7 +340,7 @@ xmlStrchr(const xmlChar *str, xmlChar val) { const xmlChar * xmlStrstr(const xmlChar *str, const xmlChar *val) { int n; - + if (str == NULL) return(NULL); if (val == NULL) return(NULL); n = xmlStrlen(val); @@ -368,7 +368,7 @@ xmlStrstr(const xmlChar *str, const xmlChar *val) { const xmlChar * xmlStrcasestr(const xmlChar *str, const xmlChar *val) { int n; - + if (str == NULL) return(NULL); if (val == NULL) return(NULL); n = xmlStrlen(val); @@ -396,7 +396,7 @@ xmlStrcasestr(const xmlChar *str, const xmlChar *val) { xmlChar * xmlStrsub(const xmlChar *str, int start, int len) { int i; - + if (str == NULL) return(NULL); if (start < 0) return(NULL); if (len < 0) return(NULL); @@ -519,7 +519,7 @@ xmlStrcat(xmlChar *cur, const xmlChar *add) { const xmlChar *p = add; if (add == NULL) return(cur); - if (cur == NULL) + if (cur == NULL) return(xmlStrdup(add)); while (*p != 0) p++; /* non input consuming */ @@ -537,20 +537,20 @@ xmlStrcat(xmlChar *cur, const xmlChar *add) { * * Returns the number of characters written to @buf or -1 if an error occurs. */ -int XMLCDECL +int XMLCDECL xmlStrPrintf(xmlChar *buf, int len, const xmlChar *msg, ...) { va_list args; int ret; - + if((buf == NULL) || (msg == NULL)) { return(-1); } - + va_start(args, msg); ret = vsnprintf((char *) buf, len, (const char *) msg, args); va_end(args); buf[len - 1] = 0; /* be safe ! */ - + return(ret); } @@ -565,17 +565,17 @@ xmlStrPrintf(xmlChar *buf, int len, const xmlChar *msg, ...) { * * Returns the number of characters written to @buf or -1 if an error occurs. */ -int +int xmlStrVPrintf(xmlChar *buf, int len, const xmlChar *msg, va_list ap) { int ret; - + if((buf == NULL) || (msg == NULL)) { return(-1); } - + ret = vsnprintf((char *) buf, len, (const char *) msg, ap); buf[len - 1] = 0; /* be safe ! */ - + return(ret); } @@ -858,7 +858,7 @@ xmlChar * xmlUTF8Strndup(const xmlChar *utf, int len) { xmlChar *ret; int i; - + if ((utf == NULL) || (len < 0)) return(NULL); i = xmlUTF8Strsize(utf, len); ret = (xmlChar *) xmlMallocAtomic((i + 1) * sizeof(xmlChar));