--- embedaddon/libxml2/xmllint.c 2012/02/21 23:37:57 1.1 +++ embedaddon/libxml2/xmllint.c 2013/07/22 01:22:22 1.1.1.2 @@ -130,6 +130,7 @@ static int copy = 0; #endif /* LIBXML_TREE_ENABLED */ static int recovery = 0; static int noent = 0; +static int noenc = 0; static int noblanks = 0; static int noout = 0; static int nowrap = 0; @@ -519,10 +520,11 @@ endTimer(char *format, ...) * We cannot do anything because we don't have a timing function */ #ifdef HAVE_STDARG_H + va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); - fprintf(stderr, " was not timed\n", msec); + fprintf(stderr, " was not timed\n"); #else /* We don't have gettimeofday, time or stdarg.h, what crazy world is * this ?! @@ -2072,7 +2074,7 @@ static void doXPathDump(xmlXPathObjectPtr cur) { #ifdef LIBXML_OUTPUT_ENABLED xmlSaveCtxtPtr ctxt; - if (cur->nodesetval->nodeNr <= 0) { + if ((cur->nodesetval == NULL) || (cur->nodesetval->nodeNr <= 0)) { fprintf(stderr, "XPath set is empty\n"); progresult = XMLLINT_ERR_XPATH; break; @@ -2550,7 +2552,9 @@ static void parseAndPrintFile(char *filename, xmlParse size = xmlC14NDocDumpMemory(doc, NULL, XML_C14N_1_0, NULL, 1, &result); if (size >= 0) { - write(1, result, size); + if (write(1, result, size) == -1) { + fprintf(stderr, "Can't write data\n"); + } xmlFree(result); } else { fprintf(stderr, "Failed to canonicalize\n"); @@ -2562,7 +2566,9 @@ static void parseAndPrintFile(char *filename, xmlParse size = xmlC14NDocDumpMemory(doc, NULL, XML_C14N_1_1, NULL, 1, &result); if (size >= 0) { - write(1, result, size); + if (write(1, result, size) == -1) { + fprintf(stderr, "Can't write data\n"); + } xmlFree(result); } else { fprintf(stderr, "Failed to canonicalize\n"); @@ -2575,7 +2581,9 @@ static void parseAndPrintFile(char *filename, xmlParse size = xmlC14NDocDumpMemory(doc, NULL, XML_C14N_EXCLUSIVE_1_0, NULL, 1, &result); if (size >= 0) { - write(1, result, size); + if (write(1, result, size) == -1) { + fprintf(stderr, "Can't write data\n"); + } xmlFree(result); } else { fprintf(stderr, "Failed to canonicalize\n"); @@ -2604,7 +2612,9 @@ static void parseAndPrintFile(char *filename, xmlParse fprintf(stderr, "Failed to save\n"); progresult = XMLLINT_ERR_OUT; } else { - write(1, result, len); + if (write(1, result, len) == -1) { + fprintf(stderr, "Can't write data\n"); + } xmlFree(result); } @@ -2949,6 +2959,7 @@ static void showVersion(const char *name) { if (xmlHasFeature(XML_WITH_DEBUG_MEM)) fprintf(stderr, "MemDebug "); if (xmlHasFeature(XML_WITH_DEBUG_RUN)) fprintf(stderr, "RunDebug "); if (xmlHasFeature(XML_WITH_ZLIB)) fprintf(stderr, "Zlib "); + if (xmlHasFeature(XML_WITH_LZMA)) fprintf(stderr, "Lzma "); fprintf(stderr, "\n"); } @@ -2975,6 +2986,7 @@ static void usage(const char *name) { printf("\t--recover : output what was parsable on broken XML documents\n"); printf("\t--huge : remove any internal arbitrary parser limits\n"); printf("\t--noent : substitute entity references by their value\n"); + printf("\t--noenc : ignore any encoding specified inside the document\n"); printf("\t--noout : don't output the result tree\n"); printf("\t--path 'paths': provide a set of paths for resources\n"); printf("\t--load-trace : print trace of all external entites loaded\n"); @@ -3129,6 +3141,10 @@ main(int argc, char **argv) { (!strcmp(argv[i], "--noent"))) { noent++; options |= XML_PARSE_NOENT; + } else if ((!strcmp(argv[i], "-noenc")) || + (!strcmp(argv[i], "--noenc"))) { + noenc++; + options |= XML_PARSE_IGNORE_ENC; } else if ((!strcmp(argv[i], "-nsclean")) || (!strcmp(argv[i], "--nsclean"))) { options |= XML_PARSE_NSCLEAN; @@ -3349,11 +3365,11 @@ main(int argc, char **argv) { i++; #ifdef LIBXML_OUTPUT_ENABLED format = atoi(argv[i]); -#endif /* LIBXML_OUTPUT_ENABLED */ if (format == 1) { noblanks++; xmlKeepBlanksDefault(0); } +#endif /* LIBXML_OUTPUT_ENABLED */ } #ifdef LIBXML_READER_ENABLED else if ((!strcmp(argv[i], "-stream")) ||