Changeset 1759


Ignore:
Timestamp:
Mar 20, 2014, 3:47:49 AM (12 years ago)
Author:
Steven Levine
Message:

RemoveCnrItems: clean up odd code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/filldir.c

    r1756 r1759  
    9696  31 May 11 SHL Disable antique debug code in RemoveCnrItems - really speeds up container close
    9797  12 Jun 11 GKY Added IdleIfNeeded to the container "free" loops to improve system
    98                 responsiveness when closing containers with large numbers of items
     98                responsiveness when closing containers with large numbers of items
    9999  12 Jun 11 GKY Replaced SleepIfNeeded with IdleIfNeeded in the container loade loop
    100100  22 Oct 11 GKY Removing unneeded UnFlesh call from StubbyScanThread appears to significantly speed opening of FM/2
    101101  02 Mar 14 GKY !didone for fFirstTime so the suggest code works again. Also clear out the
    102                 garbage that was appearing in the string.
     102                garbage that was appearing in the string.
    103103  02 Mar 14 GKY Speed up intial drive scans Ticket 528
     104  19 Mar 14 SHL RemoveCnrItems: clean up odd code
    104105
    105106***********************************************************************/
     
    259260                           (fRScanSlow ? 0 : DRIVE_SLOW)))) {
    260261              Flesh(StubbyScan->hwndCnr, StubbyScan->pci);
    261             }
    262             else {
    263               Stubby(StubbyScan->hwndCnr, StubbyScan->pci);
    264             }
     262            }
     263            else {
     264              Stubby(StubbyScan->hwndCnr, StubbyScan->pci);
     265            }
    265266          }
    266267          else {
     
    283284       // Keep drive tree in sync with directory container
    284285      if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszFocusDir), MPVOID))
    285         free(pszFocusDir);
     286        free(pszFocusDir);
    286287    }
    287288    ProcessDirCount = 0;
     
    325326             cmp == *(ULONG *) ".TAR" || cmp == *(ULONG *) ".TGZ" ||
    326327             cmp == *(ULONG *) ".GZ"  || cmp == *(ULONG *) ".Z"   ||
    327              cmp == *(ULONG *) ".CAB" || cmp == *(ULONG *) ".BZ2" ||
    328              cmp == *(ULONG *) ".WPI" || cmp == *(ULONG *) ".7Z")
     328             cmp == *(ULONG *) ".CAB" || cmp == *(ULONG *) ".BZ2" ||
     329             cmp == *(ULONG *) ".WPI" || cmp == *(ULONG *) ".7Z")
    329330      hptr = hptrArc;
    330331    else if (cmp == *(ULONG *) PCSZ_DOTBMP  ||
     
    10871088          goto Abort;
    10881089
    1089         InitITimer(&itdSleep, 500);
     1090        InitITimer(&itdSleep, 500);
    10901091        pci = NULL;
    10911092        ullTotalBytes = 0;
     
    11271128          pffbFile = (PFILEFINDBUF4L)((PBYTE)pffbFile + sizeof(FILEFINDBUF4L));
    11281129
    1129           if (!IdleIfNeeded(&itdSleep, 30)) {
    1130             for (x = x+1; x < cAffbTotal; x++) {
    1131               ullBytes = FillInRecordFromFFB(hwndCnr, pci, pszFileSpec,
    1132                                           pffbFile, partial, dcd);
    1133               pci = (PCNRITEM) pci->rc.preccNextRecord;
    1134               ullTotalBytes += ullBytes;
    1135               if (dcd) {
    1136                 dcd->totalfiles = x;
    1137                 dcd->ullTotalBytes = ullTotalBytes;
    1138               }
    1139               pffbFile = (PFILEFINDBUF4L)((PBYTE)pffbFile + sizeof(FILEFINDBUF4L));
    1140               if (pci == NULL) {
    1141                 priority_normal();
    1142                 InitITimer(&itdSleep, 500);
    1143                 break;
    1144               }
    1145             }
    1146           }
     1130          if (!IdleIfNeeded(&itdSleep, 30)) {
     1131            for (x = x+1; x < cAffbTotal; x++) {
     1132              ullBytes = FillInRecordFromFFB(hwndCnr, pci, pszFileSpec,
     1133                                          pffbFile, partial, dcd);
     1134              pci = (PCNRITEM) pci->rc.preccNextRecord;
     1135              ullTotalBytes += ullBytes;
     1136              if (dcd) {
     1137                dcd->totalfiles = x;
     1138                dcd->ullTotalBytes = ullTotalBytes;
     1139              }
     1140              pffbFile = (PFILEFINDBUF4L)((PBYTE)pffbFile + sizeof(FILEFINDBUF4L));
     1141              if (pci == NULL) {
     1142                priority_normal();
     1143                InitITimer(&itdSleep, 500);
     1144                break;
     1145              }
     1146            }
     1147          }
    11471148
    11481149          if (pci == NULL && ulRecsToInsert) {
     
    11741175          }
    11751176          //SleepIfNeeded(&itdSleep, 1);
    1176         }
    1177         priority_normal();
     1177        }
     1178        priority_normal();
    11781179        if (ok) {
    11791180          ullReturnBytes += ullTotalBytes;
     
    16491650          ULONG flags = driveflags[iDrvNum];    // Speed up
    16501651          if (~flags & DRIVE_INVALID &&
    1651               ~flags & DRIVE_NOPRESCAN && (!fNoRemovableScan || ~flags & DRIVE_REMOVABLE)) {
    1652             // DbgMsg(pszSrcFile, __LINE__, "Begin Thread %s", pci->pszFileName);
    1653             if (xbeginthread(StubbyScanThread,
     1652              ~flags & DRIVE_NOPRESCAN && (!fNoRemovableScan || ~flags & DRIVE_REMOVABLE)) {
     1653            // DbgMsg(pszSrcFile, __LINE__, "Begin Thread %s", pci->pszFileName);
     1654            if (xbeginthread(StubbyScanThread,
    16541655                             65536,
    16551656                             stubbyScan,
    16561657                             pszSrcFile, __LINE__) == -1)
    1657               xfree(stubbyScan, pszSrcFile, __LINE__);
     1658              xfree(stubbyScan, pszSrcFile, __LINE__);
    16581659
    16591660          } // if drive needs to be scanned
     
    17401741      strcat(szSuggest, " %*");
    17411742      rc = saymsg(MB_YESNOCANCEL | MB_ICONEXCLAMATION,
    1742                   hwndParent ? hwndParent : hwndCnr,
    1743                   GetPString(IDS_SUGGESTTITLETEXT),
    1744                   GetPString(IDS_SUGGEST1TEXT),
    1745                   (includesyours) ? GetPString(IDS_SUGGEST2TEXT) : NullStr,
    1746                   szSuggest);
     1743                  hwndParent ? hwndParent : hwndCnr,
     1744                  GetPString(IDS_SUGGESTTITLETEXT),
     1745                  GetPString(IDS_SUGGEST1TEXT),
     1746                  (includesyours) ? GetPString(IDS_SUGGEST2TEXT) : NullStr,
     1747                  szSuggest);
    17471748      if (rc == MBID_YES) {
    17481749        HOBJECT hFM2Object;
     
    19651966    if (!IdleIfNeeded(&itdSleep, 30)) {
    19661967      for (usCount = usCount + 1; pci; usCount++) {
    1967         pciNext = (PCNRITEM) pci->rc.preccNextRecord;
    1968         FreeCnrItemData(pci);
    1969         pci = pciNext;
     1968        pciNext = (PCNRITEM) pci->rc.preccNextRecord;
     1969        FreeCnrItemData(pci);
     1970        pci = pciNext;
    19701971      }
    19711972      break;
     
    19931994  PCNRITEM pci;
    19941995  ITIMER_DESC itdSleep = { 0 };         // 30 May 11 GKY
    1995 
    19961996
    19971997  if ((usCnt && !pciFirst) || (!usCnt && pciFirst)) {
     
    20152015      InitITimer(&itdSleep, 500);
    20162016      while (pci) {
    2017 #if 0 // 12 Sep 07 SHL dwg drivebar crash testing - ticket# ??? - fixme to be gone
    2018         static PCNRITEM pciLast;        // 12 Sep 07 SHL
    2019         ULONG ulSize = sizeof(*pci);
    2020         ULONG ulAttr;
    2021         APIRET apiret = DosQueryMem((PVOID)pci, &ulSize, &ulAttr);
    2022         if (apiret)
    2023           Dos_Error(MB_ENTER, apiret, HWND_DESKTOP, pszSrcFile, __LINE__,
    2024                     "DosQueryMem failed pci %p pciLast %p", pci, pciLast);
    2025 #endif
    20262017        FreeCnrItemData(pci);
    2027 #if 0 // 12 Sep 07 SHL dwg drivebar crash testing - ticket# ??? - fixme to be gone
    2028         pciLast = pci;
    2029 #endif
    20302018        pci = (PCNRITEM)pci->rc.preccNextRecord;
     2019        if (!pci)
     2020          break;
    20312021        if (remaining && --remaining == 0)
    20322022          break;
    2033         if (!IdleIfNeeded(&itdSleep, 30)) {
    2034           while (pci) {
    2035             FreeCnrItemData(pci);
    2036             pci = (PCNRITEM)pci->rc.preccNextRecord;
    2037             if (remaining && --remaining == 0)
    2038               break;
    2039           }
    2040         }
    2041       }
     2023        IdleIfNeeded(&itdSleep, 30);
     2024      } // while
    20422025      priority_normal();
    20432026      DosPostEventSem(CompactSem);
Note: See TracChangeset for help on using the changeset viewer.