diff options
-rw-r--r-- | HTMLparser.c | 2 | ||||
-rw-r--r-- | c14n.c | 2 | ||||
-rw-r--r-- | debugXML.c | 5 | ||||
-rw-r--r-- | entities.c | 4 | ||||
-rw-r--r-- | nanohttp.c | 2 | ||||
-rw-r--r-- | parser.c | 2 | ||||
-rw-r--r-- | runtest.c | 77 | ||||
-rw-r--r-- | testC14N.c | 7 | ||||
-rw-r--r-- | uri.c | 2 | ||||
-rw-r--r-- | xmlcatalog.c | 3 | ||||
-rw-r--r-- | xmllint.c | 2 | ||||
-rw-r--r-- | xmlregexp.c | 4 | ||||
-rw-r--r-- | xpath.c | 2 |
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); } @@ -2226,7 +2226,7 @@ xmlC11NNormalizeString(const xmlChar * input, } cur++; } - *out++ = 0; + *out = 0; return (buffer); } #endif /* LIBXML_OUTPUT_ENABLED */ @@ -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 @@ -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); } @@ -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; @@ -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: @@ -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. @@ -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; @@ -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 @@ -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; @@ -14505,7 +14505,7 @@ xmlXPathTryStreamCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { namespaces[i++] = ns->prefix; } namespaces[i++] = NULL; - namespaces[i++] = NULL; + namespaces[i] = NULL; } } |