From fdrake@users.sourceforge.net Thu Nov 8 20:05:02 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu Nov 8 20:05:02 2001 Subject: [Expat-checkins] CVS: expat/xmlwf Makefile.in,1.8,1.9 Message-ID: Update of /cvsroot/expat/expat/xmlwf In directory usw-pr-cvs1:/tmp/cvs-serv15364 Modified Files: Makefile.in Log Message: Define & use $(srcdir). Part of SF patch #465018. Index: Makefile.in =================================================================== RCS file: /cvsroot/expat/expat/xmlwf/Makefile.in,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Makefile.in 2001/08/23 09:24:45 1.8 --- Makefile.in 2001/11/09 04:04:55 1.9 *************** *** 19,24 **** # LIBDIR= ../lib/.libs ! INCDIR= ../lib LDFLAGS= @LDFLAGS@ -static --- 19,26 ---- # + srcdir=@srcdir@ + LIBDIR= ../lib/.libs ! INCDIR= $(srcdir)/../lib LDFLAGS= @LDFLAGS@ -static From fdrake@users.sourceforge.net Thu Nov 8 20:08:05 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu Nov 8 20:08:05 2001 Subject: [Expat-checkins] CVS: expat buildconf.sh,1.3,1.4 Message-ID: Update of /cvsroot/expat/expat In directory usw-pr-cvs1:/tmp/cvs-serv15877 Modified Files: buildconf.sh Log Message: Be more reliable about using the libtool version on the PATH when this script is run. Part of SF patch #465018. Index: buildconf.sh =================================================================== RCS file: /cvsroot/expat/expat/buildconf.sh,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** buildconf.sh 2001/08/23 11:27:26 1.3 --- buildconf.sh 2001/11/09 04:07:43 1.4 *************** *** 20,23 **** --- 20,24 ---- # --automake to make it shut up about "things to do" # + (cd conftools/; rm -f ltmain.sh ltconfig) $libtoolize --force --copy --automake From fdrake@users.sourceforge.net Thu Nov 8 20:09:01 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu Nov 8 20:09:01 2001 Subject: [Expat-checkins] CVS: expat/xmlwf readfilemap.c,1.7,1.8 Message-ID: Update of /cvsroot/expat/expat/xmlwf In directory usw-pr-cvs1:/tmp/cvs-serv16138/xmlwf Modified Files: readfilemap.c Log Message: Include header to avoid compiler warnings. Part of SF patch #465018. Index: readfilemap.c =================================================================== RCS file: /cvsroot/expat/expat/xmlwf/readfilemap.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** readfilemap.c 2000/09/21 21:20:18 1.7 --- readfilemap.c 2001/11/09 04:08:51 1.8 *************** *** 28,31 **** --- 28,33 ---- #endif + #include "filemap.h" + int filemap(const char *name, void (*processor)(const void *, size_t, const char *, void *arg), From fdrake@users.sourceforge.net Thu Nov 8 20:20:02 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu Nov 8 20:20:02 2001 Subject: [Expat-checkins] CVS: expat configure.in,1.24,1.25 Message-ID: Update of /cvsroot/expat/expat In directory usw-pr-cvs1:/tmp/cvs-serv18258 Modified Files: configure.in Log Message: Be more careful about deciding which filemap implementation to use for xmlwf. Part of SF patch #465018. Only add the -fexceptions option when the version of GCC we're using actually supports it. This relates to & partially solves SF bug #445893; see also SF bug #419585 for why the option was originally added. Index: configure.in =================================================================== RCS file: /cvsroot/expat/expat/configure.in,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** configure.in 2001/08/23 13:26:37 1.24 --- configure.in 2001/11/09 04:19:01 1.25 *************** *** 47,55 **** if test "$GCC" = yes ; then ! CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions" fi - dnl Checks for libraries. - dnl Checks for header files. AC_HEADER_STDC --- 47,63 ---- if test "$GCC" = yes ; then ! dnl ! dnl Be careful about adding the -fexceptions option; some versions of ! dnl don't support it and it causes extra warnings that are only ! dnl distracting; avoid. ! dnl ! OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes" ! CFLAGS="$OLDCFLAGS -fexceptions" ! AC_MSG_CHECKING(whether gcc accepts -fexceptions) ! AC_TRY_COMPILE(,(void)1, ! AC_MSG_RESULT(yes), ! AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS") fi dnl Checks for header files. AC_HEADER_STDC *************** *** 71,75 **** AC_FUNC_MMAP ! if test -z "$HAVE_MMAP"; then FILEMAP_OBJ=unixfilemap.o else --- 79,83 ---- AC_FUNC_MMAP ! if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then FILEMAP_OBJ=unixfilemap.o else From fdrake@users.sourceforge.net Thu Nov 8 20:56:02 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu Nov 8 20:56:02 2001 Subject: [Expat-checkins] CVS: expat/conftools expat.m4,NONE,1.1 Message-ID: Update of /cvsroot/expat/expat/conftools In directory usw-pr-cvs1:/tmp/cvs-serv24606/conftools Added Files: expat.m4 Log Message: autoconf probe macro to determine how to use Expat. Anonymous contribution: SF patch #438892. --- NEW FILE: expat.m4 --- dnl Check if --with-expat[=PREFIX] is specified and dnl Expat >= 1.95.0 is installed in the system. dnl If yes, substitute EXPAT_CFLAGS, EXPAT_LIBS with regard to dnl the specified PREFIX and set with_expat to PREFIX, or 'yes' if PREFIX dnl has not been specified. Also HAVE_LIBEXPAT, HAVE_EXPAT_H are defined. dnl If --with-expat has not been specified, set with_expat to 'no'. dnl In addition, an Automake conditional EXPAT_INSTALLED is set accordingly. dnl This is necessary to adapt a whole lot of packages that have expat dnl bundled as a static library. AC_DEFUN(AM_WITH_EXPAT, [ AC_ARG_WITH(expat, [ --with-expat=PREFIX Use system Expat library], , with_expat=no) AM_CONDITIONAL(EXPAT_INSTALLED, test $with_expat != no) EXPAT_CFLAGS= EXPAT_LIBS= if test $with_expat != no; then if test $with_expat != yes; then EXPAT_CFLAGS="-I$with_expat/include" EXPAT_LIBS="-L$with_expat/lib" fi AC_CHECK_LIB(expat, XML_ParserCreate, [ EXPAT_LIBS="$EXPAT_LIBS -lexpat" expat_found=yes ], [ expat_found=no ], "$EXPAT_LIBS") if test $expat_found = no; then AC_MSG_ERROR([Could not find the Expat library]) fi expat_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $EXPAT_CFLAGS" AC_CHECK_HEADERS(expat.h, , expat_found=no) if test $expat_found = no; then AC_MSG_ERROR([Could not find expat.h]) fi CFLAGS="$expat_save_CFLAGS" fi AC_SUBST(EXPAT_CFLAGS) AC_SUBST(EXPAT_LIBS) ]) From fdrake@users.sourceforge.net Thu Nov 8 20:58:02 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu Nov 8 20:58:02 2001 Subject: [Expat-checkins] CVS: expat README,1.11,1.12 Message-ID: Update of /cvsroot/expat/expat In directory usw-pr-cvs1:/tmp/cvs-serv25385 Modified Files: README Log Message: Added note about conftools/expat.m4. Index: README =================================================================== RCS file: /cvsroot/expat/expat/README,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** README 2001/07/27 20:34:52 1.11 --- README 2001/11/09 04:57:33 1.12 *************** *** 60,63 **** --- 60,68 ---- PATH=/usr/ccs/bin:$PATH make + When using Expat with a project using autoconf for configuration, you + can use the probing macro in conftools/expat.m4 to determine how to + include Expat. See the comments at the top of that file for more + information. + A reference manual is available in the file doc/reference.html in this distribution. From fdrake@users.sourceforge.net Fri Nov 9 12:22:01 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri Nov 9 12:22:01 2001 Subject: [Expat-checkins] CVS: htdocs index.html,1.3,1.4 Message-ID: Update of /cvsroot/expat/htdocs In directory usw-pr-cvs1:/tmp/cvs-serv5876 Modified Files: index.html Log Message: As long as SourceForge is changing their logo, we can look really slick too. A little geometric twiddle can take us a long way toward fame & fortune! ;-) Index: index.html =================================================================== RCS file: /cvsroot/expat/htdocs/index.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** index.html 2000/09/12 17:06:46 1.3 --- index.html 2001/11/09 20:21:10 1.4 *************** *** 10,35 **** ! SourceForge Logo -

Expat XML Parser

Expat is an XML parser library written in C. It is a stream-oriented parser in which an application registers handlers for things the parser might find in the XML document (like start tags). An ! introductory article ! on using expat is available on ! xml.com.

--- 10,47 ---- ! ! ! ! ! ! + +
SourceForge Logo 

Expat XML Parser

Expat is an XML parser library written in C. It is a stream-oriented parser in which an application registers handlers for things the parser might find in the XML document (like start tags). An ! introductory article on using expat is available on ! xml.com.

! *************** *** 39,42 **** --- 51,57 ---- community to participate on the mailing lists to help shape the future of Expat.

+
From fdrake@users.sourceforge.net Mon Nov 12 20:50:02 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon Nov 12 20:50:02 2001 Subject: [Expat-checkins] CVS: expat/tests runtests.c,1.1,1.2 Message-ID: Update of /cvsroot/expat/expat/tests In directory usw-pr-cvs1:/tmp/cvs-serv4714/tests Modified Files: runtests.c Log Message: Added a test that ensures the parser reports an out-of-place XML declaration. (Originally written to attempt to tickle a different bug, but useful as a regression test even though Expat has been doing the right thing.) Index: runtests.c =================================================================== RCS file: /cvsroot/expat/expat/tests/runtests.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** runtests.c 2001/08/17 19:16:41 1.1 --- runtests.c 2001/11/13 04:49:52 1.2 *************** *** 55,58 **** --- 55,79 ---- + START_TEST(test_xmldecl_misplaced) + { + char *text = + "\n" + "\n" + "&eee;"; + + if (parser == NULL) + fail("Parser not created."); + + if (!XML_Parse(parser, text, strlen(text), 1)) { + fail_unless(XML_GetErrorCode(parser) == XML_ERROR_MISPLACED_XML_PI, + "wrong error when XML declaration is misplaced"); + } + else { + fail("expected XML_ERROR_MISPLACED_XML_PI with misplaced XML decl"); + } + } + END_TEST + + static Suite * make_basic_suite(void) *************** *** 60,63 **** --- 81,85 ---- Suite *s = suite_create("basic"); TCase *tc_nulls = tcase_create("null characters"); + TCase *tc_xmldecl = tcase_create("XML declaration"); suite_add_tcase(s, tc_nulls); *************** *** 65,68 **** --- 87,94 ---- tcase_add_test(tc_nulls, test_nul_byte); tcase_add_test(tc_nulls, test_u0000_char); + + suite_add_tcase(s, tc_xmldecl); + tcase_set_fixture(tc_xmldecl, basic_setup, basic_teardown); + tcase_add_test(tc_xmldecl, test_xmldecl_misplaced); return s; From fdrake@users.sourceforge.net Mon Nov 12 21:05:01 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon Nov 12 21:05:01 2001 Subject: [Expat-checkins] CVS: expat/tests runtests.c,1.2,1.3 Message-ID: Update of /cvsroot/expat/expat/tests In directory usw-pr-cvs1:/tmp/cvs-serv7285/tests Modified Files: runtests.c Log Message: Update to work with check 0.8. Index: runtests.c =================================================================== RCS file: /cvsroot/expat/expat/tests/runtests.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** runtests.c 2001/11/13 04:49:52 1.2 --- runtests.c 2001/11/13 05:04:02 1.3 *************** *** 12,15 **** --- 12,17 ---- { parser = XML_ParserCreate("us-ascii"); + if (parser == NULL) + fail("Parser not created."); } *************** *** 27,33 **** char *text = "\0"; - if (parser == NULL) - fail("Parser not created."); - /* test that a NUL byte (in US-ASCII data) is an error */ if (XML_Parse(parser, text, 12, 1)) --- 29,32 ---- *************** *** 43,49 **** char *text = ""; - if (parser == NULL) - fail("Parser not created."); - /* test that a NUL byte (in US-ASCII data) is an error */ if (XML_Parse(parser, text, strlen(text), 1)) --- 42,45 ---- *************** *** 62,68 **** "&eee;"; - if (parser == NULL) - fail("Parser not created."); - if (!XML_Parse(parser, text, strlen(text), 1)) { fail_unless(XML_GetErrorCode(parser) == XML_ERROR_MISPLACED_XML_PI, --- 58,61 ---- *************** *** 84,93 **** suite_add_tcase(s, tc_nulls); ! tcase_set_fixture(tc_nulls, basic_setup, basic_teardown); tcase_add_test(tc_nulls, test_nul_byte); tcase_add_test(tc_nulls, test_u0000_char); suite_add_tcase(s, tc_xmldecl); ! tcase_set_fixture(tc_xmldecl, basic_setup, basic_teardown); tcase_add_test(tc_xmldecl, test_xmldecl_misplaced); --- 77,86 ---- suite_add_tcase(s, tc_nulls); ! tcase_add_checked_fixture(tc_nulls, basic_setup, basic_teardown); tcase_add_test(tc_nulls, test_nul_byte); tcase_add_test(tc_nulls, test_u0000_char); suite_add_tcase(s, tc_xmldecl); ! tcase_add_checked_fixture(tc_xmldecl, basic_setup, basic_teardown); tcase_add_test(tc_xmldecl, test_xmldecl_misplaced); *************** *** 100,104 **** { int nf; ! int verbosity = CRNORMAL; Suite *s = make_basic_suite(); SRunner *sr = srunner_create(s); --- 93,97 ---- { int nf; ! int verbosity = CK_NORMAL; Suite *s = make_basic_suite(); SRunner *sr = srunner_create(s); *************** *** 107,113 **** char *opt = argv[1]; if (strcmp(opt, "-v") == 0 || strcmp(opt, "--verbose") == 0) ! verbosity = CRVERBOSE; else if (strcmp(opt, "-q") == 0 || strcmp(opt, "--quiet") == 0) ! verbosity = CRSILENT; } srunner_run_all(sr, verbosity); --- 100,106 ---- char *opt = argv[1]; if (strcmp(opt, "-v") == 0 || strcmp(opt, "--verbose") == 0) ! verbosity = CK_VERBOSE; else if (strcmp(opt, "-q") == 0 || strcmp(opt, "--quiet") == 0) ! verbosity = CK_SILENT; } srunner_run_all(sr, verbosity); From fdrake@users.sourceforge.net Mon Nov 12 21:05:03 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon Nov 12 21:05:03 2001 Subject: [Expat-checkins] CVS: expat/tests README.txt,1.1,1.2 Message-ID: Update of /cvsroot/expat/expat/tests In directory usw-pr-cvs1:/tmp/cvs-serv7470/tests Modified Files: README.txt Log Message: Note that the tests need check 0.8 to work. Index: README.txt =================================================================== RCS file: /cvsroot/expat/expat/tests/README.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** README.txt 2001/08/17 19:16:41 1.1 --- README.txt 2001/11/13 05:04:51 1.2 *************** *** 9,13 **** http://check.sourceforge.net/ ! Check must be installed before the unit tests can be compiled & run. Since both Check and this test suite are young, it can all change in a --- 9,13 ---- http://check.sourceforge.net/ ! Check 0.8 must be installed before the unit tests can be compiled & run. Since both Check and this test suite are young, it can all change in a From fdrake@users.sourceforge.net Tue Nov 13 09:32:08 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue Nov 13 09:32:08 2001 Subject: [Expat-checkins] CVS: expat/tests runtests.c,1.3,1.4 Message-ID: Update of /cvsroot/expat/expat/tests In directory usw-pr-cvs1:/tmp/cvs-serv1219/tests Modified Files: runtests.c Log Message: Added tests that some basic encodings are recognized and the corresponding BOM marks do not cause core dumps. The UTF-8 BOM bug was fixed a while ago, but a regression test is always a good idea. Index: runtests.c =================================================================== RCS file: /cvsroot/expat/expat/tests/runtests.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** runtests.c 2001/11/13 05:04:02 1.3 --- runtests.c 2001/11/13 17:31:53 1.4 *************** *** 68,83 **** END_TEST static Suite * make_basic_suite(void) { Suite *s = suite_create("basic"); ! TCase *tc_nulls = tcase_create("null characters"); TCase *tc_xmldecl = tcase_create("XML declaration"); ! suite_add_tcase(s, tc_nulls); ! tcase_add_checked_fixture(tc_nulls, basic_setup, basic_teardown); ! tcase_add_test(tc_nulls, test_nul_byte); ! tcase_add_test(tc_nulls, test_u0000_char); suite_add_tcase(s, tc_xmldecl); --- 68,113 ---- END_TEST + START_TEST(test_bom_utf8) + { + /* This test is really just making sure we don't core on a UTF-8 BOM. */ + char *text = "\357\273\277"; + if (!XML_Parse(parser, text, strlen(text), 1)) + fail("false error reported for UTF-8 BOM"); + } + END_TEST + + START_TEST(test_bom_utf16_be) + { + char text[] = "\376\377\0<\0e\0/\0>"; + + if (!XML_Parse(parser, text, sizeof(text) - 1, 1)) + fail("false error reported for UTF-16-BE BOM"); + } + END_TEST + + START_TEST(test_bom_utf16_le) + { + char text[] = "\377\376<\0e\0/\0>\0"; + + if (!XML_Parse(parser, text, sizeof(text) - 1, 1)) + fail("false error reported for UTF-16-LE BOM"); + } + END_TEST + static Suite * make_basic_suite(void) { Suite *s = suite_create("basic"); ! TCase *tc_chars = tcase_create("character tests"); TCase *tc_xmldecl = tcase_create("XML declaration"); ! suite_add_tcase(s, tc_chars); ! tcase_add_checked_fixture(tc_chars, basic_setup, basic_teardown); ! tcase_add_test(tc_chars, test_nul_byte); ! tcase_add_test(tc_chars, test_u0000_char); ! tcase_add_test(tc_chars, test_bom_utf8); ! tcase_add_test(tc_chars, test_bom_utf16_be); ! tcase_add_test(tc_chars, test_bom_utf16_le); suite_add_tcase(s, tc_xmldecl); *************** *** 92,107 **** main(int argc, char *argv[]) { ! int nf; int verbosity = CK_NORMAL; Suite *s = make_basic_suite(); SRunner *sr = srunner_create(s); ! if (argc >= 2) { ! char *opt = argv[1]; if (strcmp(opt, "-v") == 0 || strcmp(opt, "--verbose") == 0) verbosity = CK_VERBOSE; else if (strcmp(opt, "-q") == 0 || strcmp(opt, "--quiet") == 0) verbosity = CK_SILENT; } srunner_run_all(sr, verbosity); nf = srunner_ntests_failed(sr); --- 122,148 ---- main(int argc, char *argv[]) { ! int i, nf; ! int forking = 0, forking_set = 0; int verbosity = CK_NORMAL; Suite *s = make_basic_suite(); SRunner *sr = srunner_create(s); ! for (i = 1; i < argc; ++i) { ! char *opt = argv[i]; if (strcmp(opt, "-v") == 0 || strcmp(opt, "--verbose") == 0) 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; + } } + if (forking_set) + srunner_set_fork_status(sr, forking ? CK_FORK : CK_NOFORK); srunner_run_all(sr, verbosity); nf = srunner_ntests_failed(sr); From fdrake@users.sourceforge.net Fri Nov 16 12:20:22 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri Nov 16 12:20:22 2001 Subject: [Expat-checkins] CVS: expat/tests runtests.c,1.4,1.5 Message-ID: Update of /cvsroot/expat/expat/tests In directory usw-pr-cvs1:/tmp/cvs-serv25991/tests Modified Files: runtests.c Log Message: Added a test to make sure that whitespace in ENTITIES, IDREFS, and NMTOKENS attributes is properly collapsed according to Section 3.3.3 of the spec. This is the first even slightly complicated test; boy are these painful in C! Had to add a test of a helper routine as well; that just uses assertions since the test framework should not be dealing with tests of the tester, just of Expat. Added a helper to make the failure messages more useful when Expat produces an unexpected error code; we now include the error message and location from Expat. This is mostly useful when developing a new test. Index: runtests.c =================================================================== RCS file: /cvsroot/expat/expat/tests/runtests.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** runtests.c 2001/11/13 17:31:53 1.4 --- runtests.c 2001/11/16 20:19:39 1.5 *************** *** 1,4 **** --- 1,6 ---- + #include #include #include + #include #include "expat.h" *************** *** 19,37 **** basic_teardown(void) { ! if (parser != NULL) { XML_ParserFree(parser); - } } START_TEST(test_nul_byte) { ! char *text = "\0"; /* test that a NUL byte (in US-ASCII data) is an error */ ! if (XML_Parse(parser, text, 12, 1)) fail("Parser did not report error on NUL-byte."); ! fail_unless(XML_GetErrorCode(parser) == XML_ERROR_INVALID_TOKEN, ! "Got wrong error code for NUL-byte in US-ASCII encoding."); } END_TEST --- 21,52 ---- basic_teardown(void) { ! if (parser != NULL) XML_ParserFree(parser); } + /* Generate a failure using the parser state to create an error message; + * this should be used when the parser reports and error we weren't + * expecting. + */ + static void + xml_failure(void) + { + char buffer[256]; + sprintf(buffer, "%s (line %d, offset %d)", + XML_ErrorString(XML_GetErrorCode(parser)), + XML_GetCurrentLineNumber(parser), + XML_GetCurrentColumnNumber(parser)); + fail(buffer); + } START_TEST(test_nul_byte) { ! char text[] = "\0"; /* test that a NUL byte (in US-ASCII data) is an error */ ! if (XML_Parse(parser, text, sizeof(text) - 1, 1)) fail("Parser did not report error on NUL-byte."); ! if (XML_GetErrorCode(parser) != XML_ERROR_INVALID_TOKEN) ! xml_failure(); } END_TEST *************** *** 45,50 **** if (XML_Parse(parser, text, strlen(text), 1)) fail("Parser did not report error on NUL-byte."); ! fail_unless(XML_GetErrorCode(parser) == XML_ERROR_BAD_CHAR_REF, ! "Got wrong error code for �."); } END_TEST --- 60,65 ---- if (XML_Parse(parser, text, strlen(text), 1)) fail("Parser did not report error on NUL-byte."); ! if (XML_GetErrorCode(parser) != XML_ERROR_BAD_CHAR_REF) ! xml_failure(); } END_TEST *************** *** 59,64 **** if (!XML_Parse(parser, text, strlen(text), 1)) { ! fail_unless(XML_GetErrorCode(parser) == XML_ERROR_MISPLACED_XML_PI, ! "wrong error when XML declaration is misplaced"); } else { --- 74,79 ---- if (!XML_Parse(parser, text, strlen(text), 1)) { ! if (XML_GetErrorCode(parser) != XML_ERROR_MISPLACED_XML_PI) ! xml_failure(); } else { *************** *** 74,78 **** if (!XML_Parse(parser, text, strlen(text), 1)) ! fail("false error reported for UTF-8 BOM"); } END_TEST --- 89,93 ---- if (!XML_Parse(parser, text, strlen(text), 1)) ! xml_failure(); } END_TEST *************** *** 83,87 **** if (!XML_Parse(parser, text, sizeof(text) - 1, 1)) ! fail("false error reported for UTF-16-BE BOM"); } END_TEST --- 98,102 ---- if (!XML_Parse(parser, text, sizeof(text) - 1, 1)) ! xml_failure(); } END_TEST *************** *** 92,99 **** if (!XML_Parse(parser, text, sizeof(text) - 1, 1)) ! fail("false error reported for UTF-16-LE BOM"); } END_TEST static Suite * make_basic_suite(void) --- 107,224 ---- if (!XML_Parse(parser, text, sizeof(text) - 1, 1)) ! xml_failure(); } END_TEST + + /* Helpers used by the following test; this checks any "attr" and "refs" + * attributes to make sure whitespace has been normalized. + */ + + /* Return true if whitespace has been normalized in a string, using + * the rules for attribute value normalization. The 'is_cdata' flag + * is needed since CDATA attributes don't need to have multiple + * whitespace characters collapsed to a single space, while other + * attribute data types do. (Section 3.3.3 of the recommendation.) + */ + static int + is_whitespace_normalized(const XML_Char *s, int is_cdata) + { + int blanks = 0; + int at_start = 1; + while (*s) { + if (*s == ' ') + ++blanks; + else if (*s == '\t' || *s == '\n' || *s == '\r') + return 0; + else { + if (at_start) { + at_start = 0; + if (blanks && !is_cdata) + /* illegal leading blanks */ + return 0; + } + else if (blanks > 1 && !is_cdata) + return 0; + blanks = 0; + } + ++s; + } + if (blanks && !is_cdata) + return 0; + return 1; + } + + /* Check the attribute whitespace checker: */ + static void + testhelper_is_whitespace_normalized(void) + { + assert(is_whitespace_normalized("abc", 0)); + assert(is_whitespace_normalized("abc", 1)); + assert(is_whitespace_normalized("abc def ghi", 0)); + assert(is_whitespace_normalized("abc def ghi", 1)); + assert(!is_whitespace_normalized(" abc def ghi", 0)); + assert(is_whitespace_normalized(" abc def ghi", 1)); + assert(!is_whitespace_normalized("abc def ghi", 0)); + assert(is_whitespace_normalized("abc def ghi", 1)); + assert(!is_whitespace_normalized("abc def ghi ", 0)); + assert(is_whitespace_normalized("abc def ghi ", 1)); + assert(!is_whitespace_normalized(" ", 0)); + assert(is_whitespace_normalized(" ", 1)); + assert(!is_whitespace_normalized("\t", 0)); + assert(!is_whitespace_normalized("\t", 1)); + assert(!is_whitespace_normalized("\n", 0)); + assert(!is_whitespace_normalized("\n", 1)); + assert(!is_whitespace_normalized("\r", 0)); + assert(!is_whitespace_normalized("\r", 1)); + assert(!is_whitespace_normalized("abc\t def", 1)); + } + + static void + check_attr_contains_normalized_whitespace(void *userdata, + const XML_Char *name, + const XML_Char **atts) + { + int i; + for (i = 0; atts[i] != NULL; i += 2) { + const XML_Char *attrname = atts[i]; + const XML_Char *value = atts[i + 1]; + if (strcmp("attr", attrname) == 0 + || strcmp("ents", attrname) == 0 + || strcmp("refs", attrname) == 0) { + if (!is_whitespace_normalized(value, 0)) { + char buffer[256]; + sprintf(buffer, "attribute value not normalized: %s='%s'", + attrname, value); + fail(buffer); + } + } + } + } + + START_TEST(test_attr_whitespace_normalization) + { + char *text = + "\n" + "]>\n" + "\n" + " \n" + " \n" + ""; + + XML_SetStartElementHandler(parser, + check_attr_contains_normalized_whitespace); + if (!XML_Parse(parser, text, strlen(text), 1)) + xml_failure(); + } + END_TEST + + static Suite * make_basic_suite(void) *************** *** 101,104 **** --- 226,230 ---- Suite *s = suite_create("basic"); TCase *tc_chars = tcase_create("character tests"); + TCase *tc_attrs = tcase_create("attributes"); TCase *tc_xmldecl = tcase_create("XML declaration"); *************** *** 111,114 **** --- 237,244 ---- tcase_add_test(tc_chars, test_bom_utf16_le); + suite_add_tcase(s, tc_attrs); + tcase_add_checked_fixture(tc_attrs, basic_setup, basic_teardown); + tcase_add_test(tc_attrs, test_attr_whitespace_normalization); + suite_add_tcase(s, tc_xmldecl); tcase_add_checked_fixture(tc_xmldecl, basic_setup, basic_teardown); *************** *** 127,130 **** --- 257,263 ---- Suite *s = make_basic_suite(); SRunner *sr = srunner_create(s); + + /* run the tests for internal helper functions */ + testhelper_is_whitespace_normalized(); for (i = 1; i < argc; ++i) { From fdrake@users.sourceforge.net Fri Nov 16 12:58:02 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri Nov 16 12:58:02 2001 Subject: [Expat-checkins] CVS: expat/lib xmlparse.c,1.24,1.25 Message-ID: Update of /cvsroot/expat/expat/lib In directory usw-pr-cvs1:/tmp/cvs-serv4072/lib Modified Files: xmlparse.c Log Message: prologProcessor(): Avoid segfault by making sure "next" is initialized; fix suggested by Tim Crook. This fixes (I think!) SF bug #226514. Removed extra "break". Index: xmlparse.c =================================================================== RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** xmlparse.c 2001/10/01 20:52:54 1.24 --- xmlparse.c 2001/11/16 20:57:30 1.25 *************** *** 2564,2568 **** const char **nextPtr) { ! const char *next; int tok = XmlPrologTok(encoding, s, end, &next); return doProlog(parser, encoding, s, end, tok, next, nextPtr); --- 2564,2568 ---- const char **nextPtr) { ! const char *next = s; int tok = XmlPrologTok(encoding, s, end, &next); return doProlog(parser, encoding, s, end, tok, next, nextPtr); *************** *** 3474,3478 **** if (!poolAppend(pool, enc, ptr, next)) return XML_ERROR_NO_MEMORY; - break; break; case XML_TOK_TRAILING_CR: --- 3474,3477 ---- From fdrake@users.sourceforge.net Sun Nov 18 06:16:42 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sun Nov 18 06:16:42 2001 Subject: [Expat-checkins] CVS: htdocs index.html,1.4,1.5 Message-ID: Update of /cvsroot/expat/htdocs In directory usw-pr-cvs1:/tmp/cvs-serv32540 Modified Files: index.html Log Message: Use the SF logo that has no box around the edge; it looks a bit cleaner. Index: index.html =================================================================== RCS file: /cvsroot/expat/htdocs/index.html,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** index.html 2001/11/09 20:21:10 1.4 --- index.html 2001/11/18 05:27:12 1.5 *************** *** 12,19 **** ! --- 12,19 ----
! SourceForge Logo
! From fdrake@users.sourceforge.net Sun Nov 18 06:50:32 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sun Nov 18 06:50:32 2001 Subject: [Expat-checkins] CVS: expat/tests runtests.c,1.5,1.6 Message-ID: Update of /cvsroot/expat/expat/tests In directory usw-pr-cvs1:/tmp/cvs-serv11037/tests Modified Files: runtests.c Log Message: Add a check for unknown command line options. Index: runtests.c =================================================================== RCS file: /cvsroot/expat/expat/tests/runtests.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** runtests.c 2001/11/16 20:19:39 1.5 --- runtests.c 2001/11/18 13:56:01 1.6 *************** *** 275,278 **** --- 275,282 ---- forking_set = 1; } + else { + fprintf(stderr, "runtests: unknown option '%s'\n", opt); + return 2; + } } if (forking_set)
! SourceForge Logo