Changeset 1892


Ignore:
Timestamp:
Jan 31, 2020, 6:45:23 AM (6 years ago)
Author:
Steven Levine
Message:

Rework RemoveCnrItems to avoid possible traps on bad input.
Rework RemoveArcItems like RemoveCnrItems.
Sync source with standards.

Location:
trunk/dll
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/arccnrs.c

    r1878 r1892  
    66  Archive containers
    77
    8   Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2013 Steven H. Levine
     8  Copyright (c) 1993-1998 M. Kimes
     9  Copyright (c) 2001-2020 Steven H. Levine
    1010
    1111  11 Jun 02 SHL Ensure archive name not garbage
     
    7777  12 Mar 09 SHL Use common SearchContainer
    7878  13 Dec 09 GKY Fixed separate paramenters. Please note that appname should be used in
    79                 profile calls for user settings that work and are setable in more than one
    80                 miniapp; FM3Str should be used for setting only relavent to FM/2 or that
    81                 aren't user settable; realappname should be used for setting applicable to
    82                 one or more miniapp but not to FM/2
     79                profile calls for user settings that work and are setable in more than one
     80                miniapp; FM3Str should be used for setting only relavent to FM/2 or that
     81                aren't user settable; realappname should be used for setting applicable to
     82                one or more miniapp but not to FM/2
    8383  17 Jan 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
    8484  15 Apr 10 JBS Ticket 422: Stop hang when open archive gets deleted or moved
    8585  23 Oct 10 GKY Add ForwardslashToBackslash function to streamline code
    8686  20 Nov 10 GKY Check that pTmpDir IsValid and recreate if not found; Fixes hangs caused
    87                 by temp file creation failures.
     87                by temp file creation failures.
    8888  13 Aug 11 GKY Change to Doxygen comment format
    8989  30 Jul 13 GKY Changes to allow 7z archiver to work with AV.
    9090  05 Aug 13 GKY Changes to allow Lzip to work with AV
    9191  11 Aug 13 GKY Removed code that attempted to use the archive name as the extract directory
    92                 It was never fully implemented and doesn't make sense for the container.
     92                It was never fully implemented and doesn't make sense for the container.
    9393  09 Feb 14 GKY Fix trap on opening a file without an extention
    9494  22 Feb 14 GKY Fix warn readonly yes don't ask to work when recursing directories.
    9595  28 Apr 14 JBS Ticket #522: Ensure use of wrapper functions where needed
    9696  01 Mar 14 GKY Fixed error checking in FillArcCnr only to report missing archivers after
    97                 all entries have been tried. Added a check b/gzip exes for TAR.B/GZ archives.
    98                 Use the test archive string from the first working archive description.
    99                 Enhance the error message. Ticket 502
     97                all entries have been tried. Added a check b/gzip exes for TAR.B/GZ archives.
     98                Use the test archive string from the first working archive description.
     99                Enhance the error message. Ticket 502
    100100  01 Mar 14 GKY Fix a trap caused by selecting "print" from the arccontainer menu. Ticket 525
    101101  01 Mar 14 GKY Fix the problem with copying text from the test archive window by launching
    102                 it in a command shell (i.e. comspec /k archiver -t archive) Ticket 503
     102                it in a command shell (i.e. comspec /k archiver -t archive) Ticket 503
    103103  02 Mar 14 GKY Fixed typo that reversed the function of the saymsg dialog g/bzip check.
    104                 Added option to suppress message regarding missing bzip2.exe
    105                 or gzip.exe on TAR.B/GZ archives.
     104                Added option to suppress message regarding missing bzip2.exe
     105                or gzip.exe on TAR.B/GZ archives.
    106106  06 Apr 14 GKY Removed all BZ/GZ checks
    107107  28 Jun 14 GKY Fix errors identified with CPPCheck; Fix retry to create workdir code
    108108  12 Aug 15 JBS Ticket #522: Ensure no "highmem-unsafe" functions are called directly.
    109                 Calls to unsafe Dos... functions have been changed to call the wrapped xDos... functions.
     109                Calls to unsafe Dos... functions have been changed to call the wrapped xDos... functions.
     110  30 Jan 20 SHL Rework RemoveArcItems like RemoveCnrItems
     111  30 Jan 20 SHL Use pai consistently for PARCITEM;
     112  30 Jan 20 SHL Clean up some inconsistent formatting
    110113
    111114***********************************************************************/
     
    114117#include <string.h>
    115118#include <ctype.h>
    116 #include <direct.h>                     // rmdir
     119#include <direct.h>                     // rmdir
    117120#include <share.h>                      // SH_DENYWR
    118121#include <limits.h>                     // ULONG_MAX
     
    145148#include "strutil.h"                    // GetPString
    146149#include "notebook.h"                   // CfgDlgProc
    147 #include "worker.h"             // Action, MassAction
     150#include "worker.h"                     // Action, MassAction
    148151#include "avv.h"                        // ArcReviewDlgProc, rewrite_archiverbb2
    149152#include "chklist.h"                    // CenterOverWindow, CheckListProc
    150153#include "common.h"                     // CommonCreateTextChildren, CommonFrameWndProc, CommonTextPaint
    151                                 // CommonTextButton
     154                                        // CommonTextButton
    152155#include "draglist.h"                   // DoFileDrag, DragOne
    153156#include "valid.h"                      // GetDesktopName, TestCDates
     
    159162#include "srchpath.h"                   // RunFM2Util
    160163#include "misc.h"                       // Broadcast, CheckMenu, CurrentRecord, SayFilter, SaySort
    161                                 // DrawTargetEmphasis, IsFm2Window
     164                                        // DrawTargetEmphasis, IsFm2Window
    162165#include "select.h"                     // SelectAll, SelectList
    163166#include "findrec.h"                    // ShowCnrRecord
     
    186189#include "excputil.h"                   // 06 May 08 SHL added
    187190
    188 #define ARCFLAGS_REALDIR    0x00000001
    189 #define ARCFLAGS_PSEUDODIR  0x00000002
    190 #define CON_COLS                6
    191 #define EXTRA_ARCRECORD_BYTES   (sizeof(ARCITEM) - sizeof(MINIRECORDCORE))
     191#define ARCFLAGS_REALDIR        0x00000001
     192#define ARCFLAGS_PSEUDODIR      0x00000002
     193#define CON_COLS                6
     194#define EXTRA_ARCRECORD_BYTES   (sizeof(ARCITEM) - sizeof(MINIRECORDCORE))
    192195#define NO_START_OF_ARCHIVER_LIST_STRING "None"
    193 #define NO_END_OF_ARCHIVER_LIST_STRING   NO_START_OF_ARCHIVER_LIST_STRING
     196#define NO_END_OF_ARCHIVER_LIST_STRING NO_START_OF_ARCHIVER_LIST_STRING
    194197
    195198#pragma data_seg(DATA1)
     
    211214typedef struct {
    212215
    213   HWND   hwndCnr;                //hwnd you want the message posted to
    214   HWND   hwndClient;             //hwnd calling this thread; NULL will work
    215   ULONG  RunFlags;               //runemf2 flags see systemf.h
    216   ULONG  msg;                    //Message to post
     216  HWND   hwndCnr;               // hwnd you want the message posted to
     217  HWND   hwndClient;            // hwnd calling this thread; NULL will work
     218  ULONG  RunFlags;              // runemf2 flags see systemf.h
     219  ULONG  msg;                   // Message to post
    217220  UINT   uiLineNumber;
    218221  PCSZ   pszSrcFile;
    219   CHAR   filename[CCHMAXPATH];   //file passed as MP1 message parameter (file selected)
    220   CHAR   *pszDirectory;          //Execution directory
    221   CHAR   *pszEnvironment;        //Enviroment -- NULL passes current
    222   CHAR   *pszCmdLine;             //Use sprintf to format multipart command line into single string
    223   CHAR   formatstring[40];       //Usally "%s"
     222  CHAR   filename[CCHMAXPATH];  // file passed as MP1 message parameter (file selected)
     223  CHAR   *pszDirectory;         // Execution directory
     224  CHAR   *pszEnvironment;       // Enviroment -- NULL passes current
     225  CHAR   *pszCmdLine;   // Use sprintf to format multipart command line into single string
     226  CHAR   formatstring[40];      // Usally "%s"
    224227}
    225228WAITCHILD;
     
    365368                              PVOID pStorage)
    366369{
    367   PARCITEM pai1 = (PARCITEM) pmrc1;
    368   PARCITEM pai2 = (PARCITEM) pmrc2;
     370  PARCITEM pai1 = (PARCITEM)pmrc1;
     371  PARCITEM pai2 = (PARCITEM)pmrc2;
    369372  DIRCNRDATA *pdcd = (DIRCNRDATA *) pStorage;
    370373  SHORT ret = 0;
     
    432435    }
    433436    if (!ret)
    434       ret = (SHORT) stricmp(pai1->pszFileName, pai2->pszFileName);
     437      ret = (SHORT)stricmp(pai1->pszFileName, pai2->pszFileName);
    435438    if (ret && (sortFlags & SORT_REVERSE))
    436439      ret = ret > 0 ? -1 : 1;
    437440    return ret;
    438441  }
    439   return (SHORT) stricmp(pai1->pszFileName, pai2->pszFileName);
     442  return (SHORT)stricmp(pai1->pszFileName, pai2->pszFileName);
    440443}
    441444
     
    448451
    449452  if (dcd && *dcd->mask.szMask) {
    450     r = (PARCITEM) rmini;
     453    r = (PARCITEM)rmini;
    451454    if (dcd->mask.pszMasks[1]) {
    452455      for (x = 0; dcd->mask.pszMasks[x]; x++) {
     
    513516/**
    514517 * Remove item(s) from archive container and free associated storage if requested
    515  * @param paiFirst points to first item to remove or NULL to remove all
    516  * @param usCnt is remove count or 0 to remove all
     518 * @param paiFirst points to specific item to remove or NULL to remove all
     519 * @param usCnt is 0 to remove all or 1 to remove specific record
     520 * @param usFlags for CM_REMOVERECORD
     521 * @returns count of items remaining to delete or -1 if error
    517522 */
    518523
     
    522527  PARCITEM pai;
    523528
    524   if ((usCnt && !paiFirst) || (!usCnt && paiFirst))
     529  // Counted remove requires paiFirst and can only remove 1 specifc record
     530  // Remove all does not allow paiFirst
     531  if ((usCnt && !paiFirst) || (usCnt != 1 && paiFirst)) {
    525532    Runtime_Error(pszSrcFile, __LINE__, "paiFirst %p usCnt %u mismatch", paiFirst, usCnt);
    526   else {
    527     // Free our buffers if free requested
    528     if (usFlags & CMA_FREE) {
    529       if (paiFirst)
    530         pai = paiFirst;
    531       else {
    532         pai = (PARCITEM)WinSendMsg(hwnd, CM_QUERYRECORD, MPVOID,
    533                                    MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
    534         if ((INT)pai == -1) {
    535           Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_QUERYRECORD");
    536           remaining = -1;
    537           pai = NULL;
    538         }
    539       }
    540       while (pai) {
    541         FreeArcItemData(pai);
    542         pai = (PARCITEM)pai->rc.preccNextRecord;
    543         if (remaining && --remaining == 0)
    544           break;
    545       }
    546     }
     533    remaining = -1;
    547534  }
    548   if (remaining != - 1) {
    549     remaining = (INT)WinSendMsg(hwnd, CM_REMOVERECORD, MPFROMP(&paiFirst),
    550                                 MPFROM2SHORT(usCnt, usFlags));
    551     if (remaining == -1) {
    552       Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,
    553                 "CM_REMOVERECORD hwnd %x pai %p cnt %u",
    554                 hwnd, paiFirst, usCnt);
    555     }
     535  if (!usFlags & CMA_FREE) {
     536    Runtime_Error(pszSrcFile, __LINE__, "usFlags must have CMA_FREE set");
     537    remaining = -1;
     538  }
     539  if (!paiFirst) {
     540    // Removing all - query first
     541    paiFirst = (PARCITEM)WinSendMsg(hwnd, CM_QUERYRECORD, MPVOID,
     542                                    MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
     543    if ((INT)paiFirst == -1) {
     544      Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_QUERYRECORD");
     545      remaining = -1;
     546    }
     547  }
     548
     549  // Free data
     550  // 2020-01-28 SHL Rework to use CMA_NEXT - preccNextRecord method was never reliable
     551  pai = paiFirst;
     552  while (pai && (INT)pai != -1 && remaining > 0) {
     553    FreeArcItemData(pai);
     554    if (--remaining == 0)
     555      break;
     556    pai = WinSendMsg(hwnd, CM_QUERYRECORD, MPFROMP(pai),
     557                     MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
     558  } // while
     559
     560  // Free ARCITEM record(s) if OK so far
     561  if (remaining != -1 && paiFirst && (INT)paiFirst != -1) {
     562#   ifdef PMPRINTF
     563    PmPrintf_Report(pszSrcFile, __LINE__, "RemoveArcItems CM_REMOVERECORD paiFirst %p usCnt %d", paiFirst, usCnt);
     564#   endif
     565    remaining = (INT)WinSendMsg(hwnd, CM_REMOVERECORD, MPFROMP(&paiFirst), MPFROM2SHORT(usCnt, usFlags));
     566    if (remaining == -1)
     567      Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_REMOVERECORD hwnd %x paiFirst %p cnt %u", hwnd, paiFirst, usCnt);
     568    else if (usCnt == 0 && remaining != 0)
     569      Runtime_Error(pszSrcFile, __LINE__, "%u records remain after CM_REMOVERECORD", remaining);
    556570  }
    557571}
     
    581595}
    582596
    583 //== FillArcCnr() generate archive content list and fill container window ==
     597/**
     598 * FillArcCnr() generate archive content list and fill container window
     599 */
    584600
    585601static INT FillArcCnr(HWND hwndCnr, CHAR * arcname, ARC_TYPE ** arcinfo,
     
    622638  MakeTempName(arctemp, ArcTempRoot, 2);
    623639
    624 
    625640ReTry:
    626641
     
    699714            return 0;
    700715          }
    701           else {
    702             rc = 0;
    703             rc = SearchPathForFile(PCSZ_PATH, s, NULL);
    704             if (!rc) {
    705               cnter ++;
    706               runemf2(SEPARATE | INVISIBLE | MINIMIZED | BACKGROUND | WAIT,
    707                       hwndCnr, pszSrcFile, __LINE__, NULL, NULL,
    708                       "%s %s",
    709                       info->list,
    710                       BldQuotedFileName(s, arcname));
    711               if (cnter == 1) {
    712                 if (info->test)
    713                   strcpy(TestStr, info->test);
    714                 else {
    715                   strcpy(TestStr, "");
    716                   notest = TRUE;
    717                 }
    718               }
    719               else if (notest && info->test) {
    720                 strcpy(TestStr, info->test);
    721                 notest = FALSE;
    722               }
    723             }
     716          else {
     717            rc = 0;
     718            rc = SearchPathForFile(PCSZ_PATH, s, NULL);
     719            if (!rc) {
     720              cnter ++;
     721              runemf2(SEPARATE | INVISIBLE | MINIMIZED | BACKGROUND | WAIT,
     722                      hwndCnr, pszSrcFile, __LINE__, NULL, NULL,
     723                      "%s %s",
     724                      info->list,
     725                      BldQuotedFileName(s, arcname));
     726              if (cnter == 1) {
     727                if (info->test)
     728                  strcpy(TestStr, info->test);
     729                else {
     730                  strcpy(TestStr, "");
     731                  notest = TRUE;
     732                }
     733              }
     734              else if (notest && info->test) {
     735                strcpy(TestStr, info->test);
     736                notest = FALSE;
     737              }
     738            }
    724739            oldstdout = fileno(stdout);
    725740            DosError(FERR_DISABLEHARDERR);
     
    737752
    738753    if (fp) {
    739       gotstart = !info->startlist ||            // If list has no start marker
     754      gotstart = !info->startlist ||    // If list has no start marker
    740755                 !*info->startlist ||
    741756                 (stricmp(info->startlist, NO_START_OF_ARCHIVER_LIST_STRING) == 0);
     
    771786          p = s;
    772787          for (fieldnum = 0; fieldnum <= highest; fieldnum++) {
    773             pp = p;
    774             while (*pp && (*pp == ' ' || *pp == '\t'))  // skip leading
     788            pp = p;
     789            // skip leading
     790            while (*pp && (*pp == ' ' || *pp == '\t'))
    775791              pp++;
    776             if (!*pp) {
    777               if (fieldnum == info->fnpos && (!strcmp(strupr(info->ext), "7Z") ||
    778                                              !strcmp(strupr(info->signature), "7Z")))
    779                 fname = nsize;// GKY 7-30-13 Work around for missing nsize field for some members of archive
    780               break;
    781             }
     792            if (!*pp) {
     793              if (fieldnum == info->fnpos && (!strcmp(strupr(info->ext), "7Z") ||
     794                                             !strcmp(strupr(info->signature), "7Z")))
     795                fname = nsize;// GKY 7-30-13 Work around for missing nsize field for some members of archive
     796              break;
     797            }
    782798            wasquote = FALSE;
    783             p = pp;
     799            p = pp;
    784800            while (*p && (wasquote ||
    785801                          ((fieldnum != info->fnpos || !info->nameislast) ?
     
    797813                }
    798814              }
    799               else if (*p)
     815              else if (*p)
    800816                p++;
    801             }
     817            }
    802818            if (*p) {
    803819              *p = 0;
    804820              p++;
    805             }
     821            }
    806822            if (fieldnum == info->nsizepos)
    807823              nsize = pp;
     
    830846              }
    831847            }
    832             else if (fieldnum == info->fnpos) {
     848            else if (fieldnum == info->fnpos) {
    833849              fname = pp;
    834               if (pp && *pp == '*' && !*(pp + 1))       // workaround for LH.EXE
     850              // workaround for LH.EXE
     851              if (pp && *pp == '*' && !*(pp + 1))
    835852                fname = NULL;
    836853              if (info->nameislast)
     
    852869
    853870            RECORDINSERT ri;
    854             PARCITEM pai;
    855 
    856             pai = WinSendMsg(hwndCnr,
    857                              CM_ALLOCRECORD,
    858                              MPFROMLONG(EXTRA_ARCRECORD_BYTES),
    859                              MPFROMLONG(1L));
     871            PARCITEM pai = WinSendMsg(hwndCnr,
     872                                      CM_ALLOCRECORD,
     873                                      MPFROMLONG(EXTRA_ARCRECORD_BYTES),
     874                                      MPFROMLONG(1L));
    860875            if (!pai) {
    861876              Runtime_Error(pszSrcFile, __LINE__, PCSZ_CM_ALLOCRECORD);
     
    893908                pai->cbComp = atol(nsize);
    894909              if (info->datetype && fdate && *fdate)
    895                 ArcDateTime(fdate, info->datetype, &pai->date, &pai->time);
     910                ArcDateTime(fdate, info->datetype, &pai->date, &pai->time);
    896911              memset(&ri, 0, sizeof(RECORDINSERT));
    897912              ri.cb = sizeof(RECORDINSERT);
     
    921936          }
    922937        }
    923       }                                 // while !eof
     938      } // while !eof
    924939
    925940      fclose(fp);
     
    928943        numarcfiles = 0;                // Request close
    929944      else if (!numarcfiles || !gotstart
    930                || (!gotend && info->endlist && *info->endlist &&
    931                    (stricmp(info->endlist, NO_END_OF_ARCHIVER_LIST_STRING)))) {
     945               || (!gotend && info->endlist && *info->endlist &&
     946                   (stricmp(info->endlist, NO_END_OF_ARCHIVER_LIST_STRING)))) {
    932947        // Oops
    933948        ARCDUMP ad;
     
    946961            goto ReTry;
    947962          }
    948         } while (tinfo);
    949         if (!fAlertBeepOff)
    950           DosBeep(750, 50);             // wake up user
    951 
    952         if (cnter > 0) {
    953           CHAR Temp[CCHMAXPATH + 2];
    954 
    955           sprintf(errstr, GetPString(IDS_ARCERRORINFOTEXT),
    956                   arcname,
    957                   !gotstart ? GetPString(IDS_NOGOTSTARTTEXT) : NullStr,
    958                   !numarcfiles ? GetPString(IDS_NOARCFILESFOUNDTEXT) : NullStr,
    959                   !gotend ? GetPString(IDS_NOENDOFLISTTEXT) : NullStr,
    960                   !notest ? NullStr : GetPString(IDS_ARCNOTEST));
    961           memset(&ad, 0, sizeof(ARCDUMP));
    962           ad.info = info;
    963           strcpy(ad.listname, arctemp);
    964           strcpy(ad.arcname, arcname);
    965           if (!notest) {
    966             strcpy(Temp, info->test);
    967             info->test = xstrdup(TestStr, pszSrcFile, __LINE__);
    968           }
    969           else if (rc) {
    970             strcpy(Temp, info->test);
    971             info->test = NULL;
    972           }
    973           ad.errmsg = errstr;
    974           WinDlgBox(HWND_DESKTOP,
    975                     hwndCnr,
    976                     ArcErrProc, FM3ModHandle, ARCERR_FRAME, MPFROMP(&ad));
    977           if (!notest || rc)
    978             info->test = xstrdup(Temp, pszSrcFile, __LINE__);
    979         }
    980         else
    981           saymsg(MB_OK, HWND_DESKTOP, GetPString(IDS_ARCMISSINGEXE),
    982                 GetPString(IDS_ARCMISSINGEXEVERBOSE));
     963        } while (tinfo);
     964        if (!fAlertBeepOff)
     965          DosBeep(750, 50);             // wake up user
     966
     967        if (cnter > 0) {
     968          CHAR Temp[CCHMAXPATH + 2];
     969
     970          sprintf(errstr, GetPString(IDS_ARCERRORINFOTEXT),
     971                  arcname,
     972                  !gotstart ? GetPString(IDS_NOGOTSTARTTEXT) : NullStr,
     973                  !numarcfiles ? GetPString(IDS_NOARCFILESFOUNDTEXT) : NullStr,
     974                  !gotend ? GetPString(IDS_NOENDOFLISTTEXT) : NullStr,
     975                  !notest ? NullStr : GetPString(IDS_ARCNOTEST));
     976          memset(&ad, 0, sizeof(ARCDUMP));
     977          ad.info = info;
     978          strcpy(ad.listname, arctemp);
     979          strcpy(ad.arcname, arcname);
     980          if (!notest) {
     981            strcpy(Temp, info->test);
     982            info->test = xstrdup(TestStr, pszSrcFile, __LINE__);
     983          }
     984          else if (rc) {
     985            strcpy(Temp, info->test);
     986            info->test = NULL;
     987          }
     988          ad.errmsg = errstr;
     989          WinDlgBox(HWND_DESKTOP,
     990                    hwndCnr,
     991                    ArcErrProc, FM3ModHandle, ARCERR_FRAME, MPFROMP(&ad));
     992          if (!notest || rc)
     993            info->test = xstrdup(Temp, pszSrcFile, __LINE__);
     994        }
     995        else
     996          saymsg(MB_OK, HWND_DESKTOP, GetPString(IDS_ARCMISSINGEXE),
     997                GetPString(IDS_ARCMISSINGEXEVERBOSE));
    983998      }
    984999      else if (!nomove && tinfo) {
     
    9941009        rewrite_archiverbb2(NULL);      // Rewrite with warning
    9951010      }
    996     }                                   // if opened
     1011    } // if opened
    9971012
    9981013    DosError(FERR_DISABLEHARDERR);
     
    11291144
    11301145  case WM_MENUEND:
    1131     if (hwndButtonPopup == (HWND) mp2) {
    1132       lastid = WinQueryWindowUShort((HWND) mp2, QWS_ID);
     1146    if (hwndButtonPopup == (HWND)mp2) {
     1147      lastid = WinQueryWindowUShort((HWND)mp2, QWS_ID);
    11331148      WinDestroyWindow(hwndButtonPopup);
    11341149      hwndButtonPopup = (HWND) 0;
     
    13191334          break;
    13201335        }
    1321         cnd.pDragInfo = (PDRAGINFO) mp1;
     1336        cnd.pDragInfo = (PDRAGINFO)mp1;
    13221337        cnd.pRecord = NULL;
    13231338        return WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
     
    14561471
    14571472      cni.pRecord = NULL;
    1458       cni.pDragInfo = (PDRAGINFO) mp1;
     1473      cni.pDragInfo = (PDRAGINFO)mp1;
    14591474      li = DoFileDrop(dcd->hwndCnr,
    14601475                      dcd->directory, FALSE, MPVOID, MPFROMP(&cni));
     
    14781493    if (dcd && dcd->info && dcd->info->extract && dcd->arcname) {
    14791494
    1480       PDRAGTRANSFER pdt = (PDRAGTRANSFER) mp1;
     1495      PDRAGTRANSFER pdt = (PDRAGTRANSFER)mp1;
    14811496      CHAR filename[CCHMAXPATH];
    14821497      ULONG len;
     
    15081523  case UM_RENDER:
    15091524    {
    1510       PDRAGTRANSFER pdt = (PDRAGTRANSFER) mp1;
     1525      PDRAGTRANSFER pdt = (PDRAGTRANSFER)mp1;
    15111526      USHORT usRes = DMFL_RENDERFAIL;
    15121527
     
    15721587      dcd->hwndObject = hwnd;           // pass back hwnd
    15731588      if (ParentIsDesktop(hwnd, dcd->hwndParent))
    1574         DosSleep(100); //05 Aug 07 GKY 250 // Avoid race?
     1589        DosSleep(100);                  // 05 Aug 07 GKY was 250 - avoid race?
    15751590    }
    15761591    return 0;
     
    16221637        {
    16231638          MASK mask;
    1624           PARCITEM pci = (PARCITEM) mp2;
     1639          PARCITEM pai = (PARCITEM)mp2;
    16251640
    16261641          memset(&mask, 0, sizeof(MASK));
     
    16311646                 GetPString((SHORT1FROMMP(mp1) == IDM_SELECTMASK) ?
    16321647                            IDS_SELECTFILTERTEXT : IDS_DESELECTFILTERTEXT));
    1633           if (pci && (INT) pci != -1)
    1634             strcpy(mask.szMask, pci->pszFileName);
     1648          if (pai && (INT)pai != -1)
     1649            strcpy(mask.szMask, pai->pszFileName);
    16351650          if (WinDlgBox(HWND_DESKTOP, dcd->hwndCnr, PickMaskDlgProc,
    16361651                        FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
     
    16401655              DeselectAll(dcd->hwndCnr, TRUE, TRUE, mask.szMask, NULL, FALSE);
    16411656          }
    1642         }
    1643         break;
     1657        }
     1658        break;
    16441659
    16451660      case IDM_INVERT:
     
    16541669    if (dcd) {
    16551670
    1656       CHAR *s = (CHAR *) mp1, *p, *pp; // filename[CCHMAXPATH];
     1671      CHAR *s = (CHAR *) mp1, *p, *pp;  // filename[CCHMAXPATH];
    16571672      WAITCHILD *WaitChild;
    16581673
     
    16831698            memmove(s, p + 1, strlen(p + 1));
    16841699        }
    1685         sprintf(WaitChild->filename, "%s\\%s", dcd->workdir, s);
    1686         ForwardslashToBackslash(WaitChild->filename);
     1700        sprintf(WaitChild->filename, "%s\\%s", dcd->workdir, s);
     1701        ForwardslashToBackslash(WaitChild->filename);
    16871702        free(s);
    16881703        WaitChild->RunFlags = SEPARATE | ASYNCHRONOUS | WAIT |
     
    17361751            ad.namecanchange = 0;
    17371752            ad.fmoving = (li->type == IDM_ARCHIVEM);
    1738             if (!WinDlgBox(HWND_DESKTOP, dcd->hwndClient, ArchiveDlgProc,
    1739                            FM3ModHandle, ARCH_FRAME, (PVOID) & ad) || !*ad.arcname ||
    1740                 !*ad.command)   // we blew it
     1753            if (!WinDlgBox(HWND_DESKTOP, dcd->hwndClient, ArchiveDlgProc,
     1754                           FM3ModHandle, ARCH_FRAME, (PVOID) & ad) || !*ad.arcname ||
     1755                !*ad.command)           // we blew it
    17411756              break;
    17421757            // build the sucker
     
    18951910              for (x = 0; li->list[x]; x++) {
    18961911                BldFullPathName(fullname, li->targetpath, li->list[x]);
    1897                 //Check if file already exists on disk warn if it does.
     1912                // Check if file already exists on disk warn if it does.
    18981913                if (IsFile(fullname) != -1) {
    18991914                  AddToList(li->list[x], &exfiles, &numfiles, &numalloc);
     
    19451960                      li->type == IDM_OPENDEFAULT ||
    19461961                      li->type == IDM_OPENSETTINGS ||
    1947                       (li->type == IDM_EDITBINARY ||            // JBS No way for this () to be true??
     1962                      (li->type == IDM_EDITBINARY ||    // JBS No way for this () to be true??
    19481963                       li->type == IDM_MCIPLAY)) ||
    19491964                     !li->info->exwdirs)) ?
     
    19791994                CHAR *temp, *p;
    19801995
    1981                 temp = li->list[x];
    1982                 ForwardslashToBackslash(temp);
     1996                temp = li->list[x];
     1997                ForwardslashToBackslash(temp);
    19831998                p = xmalloc(strlen(temp) + strlen(li->targetpath) + 2,
    19841999                            pszSrcFile, __LINE__);
     
    20172032              ExecOnList(hwnd,
    20182033                         li->runfile,
    2019                         WINDOWED | SEPARATEKEEP | PROMPT,
    2020                         li->targetpath, NULL, NULL, GetPString(IDS_EXECARCFILETITLETEXT),
     2034                        WINDOWED | SEPARATEKEEP | PROMPT,
     2035                        li->targetpath, NULL, NULL, GetPString(IDS_EXECARCFILETITLETEXT),
    20212036                         pszSrcFile, __LINE__);
    20222037            else if (li->type == IDM_VIRUSSCAN)
     
    20782093
    20792094                FILE *fp;
    2080                 CHAR szTempFile[CCHMAXPATH];
    2081                 CHAR *modew = "w";
    2082 
    2083                 if (pTmpDir && !IsValidDir(pTmpDir))
    2084                   DosCreateDir(pTmpDir, 0);
     2095                CHAR szTempFile[CCHMAXPATH];
     2096                CHAR *modew = "w";
     2097
     2098                if (pTmpDir && !IsValidDir(pTmpDir))
     2099                  DosCreateDir(pTmpDir, 0);
    20852100                BldFullPathName(szTempFile, pTmpDir, PCSZ_FM2PLAYTEMP);
    20862101                fp = xfopen(szTempFile, modew, pszSrcFile, __LINE__, FALSE);
     
    21342149                                  (li->type == IDM_EDITTEXT) ? editor :
    21352150                                  bined),
    2136                            WINDOWED | SEPARATE, NULL, NULL,
    2137                            li->list,
     2151                           WINDOWED | SEPARATE, NULL, NULL,
     2152                           li->list,
    21382153                           NULL, pszSrcFile, __LINE__);
    21392154              }
     
    22132228            CHAR **list2 = NULL, fullname[CCHMAXPATH * 2], *p;
    22142229
    2215             for (x = 0; li->list[x]; x++) {
    2216               ForwardslashToBackslash(li->list[x]);
     2230            for (x = 0; li->list[x]; x++) {
     2231              ForwardslashToBackslash(li->list[x]);
    22172232              BldFullPathName(fullname, dcd->directory, li->list[x]);
    22182233              if (IsFile(fullname) != -1)
     
    22372252              WinSendMsg(dcd->hwndCnr, WM_COMMAND,
    22382253                         MPFROM2SHORT(IDM_COLLECTOR, 0), MPVOID);
    2239               DosSleep(10); 
     2254              DosSleep(10);
    22402255              if (Collector) {
    22412256                if (!PostMsg(Collector, WM_COMMAND,
     
    22842299      WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
    22852300    break;
    2286   }                                     // switch
     2301  } // switch
    22872302  return WinDefWindowProc(hwnd, msg, mp1, mp2);
    22882303}
     
    23152330
    23162331    if (SearchContainer(hwnd, msg, mp1, mp2))
    2317         return (MRESULT)TRUE;           // Avoid default handler
     2332        return (MRESULT)TRUE;           // Avoid default handler
    23182333    break;                              // Let default handler see key too
    23192334
     
    23822397      // Display parsed date/time columns if type specified
    23832398      AdjustCnrColVis(hwnd,
    2384                       GetPString(IDS_TIMECOLTEXT),
    2385                       dcd->info->fdpos != -1 && dcd->info->datetype, FALSE);
     2399                      GetPString(IDS_TIMECOLTEXT),
     2400                      dcd->info->fdpos != -1 && dcd->info->datetype, FALSE);
    23862401      AdjustCnrColVis(hwnd,
    2387                       GetPString(IDS_DATECOLTEXT),
    2388                       dcd->info->fdpos != -1 && dcd->info->datetype, FALSE);
     2402                      GetPString(IDS_DATECOLTEXT),
     2403                      dcd->info->fdpos != -1 && dcd->info->datetype, FALSE);
    23892404      WinSendMsg(hwnd, CM_INVALIDATEDETAILFIELDINFO, MPVOID, MPVOID);
    23902405    }
     
    23952410      CNRINFO cnri;
    23962411      CHAR s[CCHMAXPATH * 2], tb[81], tf[81];
    2397       PARCITEM pci;
     2412      PARCITEM pai;
    23982413
    23992414      if (mp1) {
     
    24322447        WinSetWindowText(hwndStatus, s);
    24332448        if (!ParentIsDesktop(hwnd, dcd->hwndParent)) {
    2434           pci = WinSendMsg(hwnd,
     2449          pai = WinSendMsg(hwnd,
    24352450                           CM_QUERYRECORDEMPHASIS,
    24362451                           MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
    2437           if (pci && (INT) pci != -1) {
     2452          if (pai && (INT)pai != -1) {
    24382453            if (fSplitStatus && hwndStatus2) {
    24392454              if (dcd->ullTotalBytes)
    2440                 CommaFmtULL(tb, sizeof(tb), pci->cbFile, ' ');
     2455                CommaFmtULL(tb, sizeof(tb), pai->cbFile, ' ');
    24412456              else
    24422457                *tb = 0;
    24432458              sprintf(s, "%s%s%s%s",
    24442459                      *tb ? " " : NullStr,
    2445                       tb, *tb ? "  " : NullStr, pci->pszFileName);
     2460                      tb, *tb ? "  " : NullStr, pai->pszFileName);
    24462461              WinSetWindowText(hwndStatus2, s);
    24472462            }
    24482463            if (fMoreButtons)
    2449               WinSetWindowText(hwndName, pci->pszFileName);
     2464              WinSetWindowText(hwndName, pai->pszFileName);
    24502465          }
    24512466          else {
     
    24832498            if (rc == ERROR_ACCESS_DENIED) {
    24842499              p = strrchr(dcd->workdir, '.');
    2485               if (p) {          /* jbs: What if there is no "."? Give up? */
     2500              // jbs: What if there is no "."? Give up? FIXME
     2501              if (p) {
    24862502                p++;
    24872503                was = strtoul(p, NULL, 16);
     
    24952511              }
    24962512            }
    2497             if (rc) {
     2513            if (rc) {
    24982514              PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
    2499               return 0;
    2500             }
     2515              return 0;
     2516            }
    25012517          }
    25022518        }
     
    25562572            fii.cb = sizeof(FIELDINFOINSERT);
    25572573            fii.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST;
    2558             fii.cFieldInfoInsert = (SHORT) numcols;
     2574            fii.cFieldInfoInsert = (SHORT)numcols;
    25592575            fii.fInvalidateFieldInfo = TRUE;
    25602576            WinSendMsg(hwnd,
     
    26502666      }
    26512667      WinSetDlgItemText(dcd->hwndClient, ARC_EXTRACTDIR, dcd->directory);
    2652       return (MRESULT) ret;
     2668      return (MRESULT)ret;
    26532669    }
    26542670    return 0;
     
    26792695    if (dcd) {
    26802696
    2681       HWND hwndMenu = (HWND) mp2;
     2697      HWND hwndMenu = (HWND)mp2;
    26822698
    26832699      if (hwndMenu == ArcCnrMenu || hwndMenu == ArcMenu) {
     
    27162732      case IDM_FILESMENU:
    27172733        if (dcd->info) {
    2718           WinEnableMenuItem((HWND) mp2,
     2734          WinEnableMenuItem((HWND)mp2,
    27192735                            IDM_DELETE, dcd->info->delete != NULL);
    2720           WinEnableMenuItem((HWND) mp2, IDM_TEST, dcd->info->test != NULL);
    2721           WinEnableMenuItem((HWND) mp2, IDM_EXTRACT,
    2722                             dcd->info->extract != NULL && !strstr(dcd->info->ext, "TAR"));
    2723           WinEnableMenuItem((HWND) mp2, IDM_ARCEXTRACT,
    2724                             dcd->info->extract != NULL && !strstr(dcd->info->ext, "TAR"));
    2725           WinEnableMenuItem((HWND) mp2,
     2736          WinEnableMenuItem((HWND)mp2, IDM_TEST, dcd->info->test != NULL);
     2737          WinEnableMenuItem((HWND)mp2, IDM_EXTRACT,
     2738                            dcd->info->extract != NULL && !strstr(dcd->info->ext, "TAR"));
     2739          WinEnableMenuItem((HWND)mp2, IDM_ARCEXTRACT,
     2740                            dcd->info->extract != NULL && !strstr(dcd->info->ext, "TAR"));
     2741          WinEnableMenuItem((HWND)mp2,
    27262742                            IDM_EXTRACTWDIRS, dcd->info->exwdirs != NULL);
    2727           WinEnableMenuItem((HWND) mp2,
     2743          WinEnableMenuItem((HWND)mp2,
    27282744                            IDM_ARCEXTRACTWDIRS, dcd->info->exwdirs != NULL);
    2729           WinEnableMenuItem((HWND) mp2,
     2745          WinEnableMenuItem((HWND)mp2,
    27302746                            IDM_ARCEXTRACTWDIRSEXIT,
    27312747                            dcd->info->exwdirs != NULL);
     
    27342750
    27352751      case IDM_VIEWSMENU:
    2736         WinEnableMenuItem((HWND) mp2, IDM_TEST, dcd->info->test != NULL);
    2737         WinEnableMenuItem((HWND) mp2, IDM_ARCEXTRACT,
    2738                             dcd->info->extract != NULL && !strstr(dcd->info->ext, "TAR"));
    2739         WinCheckMenuItem((HWND) mp2,
     2752        WinEnableMenuItem((HWND)mp2, IDM_TEST, dcd->info->test != NULL);
     2753        WinEnableMenuItem((HWND)mp2, IDM_ARCEXTRACT,
     2754                            dcd->info->extract != NULL && !strstr(dcd->info->ext, "TAR"));
     2755        WinCheckMenuItem((HWND)mp2,
    27402756                         IDM_MINIICONS, (dcd->flWindowAttr & CV_MINI) != 0);
    2741         WinEnableMenuItem((HWND) mp2,
     2757        WinEnableMenuItem((HWND)mp2,
    27422758                          IDM_RESELECT, (dcd->lastselection != NULL));
    27432759        break;
    27442760
    27452761      case IDM_COMMANDSMENU:
    2746         SetupCommandMenu((HWND) mp2, hwnd);
     2762        SetupCommandMenu((HWND)mp2, hwnd);
    27472763        break;
    27482764
    27492765      case IDM_SORTSUBMENU:
    2750         SetSortChecks((HWND) mp2, dcd->sortFlags);
     2766        SetSortChecks((HWND)mp2, dcd->sortFlags);
    27512767        break;
    27522768
     
    27592775        break;
    27602776      }
    2761       dcd->hwndLastMenu = (HWND) mp2;
     2777      dcd->hwndLastMenu = (HWND)mp2;
    27622778    }
    27632779    if (msg == WM_INITMENU)
     
    29202936      case IDM_INVERT:
    29212937        {
    2922           PARCITEM pci;
    2923 
    2924           pci = (PARCITEM) WinSendMsg(hwnd,
    2925                                       CM_QUERYRECORDEMPHASIS,
    2926                                       MPFROMLONG(CMA_FIRST),
    2927                                       MPFROMSHORT(CRA_CURSORED));
    2928           if ((INT) pci == -1)
    2929             pci = NULL;
     2938          PARCITEM pai = (PARCITEM)WinSendMsg(hwnd,
     2939                                              CM_QUERYRECORDEMPHASIS,
     2940                                              MPFROMLONG(CMA_FIRST),
     2941                                              MPFROMSHORT(CRA_CURSORED));
     2942          if ((INT)pai == -1)
     2943            pai = NULL;
    29302944          if (SHORT1FROMMP(mp1) == IDM_HIDEALL) {
    2931             if (pci) {
    2932               if (!(pci->rc.flRecordAttr & CRA_SELECTED))
    2933                 pci->rc.flRecordAttr |= CRA_FILTERED;
     2945            if (pai) {
     2946              if (!(pai->rc.flRecordAttr & CRA_SELECTED))
     2947                pai->rc.flRecordAttr |= CRA_FILTERED;
    29342948              WinSendMsg(hwnd,
    29352949                         CM_INVALIDATERECORD,
    2936                          MPFROMP(&pci),
     2950                         MPFROMP(&pai),
    29372951                         MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
    29382952              break;
    29392953            }
    29402954          }
    2941           PostMsg(dcd->hwndObject, UM_SELECT, mp1, MPFROMP(pci));
     2955          PostMsg(dcd->hwndObject, UM_SELECT, mp1, MPFROMP(pai));
    29422956        }
    29432957        break;
     
    30133027            }
    30143028            WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);
    3015             DosSleep(100); 
     3029            DosSleep(100);
    30163030          }
    30173031        }
     
    30243038        if (dcd->directory && fFileNameCnrPath &&
    30253039            stricmp(lastextractpath, dcd->directory)) {
    3026           strcpy(lastextractpath, dcd->directory);
     3040          strcpy(lastextractpath, dcd->directory);
    30273041          SetDir(dcd->hwndParent, hwnd, dcd->directory, 1);
    30283042        }
     
    30623076        {
    30633077          BOOL empty = FALSE;
    3064           PARCITEM pci;
     3078          PARCITEM pai;
    30653079
    30663080          if (!*dcd->mask.szMask) {
    30673081            empty = TRUE;
    3068             pci = (PARCITEM) CurrentRecord(hwnd);
    3069             if (pci && (INT) pci != -1 && strchr(pci->pszFileName, '.'))
    3070               strcpy(dcd->mask.szMask, pci->pszFileName);
     3082            pai = (PARCITEM) CurrentRecord(hwnd);
     3083            if (pai && (INT)pai != -1 && strchr(pai->pszFileName, '.'))
     3084              strcpy(dcd->mask.szMask, pai->pszFileName);
    30713085          }
    30723086
     
    31503164            li->type = SHORT1FROMMP(mp1);
    31513165            li->hwnd = hwnd;
    3152             li->list = BuildArcList(hwnd);
    3153             if (li->type == IDM_DELETE)
    3154               ignorereadonly = FALSE;
     3166            li->list = BuildArcList(hwnd);
     3167            if (li->type == IDM_DELETE)
     3168              ignorereadonly = FALSE;
    31553169            if (li->type == IDM_REFRESH) {
    31563170
     
    31773191                  }
    31783192                }
    3179               }                         // for
     3193              } // for
    31803194            }
    31813195            strcpy(li->arcname, dcd->arcname);
     
    31903204                                            MPFROMLONG(CMA_FIRST),
    31913205                                            MPFROMSHORT(CRA_CURSORED));
    3192               if (pai && (INT) pai != -1)
     3206              if (pai && (INT)pai != -1)
    31933207                strcpy(li->runfile, pai->pszFileName);
    31943208              else
     
    32453259
    32463260      case CN_ENDEDIT:
    3247         if (!((PCNREDITDATA) mp2)->pRecord) {
    3248 
    3249           PFIELDINFO pfi = ((PCNREDITDATA) mp2)->pFieldInfo;
     3261        if (!((PCNREDITDATA)mp2)->pRecord) {
     3262
     3263          PFIELDINFO pfi = ((PCNREDITDATA)mp2)->pFieldInfo;
    32503264          USHORT cmd = 0;
    32513265
     
    32763290          PDRAGINFO pDInfo;
    32773291
    3278           pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
     3292          pDInfo = ((PCNRDRAGINFO)mp2)->pDragInfo;
    32793293          DrgAccessDraginfo(pDInfo);    // Access DRAGINFO
    32803294          DrgFreeDraginfo(pDInfo);      // Free DRAGINFO
     
    32883302          PDRAGITEM pDItem;             // Pointer to DRAGITEM
    32893303          PDRAGINFO pDInfo;             // Pointer to DRAGINFO
    3290           PARCITEM pci;
    3291 
    3292           pci = (PARCITEM) ((PCNRDRAGINFO) mp2)->pRecord;
     3304          PARCITEM pai = (PARCITEM)((PCNRDRAGINFO)mp2)->pRecord;
     3305
    32933306          if (SHORT1FROMMP(mp1) == CN_DRAGAFTER)
    3294             pci = NULL;
    3295           pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
     3307            pai = NULL;
     3308          pDInfo = ((PCNRDRAGINFO)mp2)->pDragInfo;
    32963309          DrgAccessDraginfo(pDInfo);    // Access DRAGINFO
    32973310          if (*dcd->arcname) {
     
    33023315            }
    33033316          }
    3304           if (pci && (INT) pci != -1) {
     3317          if (pai && (INT)pai != -1) {
    33053318            DrgFreeDraginfo(pDInfo);
    33063319            return MRFROM2SHORT(DOR_NODROP, 0);
    33073320          }
    3308           pDItem = DrgQueryDragitemPtr(pDInfo,          // Access DRAGITEM
    3309                                        0);              // Index to DRAGITEM
    3310           if (DrgVerifyRMF(pDItem,                      // Check valid rendering
     3321          pDItem = DrgQueryDragitemPtr(pDInfo,  // Access DRAGITEM
     3322                                       0);      // Index to DRAGITEM
     3323          // Check valid rendering
     3324          if (DrgVerifyRMF(pDItem,
    33113325                           (CHAR *) DRM_OS2FILE,        // mechanisms and data
    33123326                           NULL) && !(pDItem->fsControl & DC_PREPARE)) {
     
    33233337
    33243338          BOOL wasemphasized = FALSE;
    3325           PCNRDRAGINIT pcd = (PCNRDRAGINIT) mp2;
    3326           PARCITEM pci;
     3339          PCNRDRAGINIT pcd = (PCNRDRAGINIT)mp2;
     3340          PARCITEM pai;
    33273341
    33283342          if (pcd) {
    3329             pci = (PARCITEM) pcd->pRecord;
    3330             if (pci && (INT) pci != -1) {
    3331               if (pci->rc.flRecordAttr & CRA_SELECTED)
     3343            pai = (PARCITEM)pcd->pRecord;
     3344            if (pai && (INT)pai != -1) {
     3345              if (pai->rc.flRecordAttr & CRA_SELECTED)
    33323346                wasemphasized = TRUE;
    33333347              if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
     
    33793393      case CN_CONTEXTMENU:
    33803394        {
    3381           PARCITEM pci = (PARCITEM) mp2;
    3382 
    3383           if (pci && (INT) pci != -1) {
    3384             WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pci),
     3395          PARCITEM pai = (PARCITEM)mp2;
     3396
     3397          if (pai && (INT)pai != -1) {
     3398            WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pai),
    33853399                       MPFROM2SHORT(TRUE, CRA_CURSORED));
    33863400            MarkAll(hwnd, FALSE, FALSE, TRUE);
     
    34183432
    34193433          PNOTIFYRECORDEMPHASIS pre = mp2;
    3420           PARCITEM pci;
    34213434          CHAR s[CCHMAXPATHCOMP + 91], tf[81], tb[81];
    3422 
    3423           pci = (PARCITEM)(pre ? pre->pRecord : NULL);
    3424           if (!pci) {
     3435          PARCITEM pai = (PARCITEM)(pre ? pre->pRecord : NULL);
     3436
     3437          if (!pai) {
    34253438            if (!ParentIsDesktop(hwnd, dcd->hwndParent)) {
    34263439              if (hwndStatus2)
     
    34323445          }
    34333446          if (pre->fEmphasisMask & CRA_SELECTED) {
    3434             if (pci->rc.flRecordAttr & CRA_SELECTED) {
    3435               dcd->selectedbytes += pci->cbFile;
     3447            if (pai->rc.flRecordAttr & CRA_SELECTED) {
     3448              dcd->selectedbytes += pai->cbFile;
    34363449              dcd->selectedfiles++;
    34373450            }
    34383451            else if (dcd->selectedfiles) {
    3439               dcd->selectedbytes -= pci->cbFile;
     3452              dcd->selectedbytes -= pai->cbFile;
    34403453              dcd->selectedfiles--;
    34413454            }
     
    34523465                   !ParentIsDesktop(hwnd, dcd->hwndParent)) {
    34533466            if (pre->fEmphasisMask & CRA_CURSORED) {
    3454               if (pci->rc.flRecordAttr & CRA_CURSORED) {
     3467              if (pai->rc.flRecordAttr & CRA_CURSORED) {
    34553468                if (fSplitStatus && hwndStatus2) {
    34563469                  if (dcd->ullTotalBytes)
    3457                     CommaFmtULL(tb, sizeof(tb), pci->cbFile, ' ');
     3470                    CommaFmtULL(tb, sizeof(tb), pai->cbFile, ' ');
    34583471                  else
    34593472                    *tb = 0;
    34603473                  sprintf(s, "%s%s%s%s",
    34613474                          *tb ? " " : NullStr,
    3462                           tb, *tb ? "  " : NullStr, pci->pszFileName);
     3475                          tb, *tb ? "  " : NullStr, pai->pszFileName);
    34633476                  WinSetWindowText(hwndStatus2, s);
    34643477                }
    34653478                if (fMoreButtons)
    3466                   WinSetWindowText(hwndName, pci->pszFileName);
     3479                  WinSetWindowText(hwndName, pai->pszFileName);
    34673480              }
    34683481            }
     
    34743487        if (mp2) {
    34753488
    3476           PARCITEM pci = (PARCITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord;
    3477 
    3478           if (pci && (INT) pci != -1) {
     3489          PARCITEM pai = (PARCITEM)((PNOTIFYRECORDENTER)mp2)->pRecord;
     3490
     3491          if (pai && (INT)pai != -1) {
    34793492
    34803493            CHAR *s;
    34813494
    3482             if ((pci->rc.flRecordAttr & CRA_INUSE) ||
    3483                 (pci->flags & (ARCFLAGS_REALDIR | ARCFLAGS_PSEUDODIR)))
     3495            if ((pai->rc.flRecordAttr & CRA_INUSE) ||
     3496                (pai->flags & (ARCFLAGS_REALDIR | ARCFLAGS_PSEUDODIR)))
    34843497              break;
    3485             s = xstrdup(pci->pszFileName, pszSrcFile, __LINE__);
     3498            s = xstrdup(pai->pszFileName, pszSrcFile, __LINE__);
    34863499            if (s) {
    34873500              if (!PostMsg(dcd->hwndObject, UM_ENTER, MPFROMP(s), MPVOID)) {
     
    35783591        PCSZ szHelpString = NULL;
    35793592
    3580 
    35813593        for (i=0; i<MenuItems; i++) {
    35823594          sCurrentMenuitem = asMenuIDs[i];
     
    35903602            MOUSEMSG(&msg)->y < rectl.yTop)
    35913603           break;
    3592         }                      // for
    3593 
     3604        } // for
    35943605
    35953606         switch (sCurrentMenuitem) {
     
    37113722        dcd->id = id;
    37123723        dcd->type = ARC_FRAME;
    3713         if (pTmpDir && !IsValidDir(pTmpDir))
    3714           DosCreateDir(pTmpDir, 0);
     3724        if (pTmpDir && !IsValidDir(pTmpDir))
     3725          DosCreateDir(pTmpDir, 0);
    37153726        MakeTempName(dcd->workdir, ArcTempRoot, 2);
    37163727        strcpy(dcd->arcname, fullname);
     
    37293740          else
    37303741            strcpy(dcd->directory, extractpath);
    3731         }
     3742        }
    37323743        if (!*dcd->directory && *lastextractpath) {
    37333744          DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
     
    37653776
    37663777          oldproc = WinSubclassWindow(hwndFrame, (PFNWP) ArcFrameWndProc);
    3767           WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
     3778          WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID)oldproc);
    37683779        }
    37693780        dcd->hwndCnr = WinCreateWindow(hwndClient,
     
    37873798        }
    37883799        else {
    3789           WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID) dcd);
     3800          WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID)dcd);
    37903801          dcd->oldproc = WinSubclassWindow(dcd->hwndCnr,
    37913802                                           (PFNWP) ArcCnrWndProc);
     
    38203831
    38213832            oldmenuproc = WinSubclassWindow(hwndMenu, (PFNWP) ArcCnrMenuProc);
    3822             WinSetWindowPtr(hwndMenu, QWL_USER, (PVOID) oldmenuproc);
     3833            WinSetWindowPtr(hwndMenu, QWL_USER, (PVOID)oldmenuproc);
    38233834            if (!fToolbar) {
    38243835
  • trunk/dll/filldir.c

    r1891 r1892  
    125125  26 Sep 15 GKY Remove fInitialDriveScan code
    126126  28 Jan 20 SHL EmptyCnr: report more errors
    127   29 Jan 20 SHL RemoveCnrItems: rework removal from prev/next chain
     127  29 Jan 20 SHL Rework RemoveCnrItems removal to not use prev/next chain
     128  30 Jan 20 SHL Rework RemoveCnrItems to avoid possible traps on bad input
     129  30 Jan 20 SHL Clean up some inconsistent formatting
    128130
    129131***********************************************************************/
     
    297299      hptr = hptrArt;
    298300    else
    299       hptr = (HPOINTER) 0;
     301      hptr = (HPOINTER)0;
    300302  }
    301303  else
    302     hptr = (HPOINTER) 0;
     304    hptr = (HPOINTER)0;
    303305
    304306  return hptr;
     
    319321
    320322  // try to guess WPS default file icon
    321   hptr2 = (HPOINTER) 0;
     323  hptr2 = (HPOINTER)0;
    322324  for (u = 0; !hptrWPSFile && u < 10; u++) {
    323325    char szFileName[CCHMAXPATH];
     
    367369  ULONG flags = driveflags[toupper(*pci->pszFileName) - 'A'];
    368370  BOOL fLoadSubjectForDrive = fLoadSubject && ~flags & DRIVE_NOLOADSUBJS;
    369   BOOL fLoadLongNameForDrive = fLoadLongnames &&        // ~flags & DRIVE_NOLONGNAMES &&
     371  BOOL fLoadLongNameForDrive = fLoadLongnames &&        // ~flags & DRIVE_NOLONGNAMES &&
    370372                               ~flags & DRIVE_NOLOADLONGS;
    371373  if (fLoadSubjectForDrive || fLoadLongNameForDrive) {
     
    411413        eaop.fpFEA2List = pfealist;
    412414        eaop.oError = 0;
    413         rc = DosQueryPathInfo(pci->pszFileName, FIL_QUERYEASFROMLIST,
    414                               (PVOID) &eaop, (ULONG) sizeof(EAOP2));
     415        rc = DosQueryPathInfo(pci->pszFileName,
     416                              FIL_QUERYEASFROMLIST,
     417                              (PVOID)&eaop,
     418                              (ULONG)sizeof(EAOP2));
    415419        // Prevent this error from occuring when scanning a directory
    416420        // that contains a locked data file
     
    533537        (flags & DRIVE_NOLOADICONS) ||
    534538        !isalpha(*pci->pszFileName)) {
    535       hptr = (HPOINTER) 0;
     539      hptr = (HPOINTER)0;
    536540    }
    537541    else
     
    543547        (flags & DRIVE_NOLOADICONS) ||
    544548        !isalpha(*pci->pszFileName)) {
    545       hptr = (HPOINTER) 0;
     549      hptr = (HPOINTER)0;
    546550    }
    547551    else
     
    630634               != (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED)))) {
    631635    if (*dcd->mask.szMask || dcd->mask.antiattr) {
    632       if (!Filter((PMINIRECORDCORE) pci, (PVOID) & dcd->mask))
     636      if (!Filter((PMINIRECORDCORE)pci, (PVOID)&dcd->mask))
    633637        pci->rc.flRecordAttr |= CRA_FILTERED;
    634638    }
     
    792796        (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED)))) {
    793797    if (*dcd->mask.szMask || dcd->mask.antiattr) {
    794       if (!Filter((PMINIRECORDCORE) pci, (PVOID) & dcd->mask))
     798      if (!Filter((PMINIRECORDCORE)pci, (PVOID)&dcd->mask))
    795799        pci->rc.flRecordAttr |= CRA_FILTERED;
    796800    }
     
    954958                                               pffbFile, partial, dcd);
    955959                pciNext = pci;
    956                 pci = (PCNRITEM) pci->rc.preccNextRecord;
     960                pci = (PCNRITEM)pci->rc.preccNextRecord;
    957961                ullTotalBytes += ullBytes;
    958962              } // for
     
    960964              memset(&ri, 0, sizeof(RECORDINSERT));
    961965              ri.cb = sizeof(RECORDINSERT);
    962               ri.pRecordOrder = (PRECORDCORE) CMA_END;
    963               ri.pRecordParent = (PRECORDCORE) pciParent;
    964               ri.zOrder = (ULONG) CMA_TOP;
     966              ri.pRecordOrder = (PRECORDCORE)CMA_END;
     967              ri.pRecordParent = (PRECORDCORE)pciParent;
     968              ri.zOrder = (ULONG)CMA_TOP;
    965969              ri.cRecordsInsert = ulSelCnt;
    966970              ri.fInvalidateRecord = TRUE;
     
    978982                  ok = FALSE;
    979983                  ullTotalBytes = 0;
    980                   if (WinIsWindow((HAB) 0, hwndCnr))
     984                  if (WinIsWindow((HAB)0, hwndCnr))
    981985                    FreeCnrItemList(hwndCnr, pciFirst);
    982986                }
     
    10931097              ullBytes = FillInRecordFromFFB(hwndCnr, pci, pszFileSpec,
    10941098                                          pffbFile, partial, dcd);
    1095               pci = (PCNRITEM) pci->rc.preccNextRecord;
     1099              pci = (PCNRITEM)pci->rc.preccNextRecord;
    10961100              ullTotalBytes += ullBytes;
    10971101              DosRequestMutexSem(hmtxFiltering, SEM_INDEFINITE_WAIT);
     
    11131117            memset(&ri, 0, sizeof(RECORDINSERT));
    11141118            ri.cb = sizeof(RECORDINSERT);
    1115             ri.pRecordOrder = (PRECORDCORE) CMA_END;
    1116             ri.pRecordParent = (PRECORDCORE) pciParent;
    1117             ri.zOrder = (ULONG) CMA_TOP;
     1119            ri.pRecordOrder = (PRECORDCORE)CMA_END;
     1120            ri.pRecordParent = (PRECORDCORE)pciParent;
     1121            ri.zOrder = (ULONG)CMA_TOP;
    11181122            ri.cRecordsInsert = ulRecsToInsert;
    11191123            ri.fInvalidateRecord = (!fSyncUpdates && dcd &&
     
    11301134                ok = FALSE;
    11311135                ullTotalBytes = 0;
    1132                 if (WinIsWindow((HAB) 0, hwndCnr))
     1136                if (WinIsWindow((HAB)0, hwndCnr))
    11331137                  FreeCnrItemList(hwndCnr, pciFirst);
    11341138                pciFirst = NULL;
     
    12711275  if (!DosQuerySysInfo(QSV_BOOT_DRIVE,
    12721276                       QSV_BOOT_DRIVE,
    1273                        (PVOID) &startdrive,
    1274                        (ULONG) sizeof(ULONG)) &&
     1277                       (PVOID)&startdrive,
     1278                       (ULONG)sizeof(ULONG)) &&
    12751279      startdrive)
    12761280  {
     
    13061310                          CM_ALLOCRECORD,
    13071311                          MPFROMLONG(EXTRA_RECORD_BYTES),
    1308                           MPFROMLONG((ULONG) numtoinsert));
     1312                          MPFROMLONG((ULONG)numtoinsert));
    13091313  }
    13101314
     
    13511355              CHAR Key[80];
    13521356
    1353               sprintf(Key, "%c.VerifyOffChecked", (CHAR) (iDrvNum + 'A'));
     1357              sprintf(Key, "%c.VerifyOffChecked", (CHAR)(iDrvNum + 'A'));
    13541358              fVerifyOffChecked[iDrvNum] = TRUE;
    13551359              PrfWriteProfileData(fmprof, appname, Key, &fVerifyOffChecked[iDrvNum], sizeof(BOOL));
     
    13701374            rc = DosQueryPathInfo(szDrive,
    13711375                                  FIL_QUERYEASIZEL,
    1372                                   &fsa4, (ULONG) sizeof(FILESTATUS4L));
     1376                                  &fsa4,
     1377                                  (ULONG)sizeof(FILESTATUS4L));
    13731378            if (rc == ERROR_BAD_NET_RESP) {
    13741379              DosError(FERR_DISABLEHARDERR);
    13751380              rc = DosQueryPathInfo(szDrive,
    13761381                                    FIL_STANDARDL,
    1377                                     &fsa4, (ULONG) sizeof(FILESTATUS4L));
     1382                                    &fsa4,
     1383                                    (ULONG)sizeof(FILESTATUS4L));
    13781384              fsa4.cbList = 0;
    13791385            }
     
    14491455      }
    14501456      pci->rc.flRecordAttr |= CRA_RECORDREADONLY;
    1451       pci = (PCNRITEM) pci->rc.preccNextRecord; // next rec
     1457      pci = (PCNRITEM)pci->rc.preccNextRecord;  // next rec
    14521458    }
    14531459    else if (~ulDriveMap & ulDriveMapMask)
     
    14821488    memset(&ri, 0, sizeof(RECORDINSERT));
    14831489    ri.cb = sizeof(RECORDINSERT);
    1484     ri.pRecordOrder = (PRECORDCORE) CMA_END;
    1485     ri.pRecordParent = (PRECORDCORE) NULL;
    1486     ri.zOrder = (ULONG) CMA_TOP;
     1490    ri.pRecordOrder = (PRECORDCORE)CMA_END;
     1491    ri.pRecordParent = (PRECORDCORE)NULL;
     1492    ri.zOrder = (ULONG)CMA_TOP;
    14871493    ri.cRecordsInsert = numtoinsert;
    14881494    ri.fInvalidateRecord = FALSE;
     
    14961502
    14971503  // move cursor onto the default drive rather than the first drive
    1498   pci = (PCNRITEM) WinSendMsg(hwndCnr,
    1499                               CM_QUERYRECORD,
    1500                               MPVOID,
    1501                               MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
     1504  pci = (PCNRITEM)WinSendMsg(hwndCnr,
     1505                             CM_QUERYRECORD,
     1506                             MPVOID,
     1507                             MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
    15021508  while (pci && (INT)pci != -1) {
    1503     if ((ULONG) (toupper(*pci->pszFileName) - '@') == ulCurDriveNum) {
     1509    if ((ULONG)(toupper(*pci->pszFileName) - '@') == ulCurDriveNum) {
    15041510      WinSendMsg(hwndCnr,
    15051511                 CM_SETRECORDEMPHASIS,
     
    15071513      break;
    15081514    }
    1509     pci = (PCNRITEM) WinSendMsg(hwndCnr,
    1510                                 CM_QUERYRECORD,
    1511                                 MPFROMP(pci),
    1512                                 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
     1515    pci = (PCNRITEM)WinSendMsg(hwndCnr,
     1516                               CM_QUERYRECORD,
     1517                               MPFROMP(pci),
     1518                               MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
    15131519  }
    15141520
     
    15281534      memset(&ri, 0, sizeof(RECORDINSERT));
    15291535      ri.cb = sizeof(RECORDINSERT);
    1530       ri.pRecordOrder = (PRECORDCORE) CMA_END;
    1531       ri.pRecordParent = (PRECORDCORE) NULL;
    1532       ri.zOrder = (ULONG) CMA_TOP;
     1536      ri.pRecordOrder = (PRECORDCORE)CMA_END;
     1537      ri.pRecordParent = (PRECORDCORE)NULL;
     1538      ri.zOrder = (ULONG)CMA_TOP;
    15331539      ri.cRecordsInsert = 1;
    15341540      ri.fInvalidateRecord = FALSE;
     
    15651571              memset(&ri, 0, sizeof(RECORDINSERT));
    15661572              ri.cb = sizeof(RECORDINSERT);
    1567               ri.pRecordOrder = (PRECORDCORE) CMA_END;
    1568               ri.pRecordParent = (PRECORDCORE) pciParent;
    1569               ri.zOrder = (ULONG) CMA_TOP;
     1573              ri.pRecordOrder = (PRECORDCORE)CMA_END;
     1574              ri.pRecordParent = (PRECORDCORE)pciParent;
     1575              ri.zOrder = (ULONG)CMA_TOP;
    15701576              ri.cRecordsInsert = 1;
    15711577              ri.fInvalidateRecord = FALSE;
     
    15911597
    15921598  // Run Stubby on each hard drive to ensure expand/collapse buttons correct
    1593   pci = (PCNRITEM) WinSendMsg(hwndCnr,
    1594                               CM_QUERYRECORD,
    1595                               MPVOID,
    1596                               MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
     1599  pci = (PCNRITEM)WinSendMsg(hwndCnr,
     1600                             CM_QUERYRECORD,
     1601                             MPVOID,
     1602                             MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
    15971603  while (pci && (INT)pci != -1) {
    1598     pciNext = (PCNRITEM) WinSendMsg(hwndCnr,
    1599                                     CM_QUERYRECORD,
    1600                                     MPFROMP(pci),
    1601                                     MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
     1604    pciNext = (PCNRITEM)WinSendMsg(hwndCnr,
     1605                                   CM_QUERYRECORD,
     1606                                   MPFROMP(pci),
     1607                                   MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
    16021608    if (~pci->flags & RECFLAGS_ENV) {
    16031609      iDrvNum = toupper(*pci->pszFileName) - 'A';       // 0..25
     
    16271633
    16281634  // Fill in environment CNRITEMs, if any
    1629   pci = (PCNRITEM) WinSendMsg(hwndCnr,
    1630                               CM_QUERYRECORD,
    1631                               MPVOID,
    1632                               MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
     1635  pci = (PCNRITEM)WinSendMsg(hwndCnr,
     1636                             CM_QUERYRECORD,
     1637                             MPVOID,
     1638                             MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
    16331639  while (pci && (INT)pci != -1) {
    1634     pciNext = (PCNRITEM) WinSendMsg(hwndCnr,
    1635                                     CM_QUERYRECORD,
    1636                                     MPFROMP(pci),
    1637                                     MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
     1640    pciNext = (PCNRITEM)WinSendMsg(hwndCnr,
     1641                                   CM_QUERYRECORD,
     1642                                   MPFROMP(pci),
     1643                                   MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
    16381644    if (pci->flags & RECFLAGS_ENV) {
    16391645      pci = (PCNRITEM) WinSendMsg(hwndCnr,
     
    16451651        if (pci->flags & RECFLAGS_ENV)
    16461652          AddFleshWorkRequest(hwndCnr, pci, eFleshEnv);
    1647         pci = (PCNRITEM) WinSendMsg(hwndCnr,
    1648                                     CM_QUERYRECORD,
    1649                                     MPFROMP(pci),
    1650                                     MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
     1653        pci = (PCNRITEM)WinSendMsg(hwndCnr,
     1654                                   CM_QUERYRECORD,
     1655                                   MPFROMP(pci),
     1656                                   MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
    16511657      }
    16521658      break;
    16531659    }
    1654     pci = (PCNRITEM) WinSendMsg(hwndCnr,
    1655                                 CM_QUERYRECORD,
    1656                                 MPFROMP(pci),
    1657                                 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
     1660    pci = (PCNRITEM)WinSendMsg(hwndCnr,
     1661                               CM_QUERYRECORD,
     1662                               MPFROMP(pci),
     1663                               MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
    16581664  } // while pci
    16591665
     
    17631769
    17641770  // Remove field info descriptors
    1765   pfi = (PFIELDINFO) WinSendMsg(hwnd, CM_QUERYDETAILFIELDINFO, MPVOID,
    1766                                 MPFROMSHORT(CMA_FIRST));
     1771  pfi = (PFIELDINFO)WinSendMsg(hwnd,
     1772                               CM_QUERYDETAILFIELDINFO,
     1773                               MPVOID,
     1774                               MPFROMSHORT(CMA_FIRST));
    17671775  if (pfi &&
    17681776      (INT)WinSendMsg(hwnd, CM_REMOVEDETAILFIELDINFO, MPVOID,
     
    19551963  InitITimer(&itdSleep, 500);
    19561964  for (usCount = 0; pci; usCount++) {
    1957     pciNext = (PCNRITEM) pci->rc.preccNextRecord;
     1965    pciNext = (PCNRITEM)pci->rc.preccNextRecord;
    19581966    FreeCnrItemData(pci);
    19591967    pci = pciNext;
    19601968    if (!IdleIfNeeded(&itdSleep, 30)) {
    19611969      for (usCount = usCount + 1; pci; usCount++) {
    1962         pciNext = (PCNRITEM) pci->rc.preccNextRecord;
     1970        pciNext = (PCNRITEM)pci->rc.preccNextRecord;
    19631971        FreeCnrItemData(pci);
    19641972        pci = pciNext;
     
    19781986/**
    19791987 * Remove item(s) from container and free associated storage if requested
    1980  * @param pciFirst points to first item to remove or NULL to remove all
     1988 * @param pciFirst points to specific item to remove or NULL to remove all
    19811989 * @param usCnt is 0 to remove all or 1 to remove specific record
    19821990 * @param usFlags for CM_REMOVERECORD
     
    19972005    remaining = -1;
    19982006  }
    1999   else if (!usFlags & CMA_FREE) {
     2007  if (!usFlags & CMA_FREE) {
    20002008    Runtime_Error(pszSrcFile, __LINE__, "usFlags must have CMA_FREE set");
    20012009    remaining = -1;
    20022010  }
    2003   else if (!pciFirst) {
     2011  if (!pciFirst) {
    20042012    // Removing all - query first
    20052013    pciFirst = (PCNRITEM)WinSendMsg(hwnd, CM_QUERYRECORD, MPVOID,
     
    20212029  // 2020-01-28 SHL Rework to use CMA_NEXT - preccNextRecord method was never reliable
    20222030  pci = pciFirst;
    2023   while (pci && (INT)pci != -1) {
     2031  while (pci && (INT)pci != -1 && remaining > 0) {
    20242032    FreeCnrItemData(pci);
    2025     if (remaining && --remaining == 0)
    2026       break;                    // pci point to last CNRITEM to be deleted
     2033    if (--remaining == 0)
     2034      break;
    20272035    pci = WinSendMsg(hwnd, CM_QUERYRECORD, MPFROMP(pci),
    20282036                     MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
     
    20432051    remaining = (INT)WinSendMsg(hwnd, CM_REMOVERECORD, MPFROMP(&pciFirst), MPFROM2SHORT(usCnt, usFlags));
    20442052    if (remaining == -1)
    2045       Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_REMOVERECORD hwnd %x pci %p cnt %u", hwnd, pciFirst, usCnt);
     2053      Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_REMOVERECORD hwnd %x pciFirst %p cnt %u", hwnd, pciFirst, usCnt);
    20462054    else if (usCnt == 0 && remaining != 0)
    20472055      Runtime_Error(pszSrcFile, __LINE__, "%u records remain after CM_REMOVERECORD", remaining);
Note: See TracChangeset for help on using the changeset viewer.