Jumbo patch, resync of W3C/Gnome CVS trees:
- uri.c tree.c SAX.c parser.c entities.c debugXML.c: finished
the cleanup of the computation of URI references when seeking
external entities. The URI reference string and the resulting
URI are both stored now.
- parser.c HTMLparser.c valid.c nanoftp.c nanohttp.c xpath.c:
large s(n)printf checks and cleanup from Denis Barbier
<barbier@imacs.polytechnique.fr>
- xmlversion.h.in tree.h: couple of SGML declarations for a
possible docbook module.
- result/VC/ : a couple of test output changed due to the change
of the entities URI
Daniel
diff --git a/error.c b/error.c
index 4a124db..b51aebe 100644
--- a/error.c
+++ b/error.c
@@ -87,28 +87,32 @@
xmlParserError(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlParserInputPtr input;
+ xmlParserInputPtr input = NULL;
xmlParserInputPtr cur = NULL;
va_list args;
- input = ctxt->input;
- if ((input != NULL) && (input->filename == NULL) && (ctxt->inputNr > 1)) {
- cur = input;
- input = ctxt->inputTab[ctxt->inputNr - 2];
+ if (ctxt != NULL) {
+ input = ctxt->input;
+ if ((input != NULL) && (input->filename == NULL) &&
+ (ctxt->inputNr > 1)) {
+ cur = input;
+ input = ctxt->inputTab[ctxt->inputNr - 2];
+ }
+ xmlParserPrintFileInfo(input);
}
-
- xmlParserPrintFileInfo(input);
fprintf(stderr, "error: ");
va_start(args, msg);
vfprintf(stderr, msg, args);
va_end(args);
- xmlParserPrintFileContext(input);
- if (cur != NULL) {
- xmlParserPrintFileInfo(cur);
- fprintf(stderr, "\n");
- xmlParserPrintFileContext(cur);
+ if (ctxt != NULL) {
+ xmlParserPrintFileContext(input);
+ if (cur != NULL) {
+ xmlParserPrintFileInfo(cur);
+ fprintf(stderr, "\n");
+ xmlParserPrintFileContext(cur);
+ }
}
}
@@ -125,29 +129,32 @@
xmlParserWarning(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlParserInputPtr input;
+ xmlParserInputPtr input = NULL;
xmlParserInputPtr cur = NULL;
va_list args;
- input = ctxt->input;
- if ((input != NULL) && (input->filename == NULL) && (ctxt->inputNr > 1)) {
- cur = input;
- input = ctxt->inputTab[ctxt->inputNr - 2];
+ if (ctxt != NULL) {
+ input = ctxt->input;
+ if ((input != NULL) && (input->filename == NULL) &&
+ (ctxt->inputNr > 1)) {
+ cur = input;
+ input = ctxt->inputTab[ctxt->inputNr - 2];
+ }
+ xmlParserPrintFileInfo(input);
}
-
- xmlParserPrintFileInfo(input);
-
fprintf(stderr, "warning: ");
va_start(args, msg);
vfprintf(stderr, msg, args);
va_end(args);
- xmlParserPrintFileContext(input);
- if (cur != NULL) {
- xmlParserPrintFileInfo(cur);
- fprintf(stderr, "\n");
- xmlParserPrintFileContext(cur);
+ if (ctxt != NULL) {
+ xmlParserPrintFileContext(input);
+ if (cur != NULL) {
+ xmlParserPrintFileInfo(cur);
+ fprintf(stderr, "\n");
+ xmlParserPrintFileContext(cur);
+ }
}
}
@@ -164,21 +171,25 @@
xmlParserValidityError(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlParserInputPtr input;
+ xmlParserInputPtr input = NULL;
va_list args;
- input = ctxt->input;
- if ((input->filename == NULL) && (ctxt->inputNr > 1))
- input = ctxt->inputTab[ctxt->inputNr - 2];
-
- xmlParserPrintFileInfo(input);
+ if (ctxt != NULL) {
+ input = ctxt->input;
+ if ((input->filename == NULL) && (ctxt->inputNr > 1))
+ input = ctxt->inputTab[ctxt->inputNr - 2];
+
+ xmlParserPrintFileInfo(input);
+ }
fprintf(stderr, "validity error: ");
va_start(args, msg);
vfprintf(stderr, msg, args);
va_end(args);
- xmlParserPrintFileContext(input);
+ if (ctxt != NULL) {
+ xmlParserPrintFileContext(input);
+ }
}
/**
@@ -194,20 +205,24 @@
xmlParserValidityWarning(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlParserInputPtr input;
+ xmlParserInputPtr input = NULL;
va_list args;
- input = ctxt->input;
- if ((input->filename == NULL) && (ctxt->inputNr > 1))
- input = ctxt->inputTab[ctxt->inputNr - 2];
+ if (ctxt != NULL) {
+ input = ctxt->input;
+ if ((input->filename == NULL) && (ctxt->inputNr > 1))
+ input = ctxt->inputTab[ctxt->inputNr - 2];
- xmlParserPrintFileInfo(input);
+ xmlParserPrintFileInfo(input);
+ }
fprintf(stderr, "validity warning: ");
va_start(args, msg);
vfprintf(stderr, msg, args);
va_end(args);
- xmlParserPrintFileContext(input);
+ if (ctxt != NULL) {
+ xmlParserPrintFileContext(input);
+ }
}