apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r1002549 [13/14] - in /apr/apr-util/vendor/expat/current: ./ bcb5/ conftools/ doc/ examples/ lib/ tests/ vms/ win32/ xmlwf/
Date Wed, 29 Sep 2010 09:59:07 GMT
Added: apr/apr-util/vendor/expat/current/tests/runtests.c
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/tests/runtests.c?rev=1002549&view=auto
==============================================================================
--- apr/apr-util/vendor/expat/current/tests/runtests.c (added)
+++ apr/apr-util/vendor/expat/current/tests/runtests.c Wed Sep 29 09:59:04 2010
@@ -0,0 +1,1415 @@
+/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
+   See the file COPYING for copying permission.
+
+   runtest.c : run the Expat test suite
+*/
+
+#ifdef HAVE_EXPAT_CONFIG_H
+#include <expat_config.h>
+#endif
+
+#ifdef HAVE_CHECK_H
+#include <check.h>
+#else
+#error This test suite requires the 'check' unit test framework (http://check.sf.net/)
+#endif
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "expat.h"
+#include "chardata.h"
+
+
+static XML_Parser parser;
+
+
+static void
+basic_setup(void)
+{
+    parser = XML_ParserCreate(NULL);
+    if (parser == NULL)
+        fail("Parser not created.");
+}
+
+static void
+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 an error we weren't
+   expecting.
+*/
+static void
+_xml_failure(XML_Parser parser, const char *file, int line)
+{
+    char buffer[1024];
+    sprintf(buffer,
+            "\n    %s (line %d, offset %d)\n    reported from %s, line %d",
+            XML_ErrorString(XML_GetErrorCode(parser)),
+            XML_GetCurrentLineNumber(parser),
+            XML_GetCurrentColumnNumber(parser),
+            file, line);
+    _fail_unless(0, file, line, buffer);
+}
+
+#define xml_failure(parser) _xml_failure((parser), __FILE__, __LINE__)
+
+static void
+_expect_failure(char *text, enum XML_Error errorCode, char *errorMessage,
+                char *file, int lineno)
+{
+    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_OK)
+        /* Hackish use of _fail_unless() macro, but let's us report
+           the right filename and line number. */
+        _fail_unless(0, file, lineno, errorMessage);
+    if (XML_GetErrorCode(parser) != errorCode)
+        _xml_failure(parser, file, lineno);
+}
+
+#define expect_failure(text, errorCode, errorMessage) \
+        _expect_failure((text), (errorCode), (errorMessage), \
+                        __FILE__, __LINE__)
+
+/* Dummy handlers for when we need to set a handler to tickle a bug,
+   but it doesn't need to do anything.
+*/
+
+static void XMLCALL
+dummy_start_doctype_handler(void           *userData,
+                            const XML_Char *doctypeName,
+                            const XML_Char *sysid,
+                            const XML_Char *pubid,
+                            int            has_internal_subset)
+{}
+
+static void XMLCALL
+dummy_end_doctype_handler(void *userData)
+{}
+
+static void XMLCALL
+dummy_entity_decl_handler(void           *userData,
+                          const XML_Char *entityName,
+                          int            is_parameter_entity,
+                          const XML_Char *value,
+                          int            value_length,
+                          const XML_Char *base,
+                          const XML_Char *systemId,
+                          const XML_Char *publicId,
+                          const XML_Char *notationName)
+{}
+
+static void XMLCALL
+dummy_notation_decl_handler(void *userData,
+                            const XML_Char *notationName,
+                            const XML_Char *base,
+                            const XML_Char *systemId,
+                            const XML_Char *publicId)
+{}
+
+static void XMLCALL
+dummy_element_decl_handler(void *userData,
+                           const XML_Char *name,
+                           XML_Content *model)
+{}
+
+static void XMLCALL
+dummy_attlist_decl_handler(void           *userData,
+                           const XML_Char *elname,
+                           const XML_Char *attname,
+                           const XML_Char *att_type,
+                           const XML_Char *dflt,
+                           int            isrequired)
+{}
+
+static void XMLCALL
+dummy_comment_handler(void *userData, const XML_Char *data)
+{}
+
+static void XMLCALL
+dummy_pi_handler(void *userData, const XML_Char *target, const XML_Char *data)
+{}
+
+static void XMLCALL
+dummy_start_element(void *userData,
+                    const XML_Char *name, const XML_Char **atts)
+{}
+
+
+/*
+ * Character & encoding tests.
+ */
+
+START_TEST(test_nul_byte)
+{
+    char text[] = "<doc>\0</doc>";
+
+    /* test that a NUL byte (in US-ASCII data) is an error */
+    if (XML_Parse(parser, text, sizeof(text) - 1, XML_TRUE) == XML_STATUS_OK)
+        fail("Parser did not report error on NUL-byte.");
+    if (XML_GetErrorCode(parser) != XML_ERROR_INVALID_TOKEN)
+        xml_failure(parser);
+}
+END_TEST
+
+
+START_TEST(test_u0000_char)
+{
+    /* test that a NUL byte (in US-ASCII data) is an error */
+    expect_failure("<doc>&#0;</doc>",
+                   XML_ERROR_BAD_CHAR_REF,
+                   "Parser did not report error on NUL-byte.");
+}
+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<e/>";
+
+    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+}
+END_TEST
+
+START_TEST(test_bom_utf16_be)
+{
+    char text[] = "\376\377\0<\0e\0/\0>";
+
+    if (XML_Parse(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+}
+END_TEST
+
+START_TEST(test_bom_utf16_le)
+{
+    char text[] = "\377\376<\0e\0/\0>\0";
+
+    if (XML_Parse(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+}
+END_TEST
+
+static void XMLCALL
+accumulate_characters(void *userData, const XML_Char *s, int len)
+{
+    CharData_AppendXMLChars((CharData *)userData, s, len);
+}
+
+static void XMLCALL
+accumulate_attribute(void *userData, const XML_Char *name,
+                     const XML_Char **atts)
+{
+    CharData *storage = (CharData *)userData;
+    if (storage->count < 0 && atts != NULL && atts[0] != NULL) {
+        /* "accumulate" the value of the first attribute we see */
+        CharData_AppendXMLChars(storage, atts[1], -1);
+    }
+}
+
+
+static void
+_run_character_check(XML_Char *text, XML_Char *expected,
+                     const char *file, int line)
+{
+    CharData storage;
+
+    CharData_Init(&storage);
+    XML_SetUserData(parser, &storage);
+    XML_SetCharacterDataHandler(parser, accumulate_characters);
+    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+        _xml_failure(parser, file, line);
+    CharData_CheckXMLChars(&storage, expected);
+}
+
+#define run_character_check(text, expected) \
+        _run_character_check(text, expected, __FILE__, __LINE__)
+
+static void
+_run_attribute_check(XML_Char *text, XML_Char *expected,
+                     const char *file, int line)
+{
+    CharData storage;
+
+    CharData_Init(&storage);
+    XML_SetUserData(parser, &storage);
+    XML_SetStartElementHandler(parser, accumulate_attribute);
+    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+        _xml_failure(parser, file, line);
+    CharData_CheckXMLChars(&storage, expected);
+}
+
+#define run_attribute_check(text, expected) \
+        _run_attribute_check(text, expected, __FILE__, __LINE__)
+
+/* Regression test for SF bug #491986. */
+START_TEST(test_danish_latin1)
+{
+    char *text =
+        "<?xml version='1.0' encoding='iso-8859-1'?>\n"
+        "<e>Jørgen æøåÆØÅ</e>";
+    run_character_check(text,
+             "J\xC3\xB8rgen \xC3\xA6\xC3\xB8\xC3\xA5\xC3\x86\xC3\x98\xC3\x85");
+}
+END_TEST
+
+
+/* Regression test for SF bug #514281. */
+START_TEST(test_french_charref_hexidecimal)
+{
+    char *text =
+        "<?xml version='1.0' encoding='iso-8859-1'?>\n"
+        "<doc>&#xE9;&#xE8;&#xE0;&#xE7;&#xEA;&#xC8;</doc>";
+    run_character_check(text,
+                        "\xC3\xA9\xC3\xA8\xC3\xA0\xC3\xA7\xC3\xAA\xC3\x88");
+}
+END_TEST
+
+START_TEST(test_french_charref_decimal)
+{
+    char *text =
+        "<?xml version='1.0' encoding='iso-8859-1'?>\n"
+        "<doc>&#233;&#232;&#224;&#231;&#234;&#200;</doc>";
+    run_character_check(text,
+                        "\xC3\xA9\xC3\xA8\xC3\xA0\xC3\xA7\xC3\xAA\xC3\x88");
+}
+END_TEST
+
+START_TEST(test_french_latin1)
+{
+    char *text =
+        "<?xml version='1.0' encoding='iso-8859-1'?>\n"
+        "<doc>\xE9\xE8\xE0\xE7\xEa\xC8</doc>";
+    run_character_check(text,
+                        "\xC3\xA9\xC3\xA8\xC3\xA0\xC3\xA7\xC3\xAA\xC3\x88");
+}
+END_TEST
+
+START_TEST(test_french_utf8)
+{
+    char *text =
+        "<?xml version='1.0' encoding='utf-8'?>\n"
+        "<doc>\xC3\xA9</doc>";
+    run_character_check(text, "\xC3\xA9");
+}
+END_TEST
+
+/* Regression test for SF bug #600479.
+   XXX There should be a test that exercises all legal XML Unicode
+   characters as PCDATA and attribute value content, and XML Name
+   characters as part of element and attribute names.
+*/
+START_TEST(test_utf8_false_rejection)
+{
+    char *text = "<doc>\xEF\xBA\xBF</doc>";
+    run_character_check(text, "\xEF\xBA\xBF");
+}
+END_TEST
+
+/* Regression test for SF bug #477667.
+   This test assures that any 8-bit character followed by a 7-bit
+   character will not be mistakenly interpreted as a valid UTF-8
+   sequence.
+*/
+START_TEST(test_illegal_utf8)
+{
+    char text[100];
+    int i;
+
+    for (i = 128; i <= 255; ++i) {
+        sprintf(text, "<e>%ccd</e>", i);
+        if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_OK) {
+            sprintf(text,
+                    "expected token error for '%c' (ordinal %d) in UTF-8 text",
+                    i, i);
+            fail(text);
+        }
+        else if (XML_GetErrorCode(parser) != XML_ERROR_INVALID_TOKEN)
+            xml_failure(parser);
+        /* Reset the parser since we use the same parser repeatedly. */
+        XML_ParserReset(parser, NULL);
+    }
+}
+END_TEST
+
+START_TEST(test_utf16)
+{
+    /* <?xml version="1.0" encoding="UTF-16"?>
+       <doc a='123'>some text</doc>
+    */
+    char text[] =
+        "\000<\000?\000x\000m\000\154\000 \000v\000e\000r\000s\000i\000o"
+        "\000n\000=\000'\0001\000.\000\060\000'\000 \000e\000n\000c\000o"
+        "\000d\000i\000n\000g\000=\000'\000U\000T\000F\000-\0001\000\066"
+        "\000'\000?\000>\000\n"
+        "\000<\000d\000o\000c\000 \000a\000=\000'\0001\0002\0003\000'"
+        "\000>\000s\000o\000m\000e\000 \000t\000e\000x\000t\000<\000/"
+        "\000d\000o\000c\000>";
+    if (XML_Parse(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+}
+END_TEST
+
+START_TEST(test_utf16_le_epilog_newline)
+{
+    int first_chunk_bytes = 17;
+    char text[] = 
+        "\xFF\xFE"                      /* BOM */
+        "<\000e\000/\000>\000"          /* document element */
+        "\r\000\n\000\r\000\n\000";     /* epilog */
+
+    if (first_chunk_bytes >= sizeof(text) - 1)
+        fail("bad value of first_chunk_bytes");
+    if (  XML_Parse(parser, text, first_chunk_bytes, XML_FALSE)
+          == XML_STATUS_ERROR)
+        xml_failure(parser);
+    else {
+        enum XML_Status rc;
+        rc = XML_Parse(parser, text + first_chunk_bytes,
+                       sizeof(text) - first_chunk_bytes - 1, XML_TRUE);
+        if (rc == XML_STATUS_ERROR)
+            xml_failure(parser);
+    }
+}
+END_TEST
+
+/* Regression test for SF bug #481609, #774028. */
+START_TEST(test_latin1_umlauts)
+{
+    char *text =
+        "<?xml version='1.0' encoding='iso-8859-1'?>\n"
+        "<e a='ä ö ü &#228; &#246; &#252; &#x00E4; &#x0F6; &#xFC; >'\n"
+        "  >ä ö ü &#228; &#246; &#252; &#x00E4; &#x0F6; &#xFC; ></e>";
+    char *utf8 =
+        "\xC3\xA4 \xC3\xB6 \xC3\xBC "
+        "\xC3\xA4 \xC3\xB6 \xC3\xBC "
+        "\xC3\xA4 \xC3\xB6 \xC3\xBC >";
+    run_character_check(text, utf8);
+    XML_ParserReset(parser, NULL);
+    run_attribute_check(text, utf8);
+}
+END_TEST
+
+/* Regression test #1 for SF bug #653180. */
+START_TEST(test_line_number_after_parse)
+{  
+    char *text =
+        "<tag>\n"
+        "\n"
+        "\n</tag>";
+    int lineno;
+
+    if (XML_Parse(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+    lineno = XML_GetCurrentLineNumber(parser);
+    if (lineno != 4) {
+        char buffer[100];
+        sprintf(buffer, "expected 4 lines, saw %d", lineno);
+        fail(buffer);
+    }
+}
+END_TEST
+
+/* Regression test #2 for SF bug #653180. */
+START_TEST(test_column_number_after_parse)
+{
+    char *text = "<tag></tag>";
+    int colno;
+
+    if (XML_Parse(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+    colno = XML_GetCurrentColumnNumber(parser);
+    if (colno != 11) {
+        char buffer[100];
+        sprintf(buffer, "expected 11 columns, saw %d", colno);
+        fail(buffer);
+    }
+}
+END_TEST
+
+static void XMLCALL
+start_element_event_handler2(void *userData, const XML_Char *name,
+			     const XML_Char **attr)
+{
+    CharData *storage = (CharData *) userData;
+    char buffer[100];
+
+    sprintf(buffer, "<%s> at col:%d line:%d\n", name,
+	    XML_GetCurrentColumnNumber(parser),
+	    XML_GetCurrentLineNumber(parser));
+    CharData_AppendString(storage, buffer);
+}
+
+static void XMLCALL
+end_element_event_handler2(void *userData, const XML_Char *name)
+{
+    CharData *storage = (CharData *) userData;
+    char buffer[100];
+
+    sprintf(buffer, "</%s> at col:%d line:%d\n", name,
+	    XML_GetCurrentColumnNumber(parser),
+	    XML_GetCurrentLineNumber(parser));
+    CharData_AppendString(storage, buffer);
+}
+
+/* Regression test #3 for SF bug #653180. */
+START_TEST(test_line_and_column_numbers_inside_handlers)
+{
+    char *text =
+        "<a>\n"        /* Unix end-of-line */
+        "  <b>\r\n"    /* Windows end-of-line */
+        "    <c/>\r"   /* Mac OS end-of-line */
+        "  </b>\n"
+        "  <d>\n"
+        "    <f/>\n"
+        "  </d>\n"
+        "</a>";
+    char *expected =
+        "<a> at col:0 line:1\n"
+        "<b> at col:2 line:2\n"
+        "<c> at col:4 line:3\n"
+        "</c> at col:8 line:3\n"
+        "</b> at col:2 line:4\n"
+        "<d> at col:2 line:5\n"
+        "<f> at col:4 line:6\n"
+        "</f> at col:8 line:6\n"
+        "</d> at col:2 line:7\n"
+        "</a> at col:0 line:8\n";
+    CharData storage;
+
+    CharData_Init(&storage);
+    XML_SetUserData(parser, &storage);
+    XML_SetStartElementHandler(parser, start_element_event_handler2);
+    XML_SetEndElementHandler(parser, end_element_event_handler2);
+    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+
+    CharData_CheckString(&storage, expected); 
+}
+END_TEST
+
+/* Regression test #4 for SF bug #653180. */
+START_TEST(test_line_number_after_error)
+{
+    char *text =
+        "<a>\n"
+        "  <b>\n"
+        "  </a>";  /* missing </b> */
+    int lineno;
+    if (XML_Parse(parser, text, strlen(text), XML_FALSE) != XML_STATUS_ERROR)
+        fail("Expected a parse error");
+
+    lineno = XML_GetCurrentLineNumber(parser);
+    if (lineno != 3) {
+        char buffer[100];
+        sprintf(buffer, "expected 3 lines, saw %d", lineno);
+        fail(buffer);
+    }
+}
+END_TEST
+    
+/* Regression test #5 for SF bug #653180. */
+START_TEST(test_column_number_after_error)
+{
+    char *text =
+        "<a>\n"
+        "  <b>\n"
+        "  </a>";  /* missing </b> */
+    int colno;
+    if (XML_Parse(parser, text, strlen(text), XML_FALSE) != XML_STATUS_ERROR)
+        fail("Expected a parse error");
+
+    colno = XML_GetCurrentColumnNumber(parser);
+    if (colno != 4) { 
+        char buffer[100];
+        sprintf(buffer, "expected 4 columns, saw %d", colno);
+        fail(buffer);
+    }
+}
+END_TEST
+
+/* Regression test for SF bug #478332. */
+START_TEST(test_really_long_lines)
+{
+    /* This parses an input line longer than INIT_DATA_BUF_SIZE
+       characters long (defined to be 1024 in xmlparse.c).  We take a
+       really cheesy approach to building the input buffer, because
+       this avoids writing bugs in buffer-filling code.
+    */
+    char *text =
+        "<e>"
+        /* 64 chars */
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        /* until we have at least 1024 characters on the line: */
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "</e>";
+    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+}
+END_TEST
+
+
+/*
+ * Element event tests.
+ */
+
+static void XMLCALL
+end_element_event_handler(void *userData, const XML_Char *name)
+{
+    CharData *storage = (CharData *) userData;
+    CharData_AppendString(storage, "/");
+    CharData_AppendXMLChars(storage, name, -1);
+}
+
+START_TEST(test_end_element_events)
+{
+    char *text = "<a><b><c/></b><d><f/></d></a>";
+    char *expected = "/c/b/f/d/a";
+    CharData storage;
+
+    CharData_Init(&storage);
+    XML_SetUserData(parser, &storage);
+    XML_SetEndElementHandler(parser, end_element_event_handler);
+    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+    CharData_CheckString(&storage, expected);
+}
+END_TEST
+
+
+/*
+ * Attribute tests.
+ */
+
+/* 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 XMLCALL
+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 =
+        "<!DOCTYPE doc [\n"
+        "  <!ATTLIST doc\n"
+        "            attr NMTOKENS #REQUIRED\n"
+        "            ents ENTITIES #REQUIRED\n"
+        "            refs IDREFS   #REQUIRED>\n"
+        "]>\n"
+        "<doc attr='    a  b c\t\td\te\t' refs=' id-1   \t  id-2\t\t'  \n"
+        "     ents=' ent-1   \t\r\n"
+        "            ent-2  ' >\n"
+        "  <e id='id-1'/>\n"
+        "  <e id='id-2'/>\n"
+        "</doc>";
+
+    XML_SetStartElementHandler(parser,
+                               check_attr_contains_normalized_whitespace);
+    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+}
+END_TEST
+
+
+/*
+ * XML declaration tests.
+ */
+
+START_TEST(test_xmldecl_misplaced)
+{
+    expect_failure("\n"
+                   "<?xml version='1.0'?>\n"
+                   "<a/>",
+                   XML_ERROR_MISPLACED_XML_PI,
+                   "failed to report misplaced XML declaration");
+}
+END_TEST
+
+/* Regression test for SF bug #584832. */
+static int XMLCALL
+UnknownEncodingHandler(void *data,const XML_Char *encoding,XML_Encoding *info)
+{
+    if (strcmp(encoding,"unsupported-encoding") == 0) {
+        int i;
+        for (i = 0; i < 256; ++i)
+            info->map[i] = i;
+        info->data = NULL;
+        info->convert = NULL;
+        info->release = NULL;
+        return XML_STATUS_OK;
+    }
+    return XML_STATUS_ERROR;
+}
+
+START_TEST(test_unknown_encoding_internal_entity)
+{
+    char *text =
+        "<?xml version='1.0' encoding='unsupported-encoding'?>\n"
+        "<!DOCTYPE test [<!ENTITY foo 'bar'>]>\n"
+        "<test a='&foo;'/>";
+
+    XML_SetUnknownEncodingHandler(parser, UnknownEncodingHandler, NULL);
+    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+}
+END_TEST
+
+/* Regression test for SF bug #620106. */
+static int XMLCALL
+external_entity_loader_set_encoding(XML_Parser parser,
+                                    const XML_Char *context,
+                                    const XML_Char *base,
+                                    const XML_Char *systemId,
+                                    const XML_Char *publicId)
+{
+    /* This text says it's an unsupported encoding, but it's really
+       UTF-8, which we tell Expat using XML_SetEncoding().
+    */
+    char *text =
+        "<?xml encoding='iso-8859-3'?>"
+        "\xC3\xA9";
+    XML_Parser extparser;
+
+    extparser = XML_ExternalEntityParserCreate(parser, context, NULL);
+    if (extparser == NULL)
+        fail("Could not create external entity parser.");
+    if (!XML_SetEncoding(extparser, "utf-8"))
+        fail("XML_SetEncoding() ignored for external entity");
+    if (  XML_Parse(extparser, text, strlen(text), XML_TRUE)
+          == XML_STATUS_ERROR) {
+        xml_failure(parser);
+        return 0;
+    }
+    return 1;
+}
+
+START_TEST(test_ext_entity_set_encoding)
+{
+    char *text =
+        "<!DOCTYPE doc [\n"
+        "  <!ENTITY en SYSTEM 'http://xml.libexpat.org/dummy.ent'>\n"
+        "]>\n"
+        "<doc>&en;</doc>";
+
+    XML_SetExternalEntityRefHandler(parser,
+                                    external_entity_loader_set_encoding);
+    run_character_check(text, "\xC3\xA9");
+}
+END_TEST
+
+/* Test that no error is reported for unknown entities if we don't
+   read an external subset.  This was fixed in Expat 1.95.5.
+*/
+START_TEST(test_wfc_undeclared_entity_unread_external_subset) {
+    char *text =
+        "<!DOCTYPE doc SYSTEM 'foo'>\n"
+        "<doc>&entity;</doc>";
+
+    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+}
+END_TEST
+
+/* Test that an error is reported for unknown entities if we don't
+   have an external subset.
+*/
+START_TEST(test_wfc_undeclared_entity_no_external_subset) {
+    expect_failure("<doc>&entity;</doc>",
+                   XML_ERROR_UNDEFINED_ENTITY,
+                   "Parser did not report undefined entity w/out a DTD.");
+}
+END_TEST
+
+/* Test that an error is reported for unknown entities if we don't
+   read an external subset, but have been declared standalone.
+*/
+START_TEST(test_wfc_undeclared_entity_standalone) {
+    char *text =
+        "<?xml version='1.0' encoding='us-ascii' standalone='yes'?>\n"
+        "<!DOCTYPE doc SYSTEM 'foo'>\n"
+        "<doc>&entity;</doc>";
+
+    expect_failure(text,
+                   XML_ERROR_UNDEFINED_ENTITY,
+                   "Parser did not report undefined entity (standalone).");
+}
+END_TEST
+
+static int XMLCALL
+external_entity_loader(XML_Parser parser,
+                       const XML_Char *context,
+                       const XML_Char *base,
+                       const XML_Char *systemId,
+                       const XML_Char *publicId)
+{
+    char *text = (char *)XML_GetUserData(parser);
+    XML_Parser extparser;
+
+    extparser = XML_ExternalEntityParserCreate(parser, context, NULL);
+    if (extparser == NULL)
+        fail("Could not create external entity parser.");
+    if (  XML_Parse(extparser, text, strlen(text), XML_TRUE)
+          == XML_STATUS_ERROR) {
+        xml_failure(parser);
+        return XML_STATUS_ERROR;
+    }
+    return XML_STATUS_OK;
+}
+
+/* Test that an error is reported for unknown entities if we have read
+   an external subset, and standalone is true.
+*/
+START_TEST(test_wfc_undeclared_entity_with_external_subset_standalone) {
+    char *text =
+        "<?xml version='1.0' encoding='us-ascii' standalone='yes'?>\n"
+        "<!DOCTYPE doc SYSTEM 'foo'>\n"
+        "<doc>&entity;</doc>";
+    char *foo_text =
+        "<!ELEMENT doc (#PCDATA)*>";
+
+    XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);
+    XML_SetUserData(parser, foo_text);
+    XML_SetExternalEntityRefHandler(parser, external_entity_loader);
+    expect_failure(text,
+                   XML_ERROR_UNDEFINED_ENTITY,
+                   "Parser did not report undefined entity (external DTD).");
+}
+END_TEST
+
+/* Test that no error is reported for unknown entities if we have read
+   an external subset, and standalone is false.
+*/
+START_TEST(test_wfc_undeclared_entity_with_external_subset) {
+    char *text =
+        "<?xml version='1.0' encoding='us-ascii'?>\n"
+        "<!DOCTYPE doc SYSTEM 'foo'>\n"
+        "<doc>&entity;</doc>";
+    char *foo_text =
+        "<!ELEMENT doc (#PCDATA)*>";
+
+    XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);
+    XML_SetUserData(parser, foo_text);
+    XML_SetExternalEntityRefHandler(parser, external_entity_loader);
+    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+}
+END_TEST
+
+START_TEST(test_wfc_no_recursive_entity_refs)
+{
+    char *text =
+        "<!DOCTYPE doc [\n"
+        "  <!ENTITY entity '&#38;entity;'>\n"
+        "]>\n"
+        "<doc>&entity;</doc>";
+
+    expect_failure(text,
+                   XML_ERROR_RECURSIVE_ENTITY_REF,
+                   "Parser did not report recursive entity reference.");
+}
+END_TEST
+
+/* Regression test for SF bug #483514. */
+START_TEST(test_dtd_default_handling)
+{
+    char *text =
+        "<!DOCTYPE doc [\n"
+        "<!ENTITY e SYSTEM 'http://xml.libexpat.org/e'>\n"
+        "<!NOTATION n SYSTEM 'http://xml.libexpat.org/n'>\n"
+        "<!ELEMENT doc EMPTY>\n"
+        "<!ATTLIST doc a CDATA #IMPLIED>\n"
+        "<?pi in dtd?>\n"
+        "<!--comment in dtd-->\n"
+        "]><doc/>";
+
+    XML_SetDefaultHandler(parser, accumulate_characters);
+    XML_SetDoctypeDeclHandler(parser,
+                              dummy_start_doctype_handler,
+                              dummy_end_doctype_handler);
+    XML_SetEntityDeclHandler(parser, dummy_entity_decl_handler);
+    XML_SetNotationDeclHandler(parser, dummy_notation_decl_handler);
+    XML_SetElementDeclHandler(parser, dummy_element_decl_handler);
+    XML_SetAttlistDeclHandler(parser, dummy_attlist_decl_handler);
+    XML_SetProcessingInstructionHandler(parser, dummy_pi_handler);
+    XML_SetCommentHandler(parser, dummy_comment_handler);
+    run_character_check(text, "\n\n\n\n\n\n\n<doc/>");
+}
+END_TEST
+
+/* See related SF bug #673791.
+   When namespace processing is enabled, setting the namespace URI for
+   a prefix is not allowed; this test ensures that it *is* allowed
+   when namespace processing is not enabled.
+   (See Namespaces in XML, section 2.)
+*/
+START_TEST(test_empty_ns_without_namespaces)
+{
+    char *text =
+        "<doc xmlns:prefix='http://www.example.com/'>\n"
+        "  <e xmlns:prefix=''/>\n"
+        "</doc>";
+
+    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+}
+END_TEST
+
+
+/*
+ * Namespaces tests.
+ */
+
+static void
+namespace_setup(void)
+{
+    parser = XML_ParserCreateNS(NULL, ' ');
+    if (parser == NULL)
+        fail("Parser not created.");
+}
+
+static void
+namespace_teardown(void)
+{
+    basic_teardown();
+}
+
+/* Check that an element name and attribute name match the expected values.
+   The expected values are passed as an array reference of string pointers
+   provided as the userData argument; the first is the expected
+   element name, and the second is the expected attribute name.
+*/
+static void XMLCALL
+triplet_start_checker(void *userData, const XML_Char *name,
+                      const XML_Char **atts)
+{
+    char **elemstr = (char **)userData;
+    char buffer[1024];
+    if (strcmp(elemstr[0], name) != 0) {
+        sprintf(buffer, "unexpected start string: '%s'", name);
+        fail(buffer);
+    }
+    if (strcmp(elemstr[1], atts[0]) != 0) {
+        sprintf(buffer, "unexpected attribute string: '%s'", atts[0]);
+        fail(buffer);
+    }
+}
+
+/* Check that the element name passed to the end-element handler matches
+   the expected value.  The expected value is passed as the first element
+   in an array of strings passed as the userData argument.
+*/
+static void XMLCALL
+triplet_end_checker(void *userData, const XML_Char *name)
+{
+    char **elemstr = (char **)userData;
+    if (strcmp(elemstr[0], name) != 0) {
+        char buffer[1024];
+        sprintf(buffer, "unexpected end string: '%s'", name);
+        fail(buffer);
+    }
+}
+
+START_TEST(test_return_ns_triplet)
+{
+    char *text =
+        "<foo:e xmlns:foo='http://expat.sf.net/' bar:a='12'\n"
+        "       xmlns:bar='http://expat.sf.net/'></foo:e>";
+    char *elemstr[] = {
+        "http://expat.sf.net/ e foo",
+        "http://expat.sf.net/ a bar"
+    };
+    XML_SetReturnNSTriplet(parser, XML_TRUE);
+    XML_SetUserData(parser, elemstr);
+    XML_SetElementHandler(parser, triplet_start_checker, triplet_end_checker);
+    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+}
+END_TEST
+
+static void XMLCALL
+overwrite_start_checker(void *userData, const XML_Char *name,
+                        const XML_Char **atts)
+{
+    CharData *storage = (CharData *) userData;
+    CharData_AppendString(storage, "start ");
+    CharData_AppendXMLChars(storage, name, -1);
+    while (*atts != NULL) {
+        CharData_AppendString(storage, "\nattribute ");
+        CharData_AppendXMLChars(storage, *atts, -1);
+        atts += 2;
+    }
+    CharData_AppendString(storage, "\n");
+}
+
+static void XMLCALL
+overwrite_end_checker(void *userData, const XML_Char *name)
+{
+    CharData *storage = (CharData *) userData;
+    CharData_AppendString(storage, "end ");
+    CharData_AppendXMLChars(storage, name, -1);
+    CharData_AppendString(storage, "\n");
+}
+
+static void
+run_ns_tagname_overwrite_test(char *text, char *result)
+{
+    CharData storage;
+    CharData_Init(&storage);
+    XML_SetUserData(parser, &storage);
+    XML_SetElementHandler(parser,
+                          overwrite_start_checker, overwrite_end_checker);
+    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+    CharData_CheckString(&storage, result);
+}
+
+/* Regression test for SF bug #566334. */
+START_TEST(test_ns_tagname_overwrite)
+{
+    char *text =
+        "<n:e xmlns:n='http://xml.libexpat.org/'>\n"
+        "  <n:f n:attr='foo'/>\n"
+        "  <n:g n:attr2='bar'/>\n"
+        "</n:e>";
+    char *result =
+        "start http://xml.libexpat.org/ e\n"
+        "start http://xml.libexpat.org/ f\n"
+        "attribute http://xml.libexpat.org/ attr\n"
+        "end http://xml.libexpat.org/ f\n"
+        "start http://xml.libexpat.org/ g\n"
+        "attribute http://xml.libexpat.org/ attr2\n"
+        "end http://xml.libexpat.org/ g\n"
+        "end http://xml.libexpat.org/ e\n";
+    run_ns_tagname_overwrite_test(text, result);
+}
+END_TEST
+
+/* Regression test for SF bug #566334. */
+START_TEST(test_ns_tagname_overwrite_triplet)
+{
+    char *text =
+        "<n:e xmlns:n='http://xml.libexpat.org/'>\n"
+        "  <n:f n:attr='foo'/>\n"
+        "  <n:g n:attr2='bar'/>\n"
+        "</n:e>";
+    char *result =
+        "start http://xml.libexpat.org/ e n\n"
+        "start http://xml.libexpat.org/ f n\n"
+        "attribute http://xml.libexpat.org/ attr n\n"
+        "end http://xml.libexpat.org/ f n\n"
+        "start http://xml.libexpat.org/ g n\n"
+        "attribute http://xml.libexpat.org/ attr2 n\n"
+        "end http://xml.libexpat.org/ g n\n"
+        "end http://xml.libexpat.org/ e n\n";
+    XML_SetReturnNSTriplet(parser, XML_TRUE);
+    run_ns_tagname_overwrite_test(text, result);
+}
+END_TEST
+
+
+/* Regression test for SF bug #620343. */
+static void XMLCALL
+start_element_fail(void *userData,
+                   const XML_Char *name, const XML_Char **atts)
+{
+    /* We should never get here. */
+    fail("should never reach start_element_fail()");
+}
+
+static void XMLCALL
+start_ns_clearing_start_element(void *userData,
+                                const XML_Char *prefix,
+                                const XML_Char *uri)
+{
+    XML_SetStartElementHandler((XML_Parser) userData, NULL);
+}
+
+START_TEST(test_start_ns_clears_start_element)
+{
+    /* This needs to use separate start/end tags; using the empty tag
+       syntax doesn't cause the problematic path through Expat to be
+       taken.
+    */
+    char *text = "<e xmlns='http://xml.libexpat.org/'></e>";
+
+    XML_SetStartElementHandler(parser, start_element_fail);
+    XML_SetStartNamespaceDeclHandler(parser, start_ns_clearing_start_element);
+    XML_UseParserAsHandlerArg(parser);
+    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+}
+END_TEST
+
+/* Regression test for SF bug #616863. */
+static int XMLCALL
+external_entity_handler(XML_Parser parser,
+                        const XML_Char *context,
+                        const XML_Char *base,
+                        const XML_Char *systemId,
+                        const XML_Char *publicId) 
+{
+    int callno = 1 + (int)XML_GetUserData(parser);
+    char *text;
+    XML_Parser p2;
+
+    if (callno == 1)
+        text = ("<!ELEMENT doc (e+)>\n"
+                "<!ATTLIST doc xmlns CDATA #IMPLIED>\n"
+                "<!ELEMENT e EMPTY>\n");
+    else
+        text = ("<?xml version='1.0' encoding='us-ascii'?>"
+                "<e/>");
+
+    XML_SetUserData(parser, (void *) callno);
+    p2 = XML_ExternalEntityParserCreate(parser, context, NULL);
+    if (XML_Parse(p2, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) {
+        xml_failure(p2);
+        return 0;
+    }
+    XML_ParserFree(p2);
+    return 1;
+}
+
+START_TEST(test_default_ns_from_ext_subset_and_ext_ge)
+{
+    char *text =
+        "<?xml version='1.0'?>\n"
+        "<!DOCTYPE doc SYSTEM 'http://xml.libexpat.org/doc.dtd' [\n"
+        "  <!ENTITY en SYSTEM 'http://xml.libexpat.org/entity.ent'>\n"
+        "]>\n"
+        "<doc xmlns='http://xml.libexpat.org/ns1'>\n"
+        "&en;\n"
+        "</doc>";
+
+    XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);
+    XML_SetExternalEntityRefHandler(parser, external_entity_handler);
+    /* We actually need to set this handler to tickle this bug. */
+    XML_SetStartElementHandler(parser, dummy_start_element);
+    XML_SetUserData(parser, NULL);
+    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+}
+END_TEST
+
+/* Regression test #1 for SF bug #673791. */
+START_TEST(test_ns_prefix_with_empty_uri_1)
+{
+    char *text =
+        "<doc xmlns:prefix='http://xml.libexpat.org/'>\n"
+        "  <e xmlns:prefix=''/>\n"
+        "</doc>";
+
+    expect_failure(text,
+                   XML_ERROR_SYNTAX,
+                   "Did not report re-setting namespace"
+                   " URI with prefix to ''.");
+}
+END_TEST
+
+/* Regression test #2 for SF bug #673791. */
+START_TEST(test_ns_prefix_with_empty_uri_2)
+{
+    char *text =
+        "<?xml version='1.0'?>\n"
+        "<docelem xmlns:pre=''/>";
+
+    expect_failure(text,
+                   XML_ERROR_SYNTAX,
+                   "Did not report setting namespace URI with prefix to ''.");
+}
+END_TEST
+
+/* Regression test #3 for SF bug #673791. */
+START_TEST(test_ns_prefix_with_empty_uri_3)
+{
+    char *text =
+        "<!DOCTYPE doc [\n"
+        "  <!ELEMENT doc EMPTY>\n"
+        "  <!ATTLIST doc\n"
+        "    xmlns:prefix CDATA ''>\n"
+        "]>\n"
+        "<doc/>";
+
+    expect_failure(text,
+                   XML_ERROR_SYNTAX,
+                   "Didn't report attr default setting NS w/ prefix to ''.");
+}
+END_TEST
+
+/* Regression test #4 for SF bug #673791. */
+START_TEST(test_ns_prefix_with_empty_uri_4)
+{
+    char *text =
+        "<!DOCTYPE doc [\n"
+        "  <!ELEMENT prefix:doc EMPTY>\n"
+        "  <!ATTLIST prefix:doc\n"
+        "    xmlns:prefix CDATA 'http://xml.libexpat.org/'>\n"
+        "]>\n"
+        "<prefix:doc/>";
+    /* Packaged info expected by the end element handler;
+       the weird structuring lets us re-use the triplet_end_checker()
+       function also used for another test. */
+    char *elemstr[] = {
+        "http://xml.libexpat.org/ doc prefix"
+    };
+    XML_SetReturnNSTriplet(parser, XML_TRUE);
+    XML_SetUserData(parser, elemstr);
+    XML_SetEndElementHandler(parser, triplet_end_checker);
+    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+}
+END_TEST
+
+START_TEST(test_ns_default_with_empty_uri)
+{
+    char *text =
+        "<doc xmlns='http://xml.libexpat.org/'>\n"
+        "  <e xmlns=''/>\n"
+        "</doc>";
+    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+        xml_failure(parser);
+}
+END_TEST
+
+/* Regression test for SF bug #692964: two prefixes for one namespace. */
+START_TEST(test_ns_duplicate_attrs_diff_prefixes)
+{
+    char *text =
+        "<doc xmlns:a='http://xml.libexpat.org/a'\n"
+        "     xmlns:b='http://xml.libexpat.org/a'\n"
+        "     a:a='v' b:a='v' />";
+    expect_failure(text,
+                   XML_ERROR_DUPLICATE_ATTRIBUTE,
+                   "did not report multiple attributes with same URI+name");
+}
+END_TEST
+
+/* Regression test for SF bug #695401: unbound prefix. */
+START_TEST(test_ns_unbound_prefix_on_attribute)
+{
+    char *text = "<doc a:attr=''/>";
+    expect_failure(text,
+                   XML_ERROR_UNBOUND_PREFIX,
+                   "did not report unbound prefix on attribute");
+}
+END_TEST
+
+/* Regression test for SF bug #695401: unbound prefix. */
+START_TEST(test_ns_unbound_prefix_on_element)
+{
+    char *text = "<a:doc/>";
+    expect_failure(text,
+                   XML_ERROR_UNBOUND_PREFIX,
+                   "did not report unbound prefix on element");
+}
+END_TEST
+
+static Suite *
+make_suite(void)
+{
+    Suite *s = suite_create("basic");
+    TCase *tc_basic = tcase_create("basic tests");
+    TCase *tc_namespace = tcase_create("XML namespaces");
+
+    suite_add_tcase(s, tc_basic);
+    tcase_add_checked_fixture(tc_basic, basic_setup, basic_teardown);
+    tcase_add_test(tc_basic, test_nul_byte);
+    tcase_add_test(tc_basic, test_u0000_char);
+    tcase_add_test(tc_basic, test_bom_utf8);
+    tcase_add_test(tc_basic, test_bom_utf16_be);
+    tcase_add_test(tc_basic, test_bom_utf16_le);
+    tcase_add_test(tc_basic, test_illegal_utf8);
+    tcase_add_test(tc_basic, test_utf16);
+    tcase_add_test(tc_basic, test_utf16_le_epilog_newline);
+    tcase_add_test(tc_basic, test_latin1_umlauts);
+    /* Regression test for SF bug #491986. */
+    tcase_add_test(tc_basic, test_danish_latin1);
+    /* Regression test for SF bug #514281. */
+    tcase_add_test(tc_basic, test_french_charref_hexidecimal);
+    tcase_add_test(tc_basic, test_french_charref_decimal);
+    tcase_add_test(tc_basic, test_french_latin1);
+    tcase_add_test(tc_basic, test_french_utf8);
+    tcase_add_test(tc_basic, test_utf8_false_rejection);
+    tcase_add_test(tc_basic, test_line_number_after_parse);
+    tcase_add_test(tc_basic, test_column_number_after_parse);
+    tcase_add_test(tc_basic, test_line_and_column_numbers_inside_handlers);
+    tcase_add_test(tc_basic, test_line_number_after_error);
+    tcase_add_test(tc_basic, test_column_number_after_error);
+    tcase_add_test(tc_basic, test_really_long_lines);
+    tcase_add_test(tc_basic, test_end_element_events);
+    tcase_add_test(tc_basic, test_attr_whitespace_normalization);
+    tcase_add_test(tc_basic, test_xmldecl_misplaced);
+    tcase_add_test(tc_basic, test_unknown_encoding_internal_entity);
+    tcase_add_test(tc_basic,
+                   test_wfc_undeclared_entity_unread_external_subset);
+    tcase_add_test(tc_basic, test_wfc_undeclared_entity_no_external_subset);
+    tcase_add_test(tc_basic, test_wfc_undeclared_entity_standalone);
+    tcase_add_test(tc_basic, test_wfc_undeclared_entity_with_external_subset);
+    tcase_add_test(tc_basic,
+                   test_wfc_undeclared_entity_with_external_subset_standalone);
+    tcase_add_test(tc_basic, test_wfc_no_recursive_entity_refs);
+    tcase_add_test(tc_basic, test_ext_entity_set_encoding);
+    tcase_add_test(tc_basic, test_dtd_default_handling);
+    tcase_add_test(tc_basic, test_empty_ns_without_namespaces);
+
+    suite_add_tcase(s, tc_namespace);
+    tcase_add_checked_fixture(tc_namespace,
+                              namespace_setup, namespace_teardown);
+    tcase_add_test(tc_namespace, test_return_ns_triplet);
+    tcase_add_test(tc_namespace, test_ns_tagname_overwrite);
+    tcase_add_test(tc_namespace, test_ns_tagname_overwrite_triplet);
+    tcase_add_test(tc_namespace, test_start_ns_clears_start_element);
+    tcase_add_test(tc_namespace, test_default_ns_from_ext_subset_and_ext_ge);
+    tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_1);
+    tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_2);
+    tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_3);
+    tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_4);
+    tcase_add_test(tc_namespace, test_ns_default_with_empty_uri);
+    tcase_add_test(tc_namespace, test_ns_duplicate_attrs_diff_prefixes);
+    tcase_add_test(tc_namespace, test_ns_unbound_prefix_on_attribute);
+    tcase_add_test(tc_namespace, test_ns_unbound_prefix_on_element);
+
+    return s;
+}
+
+
+int
+main(int argc, char *argv[])
+{
+    int i, nf;
+    int forking = 0, forking_set = 0;
+    int verbosity = CK_NORMAL;
+    Suite *s = make_suite();
+    SRunner *sr = srunner_create(s);
+
+    /* run the tests for internal helper functions */
+    testhelper_is_whitespace_normalized();
+
+    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;
+        }
+        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);
+    nf = srunner_ntests_failed(sr);
+    srunner_free(sr);
+    suite_free(s);
+
+    return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+}

Added: apr/apr-util/vendor/expat/current/tests/xmltest.sh
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/tests/xmltest.sh?rev=1002549&view=auto
==============================================================================
--- apr/apr-util/vendor/expat/current/tests/xmltest.sh (added)
+++ apr/apr-util/vendor/expat/current/tests/xmltest.sh Wed Sep 29 09:59:04 2010
@@ -0,0 +1,137 @@
+#! /bin/sh
+
+#   EXPAT TEST SCRIPT FOR W3C XML TEST SUITE
+
+# This script can be used to exercise Expat against the
+# w3c.org xml test suite, available from
+# http://www.w3.org/XML/Test/xmlts20020606.zip.
+
+# To run this script, first set XMLWF so that xmlwf can be
+# found, then set the output directory with OUTPUT.
+
+# The script lists all test cases where Expat shows a discrepancy
+# from the expected result. Test cases where only the canonical
+# output differs are prefixed with "Output differs:", and a diff file
+# is generated in the appropriate subdirectory under $OUTPUT.
+
+# If there are output files provided, the script will use
+# output from xmlwf and compare the desired output against it.
+# However, one has to take into account that the canonical output
+# produced by xmlwf conforms to an older definition of canonical XML
+# and does not generate notation declarations.
+
+MYDIR="`dirname \"$0\"`"
+cd "$MYDIR"
+MYDIR="`pwd`"
+XMLWF="`dirname \"$MYDIR\"`/xmlwf/xmlwf"
+# XMLWF=/usr/local/bin/xmlwf
+TS="$MYDIR/XML-Test-Suite"
+# OUTPUT must terminate with the directory separator.
+OUTPUT="$TS/out/"
+# OUTPUT=/home/tmp/xml-testsuite-out/
+
+
+RunXmlwfNotWF() {
+  $XMLWF $1 $2 > outfile || return $?
+  read outdata < outfile
+  if test "$outdata" = "" ; then
+      echo "Well formed: $3$2"
+      return 1
+  else
+      return 0
+  fi 
+}
+
+RunXmlwfWF() {
+  $XMLWF $1 -d "$OUTPUT$3" $2 > outfile || return $?
+  read outdata < outfile 
+  if test "$outdata" = "" ; then 
+      if [ -f out/$2 ] ; then 
+          diff "$OUTPUT$3$2" out/$2 > outfile 
+          if [ -s outfile ] ; then 
+              cp outfile $OUTPUT$3${2}.diff 
+              echo "Output differs: $3$2"
+              return 1
+          fi 
+      fi 
+      return 0
+  else 
+      echo "In $3: $outdata"
+      return 1
+  fi 
+}
+
+SUCCESS=0
+ERROR=0
+
+##########################
+# well-formed test cases #
+##########################
+
+cd "$TS/xmlconf"
+for xmldir in ibm/valid/P*/ \
+              ibm/invalid/P*/ \
+              xmltest/valid/ext-sa/ \
+              xmltest/valid/not-sa/ \
+              xmltest/invalid/ \
+              xmltest/invalid/not-sa/ \
+              xmltest/valid/sa/ \
+              sun/valid/ \
+              sun/invalid/ ; do
+  cd "$TS/xmlconf/$xmldir"
+  mkdir -p "$OUTPUT$xmldir"
+  for xmlfile in *.xml ; do
+      if RunXmlwfWF -p "$xmlfile" "$xmldir" ; then
+          SUCCESS=`expr $SUCCESS + 1`
+      else
+          ERROR=`expr $ERROR + 1`
+      fi
+  done
+  rm outfile
+done
+
+cd "$TS/xmlconf/oasis"
+mkdir -p "$OUTPUT"oasis/
+for xmlfile in *pass*.xml ; do
+    if RunXmlwfWF -p "$xmlfile" "oasis/" ; then
+        SUCCESS=`expr $SUCCESS + 1`
+    else
+        ERROR=`expr $ERROR + 1`
+    fi
+done
+rm outfile
+
+##############################
+# not well-formed test cases #
+##############################
+
+cd "$TS/xmlconf"
+for xmldir in ibm/not-wf/P*/ \
+              ibm/not-wf/misc/ \
+              xmltest/not-wf/ext-sa/ \
+              xmltest/not-wf/not-sa/ \
+              xmltest/not-wf/sa/ \
+              sun/not-wf/ ; do
+  cd "$TS/xmlconf/$xmldir"
+  for xmlfile in *.xml ; do
+      if RunXmlwfNotWF -p "$xmlfile" "$xmldir" ; then
+          SUCCESS=`expr $SUCCESS + 1`
+      else
+          ERROR=`expr $ERROR + 1`
+      fi
+  done
+  rm outfile
+done
+
+cd "$TS/xmlconf/oasis"
+for xmlfile in *fail*.xml ; do
+    if RunXmlwfNotWF -p "$xmlfile" "oasis/" ; then
+        SUCCESS=`expr $SUCCESS + 1`
+    else
+        ERROR=`expr $ERROR + 1`
+    fi
+done
+rm outfile
+
+echo "Passed: $SUCCESS"
+echo "Failed: $ERROR"

Propchange: apr/apr-util/vendor/expat/current/tests/xmltest.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: apr/apr-util/vendor/expat/current/vms/README.vms
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/vms/README.vms?rev=1002549&view=auto
==============================================================================
--- apr/apr-util/vendor/expat/current/vms/README.vms (added)
+++ apr/apr-util/vendor/expat/current/vms/README.vms Wed Sep 29 09:59:04 2010
@@ -0,0 +1,23 @@
+4-jun-2002	Craig A. Berry
+		Added rudimentary build procedures for 
+		OpenVMS based on work by Martin Vorlaender.
+
+
+You'll need MMS or its freeware equivalent MMK.  Just go to the 
+top-level directory and type
+
+$ MMS/DESCRIPTION=[.vms]
+ 
+  or
+
+$ MMK/DESCRIPTION=[.vms]
+
+You'll end up with the object library expat.olb.  For now, installation
+consists merely of copying the object library, include files, and
+documentation to a suitable location.  
+
+To-do list:
+
+	-- create a shareable image
+	-- build and run the tests and build the xmlwf utility
+	-- create an install target

Added: apr/apr-util/vendor/expat/current/vms/descrip.mms
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/vms/descrip.mms?rev=1002549&view=auto
==============================================================================
--- apr/apr-util/vendor/expat/current/vms/descrip.mms (added)
+++ apr/apr-util/vendor/expat/current/vms/descrip.mms Wed Sep 29 09:59:04 2010
@@ -0,0 +1,70 @@
+# Bare bones description file (Makefile) for OpenVMS
+
+PACKAGE = expat
+VERSION = 1.95.3
+EXPAT_MAJOR_VERSION=1
+EXPAT_MINOR_VERSION=95
+EXPAT_EDIT=3
+
+O = .obj
+OLB = .olb
+ 
+LIBRARY = expat$(OLB)
+LIBDIR = [.lib]
+SOURCES = $(LIBDIR)xmlparse.c $(LIBDIR)xmltok.c $(LIBDIR)xmlrole.c
+OBJECTS = xmlparse$(O) xmltok$(O) xmlrole$(O)
+ 
+TEMPLATES = xmltok_impl.c xmltok_ns.c
+APIHEADER = $(LIBDIR)expat.h
+HEADERS = $(LIBDIR)ascii.h $(LIBDIR)iasciitab.h $(LIBDIR)utf8tab.h $(LIBDIR)xmltok.h \
+	$(LIBDIR)asciitab.h $(LIBDIR)latin1tab.h \
+	$(LIBDIR)nametab.h $(LIBDIR)xmldef.h $(LIBDIR)xmlrole.h $(LIBDIR)xmltok_impl.h
+ 
+CONFIG_HEADER = expat_config.h
+INCLUDES = /INCLUDE=([],[.lib])
+DEFS = /DEFINE=(PACKAGE="""$(PACKAGE)""",VERSION="""$(PACKAGE)_$(VERSION)""")
+LIBREVISION = 0
+LIBCURRENT  = 1
+LIBAGE      = 0
+# 
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
+# 
+# DISTFILES = $(DIST_COMMON) $(SOURCES) $(TEMPLATES) $(APIHEADER) $(HEADERS) 
+# 
+# TAR = gtar
+# GZIP_ENV = --best
+# 
+.FIRST :
+       IF F$SEARCH("$(LIBRARY)") .EQS. "" THEN $(LIBR) /CREATE /OBJECT $(LIBRARY)
+
+all : $(LIBRARY)
+        @ write sys$output "All made."
+ 
+.SUFFIXES : 
+.SUFFIXES : $(OLB) $(O) .C .H  
+ 
+.c$(O) :
+       $(COMPILE) $(MMS$SOURCE)
+ 
+$(O)$(OLB) :
+        @ IF F$SEARCH("$(MMS$TARGET)") .EQS. "" -
+                THEN LIBRARY/CREATE/LOG $(MMS$TARGET)
+        @ LIBRARY /REPLACE /LOG $(MMS$TARGET) $(MMS$SOURCE)
+ 
+clean :
+       DELETE $(LIBRARY);*,*$(O);*
+ 
+$(LIBRARY) : $(LIBRARY)( $(OBJECTS) ) 
+       $(LIBR) /COMPRESS $(MMS$TARGET)
+
+$(CONFIG_HEADER) : [.vms]expat_config.h
+        COPY/LOG $(MMS$SOURCE) $(MMS$TARGET)
+
+xmlparse$(O) : $(LIBDIR)xmlparse.c $(LIBDIR)expat.h $(LIBDIR)xmlrole.h $(LIBDIR)xmltok.h $(CONFIG_HEADER)
+ 
+xmlrole$(O) : $(LIBDIR)xmlrole.c $(LIBDIR)ascii.h $(LIBDIR)xmlrole.h $(CONFIG_HEADER)
+ 
+xmltok$(O) : $(LIBDIR)xmltok.c $(LIBDIR)xmltok_impl.c $(LIBDIR)xmltok_ns.c \
+        $(LIBDIR)ascii.h $(LIBDIR)asciitab.h $(LIBDIR)iasciitab.h $(LIBDIR)latin1tab.h \
+	$(LIBDIR)nametab.h $(LIBDIR)utf8tab.h $(LIBDIR)xmltok.h $(LIBDIR)xmltok_impl.h $(CONFIG_HEADER)
+

Added: apr/apr-util/vendor/expat/current/vms/expat_config.h
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/vms/expat_config.h?rev=1002549&view=auto
==============================================================================
--- apr/apr-util/vendor/expat/current/vms/expat_config.h (added)
+++ apr/apr-util/vendor/expat/current/vms/expat_config.h Wed Sep 29 09:59:04 2010
@@ -0,0 +1,61 @@
+/* Copyright 2000, Clark Cooper
+   All rights reserved.
+
+   This is free software. You are permitted to copy, distribute, or modify
+   it under the terms of the MIT/X license (contained in the COPYING file
+   with this distribution.)
+*/
+
+/* Define to empty if the keyword does not work.  */
+#undef const
+
+/* Define if you have a working `mmap' system call.  */
+#undef HAVE_MMAP
+
+/* Define to `long' if <sys/types.h> doesn't define.  */
+#undef off_t
+
+/* Define to `unsigned' if <sys/types.h> doesn't define.  */
+#undef size_t
+
+/* Define if you have the ANSI C header files.  */
+#define STDC_HEADERS 1
+
+/* Define if your processor stores words with the most significant
+   byte first (like Motorola and SPARC, unlike Intel and VAX).  */
+#undef WORDS_BIGENDIAN
+
+/* Define if you have the bcopy function.  */
+#undef HAVE_BCOPY
+
+/* Define if you have the getpagesize function.  */
+#undef HAVE_GETPAGESIZE
+
+/* Define if you have the memmove function.  */
+#define HAVE_MEMMOVE 1
+
+/* Define if you have the <fcntl.h> header file.  */
+#undef HAVE_FCNTL_H
+
+/* Define if you have the <unistd.h> header file.  */
+#define HAVE_UNISTD_H 1
+
+#define XML_NS
+#define XML_DTD
+
+#ifdef WORDS_BIGENDIAN
+#define XML_BYTE_ORDER 21
+#else
+#define XML_BYTE_ORDER 12
+#endif
+
+#define XML_CONTEXT_BYTES 1024
+
+#ifndef HAVE_MEMMOVE
+#ifdef HAVE_BCOPY
+#define memmove(d,s,l) bcopy((s),(d),(l))
+#else
+#define memmove(d,s,l) ;punting on memmove;
+#endif
+
+#endif

Added: apr/apr-util/vendor/expat/current/win32/MANIFEST.txt
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/win32/MANIFEST.txt?rev=1002549&view=auto
==============================================================================
--- apr/apr-util/vendor/expat/current/win32/MANIFEST.txt (added)
+++ apr/apr-util/vendor/expat/current/win32/MANIFEST.txt Wed Sep 29 09:59:04 2010
@@ -0,0 +1,29 @@
+                     Overview of the Expat distribution
+
+The Expat distribution creates several subdirectories on your system.
+Some of these directories contain components of interest to all Expat
+users, and some contain material of interest to developers who wish to
+use Expat in their applications.  In the list below, <top> is the
+directory you specified to the installer.
+
+    Directory           Contents
+    --------------------------------------------------------------------
+    <top>\              The XML well-formedness checker and some general
+                        information files.
+
+    <top>\Doc\          API documentation for developers.
+
+    <top>\Libs\         Pre-compiled dynamic libraries for developers.
+
+    <top>\StaticLibs\   Pre-compiled static libraries for developers.
+
+    <top>\Source\       Source code, which may interest some developers,
+                        including a workspace for Microsft Visual C++.
+                        The source code includes the parser, the well-
+                        formedness checker, and a couple of small sample
+                        applications.
+
+    <top>\Source\bcb5\  Project files for Borland C++ Builder 5 and BCC
+                        5.5.
+
+    <top>\Unistall\     The uninstaller and its data files.

Added: apr/apr-util/vendor/expat/current/win32/expat.iss
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/win32/expat.iss?rev=1002549&view=auto
==============================================================================
--- apr/apr-util/vendor/expat/current/win32/expat.iss (added)
+++ apr/apr-util/vendor/expat/current/win32/expat.iss Wed Sep 29 09:59:04 2010
@@ -0,0 +1,62 @@
+; Basic setup script for the Inno Setep installer builder.  For more
+; information on the free installer builder, see www.jrsoftware.org.
+;
+; This script was contributed by Tim Peters.
+; The current version is used with Inno Setup 2.0.19.
+
+[Setup]
+AppName=expat
+AppId=expat
+AppVersion=1.95.7
+AppVerName=expat 1.95.7
+AppCopyright=Copyright © 1998-2003 Thai Open Source Software Center, Clark Cooper, and the Expat maintainers
+DefaultDirName={sd}\Expat-1.95.7
+AppPublisher=The Expat Developers
+AppPublisherURL=http://www.libexpat.org/
+AppSupportURL=http://www.libexpat.org/
+AppUpdatesURL=http://www.libexpat.org/
+UninstallDisplayName=Expat XML Parser (version 1.95.7)
+UninstallFilesDir={app}\Uninstall
+
+Compression=bzip/9
+SourceDir=..
+OutputDir=win32
+DisableStartupPrompt=yes
+AllowNoIcons=yes
+DisableProgramGroupPage=yes
+DisableReadyPage=yes
+
+[Files]
+CopyMode: alwaysoverwrite; Source: xmlwf\Release\*.exe;        DestDir: "{app}"
+CopyMode: alwaysoverwrite; Source: win32\MANIFEST.txt;         DestDir: "{app}"
+CopyMode: alwaysoverwrite; Source: Changes;                    DestDir: "{app}"; DestName: Changes.txt
+CopyMode: alwaysoverwrite; Source: COPYING;                    DestDir: "{app}"; DestName: COPYING.txt
+CopyMode: alwaysoverwrite; Source: README;                     DestDir: "{app}"; DestName: README.txt
+CopyMode: alwaysoverwrite; Source: doc\*.html;                 DestDir: "{app}\Doc"
+CopyMode: alwaysoverwrite; Source: doc\*.css;                  DestDir: "{app}\Doc"
+CopyMode: alwaysoverwrite; Source: doc\*.png;                  DestDir: "{app}\Doc"
+CopyMode: alwaysoverwrite; Source: lib\Release\*.dll;          DestDir: "{app}\Libs"
+CopyMode: alwaysoverwrite; Source: lib\Release\*.lib;          DestDir: "{app}\Libs"
+CopyMode: alwaysoverwrite; Source: lib\Release-w\*.dll;        DestDir: "{app}\Libs"
+CopyMode: alwaysoverwrite; Source: lib\Release-w\*.lib;        DestDir: "{app}\Libs"
+CopyMode: alwaysoverwrite; Source: lib\Release_static\*.lib;   DestDir: "{app}\StaticLibs"
+CopyMode: alwaysoverwrite; Source: lib\Release-w_static\*.lib; DestDir: "{app}\StaticLibs"
+CopyMode: alwaysoverwrite; Source: expat.dsw;                  DestDir: "{app}\Source"
+CopyMode: alwaysoverwrite; Source: win32\README.txt;           DestDir: "{app}\Source"
+CopyMode: alwaysoverwrite; Source: bcb5\*.*;                   DestDir: "{app}\Source\bcb5"
+CopyMode: alwaysoverwrite; Source: lib\*.c;                    DestDir: "{app}\Source\lib"
+CopyMode: alwaysoverwrite; Source: lib\*.h;                    DestDir: "{app}\Source\lib"
+CopyMode: alwaysoverwrite; Source: lib\*.def;                  DestDir: "{app}\Source\lib"
+CopyMode: alwaysoverwrite; Source: lib\*.dsp;                  DestDir: "{app}\Source\lib"
+CopyMode: alwaysoverwrite; Source: examples\*.c;               DestDir: "{app}\Source\examples"
+CopyMode: alwaysoverwrite; Source: examples\*.dsp;             DestDir: "{app}\Source\examples"
+CopyMode: alwaysoverwrite; Source: tests\*.c;                  DestDir: "{app}\Source\tests"
+CopyMode: alwaysoverwrite; Source: tests\*.h;                  DestDir: "{app}\Source\tests"
+CopyMode: alwaysoverwrite; Source: tests\README.txt;           DestDir: "{app}\Source\tests"
+CopyMode: alwaysoverwrite; Source: xmlwf\*.c*;                 DestDir: "{app}\Source\xmlwf"
+CopyMode: alwaysoverwrite; Source: xmlwf\*.h;                  DestDir: "{app}\Source\xmlwf"
+CopyMode: alwaysoverwrite; Source: xmlwf\*.dsp;                DestDir: "{app}\Source\xmlwf"
+
+[Messages]
+WelcomeLabel1=Welcome to the Expat XML Parser Setup Wizard
+WelcomeLabel2=This will install [name/ver] on your computer.%n%nExpat is an XML parser with a C-language API, and is primarily made available to allow developers to build applications which use XML using a portable API and fast implementation.%n%nIt is strongly recommended that you close all other applications you have running before continuing. This will help prevent any conflicts during the installation process.

Modified: apr/apr-util/vendor/expat/current/xmlwf/codepage.c
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/xmlwf/codepage.c?rev=1002549&r1=1002548&r2=1002549&view=diff
==============================================================================
--- apr/apr-util/vendor/expat/current/xmlwf/codepage.c (original)
+++ apr/apr-util/vendor/expat/current/xmlwf/codepage.c Wed Sep 29 09:59:04 2010
@@ -1,6 +1,5 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
+/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
+   See the file COPYING for copying permission.
 */
 
 #include "codepage.h"
@@ -11,7 +10,8 @@ See the file COPYING for copying permiss
 
 #include <windows.h>
 
-int codepageMap(int cp, int *map)
+int
+codepageMap(int cp, int *map)
 {
   int i;
   CPINFO info;
@@ -26,38 +26,41 @@ int codepageMap(int cp, int *map)
         break;
       lim = info.LeadByte[i + 1];
       for (j = info.LeadByte[i]; j < lim; j++)
-	map[j] = -2;
+        map[j] = -2;
     }
   }
   for (i = 0; i < 256; i++) {
    if (map[i] == -1) {
-     char c = i;
+     char c = (char)i;
      unsigned short n;
      if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS,
-		             &c, 1, &n, 1) == 1)
+                             &c, 1, &n, 1) == 1)
        map[i] = n;
    }
   }
   return 1;
 }
 
-int codepageConvert(int cp, const char *p)
+int
+codepageConvert(int cp, const char *p)
 {
   unsigned short c;
   if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS,
-		          p, 2, &c, 1) == 1)
+                          p, 2, &c, 1) == 1)
     return c;
   return -1;
 }
 
 #else /* not WIN32 */
 
-int codepageMap(int cp, int *map)
+int
+codepageMap(int cp, int *map)
 {
   return 0;
 }
 
-int codepageConvert(int cp, const char *p)
+int
+codepageConvert(int cp, const char *p)
 {
   return -1;
 }

Modified: apr/apr-util/vendor/expat/current/xmlwf/codepage.h
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/xmlwf/codepage.h?rev=1002549&r1=1002548&r2=1002549&view=diff
==============================================================================
--- apr/apr-util/vendor/expat/current/xmlwf/codepage.h (original)
+++ apr/apr-util/vendor/expat/current/xmlwf/codepage.h Wed Sep 29 09:59:04 2010
@@ -1,6 +1,5 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
+/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
+   See the file COPYING for copying permission.
 */
 
 int codepageMap(int cp, int *map);

Modified: apr/apr-util/vendor/expat/current/xmlwf/ct.c
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/xmlwf/ct.c?rev=1002549&r1=1002548&r2=1002549&view=diff
==============================================================================
--- apr/apr-util/vendor/expat/current/xmlwf/ct.c (original)
+++ apr/apr-util/vendor/expat/current/xmlwf/ct.c Wed Sep 29 09:59:04 2010
@@ -1,7 +1,7 @@
 #define CHARSET_MAX 41
 
-static
-const char *getTok(const char **pp)
+static const char *
+getTok(const char **pp)
 {
   enum { inAtom, inString, init, inComment };
   int state = init;
@@ -15,50 +15,50 @@ const char *getTok(const char **pp)
     case '\t':
     case '\n':
       if (state == inAtom)
-	return tokStart;
+        return tokStart;
       break;
     case '(':
       if (state == inAtom)
-	return tokStart;
+        return tokStart;
       if (state != inString)
-	state++;
+        state++;
       break;
     case ')':
       if (state > init)
-	--state;
+        --state;
       else if (state != inString)
-	return 0;
+        return 0;
       break;
     case ';':
     case '/':
     case '=':
       if (state == inAtom)
-	return tokStart;
+        return tokStart;
       if (state == init)
-	return (*pp)++;
+        return (*pp)++;
       break;
     case '\\':
       ++*pp;
       if (**pp == '\0')
-	return 0;
+        return 0;
       break;
     case '"':
       switch (state) {
       case inString:
-	++*pp;
-	return tokStart;
+        ++*pp;
+        return tokStart;
       case inAtom:
-	return tokStart;
+        return tokStart;
       case init:
-	tokStart = *pp;
-	state = inString;
-	break;
+        tokStart = *pp;
+        state = inString;
+        break;
       }
       break;
     default:
       if (state == init) {
-	tokStart = *pp;
-	state = inAtom;
+        tokStart = *pp;
+        state = inAtom;
       }
       break;
     }
@@ -69,8 +69,8 @@ const char *getTok(const char **pp)
 
 /* key must be lowercase ASCII */
 
-static
-int matchkey(const char *start, const char *end, const char *key)
+static int
+matchkey(const char *start, const char *end, const char *key)
 {
   if (!start)
     return 0;
@@ -80,7 +80,8 @@ int matchkey(const char *start, const ch
   return *key == '\0';
 }
 
-void getXMLCharset(const char *buf, char *charset)
+void
+getXMLCharset(const char *buf, char *charset)
 {
   const char *next, *p;
 
@@ -102,33 +103,33 @@ void getXMLCharset(const char *buf, char
     if (*p == ';') {
       p = getTok(&next);
       if (matchkey(p, next, "charset")) {
-	p = getTok(&next);
-	if (p && *p == '=') {
-	  p = getTok(&next);
-	  if (p) {
-	    char *s = charset;
-	    if (*p == '"') {
-	      while (++p != next - 1) {
-		if (*p == '\\')
-		  ++p;
-		if (s == charset + CHARSET_MAX - 1) {
-		  charset[0] = '\0';
-		  break;
-		}
-		*s++ = *p;
-	      }
-	      *s++ = '\0';
-	    }
-	    else {
-	      if (next - p > CHARSET_MAX - 1)
-		break;
-	      while (p != next)
-		*s++ = *p++;
-	      *s = 0;
-	      break;
-	    }
-	  }
-	}
+        p = getTok(&next);
+        if (p && *p == '=') {
+          p = getTok(&next);
+          if (p) {
+            char *s = charset;
+            if (*p == '"') {
+              while (++p != next - 1) {
+                if (*p == '\\')
+                  ++p;
+                if (s == charset + CHARSET_MAX - 1) {
+                  charset[0] = '\0';
+                  break;
+                }
+                *s++ = *p;
+              }
+              *s++ = '\0';
+            }
+            else {
+              if (next - p > CHARSET_MAX - 1)
+                break;
+              while (p != next)
+                *s++ = *p++;
+              *s = 0;
+              break;
+            }
+          }
+        }
       }
     }
   else
@@ -136,7 +137,8 @@ void getXMLCharset(const char *buf, char
   }
 }
 
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
 {
   char buf[CHARSET_MAX];
   getXMLCharset(argv[1], buf);

Modified: apr/apr-util/vendor/expat/current/xmlwf/filemap.h
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/xmlwf/filemap.h?rev=1002549&r1=1002548&r2=1002549&view=diff
==============================================================================
--- apr/apr-util/vendor/expat/current/xmlwf/filemap.h (original)
+++ apr/apr-util/vendor/expat/current/xmlwf/filemap.h Wed Sep 29 09:59:04 2010
@@ -1,17 +1,17 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
+/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
+   See the file COPYING for copying permission.
 */
 
-
 #include <stddef.h>
 
 #ifdef XML_UNICODE
 int filemap(const wchar_t *name,
-	    void (*processor)(const void *, size_t, const wchar_t *, void *arg),
-	    void *arg);
+            void (*processor)(const void *, size_t,
+                              const wchar_t *, void *arg),
+            void *arg);
 #else
 int filemap(const char *name,
-	    void (*processor)(const void *, size_t, const char *, void *arg),
-	    void *arg);
+            void (*processor)(const void *, size_t,
+                              const char *, void *arg),
+            void *arg);
 #endif

Modified: apr/apr-util/vendor/expat/current/xmlwf/readfilemap.c
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/xmlwf/readfilemap.c?rev=1002549&r1=1002548&r2=1002549&view=diff
==============================================================================
--- apr/apr-util/vendor/expat/current/xmlwf/readfilemap.c (original)
+++ apr/apr-util/vendor/expat/current/xmlwf/readfilemap.c Wed Sep 29 09:59:04 2010
@@ -1,6 +1,5 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
+/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
+   See the file COPYING for copying permission.
 */
 
 #include <sys/types.h>
@@ -27,9 +26,12 @@ See the file COPYING for copying permiss
 #endif
 #endif
 
-int filemap(const char *name,
-	    void (*processor)(const void *, size_t, const char *, void *arg),
-	    void *arg)
+#include "filemap.h"
+
+int
+filemap(const char *name,
+        void (*processor)(const void *, size_t, const char *, void *arg),
+        void *arg)
 {
   size_t nbytes;
   int fd;
@@ -59,11 +61,13 @@ int filemap(const char *name,
   n = read(fd, p, nbytes);
   if (n < 0) {
     perror(name);
+    free(p);
     close(fd);
     return 0;
   }
   if (n != nbytes) {
     fprintf(stderr, "%s: read unexpected number of bytes\n", name);
+    free(p);
     close(fd);
     return 0;
   }

Modified: apr/apr-util/vendor/expat/current/xmlwf/unixfilemap.c
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/xmlwf/unixfilemap.c?rev=1002549&r1=1002548&r2=1002549&view=diff
==============================================================================
--- apr/apr-util/vendor/expat/current/xmlwf/unixfilemap.c (original)
+++ apr/apr-util/vendor/expat/current/xmlwf/unixfilemap.c Wed Sep 29 09:59:04 2010
@@ -1,6 +1,5 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
+/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
+   See the file COPYING for copying permission.
 */
 
 #include <sys/types.h>
@@ -18,9 +17,10 @@ See the file COPYING for copying permiss
 
 #include "filemap.h"
 
-int filemap(const char *name,
-	    void (*processor)(const void *, size_t, const char *, void *arg),
-	    void *arg)
+int
+filemap(const char *name,
+        void (*processor)(const void *, size_t, const char *, void *arg),
+        void *arg)
 {
   int fd;
   size_t nbytes;
@@ -42,10 +42,10 @@ int filemap(const char *name,
     fprintf(stderr, "%s: not a regular file\n", name);
     return 0;
   }
-  
+
   nbytes = sb.st_size;
   p = (void *)mmap((caddr_t)0, (size_t)nbytes, PROT_READ,
-		   MAP_FILE|MAP_PRIVATE, fd, (off_t)0);
+                   MAP_FILE|MAP_PRIVATE, fd, (off_t)0);
   if (p == (void *)-1) {
     perror(name);
     close(fd);

Modified: apr/apr-util/vendor/expat/current/xmlwf/win32filemap.c
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/xmlwf/win32filemap.c?rev=1002549&r1=1002548&r2=1002549&view=diff
==============================================================================
--- apr/apr-util/vendor/expat/current/xmlwf/win32filemap.c (original)
+++ apr/apr-util/vendor/expat/current/xmlwf/win32filemap.c Wed Sep 29 09:59:04 2010
@@ -1,6 +1,5 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
+/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
+   See the file COPYING for copying permission.
 */
 
 #define STRICT 1
@@ -23,9 +22,10 @@ See the file COPYING for copying permiss
 
 static void win32perror(const TCHAR *);
 
-int filemap(const TCHAR *name,
-	    void (*processor)(const void *, size_t, const TCHAR *, void *arg),
-	    void *arg)
+int
+filemap(const TCHAR *name,
+        void (*processor)(const void *, size_t, const TCHAR *, void *arg),
+        void *arg)
 {
   HANDLE f;
   HANDLE m;
@@ -34,7 +34,7 @@ int filemap(const TCHAR *name,
   void *p;
 
   f = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
-			  FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+                          FILE_FLAG_SEQUENTIAL_SCAN, NULL);
   if (f == INVALID_HANDLE_VALUE) {
     win32perror(name);
     return 0;
@@ -75,17 +75,18 @@ int filemap(const TCHAR *name,
   return 1;
 }
 
-static
-void win32perror(const TCHAR *s)
+static void
+win32perror(const TCHAR *s)
 {
   LPVOID buf;
-  if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
-		    NULL,
-		    GetLastError(),
-		    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-		    (LPTSTR) &buf,
-		    0,
-		    NULL)) {
+  if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
+                    | FORMAT_MESSAGE_FROM_SYSTEM,
+                    NULL,
+                    GetLastError(),
+                    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+                    (LPTSTR) &buf,
+                    0,
+                    NULL)) {
     _ftprintf(stderr, _T("%s: %s"), s, buf);
     fflush(stderr);
     LocalFree(buf);

Modified: apr/apr-util/vendor/expat/current/xmlwf/xmlfile.c
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/xmlwf/xmlfile.c?rev=1002549&r1=1002548&r2=1002549&view=diff
==============================================================================
--- apr/apr-util/vendor/expat/current/xmlwf/xmlfile.c (original)
+++ apr/apr-util/vendor/expat/current/xmlwf/xmlfile.c Wed Sep 29 09:59:04 2010
@@ -1,6 +1,5 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
+/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
+   See the file COPYING for copying permission.
 */
 
 #include <stdio.h>
@@ -8,6 +7,13 @@ See the file COPYING for copying permiss
 #include <stddef.h>
 #include <string.h>
 #include <fcntl.h>
+#ifdef COMPILED_FROM_DSP
+#include "winconfig.h"
+#else
+#ifdef HAVE_EXPAT_CONFIG_H
+#include "expat_config.h"
+#endif
+#endif
 #include "expat.h"
 #include "xmlfile.h"
 #include "xmltchar.h"
@@ -17,7 +23,7 @@ See the file COPYING for copying permiss
 #include <io.h>
 #endif
 
-#ifdef _POSIX_SOURCE
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
@@ -36,36 +42,33 @@ See the file COPYING for copying permiss
 #endif
 
 
-
 typedef struct {
   XML_Parser parser;
   int *retPtr;
 } PROCESS_ARGS;
 
-static
-void reportError(XML_Parser parser, const XML_Char *filename)
+static void
+reportError(XML_Parser parser, const XML_Char *filename)
 {
   int code = XML_GetErrorCode(parser);
   const XML_Char *message = XML_ErrorString(code);
   if (message)
     ftprintf(stdout, T("%s:%d:%d: %s\n"),
-	     filename,
-	     XML_GetErrorLineNumber(parser),
-	     XML_GetErrorColumnNumber(parser),
-	     message);
+             filename,
+             XML_GetErrorLineNumber(parser),
+             XML_GetErrorColumnNumber(parser),
+             message);
   else
     ftprintf(stderr, T("%s: (unknown message %d)\n"), filename, code);
 }
 
-static
-void processFile(const void *data,
-		 size_t size,
-		 const XML_Char *filename,
-		 void *args)
+static void
+processFile(const void *data, size_t size,
+            const XML_Char *filename, void *args)
 {
   XML_Parser parser = ((PROCESS_ARGS *)args)->parser;
   int *retPtr = ((PROCESS_ARGS *)args)->retPtr;
-  if (!XML_Parse(parser, data, size, 1)) {
+  if (XML_Parse(parser, data, size, 1) == XML_STATUS_ERROR) {
     reportError(parser, filename);
     *retPtr = 0;
   }
@@ -75,16 +78,17 @@ void processFile(const void *data,
 
 #ifdef WIN32
 
-static
-int isAsciiLetter(XML_Char c)
+static int
+isAsciiLetter(XML_Char c)
 {
   return (T('a') <= c && c <= T('z')) || (T('A') <= c && c <= T('Z'));
 }
 
 #endif /* WIN32 */
 
-static
-const XML_Char *resolveSystemId(const XML_Char *base, const XML_Char *systemId, XML_Char **toFree)
+static const XML_Char *
+resolveSystemId(const XML_Char *base, const XML_Char *systemId,
+                XML_Char **toFree)
 {
   XML_Char *s;
   *toFree = 0;
@@ -96,7 +100,8 @@ const XML_Char *resolveSystemId(const XM
 #endif
      )
     return systemId;
-  *toFree = (XML_Char *)malloc((tcslen(base) + tcslen(systemId) + 2)*sizeof(XML_Char));
+  *toFree = (XML_Char *)malloc((tcslen(base) + tcslen(systemId) + 2)
+                               * sizeof(XML_Char));
   if (!*toFree)
     return systemId;
   tcscpy(*toFree, base);
@@ -111,12 +116,12 @@ const XML_Char *resolveSystemId(const XM
   return *toFree;
 }
 
-static
-int externalEntityRefFilemap(XML_Parser parser,
-			     const XML_Char *context,
-			     const XML_Char *base,
-			     const XML_Char *systemId,
-			     const XML_Char *publicId)
+static int
+externalEntityRefFilemap(XML_Parser parser,
+                         const XML_Char *context,
+                         const XML_Char *base,
+                         const XML_Char *systemId,
+                         const XML_Char *publicId)
 {
   int result;
   XML_Char *s;
@@ -134,47 +139,57 @@ int externalEntityRefFilemap(XML_Parser 
   return result;
 }
 
-static
-int processStream(const XML_Char *filename, XML_Parser parser)
+static int
+processStream(const XML_Char *filename, XML_Parser parser)
 {
-  int fd = topen(filename, O_BINARY|O_RDONLY);
-  if (fd < 0) {
-    tperror(filename);
-    return 0;
+  /* passing NULL for filename means read intput from stdin */
+  int fd = 0;   /* 0 is the fileno for stdin */
+
+  if (filename != NULL) {
+    fd = topen(filename, O_BINARY|O_RDONLY);
+    if (fd < 0) {
+      tperror(filename);
+      return 0;
+    }
   }
   for (;;) {
     int nread;
     char *buf = XML_GetBuffer(parser, READ_SIZE);
     if (!buf) {
-      close(fd);
-      ftprintf(stderr, T("%s: out of memory\n"), filename);
+      if (filename != NULL)
+        close(fd);
+      ftprintf(stderr, T("%s: out of memory\n"),
+               filename != NULL ? filename : "xmlwf");
       return 0;
     }
     nread = read(fd, buf, READ_SIZE);
     if (nread < 0) {
-      tperror(filename);
-      close(fd);
+      tperror(filename != NULL ? filename : "STDIN");
+      if (filename != NULL)
+        close(fd);
       return 0;
     }
-    if (!XML_ParseBuffer(parser, nread, nread == 0)) {
-      reportError(parser, filename);
-      close(fd);
+    if (XML_ParseBuffer(parser, nread, nread == 0) == XML_STATUS_ERROR) {
+      reportError(parser, filename != NULL ? filename : "STDIN");
+      if (filename != NULL)
+        close(fd);
       return 0;
     }
     if (nread == 0) {
-      close(fd);
+      if (filename != NULL)
+        close(fd);
       break;;
     }
   }
   return 1;
 }
 
-static
-int externalEntityRefStream(XML_Parser parser,
-			    const XML_Char *context,
-			    const XML_Char *base,
-			    const XML_Char *systemId,
-			    const XML_Char *publicId)
+static int
+externalEntityRefStream(XML_Parser parser,
+                        const XML_Char *context,
+                        const XML_Char *base,
+                        const XML_Char *systemId,
+                        const XML_Char *publicId)
 {
   XML_Char *s;
   const XML_Char *filename;
@@ -188,9 +203,10 @@ int externalEntityRefStream(XML_Parser p
   return ret;
 }
 
-int XML_ProcessFile(XML_Parser parser,
-		    const XML_Char *filename,
-		    unsigned flags)
+int
+XML_ProcessFile(XML_Parser parser,
+                const XML_Char *filename,
+                unsigned flags)
 {
   int result;
 
@@ -201,9 +217,9 @@ int XML_ProcessFile(XML_Parser parser,
 
   if (flags & XML_EXTERNAL_ENTITIES)
       XML_SetExternalEntityRefHandler(parser,
-	                              (flags & XML_MAP_FILE)
-				      ? externalEntityRefFilemap
-				      : externalEntityRefStream);
+                                      (flags & XML_MAP_FILE)
+                                      ? externalEntityRefFilemap
+                                      : externalEntityRefStream);
   if (flags & XML_MAP_FILE) {
     PROCESS_ARGS args;
     args.retPtr = &result;

Modified: apr/apr-util/vendor/expat/current/xmlwf/xmlfile.h
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/xmlwf/xmlfile.h?rev=1002549&r1=1002548&r2=1002549&view=diff
==============================================================================
--- apr/apr-util/vendor/expat/current/xmlwf/xmlfile.h (original)
+++ apr/apr-util/vendor/expat/current/xmlwf/xmlfile.h Wed Sep 29 09:59:04 2010
@@ -1,11 +1,10 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
+/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
+   See the file COPYING for copying permission.
 */
 
 #define XML_MAP_FILE 01
 #define XML_EXTERNAL_ENTITIES 02
 
 extern int XML_ProcessFile(XML_Parser parser,
-			   const XML_Char *filename,
-			   unsigned flags);
+                           const XML_Char *filename,
+                           unsigned flags);

Modified: apr/apr-util/vendor/expat/current/xmlwf/xmlmime.c
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/xmlwf/xmlmime.c?rev=1002549&r1=1002548&r2=1002549&view=diff
==============================================================================
--- apr/apr-util/vendor/expat/current/xmlwf/xmlmime.c (original)
+++ apr/apr-util/vendor/expat/current/xmlwf/xmlmime.c Wed Sep 29 09:59:04 2010
@@ -1,8 +1,8 @@
 #include <string.h>
 #include "xmlmime.h"
 
-static
-const char *getTok(const char **pp)
+static const char *
+getTok(const char **pp)
 {
   /* inComment means one level of nesting; inComment+1 means two levels etc */
   enum { inAtom, inString, init, inComment };
@@ -12,57 +12,57 @@ const char *getTok(const char **pp)
     switch (**pp) {
     case '\0':
       if (state == inAtom)
-	return tokStart;
+        return tokStart;
       return 0;
     case ' ':
     case '\r':
     case '\t':
     case '\n':
       if (state == inAtom)
-	return tokStart;
+        return tokStart;
       break;
     case '(':
       if (state == inAtom)
-	return tokStart;
+        return tokStart;
       if (state != inString)
-	state++;
+        state++;
       break;
     case ')':
       if (state > init)
-	--state;
+        --state;
       else if (state != inString)
-	return 0;
+        return 0;
       break;
     case ';':
     case '/':
     case '=':
       if (state == inAtom)
-	return tokStart;
+        return tokStart;
       if (state == init)
-	return (*pp)++;
+        return (*pp)++;
       break;
     case '\\':
       ++*pp;
       if (**pp == '\0')
-	return 0;
+        return 0;
       break;
     case '"':
       switch (state) {
       case inString:
-	++*pp;
-	return tokStart;
+        ++*pp;
+        return tokStart;
       case inAtom:
-	return tokStart;
+        return tokStart;
       case init:
-	tokStart = *pp;
-	state = inString;
-	break;
+        tokStart = *pp;
+        state = inString;
+        break;
       }
       break;
     default:
       if (state == init) {
-	tokStart = *pp;
-	state = inAtom;
+        tokStart = *pp;
+        state = inAtom;
       }
       break;
     }
@@ -73,8 +73,8 @@ const char *getTok(const char **pp)
 
 /* key must be lowercase ASCII */
 
-static
-int matchkey(const char *start, const char *end, const char *key)
+static int
+matchkey(const char *start, const char *end, const char *key)
 {
   if (!start)
     return 0;
@@ -84,7 +84,8 @@ int matchkey(const char *start, const ch
   return *key == '\0';
 }
 
-void getXMLCharset(const char *buf, char *charset)
+void
+getXMLCharset(const char *buf, char *charset)
 {
   const char *next, *p;
 
@@ -108,34 +109,34 @@ void getXMLCharset(const char *buf, char
     if (*p == ';') {
       p = getTok(&next);
       if (matchkey(p, next, "charset")) {
-	p = getTok(&next);
-	if (p && *p == '=') {
-	  p = getTok(&next);
-	  if (p) {
-	    char *s = charset;
-	    if (*p == '"') {
-	      while (++p != next - 1) {
-		if (*p == '\\')
-		  ++p;
-		if (s == charset + CHARSET_MAX - 1) {
-		  charset[0] = '\0';
-		  break;
-		}
-		*s++ = *p;
-	      }
-	      *s++ = '\0';
-	    }
-	    else {
-	      if (next - p > CHARSET_MAX - 1)
-		break;
-	      while (p != next)
-		*s++ = *p++;
-	      *s = 0;
-	      break;
-	    }
-	  }
-	}
-	break;
+        p = getTok(&next);
+        if (p && *p == '=') {
+          p = getTok(&next);
+          if (p) {
+            char *s = charset;
+            if (*p == '"') {
+              while (++p != next - 1) {
+                if (*p == '\\')
+                  ++p;
+                if (s == charset + CHARSET_MAX - 1) {
+                  charset[0] = '\0';
+                  break;
+                }
+                *s++ = *p;
+              }
+              *s++ = '\0';
+            }
+            else {
+              if (next - p > CHARSET_MAX - 1)
+                break;
+              while (p != next)
+                *s++ = *p++;
+              *s = 0;
+              break;
+            }
+          }
+        }
+        break;
       }
     }
   else
@@ -147,7 +148,8 @@ void getXMLCharset(const char *buf, char
 
 #include <stdio.h>
 
-int main(int argc, char **argv)
+int
+main(int argc, char *argv[])
 {
   char buf[CHARSET_MAX];
   if (argc <= 1)

Modified: apr/apr-util/vendor/expat/current/xmlwf/xmlmime.h
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/xmlwf/xmlmime.h?rev=1002549&r1=1002548&r2=1002549&view=diff
==============================================================================
--- apr/apr-util/vendor/expat/current/xmlwf/xmlmime.h (original)
+++ apr/apr-util/vendor/expat/current/xmlwf/xmlmime.h Wed Sep 29 09:59:04 2010
@@ -1,4 +1,3 @@
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -8,9 +7,10 @@ extern "C" {
 #define CHARSET_MAX 41
 
 /* Figure out the charset to use from the ContentType.
-buf contains the body of the header field (the part after "Content-Type:").
-charset gets the charset to use.  It must be at least CHARSET_MAX chars long.
-charset will be empty if the default charset should be used. */
+   buf contains the body of the header field (the part after "Content-Type:").
+   charset gets the charset to use.  It must be at least CHARSET_MAX chars
+   long.  charset will be empty if the default charset should be used.
+*/
 
 void getXMLCharset(const char *buf, char *charset);
 

Modified: apr/apr-util/vendor/expat/current/xmlwf/xmlurl.h
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/xmlwf/xmlurl.h?rev=1002549&r1=1002548&r2=1002549&view=diff
==============================================================================
--- apr/apr-util/vendor/expat/current/xmlwf/xmlurl.h (original)
+++ apr/apr-util/vendor/expat/current/xmlwf/xmlurl.h Wed Sep 29 09:59:04 2010
@@ -5,8 +5,8 @@ extern "C" {
 int XML_URLInit();
 void XML_URLUninit();
 int XML_ProcessURL(XML_Parser parser,
-		   const XML_Char *url,
-		   unsigned flags);
+                   const XML_Char *url,
+                   unsigned flags);
 
 #ifdef __cplusplus
 }



Mime
View raw message