diff --git a/ChangeLog b/ChangeLog index 638a4b27..85a5a9de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Sep 16 20:12:41 CEST 2000 Daniel Veillard + + * HTMLparser.c parser.c: set ctxt->errNo before calling the + error or warning handlers + Wed Sep 13 22:03:18 CEST 2000 Daniel Veillard * parserInternals.c parserInternals.h parser.c Makefile.am: diff --git a/HTMLparser.c b/HTMLparser.c index fd7c8c0b..7d99fcb5 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -254,11 +254,11 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) { val |= cur[1] & 0x3f; } if (!IS_CHAR(val)) { + ctxt->errNo = XML_ERR_INVALID_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Char 0x%X out of allowed range\n", val); - ctxt->errNo = XML_ERR_INVALID_ENCODING; ctxt->wellFormed = 0; ctxt->disableSAX = 1; } @@ -293,6 +293,7 @@ encoding_error: * to ISO-Latin-1 (if you don't like this policy, just declare the * encoding !) */ + ctxt->errNo = XML_ERR_INVALID_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) { ctxt->sax->error(ctxt->userData, "Input is not proper UTF-8, indicate encoding !\n"); @@ -300,7 +301,6 @@ encoding_error: ctxt->input->cur[0], ctxt->input->cur[1], ctxt->input->cur[2], ctxt->input->cur[3]); } - ctxt->errNo = XML_ERR_INVALID_ENCODING; ctxt->charset = XML_CHAR_ENCODING_8859_1; *len = 1; @@ -1494,12 +1494,12 @@ htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len, int c,l; if (ctxt->depth > 40) { + ctxt->errNo = XML_ERR_ENTITY_LOOP; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Detected entity reference loop\n"); ctxt->wellFormed = 0; ctxt->disableSAX = 1; - ctxt->errNo = XML_ERR_ENTITY_LOOP; return(NULL); } @@ -1601,7 +1601,6 @@ htmlNewInputStream(htmlParserCtxtPtr ctxt) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "malloc: couldn't allocate a new input stream\n"); - ctxt->errNo = XML_ERR_NO_MEMORY; return(NULL); } memset(input, 0, sizeof(htmlParserInput)); @@ -2433,10 +2432,10 @@ htmlParseComment(htmlParserCtxtPtr ctxt) { } buf[len] = 0; if (!IS_CHAR(cur)) { + ctxt->errNo = XML_ERR_COMMENT_NOT_FINISHED; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Comment not terminated \n