update to Expat Version 2.0
Modified: trunk/reactos/lib/expat/COPYING
Modified: trunk/reactos/lib/expat/Changes
Modified: trunk/reactos/lib/expat/MANIFEST
Modified: trunk/reactos/lib/expat/README
Modified: trunk/reactos/lib/expat/configure.in
Modified: trunk/reactos/lib/expat/doc/reference.html
Modified: trunk/reactos/lib/expat/examples/elements.c
Modified: trunk/reactos/lib/expat/examples/outline.c
Modified: trunk/reactos/lib/expat/lib/internal.h
Modified: trunk/reactos/lib/expat/lib/xmlparse.c
Modified: trunk/reactos/lib/expat/lib/xmlrole.c
Modified: trunk/reactos/lib/expat/lib/xmltok.c
Modified: trunk/reactos/lib/expat/lib/xmltok.h
Modified: trunk/reactos/lib/expat/lib/xmltok_impl.c
Modified: trunk/reactos/lib/expat/make-release.sh
Modified: trunk/reactos/lib/expat/tests/README.txt
Modified: trunk/reactos/lib/expat/tests/benchmark/README.txt
Modified: trunk/reactos/lib/expat/tests/benchmark/benchmark.c
Modified: trunk/reactos/lib/expat/tests/runtests.c
Modified: trunk/reactos/lib/expat/win32/MANIFEST.txt
Modified: trunk/reactos/lib/expat/win32/README.txt
Modified: trunk/reactos/lib/expat/win32/expat.iss
Modified: trunk/reactos/lib/expat/xmlwf/codepage.c
Modified: trunk/reactos/lib/expat/xmlwf/xmlfile.c
Modified: trunk/reactos/lib/expat/xmlwf/xmlfile.h
Modified: trunk/reactos/lib/expat/xmlwf/xmlwf.c

Modified: trunk/reactos/lib/expat/COPYING
--- trunk/reactos/lib/expat/COPYING	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/COPYING	2006-01-15 00:06:16 UTC (rev 20874)
@@ -1,6 +1,6 @@
 Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
                                and Clark Cooper
-Copyright (c) 2001, 2002, 2003 Expat maintainers.
+Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers.
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the

Modified: trunk/reactos/lib/expat/Changes
--- trunk/reactos/lib/expat/Changes	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/Changes	2006-01-15 00:06:16 UTC (rev 20874)
@@ -1,9 +1,16 @@
-Release 1.95.9 TBD
+Release 2.0.0 Wed Jan 11 2006
         - We no longer use the "check" library for C unit testing; we
           always use the (partial) internal implementation of the API.
         - Report XML_NS setting via XML_GetFeatureList().
         - Fixed headers for use from C++.
-        - Updated to use libtool 1.5.10 (the most recent).
+        - XML_GetCurrentLineNumber() and  XML_GetCurrentColumnNumber()
+          now return unsigned integers.
+        - Added XML_LARGE_SIZE switch to enable 64-bit integers for
+          byte indexes and line/column numbers.
+        - Updated to use libtool 1.5.22 (the most recent).
+        - Added support for AmigaOS.
+        - Some mostly minor bug fixes. SF issues include: 1006708,
+          1021776, 1023646, 1114960, 1156398, 1221160, 1271642.
 
 Release 1.95.8 Fri Jul 23 2004
         - Major new feature: suspend/resume.  Handlers can now request

Modified: trunk/reactos/lib/expat/MANIFEST
--- trunk/reactos/lib/expat/MANIFEST	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/MANIFEST	2006-01-15 00:06:16 UTC (rev 20874)
@@ -1,3 +1,14 @@
+amiga/stdlib.c
+amiga/launch.c
+amiga/expat_vectors.c
+amiga/expat_lib.c
+amiga/expat.xml
+amiga/README.txt
+amiga/Makefile
+amiga/include/proto/expat.h
+amiga/include/libraries/expat.h
+amiga/include/interfaces/expat.h
+amiga/include/inline4/expat.h
 bcb5/README.txt
 bcb5/all_projects.bpg
 bcb5/elements.bpf
@@ -55,6 +66,7 @@
 examples/outline.c
 examples/outline.dsp
 lib/Makefile.MPW
+lib/amigaconfig.h
 lib/ascii.h
 lib/asciitab.h
 lib/expat.dsp

Modified: trunk/reactos/lib/expat/README
--- trunk/reactos/lib/expat/README	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/README	2006-01-15 00:06:16 UTC (rev 20874)
@@ -1,5 +1,5 @@
 
-                        Expat, Release 1.95.8
+                        Expat, Release 2.0.0
 
 This is Expat, a C library for parsing XML, written by James Clark.
 Expat is a stream-oriented XML parser.  This means that you register
@@ -9,7 +9,7 @@
 structures for which you may register handlers.
 
 Windows users should use the expat_win32bin package, which includes
-both precompiled libraries and executalbes, and source code for
+both precompiled libraries and executables, and source code for
 developers.
 
 Expat is free software.  You may copy, distribute, and modify it under
@@ -48,14 +48,20 @@
 /home/me/mystuff/bin, you can tell configure about that with:
 
         ./configure --prefix=/home/me/mystuff
+        
+Another interesting option is to enable 64-bit integer support for
+line and column numbers and the over-all byte index:
 
+        ./configure CPPFLAGS=-DXML_LARGE_SIZE
+
 After running the configure script, the "make" command will build
 things and "make install" will install things into their proper
-location.  Note that you need to have write permission into the
-directories into which things will be installed.
+location.  Have a look at the "Makefile" to learn about additional
+"make" options.  Note that you need to have write permission into
+the directories into which things will be installed.
 
 If you are interested in building Expat to provide document
-information in UTF-16 rather than the default UTF-8, following these
+information in UTF-16 rather than the default UTF-8, follow these
 instructions:
 
         1. For UTF-16 output as unsigned short (and version/error

Modified: trunk/reactos/lib/expat/configure.in
--- trunk/reactos/lib/expat/configure.in	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/configure.in	2006-01-15 00:06:16 UTC (rev 20874)
@@ -25,8 +25,8 @@
 dnl GNU M4 to test it right now.
 define([expat_version], ifdef([__gnu__],
                               [esyscmd(conftools/get-version.sh lib/expat.h)],
-                              [1.95.x]))
-AC_INIT(expat, expat_version, expat-bugs@mail.libexpat.org)
+                              [2.0.x]))
+AC_INIT(expat, expat_version, expat-bugs@libexpat.org)
 undefine([expat_version])
 
 AC_CONFIG_SRCDIR(Makefile.in)
@@ -44,7 +44,7 @@
 dnl If the API changes incompatibly set LIBAGE back to 0
 dnl
 
-LIBCURRENT=5
+LIBCURRENT=6
 LIBREVISION=0
 LIBAGE=5
 

Modified: trunk/reactos/lib/expat/doc/reference.html
--- trunk/reactos/lib/expat/doc/reference.html	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/doc/reference.html	2006-01-15 00:06:16 UTC (rev 20874)
@@ -19,7 +19,7 @@
       <td class="banner"><h1>The Expat XML Parser</h1></td>
     </tr>
     <tr>
-      <td class="releaseno">Release 1.95.8</td>
+      <td class="releaseno">Release 2.0.0</td>
       <td></td>
     </tr>
   </table>
@@ -344,6 +344,16 @@
 short</code> is used.  Defining this implies
 <code>XML_UNICODE</code>.</dd>
 
+<dt>XML_LARGE_SIZE</dt>
+<dd>If defined, causes the <code>XML_Size</code> and <code>XML_Index</code>
+integer types to be at least 64 bits in size. This is intended to support
+processing of very large input streams, where the return values of
+<code><a href="#XML_GetCurrentByteIndex" >XML_GetCurrentByteIndex</a></code>,
+<code><a href="#XML_GetCurrentLineNumber" >XML_GetCurrentLineNumber</a></code> and
+<code><a href="#XML_GetCurrentColumnNumber" >XML_GetCurrentColumnNumber</a></code>
+could overflow. It may not be supported by all compilers, and is turned
+off by default.</dd>
+
 <dt>XML_CONTEXT_BYTES</dt>
 <dd>The number of input bytes of markup context which the parser will
 ensure are available for reporting via <code><a href=
@@ -984,14 +994,22 @@
 <p>To state the obvious: the three parsing functions <code><a href=
 "#XML_Parse" >XML_Parse</a></code>, <code><a href= "#XML_ParseBuffer">
 XML_ParseBuffer</a></code> and <code><a href= "#XML_GetBuffer">
-XML_GetBuffer</a></code> must not be
-called from within a handler unless they operate on a separate parser
-instance, that is, one that did not call the handler. For example, it
-is OK to call the parsing functions from within an
-<code>XML_ExternalEntityRefHandler</code>, if they apply to the parser
-created by <code><a href= "#XML_ExternalEntityParserCreate"
+XML_GetBuffer</a></code> must not be called from within a handler
+unless they operate on a separate parser instance, that is, one that
+did not call the handler. For example, it is OK to call the parsing
+functions from within an <code>XML_ExternalEntityRefHandler</code>,
+if they apply to the parser created by
+<code><a href= "#XML_ExternalEntityParserCreate"
 >XML_ExternalEntityParserCreate</a></code>.</p>
 
+<p>Note: the <code>len</code> argument passed to these functions
+should be considerably less than the maximum value for an integer,
+as it could create an integer overflow situation if the added
+lengths of a buffer and the unprocessed portion of the previous buffer
+exceed the maximum integer value. Input data at the end of a buffer
+will remain unprocessed if it is part of an XML token for which the
+end is not part of that buffer.</p>
+
 <pre class="fcndec" id="XML_Parse">
 enum XML_Status XMLCALL
 XML_Parse(XML_Parser p,
@@ -1201,10 +1219,11 @@
 a return value.</p>
 
 <p>Your handlers will be receiving strings in arrays of type
-<code>XML_Char</code>. This type is defined in expat.h as <code>char
-*</code> and contains bytes encoding UTF-8.  Note that you'll receive
-them in this form independent of the original encoding of the
-document.</p>
+<code>XML_Char</code>. This type is conditionally defined in expat.h as
+either <code>char</code>, <code>wchar_t</code> or <code>unsigned short</code>.
+The former implies UTF-8 encoding, the latter two imply UTF-16 encoding.
+Note that you'll receive them in this form independent of the original
+encoding of the document.</p>
 
 <div class="handler">
 <pre class="setter" id="XML_SetStartElementHandler">
@@ -1896,7 +1915,7 @@
 </div>
 
 <pre class="fcndec" id="XML_GetCurrentByteIndex">
-long XMLCALL
+XML_Index XMLCALL
 XML_GetCurrentByteIndex(XML_Parser p);
 </pre>
 <div class="fcndef">
@@ -1907,7 +1926,7 @@
 </div>
 
 <pre class="fcndec" id="XML_GetCurrentLineNumber">
-int XMLCALL
+XML_Size XMLCALL
 XML_GetCurrentLineNumber(XML_Parser p);
 </pre>
 <div class="fcndef">
@@ -1916,7 +1935,7 @@
 </div>
 
 <pre class="fcndec" id="XML_GetCurrentColumnNumber">
-int XMLCALL
+XML_Size XMLCALL
 XML_GetCurrentColumnNumber(XML_Parser p);
 </pre>
 <div class="fcndef">

Modified: trunk/reactos/lib/expat/examples/elements.c
--- trunk/reactos/lib/expat/examples/elements.c	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/examples/elements.c	2006-01-15 00:06:16 UTC (rev 20874)
@@ -2,11 +2,22 @@
    reads an XML document from standard input and writes a line with
    the name of each element to standard output indenting child
    elements by one tab stop more than their parent element.
+   It must be used with Expat compiled for UTF-8 output.
 */
 
 #include <stdio.h>
 #include "expat.h"
 
+#ifdef XML_LARGE_SIZE
+#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
+#define XML_FMT_INT_MOD "I64"
+#else
+#define XML_FMT_INT_MOD "ll"
+#endif
+#else
+#define XML_FMT_INT_MOD "l"
+#endif
+
 static void XMLCALL
 startElement(void *userData, const char *name, const char **atts)
 {
@@ -25,8 +36,14 @@
   *depthPtr -= 1;
 }
 
+#ifdef AMIGA_SHARED_LIB
+#include <proto/expat.h>
 int
+amiga_main(int argc, char *argv[])
+#else
+int
 main(int argc, char *argv[])
+#endif
 {
   char buf[BUFSIZ];
   XML_Parser parser = XML_ParserCreate(NULL);
@@ -39,7 +56,7 @@
     done = len < sizeof(buf);
     if (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR) {
       fprintf(stderr,
-              "%s at line %d\n",
+              "%s at line %" XML_FMT_INT_MOD "u\n",
               XML_ErrorString(XML_GetErrorCode(parser)),
               XML_GetCurrentLineNumber(parser));
       return 1;

Modified: trunk/reactos/lib/expat/examples/outline.c
--- trunk/reactos/lib/expat/examples/outline.c	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/examples/outline.c	2006-01-15 00:06:16 UTC (rev 20874)
@@ -18,12 +18,23 @@
  *
  * Read an XML document from standard input and print an element
  * outline on standard output.
+ * Must be used with Expat compiled for UTF-8 output.
  */
 
 
 #include <stdio.h>
 #include <expat.h>
 
+#ifdef XML_LARGE_SIZE
+#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
+#define XML_FMT_INT_MOD "I64"
+#else
+#define XML_FMT_INT_MOD "ll"
+#endif
+#else
+#define XML_FMT_INT_MOD "l"
+#endif
+
 #define BUFFSIZE        8192
 
 char Buff[BUFFSIZE];
@@ -54,8 +65,14 @@
   Depth--;
 }
 
+#ifdef AMIGA_SHARED_LIB
+#include <proto/expat.h>
 int
+amiga_main(int argc, char *argv[])
+#else
+int
 main(int argc, char *argv[])
+#endif
 {
   XML_Parser p = XML_ParserCreate(NULL);
   if (! p) {
@@ -77,7 +94,7 @@
     done = feof(stdin);
 
     if (XML_Parse(p, Buff, len, done) == XML_STATUS_ERROR) {
-      fprintf(stderr, "Parse error at line %d:\n%s\n",
+      fprintf(stderr, "Parse error at line %" XML_FMT_INT_MOD "u:\n%s\n",
               XML_GetCurrentLineNumber(p),
               XML_ErrorString(XML_GetErrorCode(p)));
       exit(-1);

Modified: trunk/reactos/lib/expat/lib/internal.h
--- trunk/reactos/lib/expat/lib/internal.h	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/lib/internal.h	2006-01-15 00:06:16 UTC (rev 20874)
@@ -20,7 +20,7 @@
          and therefore subject to change.
 */
 
-#if defined(__GNUC__) && defined(__i386__) && !defined(__MINGW32__)
+#if defined(__GNUC__) && defined(__i386__)
 /* We'll use this version by default only where we know it helps.
 
    regparm() generates warnings on Solaris boxes.   See SF bug #692878.

Modified: trunk/reactos/lib/expat/lib/xmlparse.c
--- trunk/reactos/lib/expat/lib/xmlparse.c	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/lib/xmlparse.c	2006-01-15 00:06:16 UTC (rev 20874)
@@ -12,11 +12,13 @@
 #include "winconfig.h"
 #elif defined(MACOS_CLASSIC)
 #include "macconfig.h"
+#elif defined(__amigaos4__)
+#include "amigaconfig.h"
 #elif defined(HAVE_EXPAT_CONFIG_H)
 #include <expat_config.h>
 #endif /* ndef COMPILED_FROM_DSP */
 
-#include <expat/expat.h>
+#include "expat.h"
 
 #ifdef XML_UNICODE
 #define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX
@@ -456,7 +458,7 @@
   char *m_bufferEnd;
   /* allocated end of buffer */
   const char *m_bufferLim;
-  long m_parseEndByteIndex;
+  XML_Index m_parseEndByteIndex;
   const char *m_parseEndPtr;
   XML_Char *m_dataBuf;
   XML_Char *m_dataBufEnd;
@@ -1604,9 +1606,9 @@
 
   if (len > bufferLim - bufferEnd) {
     /* FIXME avoid integer overflow */
-    int neededSize = len + (bufferEnd - bufferPtr);
+    int neededSize = len + (int)(bufferEnd - bufferPtr);
 #ifdef XML_CONTEXT_BYTES
-    int keep = bufferPtr - buffer;
+    int keep = (int)(bufferPtr - buffer);
 
     if (keep > XML_CONTEXT_BYTES)
       keep = XML_CONTEXT_BYTES;
@@ -1615,7 +1617,7 @@
     if (neededSize  <= bufferLim - buffer) {
 #ifdef XML_CONTEXT_BYTES
       if (keep < bufferPtr - buffer) {
-        int offset = (bufferPtr - buffer) - keep;
+        int offset = (int)(bufferPtr - buffer) - keep;
         memmove(buffer, &buffer[offset], bufferEnd - bufferPtr + keep);
         bufferEnd -= offset;
         bufferPtr -= offset;
@@ -1628,7 +1630,7 @@
     }
     else {
       char *newBuf;
-      int bufferSize = bufferLim - bufferPtr;
+      int bufferSize = (int)(bufferLim - bufferPtr);
       if (bufferSize == 0)
         bufferSize = INIT_BUFFER_SIZE;
       do {
@@ -1642,7 +1644,7 @@
       bufferLim = newBuf + bufferSize;
 #ifdef XML_CONTEXT_BYTES
       if (bufferPtr) {
-        int keep = bufferPtr - buffer;
+        int keep = (int)(bufferPtr - buffer);
         if (keep > XML_CONTEXT_BYTES)
           keep = XML_CONTEXT_BYTES;
         memcpy(newBuf, &bufferPtr[-keep], bufferEnd - bufferPtr + keep);
@@ -1749,7 +1751,7 @@
   return errorCode;
 }
 
-long XMLCALL
+XML_Index XMLCALL
 XML_GetCurrentByteIndex(XML_Parser parser)
 {
   if (eventPtr)
@@ -1761,7 +1763,7 @@
 XML_GetCurrentByteCount(XML_Parser parser)
 {
   if (eventEndPtr && eventPtr)
-    return eventEndPtr - eventPtr;
+    return (int)(eventEndPtr - eventPtr);
   return 0;
 }
 
@@ -1770,15 +1772,15 @@
 {
 #ifdef XML_CONTEXT_BYTES
   if (eventPtr && buffer) {
-    *offset = eventPtr - buffer;
-    *size   = bufferEnd - buffer;
+    *offset = (int)(eventPtr - buffer);
+    *size   = (int)(bufferEnd - buffer);
     return buffer;
   }
 #endif /* defined XML_CONTEXT_BYTES */
   return (char *) 0;
 }
 
-int XMLCALL
+XML_Size XMLCALL
 XML_GetCurrentLineNumber(XML_Parser parser)
 {
   if (eventPtr && eventPtr >= positionPtr) {
@@ -1788,7 +1790,7 @@
   return position.lineNumber + 1;
 }
 
-int XMLCALL
+XML_Size XMLCALL
 XML_GetCurrentColumnNumber(XML_Parser parser)
 {
   if (eventPtr && eventPtr >= positionPtr) {
@@ -2324,12 +2326,12 @@
             XmlConvert(enc,
                        &fromPtr, rawNameEnd,
                        (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1);
-            convLen = toPtr - (XML_Char *)tag->buf;
+            convLen = (int)(toPtr - (XML_Char *)tag->buf);
             if (fromPtr == rawNameEnd) {
               tag->name.strLen = convLen;
               break;
             }
-            bufSize = (tag->bufEnd - tag->buf) << 1;
+            bufSize = (int)(tag->bufEnd - tag->buf) << 1;
             {
               char *temp = (char *)REALLOC(tag->buf, bufSize);
               if (temp == NULL)
@@ -2517,12 +2519,12 @@
           ICHAR *dataPtr = (ICHAR *)dataBuf;
           XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
           characterDataHandler(handlerArg, dataBuf,
-                               dataPtr - (ICHAR *)dataBuf);
+                               (int)(dataPtr - (ICHAR *)dataBuf));
         }
         else
           characterDataHandler(handlerArg,
                                (XML_Char *)s,
-                               (XML_Char *)end - (XML_Char *)s);
+                               (int)((XML_Char *)end - (XML_Char *)s));
       }
       else if (defaultHandler)
         reportDefault(parser, enc, s, end);
@@ -2547,7 +2549,7 @@
             XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
             *eventEndPP = s;
             characterDataHandler(handlerArg, dataBuf,
-                                 dataPtr - (ICHAR *)dataBuf);
+                                 (int)(dataPtr - (ICHAR *)dataBuf));
             if (s == next)
               break;
             *eventPP = s;
@@ -2556,7 +2558,7 @@
         else
           characterDataHandler(handlerArg,
                                (XML_Char *)s,
-                               (XML_Char *)next - (XML_Char *)s);
+                               (int)((XML_Char *)next - (XML_Char *)s));
       }
       else if (defaultHandler)
         reportDefault(parser, enc, s, next);
@@ -2854,8 +2856,10 @@
         nsAtts[j].hash = uriHash;
         nsAtts[j].uriName = s;
 
-        if (!--nPrefixes)
+        if (!--nPrefixes) {
+          i += 2;
           break;
+        }
       }
       else  /* not prefixed */
         ((XML_Char *)s)[-1] = 0;  /* clear flag */
@@ -3125,7 +3129,7 @@
             XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
             *eventEndPP = next;
             characterDataHandler(handlerArg, dataBuf,
-                                 dataPtr - (ICHAR *)dataBuf);
+                                 (int)(dataPtr - (ICHAR *)dataBuf));
             if (s == next)
               break;
             *eventPP = s;
@@ -3134,7 +3138,7 @@
         else
           characterDataHandler(handlerArg,
                                (XML_Char *)s,
-                               (XML_Char *)next - (XML_Char *)s);
+                               (int)((XML_Char *)next - (XML_Char *)s));
       }
       else if (defaultHandler)
         reportDefault(parser, enc, s, next);
@@ -3799,7 +3803,8 @@
       */
 #ifdef XML_DTD
       if (doctypeSysid || useForeignDTD) {
-        dtd->hasParamEntityRefs = XML_TRUE; /* when docTypeSysid == NULL */
+        XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs;
+        dtd->hasParamEntityRefs = XML_TRUE;
         if (paramEntityParsing && externalEntityRefHandler) {
           ENTITY *entity = (ENTITY *)lookup(&dtd->paramEntities,
                                             externalSubsetName,
@@ -3815,11 +3820,17 @@
                                         entity->systemId,
                                         entity->publicId))
             return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
-          if (dtd->paramEntityRead &&
-              !dtd->standalone &&
-              notStandaloneHandler &&
-              !notStandaloneHandler(handlerArg))
-            return XML_ERROR_NOT_STANDALONE;
+          if (dtd->paramEntityRead) {
+            if (!dtd->standalone && 
+                notStandaloneHandler && 
+                !notStandaloneHandler(handlerArg))
+              return XML_ERROR_NOT_STANDALONE;
+          }
+          /* if we didn't read the foreign DTD then this means that there
+             is no external subset and we must reset dtd->hasParamEntityRefs
+          */
+          else if (!doctypeSysid)
+            dtd->hasParamEntityRefs = hadParamEntityRefs;
           /* end of DTD - no need to update dtd->keepProcessing */
         }
         useForeignDTD = XML_FALSE;
@@ -3836,6 +3847,7 @@
          last chance to read the foreign DTD
       */
       if (useForeignDTD) {
+        XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs;
         dtd->hasParamEntityRefs = XML_TRUE;
         if (paramEntityParsing && externalEntityRefHandler) {
           ENTITY *entity = (ENTITY *)lookup(&dtd->paramEntities,
@@ -3851,11 +3863,17 @@
                                         entity->systemId,
                                         entity->publicId))
             return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
-          if (dtd->paramEntityRead &&
-              !dtd->standalone &&
-              notStandaloneHandler &&
-              !notStandaloneHandler(handlerArg))
-            return XML_ERROR_NOT_STANDALONE;
+          if (dtd->paramEntityRead) {
+            if (!dtd->standalone &&
+                notStandaloneHandler &&
+                !notStandaloneHandler(handlerArg))
+              return XML_ERROR_NOT_STANDALONE;
+          }
+          /* if we didn't read the foreign DTD then this means that there
+             is no external subset and we must reset dtd->hasParamEntityRefs
+          */
+          else
+            dtd->hasParamEntityRefs = hadParamEntityRefs;
           /* end of DTD - no need to update dtd->keepProcessing */
         }
       }
@@ -3996,7 +4014,7 @@
                                             next - enc->minBytesPerChar);
         if (declEntity) {
           declEntity->textPtr = poolStart(&dtd->entityValuePool);
-          declEntity->textLen = poolLength(&dtd->entityValuePool);
+          declEntity->textLen = (int)(poolLength(&dtd->entityValuePool));
           poolFinish(&dtd->entityValuePool);
           if (entityDeclHandler) {
             *eventEndPP = s;
@@ -4681,7 +4699,7 @@
 
   if (result == XML_ERROR_NONE) {
     if (textEnd != next && ps_parsing == XML_SUSPENDED) {
-      entity->processed = next - textStart;
+      entity->processed = (int)(next - textStart);
       processor = internalEntityProcessor;
     }
     else {
@@ -4727,7 +4745,7 @@
   if (result != XML_ERROR_NONE)
     return result;
   else if (textEnd != next && ps_parsing == XML_SUSPENDED) {
-    entity->processed = next - (char *)entity->textPtr;
+    entity->processed = (int)(next - (char *)entity->textPtr);
     return result;
   }
   else {
@@ -4861,9 +4879,8 @@
           return XML_ERROR_NO_MEMORY;
         entity = (ENTITY *)lookup(&dtd->generalEntities, name, 0);
         poolDiscard(&temp2Pool);
-        /* first, determine if a check for an existing declaration is needed;
-           if yes, check that the entity exists, and that it is internal,
-           otherwise call the default handler (if called from content)
+        /* First, determine if a check for an existing declaration is needed;
+           if yes, check that the entity exists, and that it is internal.
         */
         if (pool == &dtd->pool)  /* are we called from prolog? */
           checkEntityDecl =
@@ -4882,13 +4899,16 @@
             return XML_ERROR_ENTITY_DECLARED_IN_PE;
         }
         else if (!entity) {
-          /* cannot report skipped entity here - see comments on
-             skippedEntityHandler
+          /* Cannot report skipped entity here - see comments on
+             skippedEntityHandler.
           if (skippedEntityHandler)
             skippedEntityHandler(handlerArg, name, 0);
           */
+          /* Cannot call the default handler because this would be
+             out of sync with the call to the startElementHandler.
           if ((pool == &tempPool) && defaultHandler)
             reportDefault(parser, enc, ptr, next);
+          */
           break;
         }
         if (entity->open) {
@@ -5188,12 +5208,12 @@
       ICHAR *dataPtr = (ICHAR *)dataBuf;
       XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
       *eventEndPP = s;
-      defaultHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
+      defaultHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf));
       *eventPP = s;
     } while (s != end);
   }
   else
-    defaultHandler(handlerArg, (XML_Char *)s, (XML_Char *)end - (XML_Char *)s);
+    defaultHandler(handlerArg, (XML_Char *)s, (int)((XML_Char *)end - (XML_Char *)s));
 }
 
 
@@ -6075,7 +6095,7 @@
     }
   }
   if (pool->blocks && pool->start == pool->blocks->s) {
-    int blockSize = (pool->end - pool->start)*2;
+    int blockSize = (int)(pool->end - pool->start)*2;
     pool->blocks = (BLOCK *)
       pool->mem->realloc_fcn(pool->blocks,
                              (offsetof(BLOCK, s)
@@ -6089,7 +6109,7 @@
   }
   else {
     BLOCK *tem;
-    int blockSize = pool->end - pool->start;
+    int blockSize = (int)(pool->end - pool->start);
     if (blockSize < INIT_BLOCK_SIZE)
       blockSize = INIT_BLOCK_SIZE;
     else

Modified: trunk/reactos/lib/expat/lib/xmlrole.c
--- trunk/reactos/lib/expat/lib/xmlrole.c	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/lib/xmlrole.c	2006-01-15 00:06:16 UTC (rev 20874)
@@ -8,13 +8,15 @@
 #include "winconfig.h"
 #elif defined(MACOS_CLASSIC)
 #include "macconfig.h"
+#elif defined(__amigaos4__)
+#include "amigaconfig.h"
 #else
 #ifdef HAVE_EXPAT_CONFIG_H
 #include <expat_config.h>
 #endif
 #endif /* ndef COMPILED_FROM_DSP */
 
-#include <expat/expat_external.h>
+#include "expat_external.h"
 #include "internal.h"
 #include "xmlrole.h"
 #include "ascii.h"

Modified: trunk/reactos/lib/expat/lib/xmltok.c
--- trunk/reactos/lib/expat/lib/xmltok.c	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/lib/xmltok.c	2006-01-15 00:06:16 UTC (rev 20874)
@@ -8,13 +8,15 @@
 #include "winconfig.h"
 #elif defined(MACOS_CLASSIC)
 #include "macconfig.h"
+#elif defined(__amigaos4__)
+#include "amigaconfig.h"
 #else
 #ifdef HAVE_EXPAT_CONFIG_H
 #include <expat_config.h>
 #endif
 #endif /* ndef COMPILED_FROM_DSP */
 
-#include <expat/expat_external.h>
+#include "expat_external.h"
 #include "internal.h"
 #include "xmltok.h"
 #include "nametab.h"

Modified: trunk/reactos/lib/expat/lib/xmltok.h
--- trunk/reactos/lib/expat/lib/xmltok.h	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/lib/xmltok.h	2006-01-15 00:06:16 UTC (rev 20874)
@@ -111,8 +111,8 @@
 
 typedef struct position {
   /* first line and first column are 0 not 1 */
-  unsigned long lineNumber;
-  unsigned long columnNumber;
+  XML_Size lineNumber;
+  XML_Size columnNumber;
 } POSITION;
 
 typedef struct {

Modified: trunk/reactos/lib/expat/lib/xmltok_impl.c
--- trunk/reactos/lib/expat/lib/xmltok_impl.c	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/lib/xmltok_impl.c	2006-01-15 00:06:16 UTC (rev 20874)
@@ -1714,7 +1714,7 @@
       ptr += MINBPC(enc);
       break;
     default:
-      return ptr - start;
+      return (int)(ptr - start);
     }
   }
 }
@@ -1750,7 +1750,7 @@
     LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
 #undef LEAD_CASE
     case BT_LF:
-      pos->columnNumber = (unsigned)-1;
+      pos->columnNumber = (XML_Size)-1;
       pos->lineNumber++;
       ptr += MINBPC(enc);
       break;
@@ -1759,7 +1759,7 @@
       ptr += MINBPC(enc);
       if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF)
         ptr += MINBPC(enc);
-      pos->columnNumber = (unsigned)-1;
+      pos->columnNumber = (XML_Size)-1;
       break;
     default:
       ptr += MINBPC(enc);

Modified: trunk/reactos/lib/expat/make-release.sh
--- trunk/reactos/lib/expat/make-release.sh	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/make-release.sh	2006-01-15 00:06:16 UTC (rev 20874)
@@ -7,8 +7,8 @@
 # Note: tagname may be HEAD to just grab the head revision (e.g. for testing)
 #
 
-CVSROOT=':ext:cvs.libexpat.org:/cvsroot/expat'
-#CVSROOT=':pserver:anonymous@cvs.libexpat.org:/cvsroot/expat'
+#CVSROOT=':ext:cvs.libexpat.org:/cvsroot/expat'
+CVSROOT=':pserver:anonymous@cvs.libexpat.org:/cvsroot/expat'
 
 if test $# != 1; then
   echo "USAGE: $0 tagname"

Modified: trunk/reactos/lib/expat/tests/README.txt
--- trunk/reactos/lib/expat/tests/README.txt	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/tests/README.txt	2006-01-15 00:06:16 UTC (rev 20874)
@@ -3,12 +3,12 @@
 are not expected to be useful examples of Expat usage; see the
 examples/ directory for that.
 
-The Expat tests use the "Check" unit testing framework for C.  More
-information on Check can be found at:
+The Expat tests use a partial internal implementation of the "Check"
+unit testing framework for C. More information on Check can be found at:
 
         http://check.sourceforge.net/
 
-Check 0.8 must be installed before the unit tests can be compiled & run.
+Expat must be built and installed before "make check" can be executed.
 
 Since both Check and this test suite are young, it can all change in a
 later version.

Modified: trunk/reactos/lib/expat/tests/benchmark/README.txt
--- trunk/reactos/lib/expat/tests/benchmark/README.txt	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/tests/benchmark/README.txt	2006-01-15 00:06:16 UTC (rev 20874)
@@ -4,7 +4,7 @@
 
 The command line arguments are:
 
-  -n             ... optional; if supplied, then namespace processing is turned on
+  -n             ... optional; if supplied, namespace processing is turned on
   <file name>    ... name/path of test xml file
   <buffer size>  ... size of processing buffer;
                      the file is parsed in chunks of this size
@@ -13,4 +13,4 @@
 Returns:
 
   The time (in seconds) it takes to parse the test file,
-  averaged of the number of iterations.
\ No newline at end of file
+  averaged over the number of iterations.
\ No newline at end of file

Modified: trunk/reactos/lib/expat/tests/benchmark/benchmark.c
--- trunk/reactos/lib/expat/tests/benchmark/benchmark.c	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/tests/benchmark/benchmark.c	2006-01-15 00:06:16 UTC (rev 20874)
@@ -4,6 +4,12 @@
 #include <time.h>
 #include "expat.h"
 
+#ifdef XML_LARGE_SIZE
+#define XML_FMT_INT_MOD "ll"
+#else
+#define XML_FMT_INT_MOD "l"
+#endif
+
 static void
 usage(const char *prog, int rc)
 {
@@ -12,7 +18,13 @@
   exit(rc);
 }
 
+#ifdef AMIGA_SHARED_LIB
+#include <proto/expat.h>
+int
+amiga_main(int argc, char *argv[])
+#else
 int main (int argc, char *argv[]) 
+#endif
 {
   XML_Parser  parser;
   char        *XMLBuf, *XMLBufEnd, *XMLBufPtr;
@@ -77,7 +89,8 @@
       else
         parseBufferSize = bufferSize;
       if (!XML_Parse (parser, XMLBufPtr, parseBufferSize, isFinal)) {
-        fprintf (stderr, "error '%s' at line %d character %d\n",
+        fprintf (stderr, "error '%s' at line %" XML_FMT_INT_MOD \
+                     "u character %" XML_FMT_INT_MOD "u\n",
                  XML_ErrorString (XML_GetErrorCode (parser)),
                  XML_GetCurrentLineNumber (parser),
                  XML_GetCurrentColumnNumber (parser));

Modified: trunk/reactos/lib/expat/tests/runtests.c
--- trunk/reactos/lib/expat/tests/runtests.c	2006-01-14 23:54:05 UTC (rev 20873)
+++ trunk/reactos/lib/expat/tests/runtests.c	2006-01-15 00:06:16 UTC (rev 20874)
@@ -17,7 +17,16 @@
 #include "chardata.h"
 #include "minicheck.h"
 
+#ifdef AMIGA_SHARED_LIB
+#include <proto/expat.h>
+#endif
 
+#ifdef XML_LARGE_SIZE
+#define XML_FMT_INT_MOD "ll"
+#else
+#define XML_FMT_INT_MOD "l"
+#endif
+
 static XML_Parser parser;
 
 
@@ -45,7 +54,8 @@
 {
     char buffer[1024];
     sprintf(buffer,
-            "\n    %s (line %d, offset %d)\n    reported from %s, line %d",
+            "\n    %s (line %" XML_FMT_INT_MOD "u, offset %"\
+                XML_FMT_INT_MOD "u)\n    reported from %s, line %d",
             XML_ErrorString(XML_GetErrorCode(parser)),
             XML_GetCurrentLineNumber(parser),
             XML_GetCurrentColumnNumber(parser),
@@ -397,14 +407,15 @@
         "<tag>\n"
         "\n"
         "\n</tag>";
-    int lineno;
+    XML_Size 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);
+        sprintf(buffer, 
+            "expected 4 lines, saw %" XML_FMT_INT_MOD "u", lineno);
         fail(buffer);
     }
 }
@@ -414,14 +425,15 @@
 START_TEST(test_column_number_after_parse)
 {
     char *text = "<tag></tag>";
-    int colno;
+    XML_Size 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);
+        sprintf(buffer, 
+            "expected 11 columns, saw %" XML_FMT_INT_MOD "u", colno);
         fail(buffer);
     }
 }
@@ -434,7 +446,9 @@
     CharData *storage = (CharData *) userData;
     char buffer[100];
 
-    sprintf(buffer, "<%s> at col:%d line:%d\n", name,
+    sprintf(buffer,
+        "<%s> at col:%" XML_FMT_INT_MOD "u line:%"\
+            XML_FMT_INT_MOD "u\n", name,
 	    XML_GetCurrentColumnNumber(parser),
 	    XML_GetCurrentLineNumber(parser));
     CharData_AppendString(storage, buffer);
@@ -446,7 +460,9 @@
     CharData *storage = (CharData *) userData;
     char buffer[100];
 
-    sprintf(buffer, "</%s> at col:%d line:%d\n", name,
+    sprintf(buffer,
+        "</%s> at col:%" XML_FMT_INT_MOD "u line:%"\
+            XML_FMT_INT_MOD "u\n", name,
 	    XML_GetCurrentColumnNumber(parser),
 	    XML_GetCurrentLineNumber(parser));
     CharData_AppendString(storage, buffer);
@@ -495,14 +511,14 @@
         "<a>\n"
         "  <b>\n"
         "  </a>";  /* missing </b> */
-    int lineno;
+    XML_Size 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);
+        sprintf(buffer, "expected 3 lines, saw %" XML_FMT_INT_MOD "u", lineno);
         fail(buffer);
     }
 }
@@ -515,14 +531,15 @@
         "<a>\n"
         "  <b>\n"
         "  </a>";  /* missing </b> */
-    int colno;
+    XML_Size 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);
+        sprintf(buffer, 
+            "expected 4 columns, saw %" XML_FMT_INT_MOD "u", colno);
[truncated at 1000 lines; 299 more skipped]