Index: trunk/src/helpers/comctl.c
===================================================================
--- trunk/src/helpers/comctl.c	(revision 131)
+++ trunk/src/helpers/comctl.c	(revision 132)
@@ -977,5 +977,6 @@
  */
 
-PANIMATIONDATA CreateAnimationData(HWND hwndStatic,
+PANIMATIONDATA CreateAnimationData(HAB hab,
+                                   HWND hwndStatic,
                                    USHORT cAnimations)
 {
@@ -996,5 +997,5 @@
             WinSetWindowULong(hwndStatic, QWL_USER, (ULONG)pa);
 
-            pa->hab = WinQueryAnchorBlock(hwndStatic);
+            pa->hab = hab;
             WinQueryWindowRect(hwndStatic, &pa->rclIcon);
             pa->OldStaticProc = WinSubclassWindow(hwndStatic, ctl_fnwpBitmapStatic);
@@ -1046,13 +1047,19 @@
 {
     PANIMATIONDATA pa;
-
-    if (pa = CreateAnimationData(hwndStatic,
-                                 usAnimCount))
+    HAB     hab;
+    if (    (hwndStatic)
+         && (hab = WinQueryAnchorBlock(hwndStatic))
+         && (WinIsWindow(hab, hwndStatic))
+         && (pa = CreateAnimationData(hab,
+                                      hwndStatic,
+                                      usAnimCount))
+       )
     {
         // switch static to icon mode
         pa->ulFlags = ANF_ICON;
+        return (pa);
     }
 
-    return (pa);
+    return (NULL);
 }
 
@@ -1233,6 +1240,10 @@
 {
     PANIMATIONDATA pa;
-
-    if (pa = CreateAnimationData(hwndStatic, 1))
+    HAB hab;
+    if (    (hwndStatic)
+         && (hab = WinQueryAnchorBlock(hwndStatic))
+         && (WinIsWindow(hab, hwndStatic))
+         && (pa = CreateAnimationData(hab, hwndStatic, 1))
+       )
     {
         // switch static to bitmap mode
@@ -1240,7 +1251,8 @@
         if (fPreserveProportions)
             pa->ulFlags |= ANF_PROPORTIONAL;
+        return (pa);
     }
 
-    return (pa);
+    return NULL;
 }
 
Index: trunk/src/helpers/dialog.c
===================================================================
--- trunk/src/helpers/dialog.c	(revision 131)
+++ trunk/src/helpers/dialog.c	(revision 132)
@@ -234,5 +234,5 @@
 {
     LONG lPointSize = 0;
-    const char *pcszFontThis = pControlDef->pcszFont;
+    PCSZ pcszFontThis = pControlDef->pcszFont;
                     // can be NULL,
                     // or CTL_COMMON_FONT
@@ -1240,5 +1240,5 @@
 
 APIRET Dlg1_ParseTables(PDLGPRIVATE pDlgData,
-                        PDLGHITEM paDlgItems,      // in: definition array
+                        PCDLGHITEM paDlgItems,      // in: definition array
                         ULONG cDlgItems)           // in: array item count (NOT array size)
 {
@@ -1256,5 +1256,5 @@
          ul++)
     {
-        PDLGHITEM   pItemThis = &paDlgItems[ul];
+        PCDLGHITEM   pItemThis = &paDlgItems[ul];
 
         switch (pItemThis->Type)
@@ -1584,5 +1584,5 @@
  *          it produces a static group control around the table.
  *          Useful for group boxes. pDef must point to a
- *          _CONTROLDEF describing the control to be used for
+ *          CONTROLDEF describing the control to be used for
  *          the group (usually a WC_STATIC with SS_GROUP style),
  *          whose size parameter is ignored.
@@ -1602,15 +1602,16 @@
  *          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
- *          this function, depending on the sizes of the
- *          controls and their nesting within the various tables.
- *
- *          If you specify SZL_AUTOSIZE, the size of the
- *          control is even computed automatically. Presently,
- *          this only works for statics with SS_TEXT, SS_ICON,
- *          and SS_BITMAP.
+ *          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 this function, depending
+ *          on the sizes of the controls and their nesting within
+ *          the various tables.
+ *
+ *          If you specify SZL_AUTOSIZE with either cx or cy
+ *          or both, the size of the control is even computed
+ *          automatically. Presently, this only works for statics
+ *          with SS_TEXT, SS_ICON, and SS_BITMAP, push buttons,
+ *          and radio and check boxes.
  *
  *          Unless separated with START_ROW items, subsequent
@@ -1621,9 +1622,9 @@
  *      an error:
  *
- *      -- The entire array must be enclosed in a table
- *         (the "root" table).
- *
- *      -- After START_TABLE or START_GROUP_TABLE, there must
- *         always be a START_ROW first.
+ *      --  The entire array must be enclosed in a table
+ *          (the "root" table).
+ *
+ *      --  After START_TABLE or START_GROUP_TABLE, there must
+ *          always be a START_ROW first.
  *
  *      To create a dialog, set up arrays like the following:
@@ -1686,7 +1687,9 @@
  +          º ³  ³                        ³  ³  º
  +          º ³  ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ  ³  º
+ +          º ³                              ³  º
  +          º ³  Static below cnr (3)        ³  º
  +          º ³                              ³  º
  +          º ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ  º
+ +          º                                   º
  +          º ÚÄÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿     º
  +          º ³   OK (4)  ³ ³  Cancel (5) ³     º
@@ -1756,9 +1759,9 @@
                      ULONG flCreateFlags,       // in: standard FCF_* frame flags
                      PFNWP pfnwpDialogProc,
-                     const char *pcszDlgTitle,
-                     PDLGHITEM paDlgItems,      // in: definition array
+                     PCSZ pcszDlgTitle,
+                     PCDLGHITEM paDlgItems,      // in: definition array
                      ULONG cDlgItems,           // in: array item count (NOT array size)
                      PVOID pCreateParams,       // in: for mp2 of WM_INITDLG
-                     const char *pcszControlsFont) // in: font for ctls with CTL_COMMON_FONT
+                     PCSZ pcszControlsFont) // in: font for ctls with CTL_COMMON_FONT
 {
     APIRET      arc = NO_ERROR;
@@ -1840,49 +1843,50 @@
                  */
 
-                Dlg2_CalcSizes(pDlgData,
-                               &szlClient);
-
-                WinSubclassWindow(hwndDlg, pfnwpDialogProc);
-
-                /*
-                 *  4) compute size of dialog client from total
-                 *     size of all controls
-                 */
-
-                // calculate the frame size from the client size
-                rclClient.xLeft = 10;
-                rclClient.yBottom = 10;
-                rclClient.xRight = szlClient.cx + 2 * SPACING;
-                rclClient.yTop = szlClient.cy + 2 * SPACING;
-                WinCalcFrameRect(hwndDlg,
-                                 &rclClient,
-                                 FALSE);            // frame from client
-
-                WinSetWindowPos(hwndDlg,
-                                0,
-                                10,
-                                10,
-                                rclClient.xRight,
-                                rclClient.yTop,
-                                SWP_MOVE | SWP_SIZE | SWP_NOADJUST);
-
-                arc = Dlg3_PositionAndCreate(pDlgData,
-                                             &szlClient,
-                                             &hwndFocusItem);
-
-                /*
-                 *  7) WM_INITDLG, set focus
-                 *
-                 */
-
-                if (!WinSendMsg(pDlgData->hwndDlg,
-                                WM_INITDLG,
-                                (MPARAM)hwndFocusItem,
-                                (MPARAM)pCreateParams))
+                if (!(arc = Dlg2_CalcSizes(pDlgData,
+                                           &szlClient)))
                 {
-                    // if WM_INITDLG returns FALSE, this means
-                    // the dlg proc has not changed the focus;
-                    // we must then set the focus here
-                    WinSetFocus(HWND_DESKTOP, hwndFocusItem);
+                    WinSubclassWindow(hwndDlg, pfnwpDialogProc);
+
+                    /*
+                     *  4) compute size of dialog client from total
+                     *     size of all controls
+                     */
+
+                    // calculate the frame size from the client size
+                    rclClient.xLeft = 10;
+                    rclClient.yBottom = 10;
+                    rclClient.xRight = szlClient.cx + 2 * SPACING;
+                    rclClient.yTop = szlClient.cy + 2 * SPACING;
+                    WinCalcFrameRect(hwndDlg,
+                                     &rclClient,
+                                     FALSE);            // frame from client
+
+                    WinSetWindowPos(hwndDlg,
+                                    0,
+                                    10,
+                                    10,
+                                    rclClient.xRight,
+                                    rclClient.yTop,
+                                    SWP_MOVE | SWP_SIZE | SWP_NOADJUST);
+
+                    arc = Dlg3_PositionAndCreate(pDlgData,
+                                                 &szlClient,
+                                                 &hwndFocusItem);
+
+                    /*
+                     *  7) WM_INITDLG, set focus
+                     *
+                     */
+
+                    if (!WinSendMsg(pDlgData->hwndDlg,
+                                    WM_INITDLG,
+                                    (MPARAM)hwndFocusItem,
+                                    (MPARAM)pCreateParams))
+                    {
+                        // if WM_INITDLG returns FALSE, this means
+                        // the dlg proc has not changed the focus;
+                        // we must then set the focus here
+                        WinSetFocus(HWND_DESKTOP, hwndFocusItem);
+                    }
                 }
             }
@@ -1953,7 +1957,7 @@
 
 APIRET dlghFormatDlg(HWND hwndDlg,              // in: dialog frame to work on
-                     PDLGHITEM paDlgItems,      // in: definition array
+                     PCDLGHITEM paDlgItems,      // in: definition array
                      ULONG cDlgItems,           // in: array item count (NOT array size)
-                     const char *pcszControlsFont, // in: font for ctls with CTL_COMMON_FONT
+                     PCSZ pcszControlsFont, // in: font for ctls with CTL_COMMON_FONT
                      ULONG flFlags)             // in: DFFL_* flags
 {
@@ -2209,5 +2213,5 @@
 
 APIRET dlghAppendToArray(PDLGARRAY pArray,      // in: dialog array created by dlghCreateArray
-                         DLGHITEM *paItems,     // in: subarray to be appended
+                         PCDLGHITEM paItems,     // in: subarray to be appended
                          ULONG cItems)          // in: subarray item count (NOT array size)
 {
@@ -2250,8 +2254,8 @@
                             HWND hwndOwner,
                             HPOINTER hptrIcon,
-                            const char *pcszTitle,
-                            const char *pcszMessage,
+                            PCSZ pcszTitle,
+                            PCSZ pcszMessage,
                             ULONG flFlags,
-                            const char *pcszFont,
+                            PCSZ pcszFont,
                             const MSGBOXSTRINGS *pStrings,
                             PULONG pulAlarmFlag)      // out: alarm sound to be played
@@ -2334,5 +2338,5 @@
                 *p2 = NULL;
 
-    Icon.pcszText = (const char *)hptrIcon;
+    Icon.pcszText = (PCSZ)hptrIcon;
     InfoText.pcszText = pcszMessage;
 
@@ -2545,8 +2549,8 @@
 ULONG dlghMessageBox(HWND hwndOwner,            // in: owner for msg box
                      HPOINTER hptrIcon,         // in: icon to display
-                     const char *pcszTitle,     // in: title
-                     const char *pcszMessage,   // in: message
+                     PCSZ pcszTitle,     // in: title
+                     PCSZ pcszMessage,   // in: message
                      ULONG flFlags,             // in: standard message box flags
-                     const char *pcszFont,      // in: font (e.g. "9.WarpSans")
+                     PCSZ pcszFont,      // in: font (e.g. "9.WarpSans")
                      const MSGBOXSTRINGS *pStrings) // in: strings array
 {
@@ -2616,12 +2620,12 @@
 
 PSZ dlghTextEntryBox(HWND hwndOwner,
-                     const char *pcszTitle,          // in: dlg title
-                     const char *pcszDescription,    // in: descriptive text above entry field
-                     const char *pcszDefault,        // in: default text for entry field or NULL
-                     const char *pcszOK,             // in: "OK" string
-                     const char *pcszCancel,         // in: "Cancel" string
+                     PCSZ pcszTitle,          // in: dlg title
+                     PCSZ pcszDescription,    // in: descriptive text above entry field
+                     PCSZ pcszDefault,        // in: default text for entry field or NULL
+                     PCSZ pcszOK,             // in: "OK" string
+                     PCSZ pcszCancel,         // in: "Cancel" string
                      ULONG ulMaxLen,                 // in: maximum length for entry
                      ULONG fl,                       // in: TEBF_* flags
-                     const char *pcszFont)           // in: font (e.g. "9.WarpSans")
+                     PCSZ pcszFont)           // in: font (e.g. "9.WarpSans")
 {
     CONTROLDEF
Index: trunk/src/helpers/dosh.c
===================================================================
--- trunk/src/helpers/dosh.c	(revision 131)
+++ trunk/src/helpers/dosh.c	(revision 132)
@@ -2382,4 +2382,6 @@
                     pszContent[cbRead] = '\0';
                     *ppszContent = pszContent;
+                    if (pcbRead)
+                        *pcbRead = cbRead + 1;
                 }
             }
@@ -2978,4 +2980,63 @@
 
 /*
+ *@@ doshQueryProcAddr:
+ *      attempts to resolve the given procedure from
+ *      the given module name. Saves you from querying
+ *      the module handle and all that.
+ *
+ *      This is intended for resolving undocumented
+ *      APIs from OS/2 system DLls such as PMMERGE
+ *      and DOSCALLS. It is assumed that the specified
+ *      module is already loaded.
+ *
+ *      Returns:
+ *
+ *      --  NO_ERROR
+ *
+ *      --  ERROR_INVALID_NAME
+ *
+ *      --  ERROR_INVALID_ORDINAL
+ *
+ *      plus the error codes of DosLoadModule.
+ *
+ *@@added V0.9.16 (2002-01-13) [umoeller]
+ */
+
+APIRET doshQueryProcAddr(PCSZ pcszModuleName,       // in: module name (e.g. "PMMERGE")
+                         ULONG ulOrdinal,           // in: proc ordinal
+                         PFN *ppfn)                 // out: proc address
+{
+    HMODULE hmod;
+    APIRET  arc;
+    if (!(arc = DosQueryModuleHandle((PSZ)pcszModuleName,
+                                     &hmod)))
+    {
+        if ((arc = DosQueryProcAddr(hmod,
+                                    ulOrdinal,
+                                    NULL,
+                                    ppfn)))
+        {
+            // the CP programming guide and reference says use
+            // DosLoadModule if DosQueryProcAddr fails with this error
+            if (arc == ERROR_INVALID_HANDLE)
+            {
+                if (!(arc = DosLoadModule(NULL,
+                                          0,
+                                          (PSZ)pcszModuleName,
+                                          &hmod)))
+                {
+                    arc = DosQueryProcAddr(hmod,
+                                           ulOrdinal,
+                                           NULL,
+                                           ppfn);
+                }
+            }
+        }
+    }
+
+    return (arc);
+}
+
+/*
  *@@ doshResolveImports:
  *      this function loads the module called pszModuleName
@@ -2990,7 +3051,7 @@
  */
 
-APIRET doshResolveImports(PSZ pszModuleName,    // in: DLL to load
+APIRET doshResolveImports(PCSZ pcszModuleName,    // in: DLL to load
                           HMODULE *phmod,       // out: module handle
-                          PRESOLVEFUNCTION paResolves, // in/out: function resolves
+                          PCRESOLVEFUNCTION paResolves, // in/out: function resolves
                           ULONG cResolves)      // in: array item count (not array size!)
 {
@@ -3000,5 +3061,5 @@
     if (!(arc = DosLoadModule(szName,
                               sizeof(szName),
-                              pszModuleName,
+                              (PSZ)pcszModuleName,
                               phmod)))
     {
Index: trunk/src/helpers/exeh.c
===================================================================
--- trunk/src/helpers/exeh.c	(revision 131)
+++ trunk/src/helpers/exeh.c	(revision 132)
@@ -329,5 +329,5 @@
                 // go read in the complete header then
                 // (doshReadAt has this in the cache)
-                if (!(pExec->pNEHeader = malloc(cbRead)))
+                if (!(pExec->pNEHeader = (PNEHEADER)malloc(cbRead)))
                     arc = ERROR_NOT_ENOUGH_MEMORY;
                 else if (!(arc = doshReadAt(pFile,
@@ -361,5 +361,5 @@
                 // go read in the complete header then
                 // (doshReadAt has this in the cache)
-                if (!(pExec->pLXHeader = malloc(cbRead)))
+                if (!(pExec->pLXHeader = (PLXHEADER)malloc(cbRead)))
                     arc = ERROR_NOT_ENOUGH_MEMORY;
                 else if (!(arc = doshReadAt(pFile,
@@ -389,5 +389,5 @@
                 // plus an extended header, so check
                 // what we've got
-                if (!(pExec->pPEHeader = malloc(sizeof(PEHEADER))))
+                if (!(pExec->pPEHeader = (PPEHEADER)malloc(sizeof(PEHEADER))))
                     arc = ERROR_NOT_ENOUGH_MEMORY;
                 else
@@ -2742,5 +2742,5 @@
                     // 4096 bytes for each page that is read in
                     // plus 4 extra bytes to terminate for decompression
-                    if (!(pabCompressed = malloc(ulPageSize + 4)))
+                    if (!(pabCompressed = (PBYTE)malloc(ulPageSize + 4)))
                         arc = ERROR_NOT_ENOUGH_MEMORY;
                     // 4096 * cPages for the data that is composed from that
@@ -2793,5 +2793,5 @@
                         {
                             // allocate a new buffer for caller
-                            if (!(*ppbResData = malloc(pRsEntry->cb)))
+                            if (!(*ppbResData = (PBYTE)malloc(pRsEntry->cb)))
                                 arc = ERROR_NOT_ENOUGH_MEMORY;
                             else
@@ -3052,5 +3052,5 @@
                 ULONG cb = pSegThis->ns_cbseg;        // resource size
                 PBYTE pb;
-                if (!(*ppbResData = malloc(cb)))
+                if (!(*ppbResData = (PBYTE)malloc(cb)))
                     arc = ERROR_NOT_ENOUGH_MEMORY;
                 else
Index: trunk/src/helpers/linklist.c
===================================================================
--- trunk/src/helpers/linklist.c	(revision 131)
+++ trunk/src/helpers/linklist.c	(revision 132)
@@ -292,6 +292,6 @@
                                             // item pointers upon destruction?
 {
-    PLINKLIST pNewList = (PLINKLIST)malloc(sizeof(LINKLIST));
-    if (pNewList)
+    PLINKLIST pNewList;
+    if (pNewList = (PLINKLIST)malloc(sizeof(LINKLIST)))
         lstInit(pNewList, fItemsFreeable);
     return (pNewList);
@@ -444,20 +444,21 @@
     PLISTNODE pNode = NULL;
 
-    if (pList)
-        if (pList->ulMagic == LINKLISTMAGIC)
-            if (pList->pFirst)
-            {
-                unsigned long ulCount = 0;
-                pNode = pList->pFirst;
-                for (ulCount = 0;
-                     ((pNode) && (ulCount < ulIndex));
-                     ulCount++)
-                {
-                    if (pNode->pNext)
-                        pNode = pNode->pNext;
-                    else
-                        pNode = NULL; // exit
-                }
-            }
+    if (    (pList)
+         && (pList->ulMagic == LINKLISTMAGIC)
+         && (pList->pFirst)
+       )
+    {
+        unsigned long ulCount = 0;
+        pNode = pList->pFirst;
+        for (ulCount = 0;
+             ((pNode) && (ulCount < ulIndex));
+             ulCount++)
+        {
+            if (pNode->pNext)
+                pNode = pNode->pNext;
+            else
+                pNode = NULL; // exit
+        }
+    }
 
     return (pNode);
@@ -480,21 +481,21 @@
               pNodeFound = 0;
 
-    if (pList)
-        if (    (pList->ulMagic == LINKLISTMAGIC)
-             && (pItemData)
-           )
-        {
-            pNode = pList->pFirst;
-            while (pNode)
+    if (    (pList)
+         && (pList->ulMagic == LINKLISTMAGIC)
+         && (pItemData)
+       )
+    {
+        pNode = pList->pFirst;
+        while (pNode)
+        {
+            if (pNode->pItemData == pItemData)
             {
-                if (pNode->pItemData == pItemData)
-                {
-                    pNodeFound = pNode;
-                    break;
-                }
-
-                pNode = pNode->pNext;
+                pNodeFound = pNode;
+                break;
             }
-        }
+
+            pNode = pNode->pNext;
+        }
+    }
 
     return (pNodeFound);
@@ -518,6 +519,6 @@
                        unsigned long ulIndex)
 {
-    PLISTNODE pNode = lstNodeFromIndex(pList, ulIndex);
-    if (pNode)
+    PLISTNODE pNode;
+    if (pNode = lstNodeFromIndex(pList, ulIndex))
         return (pNode->pItemData);
     else
@@ -580,38 +581,37 @@
                              const char *function)
 {
-    PLISTNODE pNewNode = 0;
-
-    if (pList)
-        if (pList->ulMagic == LINKLISTMAGIC)
-        {
-            if (pNewNode = (PLISTNODE)memdMalloc(sizeof(LISTNODE), file, line, function))
-            {
-                memset(pNewNode, 0, sizeof(LISTNODE));
-                pNewNode->pItemData = pNewItemData;
-
-                if (pList->pLast)
-                {
-                    // list is not empty: append to tail
-
-                    // 1) make last item point to new node
-                    pList->pLast->pNext = pNewNode;
-                    // 2) make new node point to last item
-                    pNewNode->pPrevious = pList->pLast;
-                    // 3) store new node as new last item
-                    pList->pLast = pNewNode;
-
-                    pList->ulCount++;
-                }
-                else
-                {
-                    // list is empty: insert as first
-                    pList->pFirst
-                        = pList->pLast
-                        = pNewNode;
-
-                    pList->ulCount = 1;
-                }
-            }
-         }
+    PLISTNODE pNewNode = NULL;
+
+    if (    (pList)
+         && (pList->ulMagic == LINKLISTMAGIC)
+         && (pNewNode = (PLISTNODE)memdMalloc(sizeof(LISTNODE), file, line, function))
+       )
+    {
+        memset(pNewNode, 0, sizeof(LISTNODE));
+        pNewNode->pItemData = pNewItemData;
+
+        if (pList->pLast)
+        {
+            // list is not empty: append to tail
+
+            // 1) make last item point to new node
+            pList->pLast->pNext = pNewNode;
+            // 2) make new node point to last item
+            pNewNode->pPrevious = pList->pLast;
+            // 3) store new node as new last item
+            pList->pLast = pNewNode;
+
+            pList->ulCount++;
+        }
+        else
+        {
+            // list is empty: insert as first
+            pList->pFirst
+                = pList->pLast
+                = pNewNode;
+
+            pList->ulCount = 1;
+        }
+    }
 
     return (pNewNode);
@@ -635,38 +635,37 @@
                         void* pNewItemData)     // in: data to store in list node
 {
-    PLISTNODE pNewNode = 0;
-
-    if (pList)
-        if (pList->ulMagic == LINKLISTMAGIC)
-        {
-            if (pNewNode = (PLISTNODE)malloc(sizeof(LISTNODE)))
-            {
-                memset(pNewNode, 0, sizeof(LISTNODE));
-                pNewNode->pItemData = pNewItemData;
-
-                if (pList->pLast)
-                {
-                    // list is not empty: append to tail
-
-                    // 1) make last item point to new node
-                    pList->pLast->pNext = pNewNode;
-                    // 2) make new node point to last item
-                    pNewNode->pPrevious = pList->pLast;
-                    // 3) store new node as new last item
-                    pList->pLast = pNewNode;
-
-                    pList->ulCount++;
-                }
-                else
-                {
-                    // list is empty: insert as first
-                    pList->pFirst
-                        = pList->pLast
-                        = pNewNode;
-
-                    pList->ulCount = 1;
-                }
-            }
-         }
+    PLISTNODE pNewNode = NULL;
+
+    if (    (pList)
+         && (pList->ulMagic == LINKLISTMAGIC)
+         && (pNewNode = (PLISTNODE)malloc(sizeof(LISTNODE)))
+       )
+    {
+        memset(pNewNode, 0, sizeof(LISTNODE));
+        pNewNode->pItemData = pNewItemData;
+
+        if (pList->pLast)
+        {
+            // list is not empty: append to tail
+
+            // 1) make last item point to new node
+            pList->pLast->pNext = pNewNode;
+            // 2) make new node point to last item
+            pNewNode->pPrevious = pList->pLast;
+            // 3) store new node as new last item
+            pList->pLast = pNewNode;
+
+            pList->ulCount++;
+        }
+        else
+        {
+            // list is empty: insert as first
+            pList->pFirst
+                = pList->pLast
+                = pNewNode;
+
+            pList->ulCount = 1;
+        }
+    }
 
     return (pNewNode);
@@ -703,68 +702,67 @@
                               unsigned long ulIndex)
 {
-    PLISTNODE pNewNode = 0;
-
-    if (pList)
-        if (pList->ulMagic == LINKLISTMAGIC)
-        {
-            if (pNewNode = (PLISTNODE)malloc(sizeof(LISTNODE)))
+    PLISTNODE pNewNode = NULL;
+
+    if (    (pList)
+         && (pList->ulMagic == LINKLISTMAGIC)
+         && (pNewNode = (PLISTNODE)malloc(sizeof(LISTNODE)))
+       )
+    {
+        memset(pNewNode, 0, sizeof(LISTNODE));
+        pNewNode->pItemData = pNewItemData;
+
+        if (ulIndex == 0)
+        {
+            // insert at beginning:
+            if (pList->pFirst)
+                pList->pFirst->pPrevious = pNewNode;
+
+            pNewNode->pNext = pList->pFirst;
+            pNewNode->pPrevious = NULL;
+
+            pList->pFirst = pNewNode;
+
+            if (!pList->pLast)
+                // the list was empty:
+                pList->pLast = pNewNode;        // V0.9.14 (2001-07-14) [umoeller]
+
+            (pList->ulCount)++;
+        }
+        else
+        {
+            // insert at a later position:
+            PLISTNODE pNodeInsertAfter = lstNodeFromIndex(
+                                    pList,
+                                    (ulIndex-1));
+
+            if (pNodeInsertAfter)
             {
-                memset(pNewNode, 0, sizeof(LISTNODE));
-                pNewNode->pItemData = pNewItemData;
-
-                if (ulIndex == 0)
-                {
-                    // insert at beginning:
-                    if (pList->pFirst)
-                        pList->pFirst->pPrevious = pNewNode;
-
-                    pNewNode->pNext = pList->pFirst;
-                    pNewNode->pPrevious = NULL;
-
-                    pList->pFirst = pNewNode;
-
-                    if (!pList->pLast)
-                        // the list was empty:
-                        pList->pLast = pNewNode;        // V0.9.14 (2001-07-14) [umoeller]
-
-                    (pList->ulCount)++;
-                }
-                else
-                {
-                    // insert at a later position:
-                    PLISTNODE pNodeInsertAfter = lstNodeFromIndex(
-                                            pList,
-                                            (ulIndex-1));
-
-                    if (pNodeInsertAfter)
-                    {
-                        // 1) set pointers for new node
-                        pNewNode->pPrevious = pNodeInsertAfter;
-                        pNewNode->pNext = pNodeInsertAfter->pNext;
-
-                        // 2) adjust next item
-                        // so that it points to the new node
-                        if (pNodeInsertAfter->pNext)
-                            pNodeInsertAfter->pNext->pPrevious = pNewNode;
-
-                        // 3) adjust previous item
-                        // so that it points to the new node
-                        pNodeInsertAfter->pNext = pNewNode;
-
-                        // 4) adjust last item, if necessary
-                        if (pList->pLast == pNodeInsertAfter)
-                            pList->pLast = pNewNode;
-
-                        (pList->ulCount)++;
-                    }
-                    else
-                    {
-                        // item index too large: append instead
-                        free(pNewNode);
-                        pNewNode = lstAppendItem(pList, pNewItemData);
-                    }
-                }
+                // 1) set pointers for new node
+                pNewNode->pPrevious = pNodeInsertAfter;
+                pNewNode->pNext = pNodeInsertAfter->pNext;
+
+                // 2) adjust next item
+                // so that it points to the new node
+                if (pNodeInsertAfter->pNext)
+                    pNodeInsertAfter->pNext->pPrevious = pNewNode;
+
+                // 3) adjust previous item
+                // so that it points to the new node
+                pNodeInsertAfter->pNext = pNewNode;
+
+                // 4) adjust last item, if necessary
+                if (pList->pLast == pNodeInsertAfter)
+                    pList->pLast = pNewNode;
+
+                (pList->ulCount)++;
             }
-        }
+            else
+            {
+                // item index too large: append instead
+                free(pNewNode);
+                pNewNode = lstAppendItem(pList, pNewItemData);
+            }
+        }
+    }
 
     return (pNewNode);
@@ -797,36 +795,36 @@
     BOOL fFound = FALSE;
 
-    if (pList)
-        if (    (pList->ulMagic == LINKLISTMAGIC)
-             && (pRemoveNode)
-           )
-        {
-            if (pList->pFirst == pRemoveNode)
-                // item to be removed is first: adjust first
-                pList->pFirst = pRemoveNode->pNext;     // can be NULL
-            if (pList->pLast == pRemoveNode)
-                // item to be removed is last: adjust last
-                pList->pLast = pRemoveNode->pPrevious;  // can be NULL
-
-            if (pRemoveNode->pPrevious)
-                // adjust previous item
-                pRemoveNode->pPrevious->pNext = pRemoveNode->pNext;
-
-            if (pRemoveNode->pNext)
-                // adjust next item
-                pRemoveNode->pNext->pPrevious = pRemoveNode->pPrevious;
-
-            // decrease list count
-            pList->ulCount--;
-
-            // free node data
-            if (pList->fItemsFreeable)
-                if (pRemoveNode->pItemData)
-                    free(pRemoveNode->pItemData);
-            // free node
-            free(pRemoveNode);
-
-            fFound = TRUE;
-        }
+    if (    (pList)
+         && (pList->ulMagic == LINKLISTMAGIC)
+         && (pRemoveNode)
+       )
+    {
+        if (pList->pFirst == pRemoveNode)
+            // item to be removed is first: adjust first
+            pList->pFirst = pRemoveNode->pNext;     // can be NULL
+        if (pList->pLast == pRemoveNode)
+            // item to be removed is last: adjust last
+            pList->pLast = pRemoveNode->pPrevious;  // can be NULL
+
+        if (pRemoveNode->pPrevious)
+            // adjust previous item
+            pRemoveNode->pPrevious->pNext = pRemoveNode->pNext;
+
+        if (pRemoveNode->pNext)
+            // adjust next item
+            pRemoveNode->pNext->pPrevious = pRemoveNode->pPrevious;
+
+        // decrease list count
+        pList->ulCount--;
+
+        // free node data
+        if (pList->fItemsFreeable)
+            if (pRemoveNode->pItemData)
+                free(pRemoveNode->pItemData);
+        // free node
+        free(pRemoveNode);
+
+        fFound = TRUE;
+    }
 
     return (fFound);
@@ -852,12 +850,10 @@
 BOOL lstRemoveItem(PLINKLIST pList, void* pRemoveItem)
 {
-    BOOL brc = FALSE;
-
-    PLISTNODE pNode = lstNodeFromItem(pList, pRemoveItem);
-
-    if (pNode)
-        brc = lstRemoveNode(pList, pNode);
-
-    return (brc);
+    PLISTNODE pNode;
+
+    if (pNode = lstNodeFromItem(pList, pRemoveItem))
+        return (lstRemoveNode(pList, pNode));
+
+    return (FALSE);
 }
 
@@ -875,6 +871,4 @@
                   PLISTNODE pNode2)
 {
-    BOOL brc = FALSE;
-
     if ( (pNode1) && (pNode2) )
     {
@@ -883,8 +877,8 @@
         pNode2->pItemData = pTemp;
 
-        brc = TRUE;
+        return (TRUE);
     }
 
-    return (brc);
+    return (FALSE);
 }
 
@@ -907,5 +901,5 @@
 {
     long ll = lLeft,
-         lr = lRight-1,
+         lr = lRight - 1,
          lPivot = lRight;
 
@@ -919,7 +913,7 @@
         {
             // compare left item data to pivot item data
-            while ( (*pfnSort)(pNodeLeft->pItemData,
-                               pNodePivot->pItemData,
-                               pStorage)
+            while ( pfnSort(pNodeLeft->pItemData,
+                            pNodePivot->pItemData,
+                            pStorage)
                     < 0 )
             {
@@ -930,7 +924,7 @@
 
             // compare right item to pivot
-            while (     ( (*pfnSort)(pNodeRight->pItemData,
-                                     pNodePivot->pItemData,
-                                     pStorage)
+            while (     ( pfnSort(pNodeRight->pItemData,
+                                  pNodePivot->pItemData,
+                                  pStorage)
                            >= 0 )
                     && (lr > ll)
@@ -953,6 +947,10 @@
 
         // recurse!
-        lstQuickSort2(pList, pfnSort, pStorage, lLeft, ll-1);
-        lstQuickSort2(pList, pfnSort, pStorage, ll+1, lRight);
+        lstQuickSort2(pList, pfnSort, pStorage,
+                      lLeft,
+                      ll - 1);
+        lstQuickSort2(pList, pfnSort, pStorage,
+                      ll + 1,
+                      lRight);
     }
 }
@@ -994,16 +992,16 @@
     BOOL brc = FALSE;
 
-    if (pList)
-        if (    (pList->ulMagic == LINKLISTMAGIC)
-             && (pfnSort)
-           )
-        {
-            long lRight = lstCountItems(pList)-1;
-
-            lstQuickSort2(pList, pfnSort, pStorage,
-                        0,          // lLeft
-                        lRight);
-            brc = TRUE;
-        }
+    if (    (pList)
+         && (pList->ulMagic == LINKLISTMAGIC)
+         && (pfnSort)
+       )
+    {
+        long lRight = lstCountItems(pList) - 1;
+
+        lstQuickSort2(pList, pfnSort, pStorage,
+                      0,          // lLeft
+                      lRight);
+        brc = TRUE;
+    }
 
     return (brc);
Index: trunk/src/helpers/memdebug.c
===================================================================
--- trunk/src/helpers/memdebug.c	(revision 131)
+++ trunk/src/helpers/memdebug.c	(revision 132)
@@ -753,8 +753,8 @@
                                              //     before each output line
     {
-        PSZ psz = strhCreateDump(pb, ulSize, ulIndent);
-        if (psz)
+        PSZ psz;
+        if (psz = strhCreateDump(pb, ulSize, ulIndent))
         {
-            _Pmpf(("\n%s", psz));
+            // _Pmpf(("\n%s", psz));
             free(psz);
         }
Index: trunk/src/helpers/stringh.c
===================================================================
--- trunk/src/helpers/stringh.c	(revision 131)
+++ trunk/src/helpers/stringh.c	(revision 132)
@@ -347,4 +347,6 @@
  *@@ strhncpy0:
  *      like strncpy, but always appends a 0 character.
+ *
+ *@@changed V0.9.16 (2002-01-09) [umoeller]: fixed crash on null pszSource
  */
 
@@ -354,12 +356,16 @@
 {
     ULONG ul = 0;
-    PSZ pTarget = pszTarget,
-        pSource = (PSZ)pszSource;
-
-    for (ul = 0; ul < cbSource; ul++)
-        if (*pSource)
-            *pTarget++ = *pSource++;
-        else
-            break;
+    PSZ     pTarget = pszTarget,
+            pSource;
+
+    if (pSource = (PSZ)pszSource)       // V0.9.16 (2002-01-09) [umoeller]
+    {
+        for (ul = 0; ul < cbSource; ul++)
+            if (*pSource)
+                *pTarget++ = *pSource++;
+            else
+                break;
+    }
+
     *pTarget = 0;
 
@@ -529,6 +535,6 @@
     if (pszBuf)
     {
-        PSZ pOpen = strchr(pszBuf, cOpen);
-        if (pOpen)
+        PSZ pOpen;
+        if (pOpen = strchr(pszBuf, cOpen))
         {
             // opening char found:
Index: trunk/src/helpers/threads.c
===================================================================
--- trunk/src/helpers/threads.c	(revision 131)
+++ trunk/src/helpers/threads.c	(revision 132)
@@ -501,15 +501,17 @@
         PLISTNODE pNode;
         *pcThreads = lstCountItems(&G_llThreadInfos);
-        pArray = (PTHREADINFO)malloc(*pcThreads * sizeof(THREADINFO));
-        pThis = pArray;
-
-        pNode = lstQueryFirstNode(&G_llThreadInfos);
-        while (pNode)
+        if (pArray = (PTHREADINFO)malloc(*pcThreads * sizeof(THREADINFO)))
         {
-            memcpy(pThis,
-                   (PTHREADINFO)pNode->pItemData,
-                   sizeof(THREADINFO));
-            pThis++;
-            pNode = pNode->pNext;
+            pThis = pArray;
+
+            pNode = lstQueryFirstNode(&G_llThreadInfos);
+            while (pNode)
+            {
+                memcpy(pThis,
+                       (PTHREADINFO)pNode->pItemData,
+                       sizeof(THREADINFO));
+                pThis++;
+                pNode = pNode->pNext;
+            }
         }
 
Index: trunk/src/helpers/winh.c
===================================================================
--- trunk/src/helpers/winh.c	(revision 131)
+++ trunk/src/helpers/winh.c	(revision 132)
@@ -4510,5 +4510,5 @@
             HWND hwndStatusBar = winhCreateStatusBar(hwndFrame,
                                                      hwndFrame,
-                                                     NULL,
+                                                     "",
                                                      "9.WarpSans",
                                                      CLR_BLACK);
Index: trunk/src/helpers/xstring.c
===================================================================
--- trunk/src/helpers/xstring.c	(revision 131)
+++ trunk/src/helpers/xstring.c	(revision 132)
@@ -129,7 +129,7 @@
 void XWPENTRY xstrInitDebug(PXSTRING pxstr,
                             ULONG ulPreAllocate,
-                            const char *file,
+                            PCSZ file,
                             unsigned long line,
-                            const char *function)
+                            PCSZ function)
 {
     memset(pxstr, 0, sizeof(XSTRING));
@@ -194,5 +194,5 @@
 
 /*
- *@@ xstrInitSet:
+ *@@ xstrInitSet2:
  *      this can be used instead of xstrInit if you
  *      have a free()'able string you want to initialize
@@ -212,10 +212,10 @@
  +          xstrInitSet(&str, strdup("blah"));
  *
- *@@added V0.9.6 (2000-11-01) [umoeller]
- *@@changed V0.9.9 (2001-03-09) [umoeller]: added ulDelta
- */
-
-void xstrInitSet(PXSTRING pxstr,
-                 PSZ pszNew)
+ *@@added V0.9.16 (2002-01-13) [umoeller]
+ */
+
+void xstrInitSet2(PXSTRING pxstr,
+                  PSZ pszNew,
+                  ULONG ulNewLength)
 {
     if (!pszNew)
@@ -223,9 +223,25 @@
     else
     {
+        if (!ulNewLength)
+            ulNewLength = strlen(pszNew);
         pxstr->psz = pszNew;
-        pxstr->ulLength = strlen(pszNew);
-        pxstr->cbAllocated = pxstr->ulLength + 1;
-        pxstr->ulDelta = pxstr->ulLength  * 10 / 100;
-    }
+        pxstr->ulLength = ulNewLength;
+        pxstr->cbAllocated = ulNewLength + 1;
+        pxstr->ulDelta = ulNewLength * 10 / 100;
+    }
+}
+
+/*
+ *@@ xstrInitSet:
+ *      shortcut to xstrInitSet2 to retain compatibility.
+ *
+ *@@added V0.9.6 (2000-11-01) [umoeller]
+ *@@changed V0.9.9 (2001-03-09) [umoeller]: added ulDelta
+ */
+
+void xstrInitSet(PXSTRING pxstr,
+                 PSZ pszNew)
+{
+    xstrInitSet2(pxstr, pszNew, 0);
 }
 
@@ -239,9 +255,9 @@
 
 void XWPENTRY xstrInitCopyDebug(PXSTRING pxstr,
-                                const char *pcszSource,
+                                PCSZ pcszSource,
                                 ULONG ulExtraAllocate,
-                                const char *file,
+                                PCSZ file,
                                 unsigned long line,
-                                const char *function)
+                                PCSZ function)
 {
     if (pxstr)
@@ -301,5 +317,5 @@
 
 void xstrInitCopy(PXSTRING pxstr,
-                  const char *pcszSource,
+                  PCSZ pcszSource,
                   ULONG ulExtraAllocate)          // in: if > 0, extra memory to allocate
 {
@@ -497,5 +513,5 @@
 
 /*
- *@@ xstrset:
+ *@@ xstrset2:
  *      sets the specified XSTRING to a new string
  *      without copying it.
@@ -511,10 +527,14 @@
  *      is true if pszNew comes from strdup().
  *
- *@@added V0.9.6 (2000-11-01) [umoeller]
- *@@changed V0.9.9 (2001-02-14) [umoeller]: fixed NULL target crash
- */
-
-ULONG xstrset(PXSTRING pxstr,               // in/out: string
-              PSZ pszNew)                   // in: heap PSZ to use
+ *      With this function, you can pass in the
+ *      length of the string in ulNewLength.
+ *      Otherwise use xstrset.
+ *
+ *@@added V0.9.16 (2002-01-13) [umoeller]
+ */
+
+ULONG xstrset2(PXSTRING pxstr,              // in/out: string
+               PSZ pszNew,                  // in: heap PSZ to use
+               ULONG ulNewLength)           // in: length of string or 0 to run strlen here
 {
     if (!pxstr)
@@ -525,12 +545,28 @@
     if (pszNew)
     {
-        pxstr->ulLength = strlen(pszNew);
-        pxstr->cbAllocated = pxstr->ulLength + 1;
-
-        pxstr->ulDelta = pxstr->cbAllocated * 10 / 100;
+        if (!ulNewLength)
+            ulNewLength = strlen(pszNew);
+        pxstr->ulLength = ulNewLength;
+        pxstr->cbAllocated = ulNewLength + 1;
+
+        pxstr->ulDelta = ulNewLength * 10 / 100;
     }
     // else null string: cbAllocated and ulLength are 0 already
 
     return (pxstr->ulLength);
+}
+
+/*
+ *@@ xstrset:
+ *      shortcut for xstrset2 for retaining compatibility.
+ *
+ *@@added V0.9.6 (2000-11-01) [umoeller]
+ *@@changed V0.9.9 (2001-02-14) [umoeller]: fixed NULL target crash
+ */
+
+ULONG xstrset(PXSTRING pxstr,               // in/out: string
+              PSZ pszNew)                   // in: heap PSZ to use
+{
+    return (xstrset2(pxstr, pszNew, 0));
 }
 
@@ -583,5 +619,5 @@
 
 ULONG xstrcpy(PXSTRING pxstr,               // in/out: string
-              const char *pcszSource,       // in: source, can be NULL
+              PCSZ pcszSource,       // in: source, can be NULL
               ULONG ulSourceLength)         // in: length of pcszSource or 0
 {
@@ -694,5 +730,5 @@
 
 ULONG xstrcat(PXSTRING pxstr,               // in/out: string
-              const char *pcszSource,       // in: source, can be NULL
+              PCSZ pcszSource,       // in: source, can be NULL
               ULONG ulSourceLength)         // in: length of pcszSource or 0
 {
@@ -863,5 +899,5 @@
               ULONG ulFirstReplOfs,             // in: ofs of first char to replace
               ULONG cReplLen,                   // in: no. of chars to replace
-              const char *pcszReplaceWith,      // in: string to replace chars with
+              PCSZ pcszReplaceWith,      // in: string to replace chars with
               ULONG cReplaceWithLen)            // in: length of replacement string
                                                 // (this MUST be specified; if 0, chars are removed only)
@@ -1014,6 +1050,6 @@
                  size_t *pShiftTable,         // in: shift table (see strhmemfind)
                  PBOOL pfRepeatFind,          // in: repeat find? (see strhmemfind)
-                 const char *pcszBeginChars,  // suggestion: "\x0d\x0a ()/\\-,."
-                 const char *pcszEndChars)    // suggestion: "\x0d\x0a ()/\\-,.:;"
+                 PCSZ pcszBeginChars,  // suggestion: "\x0d\x0a ()/\\-,."
+                 PCSZ pcszEndChars)    // suggestion: "\x0d\x0a ()/\\-,.:;"
 {
     PSZ     pReturn = 0;
@@ -1025,5 +1061,5 @@
         if ((pxstr->ulLength) && (ulFoundLen))
         {
-            const char *p = pxstr->psz + ulOfs;
+            PCSZ p = pxstr->psz + ulOfs;
 
             do  // while p
@@ -1152,6 +1188,6 @@
             // yes:
             ULONG   ulOfs = *pulOfs;
-            const char *pFound
-                = (const char *)strhmemfind(pxstr->psz + ulOfs, // in: haystack
+            PCSZ pFound
+                = (PCSZ)strhmemfind(pxstr->psz + ulOfs, // in: haystack
                                             pxstr->ulLength - ulOfs,
                                             pstrSearch->psz,
@@ -1199,6 +1235,6 @@
                        PULONG pulOfs,               // in: where to begin search (0 = start);
                                                     // out: ofs of first char after replacement string
-                       const char *pcszSearch,      // in: search string; cannot be NULL
-                       const char *pcszReplace)     // in: replacement string; cannot be NULL
+                       PCSZ pcszSearch,      // in: search string; cannot be NULL
+                       PCSZ pcszReplace)     // in: replacement string; cannot be NULL
 {
     XSTRING xstrFind,
@@ -1292,5 +1328,5 @@
 
 ULONG xstrEncode(PXSTRING pxstr,            // in/out: string to convert
-                 const char *pcszEncode)    // in: characters to encode (e.g. "%,();=")
+                 PCSZ pcszEncode)    // in: characters to encode (e.g. "%,();=")
 {
     ULONG ulrc = 0,
