aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--HTMLparser.c2
-rw-r--r--c14n.c2
-rw-r--r--debugXML.c5
-rw-r--r--entities.c4
-rw-r--r--nanohttp.c2
-rw-r--r--parser.c2
-rw-r--r--runtest.c77
-rw-r--r--testC14N.c7
-rw-r--r--uri.c2
-rw-r--r--xmlcatalog.c3
-rw-r--r--xmllint.c2
-rw-r--r--xmlregexp.c4
-rw-r--r--xpath.c2
13 files changed, 65 insertions, 49 deletions
diff --git a/HTMLparser.c b/HTMLparser.c
index ceb47fa7..f6385118 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -2560,7 +2560,7 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
NEXT;
}
}
- *out++ = 0;
+ *out = 0;
return(buffer);
}
diff --git a/c14n.c b/c14n.c
index 5c6c4560..9c3cad2a 100644
--- a/c14n.c
+++ b/c14n.c
@@ -2226,7 +2226,7 @@ xmlC11NNormalizeString(const xmlChar * input,
}
cur++;
}
- *out++ = 0;
+ *out = 0;
return (buffer);
}
#endif /* LIBXML_OUTPUT_ENABLED */
diff --git a/debugXML.c b/debugXML.c
index 76134cca..415889a6 100644
--- a/debugXML.c
+++ b/debugXML.c
@@ -2803,7 +2803,6 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
{
char prompt[500] = "/ > ";
char *cmdline = NULL, *cur;
- int nbargs;
char command[100];
char arg[400];
int i;
@@ -2855,7 +2854,6 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
* Parse the command itself
*/
cur = cmdline;
- nbargs = 0;
while ((*cur == ' ') || (*cur == '\t'))
cur++;
i = 0;
@@ -2868,7 +2866,6 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
command[i] = 0;
if (i == 0)
continue;
- nbargs++;
/*
* Parse the argument
@@ -2882,8 +2879,6 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
arg[i++] = *cur++;
}
arg[i] = 0;
- if (i != 0)
- nbargs++;
/*
* start interpreting the command
diff --git a/entities.c b/entities.c
index c171e97f..6aef49f4 100644
--- a/entities.c
+++ b/entities.c
@@ -690,7 +690,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
}
cur++;
}
- *out++ = 0;
+ *out = 0;
return(buffer);
}
@@ -772,7 +772,7 @@ xmlEncodeSpecialChars(xmlDocPtr doc ATTRIBUTE_UNUSED, const xmlChar *input) {
}
cur++;
}
- *out++ = 0;
+ *out = 0;
return(buffer);
}
diff --git a/nanohttp.c b/nanohttp.c
index 9ae35740..9df7a97c 100644
--- a/nanohttp.c
+++ b/nanohttp.c
@@ -150,6 +150,7 @@ typedef struct xmlNanoHTTPCtxt {
int inlen; /* len of the input buffer */
int last; /* return code for last operation */
int returnValue; /* the protocol return value */
+ int version; /* the protocol version */
int ContentLength; /* specified content length from HTTP header */
char *contentType; /* the MIME type for the input */
char *location; /* the new URL in case of redirect */
@@ -722,6 +723,7 @@ xmlNanoHTTPScanAnswer(xmlNanoHTTPCtxtPtr ctxt, const char *line) {
}
if ((*cur != 0) && (*cur != ' ') && (*cur != '\t')) return;
ctxt->returnValue = ret;
+ ctxt->version = version;
} else if (!xmlStrncasecmp(BAD_CAST line, BAD_CAST"Content-Type:", 13)) {
const xmlChar *charset, *last, *mime;
cur += 13;
diff --git a/parser.c b/parser.c
index 6d92656d..6ae2d775 100644
--- a/parser.c
+++ b/parser.c
@@ -2616,7 +2616,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
else
c = 0;
}
- buffer[nbchars++] = 0;
+ buffer[nbchars] = 0;
return(buffer);
mem_error:
diff --git a/runtest.c b/runtest.c
index 1d646959..7640aad2 100644
--- a/runtest.c
+++ b/runtest.c
@@ -1704,9 +1704,11 @@ saxParseTest(const char *filename, const char *result,
if (compareFiles(temp, result)) {
fprintf(stderr, "Got a difference for %s\n", filename);
ret = 1;
- } else
- unlink(temp);
- free(temp);
+ }
+ if (temp != NULL) {
+ unlink(temp);
+ free(temp);
+ }
/* switch back to structured error handling */
xmlSetGenericErrorFunc(NULL, NULL);
@@ -1779,8 +1781,10 @@ oldParseTest(const char *filename, const char *result,
}
xmlFreeDoc(doc);
- unlink(temp);
- free(temp);
+ if (temp != NULL) {
+ unlink(temp);
+ free(temp);
+ }
return(res);
}
@@ -1980,8 +1984,10 @@ noentParseTest(const char *filename, const char *result,
}
xmlFreeDoc(doc);
- unlink(temp);
- free(temp);
+ if (temp != NULL) {
+ unlink(temp);
+ free(temp);
+ }
return(res);
}
@@ -2120,8 +2126,10 @@ streamProcessTest(const char *filename, const char *result, const char *err,
testErrorHandler(NULL, "Relax-NG schema %s failed to compile\n",
rng);
fclose(t);
- unlink(temp);
- free(temp);
+ if (temp != NULL) {
+ unlink(temp);
+ free(temp);
+ }
return(0);
}
}
@@ -2147,8 +2155,10 @@ streamProcessTest(const char *filename, const char *result, const char *err,
if (t != NULL) {
fclose(t);
ret = compareFiles(temp, result);
- unlink(temp);
- free(temp);
+ if (temp != NULL) {
+ unlink(temp);
+ free(temp);
+ }
if (ret) {
fprintf(stderr, "Result for %s failed\n", filename);
return(-1);
@@ -2357,8 +2367,10 @@ xpathCommonTest(const char *filename, const char *result,
}
}
- unlink(temp);
- free(temp);
+ if (temp != NULL) {
+ unlink(temp);
+ free(temp);
+ }
return(ret);
}
@@ -2527,8 +2539,10 @@ xmlidDocTest(const char *filename,
}
}
- unlink(temp);
- free(temp);
+ if (temp != NULL) {
+ unlink(temp);
+ free(temp);
+ }
xmlFreeDoc(xpathDocument);
if (err != NULL) {
@@ -2614,8 +2628,10 @@ uriCommonTest(const char *filename,
if (f == NULL) {
fprintf(stderr, "failed to open input file %s\n", filename);
fclose(o);
- unlink(temp);
- free(temp);
+ if (temp != NULL) {
+ unlink(temp);
+ free(temp);
+ }
return(-1);
}
@@ -2658,8 +2674,10 @@ uriCommonTest(const char *filename,
}
}
- unlink(temp);
- free(temp);
+ if (temp != NULL) {
+ unlink(temp);
+ free(temp);
+ }
return(res);
}
@@ -2933,8 +2951,10 @@ schemasOneTest(const char *sch,
ret = 1;
}
}
- unlink(temp);
- free(temp);
+ if (temp != NULL) {
+ unlink(temp);
+ free(temp);
+ }
if ((validResult != 0) && (err != NULL)) {
if (compareFileMem(err, testErrors, testErrorsSize)) {
@@ -3106,8 +3126,10 @@ rngOneTest(const char *sch,
ret = 1;
}
}
- unlink(temp);
- free(temp);
+ if (temp != NULL) {
+ unlink(temp);
+ free(temp);
+ }
if (err != NULL) {
if (compareFileMem(err, testErrors, testErrorsSize)) {
@@ -3464,7 +3486,7 @@ patternTest(const char *filename,
namespaces[j++] = ns->prefix;
}
namespaces[j++] = NULL;
- namespaces[j++] = NULL;
+ namespaces[j] = NULL;
patternc = xmlPatterncompile((const xmlChar *) str, doc->dict,
0, &namespaces[0]);
@@ -3512,8 +3534,10 @@ patternTest(const char *filename,
fprintf(stderr, "Result for %s failed\n", filename);
ret = 1;
}
- unlink(temp);
- free(temp);
+ if (temp != NULL) {
+ unlink(temp);
+ free(temp);
+ }
return(ret);
}
#endif /* READER */
@@ -3643,7 +3667,6 @@ parse_list(xmlChar *str) {
if((str[0] == '\'') && (str[len - 1] == '\'')) {
str[len - 1] = '\0';
str++;
- len -= 2;
}
/*
* allocate an translation buffer.
diff --git a/testC14N.c b/testC14N.c
index ba70127e..fbfa8696 100644
--- a/testC14N.c
+++ b/testC14N.c
@@ -170,7 +170,7 @@ int main(int argc, char **argv) {
*/
xmlCleanupParser();
xmlMemoryDump();
-
+
return((ret >= 0) ? 0 : 1);
}
@@ -180,7 +180,7 @@ int main(int argc, char **argv) {
#define growBufferReentrant() { \
buffer_size *= 2; \
buffer = (xmlChar **) \
- xmlRealloc(buffer, buffer_size * sizeof(xmlChar*)); \
+ xmlRealloc(buffer, buffer_size * sizeof(xmlChar*)); \
if (buffer == NULL) { \
perror("realloc failed"); \
return(NULL); \
@@ -202,7 +202,6 @@ parse_list(xmlChar *str) {
if((str[0] == '\'') && (str[len - 1] == '\'')) {
str[len - 1] = '\0';
str++;
- len -= 2;
}
/*
* allocate an translation buffer.
@@ -214,7 +213,7 @@ parse_list(xmlChar *str) {
return(NULL);
}
out = buffer;
-
+
while(*str != '\0') {
if (out - buffer > buffer_size - 10) {
int indx = out - buffer;
diff --git a/uri.c b/uri.c
index 28401c8c..1e5e03f5 100644
--- a/uri.c
+++ b/uri.c
@@ -1373,7 +1373,7 @@ xmlSaveUri(xmlURIPtr uri) {
}
ret = temp;
}
- ret[len++] = 0;
+ ret[len] = 0;
return(ret);
}
diff --git a/xmlcatalog.c b/xmlcatalog.c
index 6f193b17..489509f5 100644
--- a/xmlcatalog.c
+++ b/xmlcatalog.c
@@ -124,7 +124,6 @@ static void usershell(void) {
free(cmdline);
continue;
}
- nbargs++;
/*
* Parse the argument string
@@ -138,8 +137,6 @@ static void usershell(void) {
arg[i++] = *cur++;
}
arg[i] = 0;
- if (i != 0)
- nbargs++;
/*
* Parse the arguments
diff --git a/xmllint.c b/xmllint.c
index 9b0b89d0..25c6fb98 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -1990,7 +1990,7 @@ static void walkDoc(xmlDocPtr doc) {
namespaces[i++] = ns->prefix;
}
namespaces[i++] = NULL;
- namespaces[i++] = NULL;
+ namespaces[i] = NULL;
if (pattern != NULL) {
patternc = xmlPatterncompile((const xmlChar *) pattern, doc->dict,
diff --git a/xmlregexp.c b/xmlregexp.c
index ac6d8bc5..b1f1326e 100644
--- a/xmlregexp.c
+++ b/xmlregexp.c
@@ -6923,7 +6923,7 @@ tail:
return(0);
if (nb >= len)
return(-2);
- list[nb++] = exp->exp_str;
+ list[nb] = exp->exp_str;
return(1);
case XML_EXP_COUNT:
exp = exp->exp_left;
@@ -6978,7 +6978,7 @@ tail:
return(0);
if (nb >= len)
return(-2);
- list[nb++] = exp->exp_str;
+ list[nb] = exp->exp_str;
return(1);
case XML_EXP_COUNT:
exp = exp->exp_left;
diff --git a/xpath.c b/xpath.c
index a1b7ddad..ab130d33 100644
--- a/xpath.c
+++ b/xpath.c
@@ -14505,7 +14505,7 @@ xmlXPathTryStreamCompile(xmlXPathContextPtr ctxt, const xmlChar *str) {
namespaces[i++] = ns->prefix;
}
namespaces[i++] = NULL;
- namespaces[i++] = NULL;
+ namespaces[i] = NULL;
}
}