Changeset 774 for trunk/dll/dirsize.c


Ignore:
Timestamp:
Aug 11, 2007, 11:04:35 PM (18 years ago)
Author:
Gregg Young
Message:

Allocate memory to allow use of FilesToGet to speed loading

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/dirsize.c

    r771 r774  
    2525  22 Mar 07 GKY Use QWL_USER
    2626  23 Jul 07 SHL Sync with naming standards
     27  03 Aug 07 GKY Enlarged and made setable everywhere Findbuf (speed file loading)
    2728  03 Aug 07 SHL DirSizeProc; correct sizing and positioning to be deterministic
     29  06 Aug 07 GKY Reduce DosSleep times (ticket 148)
     30
    2831
    2932***********************************************************************/
     
    205208  }
    206209  hdir = HDIR_CREATE;
    207   nm = 1;
     210  nm = FilesToGet;
     211  pffb =
     212    xrealloc(pffb, (nm + 1) * sizeof(FILEFINDBUF4), pszSrcFile, __LINE__);
    208213  rc = DosFindFirst(maskstr, &hdir,
    209214                    FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED |
    210215                    FILE_SYSTEM | FILE_HIDDEN | FILE_DIRECTORY,
    211                     pffb, sizeof(FILEFINDBUF4), &nm, FIL_QUERYEASIZE);
     216                    pffb, (nm + 1) * sizeof(FILEFINDBUF4), &nm, FIL_QUERYEASIZE);
    212217  if (!rc) {
    213218    register PBYTE fb = (PBYTE) pffb;
    214219    FILEFINDBUF4 *pffbFile;
    215220    ULONG x;
     221    UINT y = 1;
    216222
    217223    while (!rc) {
     
    250256        break;
    251257      DosSleep(1);
    252       nm = 1;                           /* FilesToGet */
    253       rc = DosFindNext(hdir, pffb, sizeof(FILEFINDBUF4), &nm);
     258      nm = FilesToGet;                          /* FilesToGet */
     259      y++;
     260      pffb = xrealloc(pffb, y * (nm + 1) * sizeof(FILEFINDBUF4), pszSrcFile, __LINE__);
     261      DosError(FERR_DISABLEHARDERR);
     262      rc = DosFindNext(hdir, pffb, (nm + 1) * sizeof(FILEFINDBUF4), &nm);
    254263    }                                   // while more found
    255264    DosFindClose(hdir);
Note: See TracChangeset for help on using the changeset viewer.