Index: trunk/src/helpers/cctl_splitwin.c
===================================================================
--- trunk/src/helpers/cctl_splitwin.c	(revision 97)
+++ trunk/src/helpers/cctl_splitwin.c	(revision 98)
@@ -510,5 +510,10 @@
 
             case WM_MOUSEMOVE:
-                pData->hptrOld = WinSetPointer(HWND_DESKTOP, pData->hptrMove);
+                if (pData->sbcd.ulCreateFlags & SBCF_MOVEABLE)
+                    // V0.9.14 (2001-08-21) [umoeller]
+                    // split bar is moveable:
+                    pData->hptrOld = WinSetPointer(HWND_DESKTOP, pData->hptrMove);
+                else
+                    mrc = OldStaticProc(hwndBar, msg, mp1, mp2);
             break;
 
@@ -521,5 +526,10 @@
             case WM_BUTTON1DOWN:
             case WM_BUTTON2DOWN:
-                TrackSplitBar(hwndBar, pData);
+                if (pData->sbcd.ulCreateFlags & SBCF_MOVEABLE)
+                    // V0.9.14 (2001-08-21) [umoeller]
+                    // split bar is moveable:
+                    TrackSplitBar(hwndBar, pData);
+                else
+                    mrc = OldStaticProc(hwndBar, msg, mp1, mp2);
             break;
 
Index: trunk/src/helpers/dialog.c
===================================================================
--- trunk/src/helpers/dialog.c	(revision 97)
+++ trunk/src/helpers/dialog.c	(revision 98)
@@ -100,5 +100,6 @@
     LINKLIST    llTables;
 
-    HWND        hwndFirstFocus;
+    HWND        hwndFirstFocus,
+                hwndDefPushbutton;      // V0.9.14 (2001-08-21) [umoeller]
 
     POINTL      ptlTotalOfs;
@@ -719,4 +720,13 @@
                        )
                         pDlgData->hwndFirstFocus = pColumnDef->hwndControl;
+
+                    // if this is the first default push button,
+                    // go store it too
+                    // V0.9.14 (2001-08-21) [umoeller]
+                    if (    (!pDlgData->hwndDefPushbutton)
+                         && ((ULONG)pControlDef->pcszClass == 0xffff0003L)
+                         && (pControlDef->flStyle & BS_DEFAULT)
+                       )
+                        pDlgData->hwndDefPushbutton = pColumnDef->hwndControl;
                 }
                 else
@@ -1048,6 +1058,14 @@
  *      This does NOT use regular dialog templates from
  *      module resources. Instead, you pass in an array
- *      of _DLGHITEM structures, which define the controls
+ *      of DLGHITEM structures, which define the controls
  *      and how they are to be formatted.
+ *
+ *      The main advantage compared to dialog resources is
+ *      that with this  function, you will never have to
+ *      define control _positions_. Instead, you only specify
+ *      the control _sizes_, and all positions are computed
+ *      automatically here. Even better, for many controls,
+ *      auto-sizing is supported according to the control's
+ *      text (e.g. for statics and checkboxes).
  *
  *      A regular standard dialog would use something like
@@ -1068,16 +1086,15 @@
  *      your dlg proc, use WinDefDlgProc as usual.
  *
- *      There is NO run-time overhead after creation; after this
- *      function returns, the dialog is a standard dialog as if
- *      loaded from WinLoadDlg.
- *
- *      The array of _DLGHITEM structures defines how the
+ *      There is NO run-time overhead for either code or memory
+ *      after dialog creation; after this function returns, the
+ *      dialog is a standard dialog as if loaded from WinLoadDlg.
+ *      The array of DLGHITEM structures defines how the
  *      dialog is set up. All this is ONLY used by this function
  *      and NOT needed after the dialog has been created.
  *
- *      In _DLGHITEM, the "Type" field determines what this
+ *      In DLGHITEM, the "Type" field determines what this
  *      structure defines. A number of handy macros have been
  *      defined to make this easier and to provide type-checking
- *      at compile time.
+ *      at compile time. See dialog.h for more.
  *
  *      Essentially, such a dialog item operates similarly to
@@ -1111,9 +1128,8 @@
  *
  *      --  CONTROL_DEF(pDef) defines a control in a table row.
- *          pDef must point to a _CONTROLDEF structure.
- *
- *          The main difference (and advantage) of this
- *          function is that there is NO information in
- *          _CONTROLDEF about a control's _position_.
+ *          pDef must point to a CONTROLDEF structure.
+ *
+ *          Again, there is is NO information in
+ *          CONTROLDEF about a control's _position_.
  *          Instead, the structure only contains the _size_
  *          of the control. All positions are computed by
@@ -1251,5 +1267,6 @@
  +                                        DlgTemplate,      // DLGHITEM array
  +                                        ARRAYITEMCOUNT(DlgTemplate),
- +                                        NULL))
+ +                                        NULL,             // mp2 for WM_INITDLG
+ +                                        "9.WarpSans"))    // default font
  +          {
  +              ULONG idReturn = WinProcessDlg(hwndDlg);
@@ -1259,4 +1276,5 @@
  *@@changed V0.9.14 (2001-07-07) [umoeller]: fixed disabled mouse with hwndOwner == HWND_DESKTOP
  *@@changed V0.9.14 (2001-08-01) [umoeller]: fixed major memory leaks with nested tables
+ *@@changed V0.9.14 (2001-08-21) [umoeller]: fixed default push button problems
  */
 
@@ -1317,6 +1335,11 @@
 
                 // push the current table on the stack
-                PSTACKITEM pStackItem = NEW(STACKITEM);
-                if (pStackItem)
+                PSTACKITEM pStackItem;
+                if (!(pStackItem = NEW(STACKITEM)))
+                {
+                    arc = ERROR_NOT_ENOUGH_MEMORY;
+                    break;
+                }
+                else
                 {
                     pStackItem->pLastTable = pCurrentTable;
@@ -1326,6 +1349,5 @@
 
                 // create new table
-                pCurrentTable = NEW(TABLEDEF);
-                if (!pCurrentTable)
+                if (!(pCurrentTable = NEW(TABLEDEF)))
                     arc = ERROR_NOT_ENOUGH_MEMORY;
                 else
@@ -1372,6 +1394,5 @@
                 {
                     // create new row
-                    pCurrentRow = NEW(ROWDEF);
-                    if (!pCurrentRow)
+                    if (!(pCurrentRow = NEW(ROWDEF)))
                         arc = ERROR_NOT_ENOUGH_MEMORY;
                     else
@@ -1465,16 +1486,14 @@
             hwndOwner = NULLHANDLE;
 
-        pDlgData->hwndDlg = WinCreateWindow(HWND_DESKTOP,
-                                            WC_FRAME,
-                                            (PSZ)pcszDlgTitle,
-                                            flStyle,        // style; invisible for now
-                                            0, 0, 0, 0,
-                                            hwndOwner,
-                                            HWND_TOP,
-                                            0,              // ID
-                                            &fcData,
-                                            NULL);          // presparams
-
-        if (!pDlgData->hwndDlg)
+        if (!(pDlgData->hwndDlg = WinCreateWindow(HWND_DESKTOP,
+                                                  WC_FRAME,
+                                                  (PSZ)pcszDlgTitle,
+                                                  flStyle,        // style; invisible for now
+                                                  0, 0, 0, 0,
+                                                  hwndOwner,
+                                                  HWND_TOP,
+                                                  0,              // ID
+                                                  &fcData,
+                                                  NULL)))          // presparams
             arc = DLGERR_CANNOT_CREATE_FRAME;
         else
@@ -1493,5 +1512,8 @@
                        &szlClient,
                        PROCESS_CALC_SIZES);
-
+                // this goes into major recursions...
+
+            // free the cached font resources that
+            // might have been created here
             if (pDlgData->lcidLast)
             {
@@ -1501,4 +1523,6 @@
             if (pDlgData->hps)
                 WinReleasePS(pDlgData->hps);
+
+            WinSubclassWindow(hwndDlg, pfnwpDialogProc);
 
             /*
@@ -1506,6 +1530,4 @@
              *     size of all controls
              */
-
-            WinSubclassWindow(hwndDlg, pfnwpDialogProc);
 
             // calculate the frame size from the client size
@@ -1546,4 +1568,11 @@
                        &szlClient,
                        PROCESS_CREATE_CONTROLS);
+
+            if (pDlgData->hwndDefPushbutton)
+                // we had a default pushbutton:
+                // go set it V0.9.14 (2001-08-21) [umoeller]
+                WinSetWindowULong(pDlgData->hwndDlg,
+                                  QWL_DEFBUTTON,
+                                  pDlgData->hwndDefPushbutton);
 
             /*
Index: trunk/src/helpers/xmlparse.c
===================================================================
--- trunk/src/helpers/xmlparse.c	(revision 97)
+++ trunk/src/helpers/xmlparse.c	(revision 98)
@@ -947,7 +947,7 @@
     inheritedBindings = 0;
     attsSize = INIT_ATTS_SIZE;
-    atts = MALLOC(attsSize * sizeof(ATTRIBUTE));
+    atts = (ATTRIBUTE*)MALLOC(attsSize * sizeof(ATTRIBUTE));
     nSpecifiedAtts = 0;
-    dataBuf = MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char));
+    dataBuf = (XML_Char*)MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char));
     groupSize = 0;
     groupConnector = 0;
@@ -1065,5 +1065,5 @@
 
 #ifdef XML_DTD
-    int oldParamEntityParsing = paramEntityParsing;
+    enum XML_ParamEntityParsing oldParamEntityParsing = paramEntityParsing;
 
 #endif
@@ -2252,5 +2252,5 @@
             }
             while (bufferSize < neededSize);
-            newBuf = MALLOC(bufferSize);
+            newBuf = (char*)MALLOC(bufferSize);
             if (newBuf == 0)
             {
@@ -2783,8 +2783,8 @@
                     else
                     {
-                        tag = MALLOC(sizeof(TAG));
+                        tag = (TAG*)MALLOC(sizeof(TAG));
                         if (!tag)
                             return ERROR_EXPAT_NO_MEMORY;
-                        tag->buf = MALLOC(INIT_TAG_BUF_SIZE);
+                        tag->buf = (char*)MALLOC(INIT_TAG_BUF_SIZE);
                         if (!tag->buf)
                             return ERROR_EXPAT_NO_MEMORY;
@@ -2806,5 +2806,5 @@
 
                             bufSize = ROUND_UP(bufSize, sizeof(XML_Char));
-                            tag->buf = REALLOC(tag->buf, bufSize);
+                            tag->buf = (char*)REALLOC(tag->buf, bufSize);
                             if (!tag->buf)
                                 return ERROR_EXPAT_NO_MEMORY;
@@ -2837,5 +2837,5 @@
                                 break;
                             bufSize = (tag->bufEnd - tag->buf) << 1;
-                            tag->buf = REALLOC(tag->buf, bufSize);
+                            tag->buf = (char*)REALLOC(tag->buf, bufSize);
                             if (!tag->buf)
                                 return ERROR_EXPAT_NO_MEMORY;
@@ -3140,5 +3140,5 @@
 
         attsSize = n + nDefaultAtts + INIT_ATTS_SIZE;
-        atts = REALLOC((void *)atts, attsSize * sizeof(ATTRIBUTE));
+        atts = (ATTRIBUTE*)REALLOC((void *)atts, attsSize * sizeof(ATTRIBUTE));
         if (!atts)
             return ERROR_EXPAT_NO_MEMORY;
@@ -3365,5 +3365,5 @@
     {
         TAG *p;
-        XML_Char *uri = MALLOC((n + EXPAND_SPARE) * sizeof(XML_Char));
+        XML_Char *uri = (XML_Char*)MALLOC((n + EXPAND_SPARE) * sizeof(XML_Char));
 
         if (!uri)
@@ -3397,5 +3397,5 @@
         if (len > b->uriAlloc)
         {
-            b->uri = REALLOC(b->uri, sizeof(XML_Char) * (len + EXPAND_SPARE));
+            b->uri = (XML_Char*)REALLOC(b->uri, sizeof(XML_Char) * (len + EXPAND_SPARE));
             if (!b->uri)
                 return 0;
@@ -3406,8 +3406,8 @@
     else
     {
-        b = MALLOC(sizeof(BINDING));
+        b = (BINDING*)MALLOC(sizeof(BINDING));
         if (!b)
             return 0;
-        b->uri = MALLOC(sizeof(XML_Char) * (len + EXPAND_SPARE));
+        b->uri = (XML_Char*)MALLOC(sizeof(XML_Char) * (len + EXPAND_SPARE));
         if (!b->uri)
         {
@@ -3819,5 +3819,5 @@
             {
                 unknownEncodingData = info.data;
-                unknownEncodingRelease = info.release;
+                unknownEncodingRelease = (void(*)(void*))info.release;
                 encoding = enc;
                 return ERROR_EXPAT_NONE;
@@ -4453,10 +4453,10 @@
                     if (groupSize)
                     {
-                        groupConnector = REALLOC(groupConnector, groupSize *= 2);
+                        groupConnector = (char*)REALLOC(groupConnector, groupSize *= 2);
                         if (dtd.scaffIndex)
-                            dtd.scaffIndex = REALLOC(dtd.scaffIndex, groupSize * sizeof(int));
+                            dtd.scaffIndex = (int*)REALLOC(dtd.scaffIndex, groupSize * sizeof(int));
                     }
                     else
-                        groupConnector = MALLOC(groupSize = 32);
+                        groupConnector = (char*)MALLOC(groupSize = 32);
                     if (!groupConnector)
                         return ERROR_EXPAT_NO_MEMORY;
@@ -5232,10 +5232,10 @@
         {
             type->allocDefaultAtts = 8;
-            type->defaultAtts = MALLOC(type->allocDefaultAtts * sizeof(DEFAULT_ATTRIBUTE));
+            type->defaultAtts = (DEFAULT_ATTRIBUTE*)MALLOC(type->allocDefaultAtts * sizeof(DEFAULT_ATTRIBUTE));
         }
         else
         {
             type->allocDefaultAtts *= 2;
-            type->defaultAtts = REALLOC(type->defaultAtts,
+            type->defaultAtts = (DEFAULT_ATTRIBUTE*)REALLOC(type->defaultAtts,
                           type->allocDefaultAtts * sizeof(DEFAULT_ATTRIBUTE));
         }
@@ -5814,5 +5814,5 @@
             return 0;
         tsize = INIT_SIZE * sizeof(NAMED *);
-        table->v = table->mem->malloc_fcn(tsize);
+        table->v = (NAMED**)table->mem->malloc_fcn(tsize);
         if (!table->v)
             return 0;
@@ -5840,5 +5840,5 @@
             size_t newSize = table->size * 2;
             size_t tsize = newSize * sizeof(NAMED *);
-            NAMED **newV = table->mem->malloc_fcn(tsize);
+            NAMED **newV = (NAMED**)table->mem->malloc_fcn(tsize);
 
             if (!newV)
@@ -5866,5 +5866,5 @@
         }
     }
-    table->v[i] = table->mem->malloc_fcn(createSize);
+    table->v[i] = (NAMED*)table->mem->malloc_fcn(createSize);
     if (!table->v[i])
         return 0;
@@ -6140,5 +6140,5 @@
         int blockSize = (pool->end - pool->start) * 2;
 
-        pool->blocks = pool->mem->realloc_fcn(pool->blocks, offsetof(BLOCK, s) + blockSize * sizeof(XML_Char));
+        pool->blocks = (BLOCK*)pool->mem->realloc_fcn(pool->blocks, offsetof(BLOCK, s) + blockSize * sizeof(XML_Char));
         if (!pool->blocks)
             return 0;
@@ -6157,5 +6157,5 @@
         else
             blockSize *= 2;
-        tem = pool->mem->malloc_fcn(offsetof(BLOCK, s) + blockSize * sizeof(XML_Char));
+        tem = (BLOCK*)pool->mem->malloc_fcn(offsetof(BLOCK, s) + blockSize * sizeof(XML_Char));
         if (!tem)
             return 0;
@@ -6180,5 +6180,5 @@
     if (!dtd.scaffIndex)
     {
-        dtd.scaffIndex = MALLOC(groupSize * sizeof(int));
+        dtd.scaffIndex = (int*)MALLOC(groupSize * sizeof(int));
 
         if (!dtd.scaffIndex)
@@ -6273,5 +6273,5 @@
     int allocsize = dtd.scaffCount * sizeof(XMLCONTENT) + dtd.contentStringLen;
 
-    ret = MALLOC(allocsize);
+    ret = (XMLCONTENT*)MALLOC(allocsize);
     if (!ret)
         return 0;
Index: trunk/src/helpers/xmlrole.c
===================================================================
--- trunk/src/helpers/xmlrole.c	(revision 97)
+++ trunk/src/helpers/xmlrole.c	(revision 98)
@@ -64,9 +64,9 @@
 #endif /* not XML_DTD */
 
-typedef int PROLOG_HANDLER(PROLOG_STATE *state,
-               int tok,
-               const char *ptr,
-               const char *end,
-               const ENCODING *enc);
+typedef int EXPATENTRY PROLOG_HANDLER(PROLOG_STATE *state,
+                                      int tok,
+                                      const char *ptr,
+                                      const char *end,
+                                      const ENCODING *enc);
 
 static PROLOG_HANDLER
@@ -92,5 +92,5 @@
 
 static
-int prolog0(PROLOG_STATE *state,
+int EXPATENTRY prolog0(PROLOG_STATE *state,
         int tok,
         const char *ptr,
Index: trunk/src/helpers/xmltok.c
===================================================================
--- trunk/src/helpers/xmltok.c	(revision 97)
+++ trunk/src/helpers/xmltok.c	(revision 98)
@@ -86,5 +86,5 @@
 
 static
-int isNever(const ENCODING * enc, const char *p)
+int EXPATENTRY isNever(const ENCODING * enc, const char *p)
 {
     return 0;
@@ -92,5 +92,5 @@
 
 static
-int utf8_isName2(const ENCODING * enc, const char *p)
+int EXPATENTRY utf8_isName2(const ENCODING * enc, const char *p)
 {
     return UTF8_GET_NAMING2(namePages, (const unsigned char *)p);
@@ -98,5 +98,5 @@
 
 static
-int utf8_isName3(const ENCODING * enc, const char *p)
+int EXPATENTRY utf8_isName3(const ENCODING * enc, const char *p)
 {
     return UTF8_GET_NAMING3(namePages, (const unsigned char *)p);
@@ -106,5 +106,5 @@
 
 static
-int utf8_isNmstrt2(const ENCODING * enc, const char *p)
+int EXPATENTRY utf8_isNmstrt2(const ENCODING * enc, const char *p)
 {
     return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p);
@@ -112,5 +112,5 @@
 
 static
-int utf8_isNmstrt3(const ENCODING * enc, const char *p)
+int EXPATENTRY utf8_isNmstrt3(const ENCODING * enc, const char *p)
 {
     return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p);
@@ -122,5 +122,5 @@
 
 static
-int utf8_isInvalid3(const ENCODING * enc, const char *p)
+int EXPATENTRY utf8_isInvalid3(const ENCODING * enc, const char *p)
 {
     return UTF8_INVALID3((const unsigned char *)p);
@@ -128,5 +128,5 @@
 
 static
-int utf8_isInvalid4(const ENCODING * enc, const char *p)
+int EXPATENTRY utf8_isInvalid4(const ENCODING * enc, const char *p)
 {
     return UTF8_INVALID4((const unsigned char *)p);
@@ -138,19 +138,19 @@
     unsigned char type[256];
 #ifdef XML_MIN_SIZE
-    int (*byteType) (const ENCODING *, const char *);
-    int (*isNameMin) (const ENCODING *, const char *);
-    int (*isNmstrtMin) (const ENCODING *, const char *);
-    int (*byteToAscii) (const ENCODING *, const char *);
-    int (*charMatches) (const ENCODING *, const char *, int);
+    int (* EXPATENTRY byteType) (const ENCODING *, const char *);
+    int (* EXPATENTRY isNameMin) (const ENCODING *, const char *);
+    int (* EXPATENTRY isNmstrtMin) (const ENCODING *, const char *);
+    int (* EXPATENTRY byteToAscii) (const ENCODING *, const char *);
+    int (* EXPATENTRY charMatches) (const ENCODING *, const char *, int);
 #endif                          /* XML_MIN_SIZE */
-    int (*isName2) (const ENCODING *, const char *);
-    int (*isName3) (const ENCODING *, const char *);
-    int (*isName4) (const ENCODING *, const char *);
-    int (*isNmstrt2) (const ENCODING *, const char *);
-    int (*isNmstrt3) (const ENCODING *, const char *);
-    int (*isNmstrt4) (const ENCODING *, const char *);
-    int (*isInvalid2) (const ENCODING *, const char *);
-    int (*isInvalid3) (const ENCODING *, const char *);
-    int (*isInvalid4) (const ENCODING *, const char *);
+    int (* EXPATENTRY isName2) (const ENCODING *, const char *);
+    int (* EXPATENTRY isName3) (const ENCODING *, const char *);
+    int (* EXPATENTRY isName4) (const ENCODING *, const char *);
+    int (* EXPATENTRY isNmstrt2) (const ENCODING *, const char *);
+    int (* EXPATENTRY isNmstrt3) (const ENCODING *, const char *);
+    int (* EXPATENTRY isNmstrt4) (const ENCODING *, const char *);
+    int (* EXPATENTRY isInvalid2) (const ENCODING *, const char *);
+    int (* EXPATENTRY isInvalid3) (const ENCODING *, const char *);
+    int (* EXPATENTRY isInvalid4) (const ENCODING *, const char *);
 };
 
@@ -202,6 +202,5 @@
 
 #ifdef XML_MIN_SIZE
-static
-int sb_byteType(const ENCODING * enc, const char *p)
+static int EXPATENTRY sb_byteType(const ENCODING * enc, const char *p)
 {
     return SB_BYTE_TYPE(enc, p);
@@ -217,5 +216,5 @@
  (((const struct normal_encoding *)(enc))->byteToAscii(enc, p))
 static
-int sb_byteToAscii(const ENCODING * enc, const char *p)
+int EXPATENTRY sb_byteToAscii(const ENCODING * enc, const char *p)
 {
     return *p;
@@ -246,5 +245,5 @@
  (((const struct normal_encoding *)(enc))->charMatches(enc, p, c))
 static
-int sb_charMatches(const ENCODING * enc, const char *p, int c)
+int EXPATENTRY sb_charMatches(const ENCODING * enc, const char *p, int c)
 {
     return *p == c;
@@ -276,5 +275,5 @@
 };
 
-static void utf8_toUtf8(const ENCODING * enc,
+static void EXPATENTRY utf8_toUtf8(const ENCODING * enc,
                         const char **fromP,
                         const char *fromLim,
@@ -302,5 +301,5 @@
 }
 
-static void utf8_toUtf16(const ENCODING * enc,
+static void EXPATENTRY utf8_toUtf16(const ENCODING * enc,
                          const char **fromP,
                          const char *fromLim,
@@ -397,5 +396,5 @@
 };
 
-static void latin1_toUtf8(const ENCODING * enc,
+static void  EXPATENTRY latin1_toUtf8(const ENCODING * enc,
                           const char **fromP,
                           const char *fromLim,
@@ -427,5 +426,5 @@
 }
 
-static void latin1_toUtf16(const ENCODING * enc,
+static void  EXPATENTRY latin1_toUtf16(const ENCODING * enc,
                            const char **fromP,
                            const char *fromLim,
@@ -463,5 +462,5 @@
 };
 
-static void ascii_toUtf8(const ENCODING * enc,
+static void EXPATENTRY ascii_toUtf8(const ENCODING * enc,
                          const char **fromP,
                          const char *fromLim,
@@ -526,6 +525,5 @@
 
 #define DEFINE_UTF16_TO_UTF8(E) \
-static \
-void E ## toUtf8(const ENCODING *enc, \
+static void EXPATENTRY E ## toUtf8(const ENCODING *enc, \
          const char **fromP, const char *fromLim, \
          char **toP, const char *toLim) \
@@ -589,6 +587,5 @@
 
 #define DEFINE_UTF16_TO_UTF16(E) \
-static \
-void E ## toUtf16(const ENCODING *enc, \
+static void EXPATENTRY E ## toUtf16(const ENCODING *enc, \
           const char **fromP, const char *fromLim, \
           unsigned short **toP, const unsigned short *toLim) \
@@ -638,27 +635,25 @@
 
 #ifdef XML_MIN_SIZE
-
-     static
-     int little2_byteType(const ENCODING * enc, const char *p)
+static int  EXPATENTRY little2_byteType(const ENCODING * enc, const char *p)
 {
     return LITTLE2_BYTE_TYPE(enc, p);
 }
 
-static int little2_byteToAscii(const ENCODING * enc, const char *p)
+static int  EXPATENTRY little2_byteToAscii(const ENCODING * enc, const char *p)
 {
     return LITTLE2_BYTE_TO_ASCII(enc, p);
 }
 
-static int little2_charMatches(const ENCODING * enc, const char *p, int c)
+static int  EXPATENTRY little2_charMatches(const ENCODING * enc, const char *p, int c)
 {
     return LITTLE2_CHAR_MATCHES(enc, p, c);
 }
 
-static int little2_isNameMin(const ENCODING * enc, const char *p)
+static int  EXPATENTRY little2_isNameMin(const ENCODING * enc, const char *p)
 {
     return LITTLE2_IS_NAME_CHAR_MINBPC(enc, p);
 }
 
-static int little2_isNmstrtMin(const ENCODING * enc, const char *p)
+static int  EXPATENTRY little2_isNmstrtMin(const ENCODING * enc, const char *p)
 {
     return LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p);
@@ -778,25 +773,25 @@
 #ifdef XML_MIN_SIZE
 
-static int big2_byteType(const ENCODING * enc, const char *p)
+static int  EXPATENTRY big2_byteType(const ENCODING * enc, const char *p)
 {
     return BIG2_BYTE_TYPE(enc, p);
 }
 
-static int big2_byteToAscii(const ENCODING * enc, const char *p)
+static int  EXPATENTRY big2_byteToAscii(const ENCODING * enc, const char *p)
 {
     return BIG2_BYTE_TO_ASCII(enc, p);
 }
 
-static int big2_charMatches(const ENCODING * enc, const char *p, int c)
+static int  EXPATENTRY big2_charMatches(const ENCODING * enc, const char *p, int c)
 {
     return BIG2_CHAR_MATCHES(enc, p, c);
 }
 
-static int big2_isNameMin(const ENCODING * enc, const char *p)
+static int  EXPATENTRY big2_isNameMin(const ENCODING * enc, const char *p)
 {
     return BIG2_IS_NAME_CHAR_MINBPC(enc, p);
 }
 
-static int big2_isNmstrtMin(const ENCODING * enc, const char *p)
+static int  EXPATENTRY big2_isNmstrtMin(const ENCODING * enc, const char *p)
 {
     return BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p);
@@ -923,5 +918,5 @@
 }
 
-static void initUpdatePosition(const ENCODING * enc, const char *ptr,
+static void  EXPATENTRY initUpdatePosition(const ENCODING * enc, const char *ptr,
                         const char *end, POSITION * pos)
 {
@@ -929,5 +924,5 @@
 }
 
-static int toAscii(const ENCODING * enc, const char *ptr, const char *end)
+static int  EXPATENTRY toAscii(const ENCODING * enc, const char *ptr, const char *end)
 {
     char buf[1];
@@ -941,5 +936,5 @@
 }
 
-static int isSpace(int c)
+static int  EXPATENTRY isSpace(int c)
 {
     switch (c)
@@ -956,5 +951,5 @@
 /* Return 1 if there's just optional white space
  * or there's an S followed by name=val. */
-static int parsePseudoAttribute(const ENCODING * enc,
+static int  EXPATENTRY parsePseudoAttribute(const ENCODING * enc,
                                 const char *ptr,
                                 const char *end,
@@ -1288,5 +1283,5 @@
 }
 
-static int unknown_isName(const ENCODING * enc, const char *p)
+static int  EXPATENTRY unknown_isName(const ENCODING * enc, const char *p)
 {
     int c = ((const struct unknown_encoding *)enc)
@@ -1298,5 +1293,5 @@
 }
 
-static int unknown_isNmstrt(const ENCODING * enc, const char *p)
+static int  EXPATENTRY unknown_isNmstrt(const ENCODING * enc, const char *p)
 {
     int c = ((const struct unknown_encoding *)enc)
@@ -1308,5 +1303,5 @@
 }
 
-static int unknown_isInvalid(const ENCODING * enc, const char *p)
+static int  EXPATENTRY unknown_isInvalid(const ENCODING * enc, const char *p)
 {
     int c = ((const struct unknown_encoding *)enc)
@@ -1316,5 +1311,5 @@
 }
 
-static void unknown_toUtf8(const ENCODING * enc,
+static void  EXPATENTRY unknown_toUtf8(const ENCODING * enc,
                            const char **fromP,
                            const char *fromLim,
@@ -1359,5 +1354,5 @@
 }
 
-static void unknown_toUtf16(const ENCODING * enc,
+static void  EXPATENTRY unknown_toUtf16(const ENCODING * enc,
                             const char **fromP,
                             const char *fromLim,
@@ -1395,5 +1390,5 @@
 {
     int i;
-    struct unknown_encoding *e = mem;
+    struct unknown_encoding *e = (struct unknown_encoding*)mem;
 
     // gee, isn't this a regular memcpy?!?
@@ -1563,5 +1558,5 @@
 
 
-static int initScan(const ENCODING ** encodingTable,
+static int EXPATENTRY initScan(const ENCODING ** encodingTable,
                     const INIT_ENCODING * enc,
                     int state,
@@ -1708,5 +1703,5 @@
 ENCODING * XmlInitUnknownEncodingNS(void *mem,
                                     int *table,
-                                    int (*convert) (void *userData, const char *p),
+                                    int (* EXPATENTRY convert) (void *userData, const char *p),
                                     void *userData)
 {
Index: trunk/src/helpers/xmltok_impl.c
===================================================================
--- trunk/src/helpers/xmltok_impl.c	(revision 97)
+++ trunk/src/helpers/xmltok_impl.c	(revision 98)
@@ -1,6 +1,35 @@
+
 /*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
-*/
+ *sourcefile xmltok_impl.c
+ *      part of the expat implementation. See xmlparse.c.
+ *
+ *      NOTE: This file must not be compiled directly. It is
+ *      #include'd from xmltok.c several times.
+ */
+
+/*
+ *      Copyright (C) 2001 Ulrich Mller.
+ *      Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
+ *                                     and Clark Cooper.
+ *
+ *      Permission is hereby granted, free of charge, to any person obtaining
+ *      a copy of this software and associated documentation files (the
+ *      "Software"), to deal in the Software without restriction, including
+ *      without limitation the rights to use, copy, modify, merge, publish,
+ *      distribute, sublicense, and/or sell copies of the Software, and to
+ *      permit persons to whom the Software is furnished to do so, subject to
+ *      the following conditions:
+ *
+ *      The above copyright notice and this permission notice shall be included
+ *      in all copies or substantial portions of the Software.
+ *
+ *      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *      EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *      MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *      IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ *      CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ *      TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ *      SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
 
 #ifndef IS_INVALID_CHAR
@@ -88,7 +117,8 @@
 /* ptr points to character following "<!-" */
 
-static
-int PREFIX(scanComment)(const ENCODING *enc, const char *ptr, const char *end,
-            const char **nextTokPtr)
+static int EXPATENTRY PREFIX(scanComment)(const ENCODING *enc,
+                                          const char *ptr,
+                                          const char *end,
+                                          const char **nextTokPtr)
 {
   if (ptr != end) {
@@ -126,6 +156,5 @@
 /* ptr points to character following "<!" */
 
-static
-int PREFIX(scanDecl)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY PREFIX(scanDecl)(const ENCODING *enc, const char *ptr, const char *end,
              const char **nextTokPtr)
 {
@@ -173,6 +202,5 @@
 }
 
-static
-int PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end, int *tokPtr)
+static int EXPATENTRY PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end, int *tokPtr)
 {
   int upper = 0;
@@ -217,6 +245,5 @@
 /* ptr points to character following "<?" */
 
-static
-int PREFIX(scanPi)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY PREFIX(scanPi)(const ENCODING *enc, const char *ptr, const char *end,
            const char **nextTokPtr)
 {
@@ -280,6 +307,5 @@
 
 
-static
-int PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr, const char *end,
                  const char **nextTokPtr)
 {
@@ -299,6 +325,5 @@
 }
 
-static
-int PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, const char *end,
                 const char **nextTokPtr)
 {
@@ -377,6 +402,5 @@
 /* ptr points to character following "</" */
 
-static
-int PREFIX(scanEndTag)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY PREFIX(scanEndTag)(const ENCODING *enc, const char *ptr, const char *end,
                const char **nextTokPtr)
 {
@@ -425,6 +449,5 @@
 /* ptr points to character following "&#X" */
 
-static
-int PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr, const char *end,
                const char **nextTokPtr)
 {
@@ -457,6 +480,5 @@
 /* ptr points to character following "&#" */
 
-static
-int PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr, const char *end,
             const char **nextTokPtr)
 {
@@ -489,6 +511,5 @@
 /* ptr points to character following "&" */
 
-static
-int PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,
             const char **nextTokPtr)
 {
@@ -519,6 +540,5 @@
 /* ptr points to character following first character of attribute name */
 
-static
-int PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
              const char **nextTokPtr)
 {
@@ -679,6 +699,5 @@
 /* ptr points to character following "<" */
 
-static
-int PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
            const char **nextTokPtr)
 {
@@ -778,6 +797,5 @@
 }
 
-static
-int PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
                const char **nextTokPtr)
 {
@@ -877,6 +895,5 @@
 /* ptr points to character following "%" */
 
-static
-int PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,
             const char **nextTokPtr)
 {
@@ -906,6 +923,5 @@
 }
 
-static
-int PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end,
               const char **nextTokPtr)
 {
@@ -933,6 +949,5 @@
 }
 
-static
-int PREFIX(scanLit)(int open, const ENCODING *enc,
+static int EXPATENTRY PREFIX(scanLit)(int open, const ENCODING *enc,
             const char *ptr, const char *end,
             const char **nextTokPtr)
@@ -965,6 +980,5 @@
 }
 
-static
-int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
               const char **nextTokPtr)
 {
@@ -1193,6 +1207,5 @@
 }
 
-static
-int PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *end,
                   const char **nextTokPtr)
 {
@@ -1251,6 +1264,5 @@
 }
 
-static
-int PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, const char *end,
                const char **nextTokPtr)
 {
@@ -1308,6 +1320,5 @@
 #ifdef XML_DTD
 
-static
-int PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, const char *end,
                  const char **nextTokPtr)
 {
@@ -1361,6 +1372,5 @@
 #endif /* XML_DTD */
 
-static
-int PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
                const char **badPtr)
 {
@@ -1420,6 +1430,5 @@
 are stored in atts. */
 
-static
-int PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
+static int EXPATENTRY PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
             int attsMax, ATTRIBUTE *atts)
 {
@@ -1513,6 +1522,5 @@
 }
 
-static
-int PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
+static int EXPATENTRY PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
 {
   int result = 0;
@@ -1553,6 +1561,5 @@
 }
 
-static
-int PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr, const char *end)
+static int EXPATENTRY PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr, const char *end)
 {
   switch ((end - ptr)/MINBPC(enc)) {
@@ -1606,6 +1613,5 @@
 }
 
-static
-int PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2)
+static int EXPATENTRY PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2)
 {
   for (;;) {
@@ -1670,6 +1676,5 @@
 }
 
-static
-int PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1,
+static int EXPATENTRY PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1,
                  const char *end1, const char *ptr2)
 {
@@ -1683,6 +1688,5 @@
 }
 
-static
-int PREFIX(nameLength)(const ENCODING *enc, const char *ptr)
+static int EXPATENTRY PREFIX(nameLength)(const ENCODING *enc, const char *ptr)
 {
   const char *start = ptr;
@@ -1710,6 +1714,5 @@
 }
 
-static
-const char *PREFIX(skipS)(const ENCODING *enc, const char *ptr)
+static const char* EXPATENTRY PREFIX(skipS)(const ENCODING *enc, const char *ptr)
 {
   for (;;) {
@@ -1726,6 +1729,5 @@
 }
 
-static
-void PREFIX(updatePosition)(const ENCODING *enc,
+static void EXPATENTRY PREFIX(updatePosition)(const ENCODING *enc,
                 const char *ptr,
                 const char *end,
Index: trunk/src/helpers/xmltok_ns.c
===================================================================
--- trunk/src/helpers/xmltok_ns.c	(revision 97)
+++ trunk/src/helpers/xmltok_ns.c	(revision 98)
@@ -27,6 +27,5 @@
 };
 
-static
-int NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end,
                const char **nextTokPtr)
 {
@@ -34,6 +33,5 @@
 }
 
-static
-int NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end,
+static int EXPATENTRY NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end,
                const char **nextTokPtr)
 {
