From fdrake at users.sourceforge.net Sat Jul 1 04:34:53 2006 From: fdrake at users.sourceforge.net (Fred L. Drake) Date: Fri, 30 Jun 2006 19:34:53 -0700 Subject: [Expat-checkins] expat/tests minicheck.c, 1.4, 1.5 minicheck.h, 1.5, 1.6 runtests.c, 1.63, 1.64 Message-ID: <20060701023455.A30571E4002@bag.python.org> Update of /cvsroot/expat/expat/tests In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv16272 Modified Files: minicheck.c minicheck.h runtests.c Log Message: - suppress compiler warning when the tests are built with C++ - remove non-implemented forking API from minicheck; it is not used, and we always use minicheck instead of check Index: minicheck.c =================================================================== RCS file: /cvsroot/expat/expat/tests/minicheck.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- minicheck.c 28 Jan 2005 16:16:14 -0000 1.4 +++ minicheck.c 1 Jul 2006 02:34:50 -0000 1.5 @@ -82,12 +82,6 @@ return runner; } -void -srunner_set_fork_status(SRunner *runner, int status) -{ - /* We ignore this. */ -} - static jmp_buf env; static char const *_check_current_function = NULL; Index: minicheck.h =================================================================== RCS file: /cvsroot/expat/expat/tests/minicheck.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- minicheck.h 6 Mar 2006 14:24:36 -0000 1.5 +++ minicheck.h 1 Jul 2006 02:34:50 -0000 1.6 @@ -42,7 +42,6 @@ struct SRunner { Suite *suite; - int forking; int nchecks; int nfailures; }; @@ -81,7 +80,6 @@ tcase_teardown_function); void tcase_add_test(TCase *tc, tcase_test_function test); SRunner *srunner_create(Suite *suite); -void srunner_set_fork_status(SRunner *runner, int forking); void srunner_run_all(SRunner *runner, int verbosity); int srunner_ntests_failed(SRunner *runner); void srunner_free(SRunner *runner); Index: runtests.c =================================================================== RCS file: /cvsroot/expat/expat/tests/runtests.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- runtests.c 6 Mar 2006 14:24:36 -0000 1.63 +++ runtests.c 1 Jul 2006 02:34:50 -0000 1.64 @@ -362,7 +362,7 @@ START_TEST(test_utf16_le_epilog_newline) { - int first_chunk_bytes = 17; + unsigned int first_chunk_bytes = 17; char text[] = "\xFF\xFE" /* BOM */ "<\000e\000/\000>\000" /* document element */ @@ -1411,7 +1411,6 @@ #endif { int i, nf; - int forking = 0, forking_set = 0; int verbosity = CK_NORMAL; Suite *s = make_suite(); SRunner *sr = srunner_create(s); @@ -1425,21 +1424,11 @@ verbosity = CK_VERBOSE; else if (strcmp(opt, "-q") == 0 || strcmp(opt, "--quiet") == 0) verbosity = CK_SILENT; - else if (strcmp(opt, "-f") == 0 || strcmp(opt, "--fork") == 0) { - forking = 1; - forking_set = 1; - } - else if (strcmp(opt, "-n") == 0 || strcmp(opt, "--no-fork") == 0) { - forking = 0; - forking_set = 1; - } else { fprintf(stderr, "runtests: unknown option '%s'\n", opt); return 2; } } - if (forking_set) - srunner_set_fork_status(sr, forking ? CK_FORK : CK_NOFORK); if (verbosity != CK_SILENT) printf("Expat version: %s\n", XML_ExpatVersion()); srunner_run_all(sr, verbosity); From fdrake at users.sourceforge.net Sat Jul 1 05:57:32 2006 From: fdrake at users.sourceforge.net (Fred L. Drake) Date: Fri, 30 Jun 2006 20:57:32 -0700 Subject: [Expat-checkins] expat/lib xmlparse.c,1.153,1.154 Message-ID: <20060701035734.F15121E4002@bag.python.org> Update of /cvsroot/expat/expat/lib In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv17986/lib Modified Files: xmlparse.c Log Message: SF bug #1515266: missing check of stopped parser in doContext() for loop (variation of patch by Brett Cannon; test case to come tomorrow) Index: xmlparse.c =================================================================== RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v retrieving revision 1.153 retrieving revision 1.154 diff -u -d -r1.153 -r1.154 --- xmlparse.c 14 Apr 2006 17:19:09 -0000 1.153 +++ xmlparse.c 1 Jul 2006 03:57:29 -0000 1.154 @@ -2555,6 +2555,8 @@ (int)(dataPtr - (ICHAR *)dataBuf)); if (s == next) break; + if (ps_parsing == XML_FINISHED) + break; *eventPP = s; } } From fdrake at users.sourceforge.net Sat Jul 1 16:54:08 2006 From: fdrake at users.sourceforge.net (Fred L. Drake) Date: Sat, 01 Jul 2006 07:54:08 -0700 Subject: [Expat-checkins] expat/tests minicheck.c,1.5,1.6 Message-ID: <20060701145410.941891E4002@bag.python.org> Update of /cvsroot/expat/expat/tests In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv4630 Modified Files: minicheck.c Log Message: if the test reports a failure message, always display it (it was ignored); it makes no sense to ever hide this, so we don't worry about the verbosity setting for this Index: minicheck.c =================================================================== RCS file: /cvsroot/expat/expat/tests/minicheck.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- minicheck.c 1 Jul 2006 02:34:50 -0000 1.5 +++ minicheck.c 1 Jul 2006 14:54:06 -0000 1.6 @@ -158,6 +158,12 @@ void _fail_unless(int condition, const char *file, int line, char *msg) { + /* Always print the error message so it isn't lost. In this case, + we have a failure, so there's no reason to be quiet about what + it is. + */ + if (msg != NULL) + printf("%s", msg); longjmp(env, 1); } From fdrake at users.sourceforge.net Sat Jul 1 17:01:10 2006 From: fdrake at users.sourceforge.net (Fred L. Drake) Date: Sat, 01 Jul 2006 08:01:10 -0700 Subject: [Expat-checkins] expat/tests runtests.c,1.64,1.65 Message-ID: <20060701150112.098C51E4002@bag.python.org> Update of /cvsroot/expat/expat/tests In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv7527/tests Modified Files: runtests.c Log Message: SF bug #1515266: missing check of stopped parser in doContext() for loop (added regression test, closing bug report) Index: runtests.c =================================================================== RCS file: /cvsroot/expat/expat/tests/runtests.c,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- runtests.c 1 Jul 2006 02:34:50 -0000 1.64 +++ runtests.c 1 Jul 2006 15:01:00 -0000 1.65 @@ -983,6 +983,59 @@ END_TEST +static void +self_clearing_aborting_character_handler(void *userData, + const XML_Char *s, + int len) +{ + XML_StopParser(parser, XML_FALSE); + XML_SetCharacterDataHandler(parser, NULL); +} + +/* Regression test for SF bug #1515266: missing check of stopped + parser in doContext() 'for' loop. */ +START_TEST(test_stop_parser_between_char_data_calls) +{ + /* The sample data must be big enough that there are two calls to + the character data handler from within the inner "for" loop of + the XML_TOK_DATA_CHARS case in doContent(), and the character + handler must stop the parser and clear the character data + handler. + */ + char *text = + "" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + ""; + + XML_SetCharacterDataHandler(parser, + self_clearing_aborting_character_handler); + if (XML_Parse(parser, text, strlen(text), XML_TRUE) != XML_STATUS_ERROR) + xml_failure(parser); + if (XML_GetErrorCode(parser) != XML_ERROR_ABORTED) + xml_failure(parser); +} +END_TEST + + /* * Namespaces tests. */ @@ -1380,6 +1433,7 @@ tcase_add_test(tc_basic, test_dtd_default_handling); tcase_add_test(tc_basic, test_empty_ns_without_namespaces); tcase_add_test(tc_basic, test_ns_in_attribute_default_without_namespaces); + tcase_add_test(tc_basic, test_stop_parser_between_char_data_calls); suite_add_tcase(s, tc_namespace); tcase_add_checked_fixture(tc_namespace, From fdrake at users.sourceforge.net Sat Jul 1 19:19:28 2006 From: fdrake at users.sourceforge.net (Fred L. Drake) Date: Sat, 01 Jul 2006 10:19:28 -0700 Subject: [Expat-checkins] expat/lib xmlparse.c,1.154,1.155 Message-ID: <20060701171932.0C6D81E4002@bag.python.org> Update of /cvsroot/expat/expat/lib In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv24810/lib Modified Files: xmlparse.c Log Message: SF bug #1515266: as noted, suspending the parser has the same problem that the abort code has; added a check and regression test or that Index: xmlparse.c =================================================================== RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v retrieving revision 1.154 retrieving revision 1.155 diff -u -d -r1.154 -r1.155 --- xmlparse.c 1 Jul 2006 03:57:29 -0000 1.154 +++ xmlparse.c 1 Jul 2006 15:30:37 -0000 1.155 @@ -2555,7 +2555,7 @@ (int)(dataPtr - (ICHAR *)dataBuf)); if (s == next) break; - if (ps_parsing == XML_FINISHED) + if (ps_parsing == XML_FINISHED || ps_parsing == XML_SUSPENDED) break; *eventPP = s; } From fdrake at users.sourceforge.net Sat Jul 1 19:19:29 2006 From: fdrake at users.sourceforge.net (Fred L. Drake) Date: Sat, 01 Jul 2006 10:19:29 -0700 Subject: [Expat-checkins] expat/tests runtests.c,1.65,1.66 Message-ID: <20060701171932.6E8A81E4002@bag.python.org> Update of /cvsroot/expat/expat/tests In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv24810/tests Modified Files: runtests.c Log Message: SF bug #1515266: as noted, suspending the parser has the same problem that the abort code has; added a check and regression test or that Index: runtests.c =================================================================== RCS file: /cvsroot/expat/expat/tests/runtests.c,v retrieving revision 1.65 retrieving revision 1.66 diff -u -d -r1.65 -r1.66 --- runtests.c 1 Jul 2006 15:01:00 -0000 1.65 +++ runtests.c 1 Jul 2006 15:30:38 -0000 1.66 @@ -53,10 +53,12 @@ _xml_failure(XML_Parser parser, const char *file, int line) { char buffer[1024]; + enum XML_Error err = XML_GetErrorCode(parser); sprintf(buffer, - "\n %s (line %" XML_FMT_INT_MOD "u, offset %"\ - XML_FMT_INT_MOD "u)\n reported from %s, line %d", - XML_ErrorString(XML_GetErrorCode(parser)), + " %d: %s (line %" XML_FMT_INT_MOD "u, offset %"\ + XML_FMT_INT_MOD "u)\n reported from %s, line %d\n", + err, + XML_ErrorString(err), XML_GetCurrentLineNumber(parser), XML_GetCurrentColumnNumber(parser), file, line); @@ -982,13 +984,37 @@ } END_TEST +static char *long_character_data_text = + "" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + ""; + +static XML_Bool resumable = XML_FALSE; static void -self_clearing_aborting_character_handler(void *userData, - const XML_Char *s, - int len) +clearing_aborting_character_handler(void *userData, + const XML_Char *s, int len) { - XML_StopParser(parser, XML_FALSE); + XML_StopParser(parser, resumable); XML_SetCharacterDataHandler(parser, NULL); } @@ -1002,32 +1028,10 @@ handler must stop the parser and clear the character data handler. */ - char *text = - "" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - ""; + char *text = long_character_data_text; - XML_SetCharacterDataHandler(parser, - self_clearing_aborting_character_handler); + XML_SetCharacterDataHandler(parser, clearing_aborting_character_handler); + resumable = XML_FALSE; if (XML_Parse(parser, text, strlen(text), XML_TRUE) != XML_STATUS_ERROR) xml_failure(parser); if (XML_GetErrorCode(parser) != XML_ERROR_ABORTED) @@ -1035,6 +1039,27 @@ } END_TEST +/* Regression test for SF bug #1515266: missing check of stopped + parser in doContext() 'for' loop. */ +START_TEST(test_suspend_parser_between_char_data_calls) +{ + /* The sample data must be big enough that there are two calls to + the character data handler from within the inner "for" loop of + the XML_TOK_DATA_CHARS case in doContent(), and the character + handler must stop the parser and clear the character data + handler. + */ + char *text = long_character_data_text; + + XML_SetCharacterDataHandler(parser, clearing_aborting_character_handler); + resumable = XML_TRUE; + if (XML_Parse(parser, text, strlen(text), XML_TRUE) != XML_STATUS_SUSPENDED) + xml_failure(parser); + if (XML_GetErrorCode(parser) != XML_ERROR_NONE) + xml_failure(parser); +} +END_TEST + /* * Namespaces tests. @@ -1434,6 +1459,7 @@ tcase_add_test(tc_basic, test_empty_ns_without_namespaces); tcase_add_test(tc_basic, test_ns_in_attribute_default_without_namespaces); tcase_add_test(tc_basic, test_stop_parser_between_char_data_calls); + tcase_add_test(tc_basic, test_suspend_parser_between_char_data_calls); suite_add_tcase(s, tc_namespace); tcase_add_checked_fixture(tc_namespace, From fdrake at users.sourceforge.net Sun Jul 2 04:11:57 2006 From: fdrake at users.sourceforge.net (Fred L. Drake) Date: Sat, 01 Jul 2006 19:11:57 -0700 Subject: [Expat-checkins] expat Changes,1.49,1.50 Message-ID: <20060702021159.84DE81E4002@bag.python.org> Update of /cvsroot/expat/expat In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv8556 Modified Files: Changes Log Message: record my changes from today and yesterday Index: Changes =================================================================== RCS file: /cvsroot/expat/expat/Changes,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- Changes 11 Jan 2006 01:01:23 -0000 1.49 +++ Changes 2 Jul 2006 02:11:55 -0000 1.50 @@ -1,3 +1,10 @@ +Unrelease version + - SF bug #1515266: The character data handler's calling of + XML_StopParser() was not handled properly; if the parser was + stopped and the handler set to NULL, the parser would + segfault. Fixed. + - Minor cleanups of the test harness. + Release 2.0.0 Wed Jan 11 2006 - We no longer use the "check" library for C unit testing; we always use the (partial) internal implementation of the API. From kwaclaw at users.sourceforge.net Wed Jul 5 15:07:03 2006 From: kwaclaw at users.sourceforge.net (Karl Waclawek) Date: Wed, 05 Jul 2006 06:07:03 -0700 Subject: [Expat-checkins] expat/doc reference.html,1.70,1.71 Message-ID: <20060705130705.2CEA21E4003@bag.python.org> Update of /cvsroot/expat/expat/doc In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv8239/doc Modified Files: reference.html Log Message: Fix for issues # 1515266 and # 1515600. The inner for loop under XML_TOK_DATA_CHARS in doContent() and doCdataSection() did not check if the character data handler was set each time a call-back was made. Index: reference.html =================================================================== RCS file: /cvsroot/expat/expat/doc/reference.html,v retrieving revision 1.70 retrieving revision 1.71 diff -u -d -r1.70 -r1.71 --- reference.html 7 Apr 2006 20:28:19 -0000 1.70 +++ reference.html 5 Jul 2006 13:06:59 -0000 1.71 @@ -1103,8 +1103,10 @@ and possibly others.

From kwaclaw at users.sourceforge.net Wed Jul 5 15:07:02 2006 From: kwaclaw at users.sourceforge.net (Karl Waclawek) Date: Wed, 05 Jul 2006 06:07:02 -0700 Subject: [Expat-checkins] expat/lib xmlparse.c,1.155,1.156 Message-ID: <20060705130705.BB4611E4003@bag.python.org> Update of /cvsroot/expat/expat/lib In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv8239/lib Modified Files: xmlparse.c Log Message: Fix for issues # 1515266 and # 1515600. The inner for loop under XML_TOK_DATA_CHARS in doContent() and doCdataSection() did not check if the character data handler was set each time a call-back was made. Index: xmlparse.c =================================================================== RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v retrieving revision 1.155 retrieving revision 1.156 diff -u -d -r1.155 -r1.156 --- xmlparse.c 1 Jul 2006 15:30:37 -0000 1.155 +++ xmlparse.c 5 Jul 2006 13:06:59 -0000 1.156 @@ -2545,9 +2545,9 @@ *nextPtr = end; return XML_ERROR_NONE; case XML_TOK_DATA_CHARS: - if (characterDataHandler) { - if (MUST_CONVERT(enc, s)) { - for (;;) { + if (MUST_CONVERT(enc, s)) { + for (;;) { + if (characterDataHandler) { ICHAR *dataPtr = (ICHAR *)dataBuf; XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); *eventEndPP = s; @@ -2555,16 +2555,14 @@ (int)(dataPtr - (ICHAR *)dataBuf)); if (s == next) break; - if (ps_parsing == XML_FINISHED || ps_parsing == XML_SUSPENDED) - break; *eventPP = s; } } - else - characterDataHandler(handlerArg, - (XML_Char *)s, - (int)((XML_Char *)next - (XML_Char *)s)); } + else if (characterDataHandler) + characterDataHandler(handlerArg, + (XML_Char *)s, + (int)((XML_Char *)next - (XML_Char *)s)); else if (defaultHandler) reportDefault(parser, enc, s, next); break; @@ -3127,9 +3125,9 @@ reportDefault(parser, enc, s, next); break; case XML_TOK_DATA_CHARS: - if (characterDataHandler) { - if (MUST_CONVERT(enc, s)) { - for (;;) { + if (MUST_CONVERT(enc, s)) { + for (;;) { + if (characterDataHandler) { ICHAR *dataPtr = (ICHAR *)dataBuf; XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); *eventEndPP = next; @@ -3140,11 +3138,11 @@ *eventPP = s; } } - else - characterDataHandler(handlerArg, - (XML_Char *)s, - (int)((XML_Char *)next - (XML_Char *)s)); } + else if (characterDataHandler) + characterDataHandler(handlerArg, + (XML_Char *)s, + (int)((XML_Char *)next - (XML_Char *)s)); else if (defaultHandler) reportDefault(parser, enc, s, next); break; From kwaclaw at users.sourceforge.net Thu Jul 6 04:50:29 2006 From: kwaclaw at users.sourceforge.net (Karl Waclawek) Date: Wed, 05 Jul 2006 19:50:29 -0700 Subject: [Expat-checkins] expat/lib xmlparse.c,1.156,1.157 Message-ID: <20060706025034.2E1F51E4012@bag.python.org> Update of /cvsroot/expat/expat/lib In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv29783 Modified Files: xmlparse.c Log Message: Fixed infinite loop when character data handler was cleared under XML_TOK_DATA_CHARS in doContent() and doCdataSection(). Index: xmlparse.c =================================================================== RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v retrieving revision 1.156 retrieving revision 1.157 diff -u -d -r1.156 -r1.157 --- xmlparse.c 5 Jul 2006 13:06:59 -0000 1.156 +++ xmlparse.c 6 Jul 2006 02:50:27 -0000 1.157 @@ -2557,6 +2557,8 @@ break; *eventPP = s; } + else + break; } } else if (characterDataHandler) @@ -3137,6 +3139,8 @@ break; *eventPP = s; } + else + break; } } else if (characterDataHandler) From kwaclaw at users.sourceforge.net Mon Jul 10 20:59:55 2006 From: kwaclaw at users.sourceforge.net (Karl Waclawek) Date: Mon, 10 Jul 2006 11:59:55 -0700 Subject: [Expat-checkins] expat/doc reference.html,1.71,1.72 Message-ID: <20060710185956.F3C7D1E4002@bag.python.org> Update of /cvsroot/expat/expat/doc In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv28082/doc Modified Files: reference.html Log Message: Improved fix for issues # 1515266 and # 1515600. Will now preserve the "failover to default handler" logic. Note: clearing the character data handler does not take effect immediately anymore. Index: reference.html =================================================================== RCS file: /cvsroot/expat/expat/doc/reference.html,v retrieving revision 1.71 retrieving revision 1.72 diff -u -d -r1.71 -r1.72 --- reference.html 5 Jul 2006 13:06:59 -0000 1.71 +++ reference.html 10 Jul 2006 18:59:52 -0000 1.72 @@ -1290,7 +1290,10 @@ to deal with the end of the string. A single block of contiguous text free of markup may still result in a sequence of calls to this handler. In other words, if you're searching for a pattern in the text, it may -be split across calls to this handler.

+be split across calls to this handler. Note: Setting this handler to NULL +may NOT immediately terminate call-backs if the parser is currently +processing such a single block of contiguous markup-free text, as the parser +will continue calling back until the end of the block is reached.

From kwaclaw at users.sourceforge.net Mon Jul 10 20:59:55 2006 From: kwaclaw at users.sourceforge.net (Karl Waclawek) Date: Mon, 10 Jul 2006 11:59:55 -0700 Subject: [Expat-checkins] expat/lib xmlparse.c,1.157,1.158 Message-ID: <20060710185957.4838D1E4002@bag.python.org> Update of /cvsroot/expat/expat/lib In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv28082/lib Modified Files: xmlparse.c Log Message: Improved fix for issues # 1515266 and # 1515600. Will now preserve the "failover to default handler" logic. Note: clearing the character data handler does not take effect immediately anymore. Index: xmlparse.c =================================================================== RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v retrieving revision 1.157 retrieving revision 1.158 diff -u -d -r1.157 -r1.158 --- xmlparse.c 6 Jul 2006 02:50:27 -0000 1.157 +++ xmlparse.c 10 Jul 2006 18:59:52 -0000 1.158 @@ -2544,29 +2544,30 @@ } *nextPtr = end; return XML_ERROR_NONE; - case XML_TOK_DATA_CHARS: - if (MUST_CONVERT(enc, s)) { - for (;;) { - if (characterDataHandler) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = s; - characterDataHandler(handlerArg, dataBuf, - (int)(dataPtr - (ICHAR *)dataBuf)); - if (s == next) - break; - *eventPP = s; + case XML_TOK_DATA_CHARS: + { + XML_CharacterDataHandler charDataHandler = characterDataHandler; + if (charDataHandler) { + if (MUST_CONVERT(enc, s)) { + for (;;) { + ICHAR *dataPtr = (ICHAR *)dataBuf; + XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); + *eventEndPP = s; + charDataHandler(handlerArg, dataBuf, + (int)(dataPtr - (ICHAR *)dataBuf)); + if (s == next) + break; + *eventPP = s; + } } else - break; + charDataHandler(handlerArg, + (XML_Char *)s, + (int)((XML_Char *)next - (XML_Char *)s)); } + else if (defaultHandler) + reportDefault(parser, enc, s, next); } - else if (characterDataHandler) - characterDataHandler(handlerArg, - (XML_Char *)s, - (int)((XML_Char *)next - (XML_Char *)s)); - else if (defaultHandler) - reportDefault(parser, enc, s, next); break; case XML_TOK_PI: if (!reportProcessingInstruction(parser, enc, s, next)) @@ -3127,28 +3128,29 @@ reportDefault(parser, enc, s, next); break; case XML_TOK_DATA_CHARS: - if (MUST_CONVERT(enc, s)) { - for (;;) { - if (characterDataHandler) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = next; - characterDataHandler(handlerArg, dataBuf, - (int)(dataPtr - (ICHAR *)dataBuf)); - if (s == next) - break; - *eventPP = s; + { + XML_CharacterDataHandler charDataHandler = characterDataHandler; + if (charDataHandler) { + if (MUST_CONVERT(enc, s)) { + for (;;) { + ICHAR *dataPtr = (ICHAR *)dataBuf; + XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); + *eventEndPP = next; + charDataHandler(handlerArg, dataBuf, + (int)(dataPtr - (ICHAR *)dataBuf)); + if (s == next) + break; + *eventPP = s; + } } else - break; + charDataHandler(handlerArg, + (XML_Char *)s, + (int)((XML_Char *)next - (XML_Char *)s)); } + else if (defaultHandler) + reportDefault(parser, enc, s, next); } - else if (characterDataHandler) - characterDataHandler(handlerArg, - (XML_Char *)s, - (int)((XML_Char *)next - (XML_Char *)s)); - else if (defaultHandler) - reportDefault(parser, enc, s, next); break; case XML_TOK_INVALID: *eventPP = next;