Changeset 90


Ignore:
Timestamp:
May 21, 2004, 5:15:19 PM (21 years ago)
Author:
root
Message:

ProcessDirectory: avoid most large drive failures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/dll/filldir.c

    r70 r90  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2003 Steven H.Levine
     9  Copyright (c) 2001, 2004 Steven H.Levine
    1010
    1111  Revisions     12 Sep 02 SHL - Rework symbols to understand code
    1212                08 Feb 03 SHL - DropHelp: calc EA size consistently
    1313                11 Jun 03 SHL - Add JFS and FAT32 support
     14                10 Jan 04 SHL - ProcessDirectory: avoid most large drive failures
    1415
    1516***********************************************************************/
     
    3334
    3435
    35 HPOINTER IDFile (ULONG cmp) {
    36 
     36HPOINTER IDFile (ULONG cmp)
     37{
    3738  HPOINTER hptr;
    3839
     
    523524  PFILEFINDBUF4  paffbFound,*papffbSelected,pffbFile,paffbTotal = NULL,paffbTemp;
    524525  HDIR           hdir = HDIR_CREATE;
    525   ULONG          ulMaxFiles,ulExtraBytes,ulM = 1L,ulTotal = 0L;
    526   LONG           numbytes,totalbytes,returnbytes = 0L;
     526  ULONG          ulMaxFiles,ulExtraBytes,ulM = 1,ulTotal = 0L;
     527  ULONG          numbytes,totalbytes,returnbytes = 0L;
    527528  PCH            pchEndPath;
    528529  APIRET         rc;
     
    539540//      ulExtraBytes = EXTRA_RECORD_BYTES2;
    540541    if((driveflags[toupper(*szDirBase) - 'A'] & DRIVE_REMOTE) && fRemoteBug)
    541       ulM = 1L;                         /* file system gets confused */
     542      ulM = 1;                          /* file system gets confused */
    542543    else if(driveflags[toupper(*szDirBase) - 'A'] & DRIVE_ZIPSTREAM)
    543544      ulM = min(FilesToGet,225);        /* anything more is wasted */
     
    554555  ulMaxFiles = ulM;
    555556  pszFileSpec = malloc(CCHMAXPATH + 2);
    556   paffbFound = malloc((ulM + 1L) * sizeof(FILEFINDBUF4));
    557   papffbSelected = malloc((ulM + 1L) * sizeof(PFILEFINDBUF4));
     557  paffbFound = malloc((ulM + 1) * sizeof(FILEFINDBUF4));
     558  papffbSelected = malloc((ulM + 1) * sizeof(PFILEFINDBUF4));
    558559  if(paffbFound && papffbSelected && pszFileSpec) {
    559560    t = strlen(szDirBase);
     
    624625                  numbytes = FillInRecordFromFFB(hwndCnr,pci,pszFileSpec,
    625626                                                 pffbFile,partial,dcd);
    626                   if(numbytes > -1L) {
     627                  if(numbytes != -1) {
    627628                    pci = (PCNRITEM)pci->rc.preccNextRecord;
    628629                    totalbytes += numbytes;
     630                    if (totalbytes == -1)
     631                      totalbytes--;             // fixme for real someday
     632
    629633                  }
    630634                  else {
     
    649653                                 CM_INSERTRECORD,
    650654                                 MPFROMP(pciFirst),
    651                                  MPFROMP(&ri))) {
     655                                 MPFROMP(&ri)))
     656                  {
    652657                    DosSleep(100L);
    653658                    WinSetFocus(HWND_DESKTOP,hwndCnr);
     
    673678                                    __LINE__,
    674679                                    GetPString(IDS_FILLDIRERR2TEXT));
    675                       totalbytes = -1L;
     680                      totalbytes = -1;
    676681                      if(WinIsWindow((HAB)0,hwndCnr)) {
    677682                        pci = pciFirst;
     
    695700                              __LINE__,
    696701                              GetPString(IDS_FILLDIRERR3TEXT));
    697                 totalbytes = -1L;
     702                totalbytes = -1;
    698703              }
    699               if(totalbytes > -1L) {
     704              if(totalbytes != -1) {
    700705                returnbytes += totalbytes;
     706                if (returnbytes == -1)
     707                  returnbytes--;        // fixme for real someday
    701708                if(foundany)
    702709                  (*foundany) += ulMaxFiles;
     
    760767            numbytes = FillInRecordFromFFB(hwndCnr,pci,pszFileSpec,
    761768                                           pffbFile,partial,dcd);
    762             if(numbytes > -1L) {
     769            if (numbytes != -1) {
    763770              pci = (PCNRITEM)pci->rc.preccNextRecord;
    764771              totalbytes += numbytes;
     772              if (totalbytes == -1)
     773                totalbytes--;           // fixme for real someday
    765774            }
    766775            else {
     
    790799              WinSetFocus(HWND_DESKTOP,hwndCnr);
    791800              if(!WinSendMsg(hwndCnr,CM_INSERTRECORD,
    792                              MPFROMP(pciFirst),MPFROMP(&ri))) {
    793 
     801                             MPFROMP(pciFirst),MPFROMP(&ri)))
     802              {
    794803                { // SHL
    795804                  CHAR sz[80];
     
    808817                              __LINE__,
    809818                              GetPString(IDS_FILLDIRERR5TEXT));
    810                 totalbytes = -1L;
     819                totalbytes = -1;
    811820                if(WinIsWindow((HAB)0,hwndCnr)) {
    812821                  pci = pciFirst;
     
    828837                        __LINE__,
    829838                        GetPString(IDS_FILLDIRERR3TEXT));
    830           totalbytes = -1L;
    831         }
    832         if(totalbytes > -1L) {
     839          totalbytes = -1;
     840        }
     841        if(totalbytes != -1) {
    833842          returnbytes += totalbytes;
     843          if (returnbytes == -1)
     844            returnbytes--;              // fixme for real someday
    834845          if(foundany)
    835846            (*foundany) += ulMaxFiles;
     
    868879
    869880
    870 ULONG FillDirCnr (HWND hwndCnr,CHAR *directory,DIRCNRDATA *dcd) {
    871 
     881ULONG FillDirCnr (HWND hwndCnr,CHAR *directory,DIRCNRDATA *dcd)
     882{
    872883  ULONG ret;
    873884
     
    879890
    880891
    881 ULONG FillTreeCnr (HWND hwndCnr,HWND hwndParent) {
    882 
     892ULONG FillTreeCnr (HWND hwndCnr,HWND hwndParent)
     893{
    883894  ULONG       ulDriveNum,ulDriveMap,numtoinsert = 0L,drvtype;
    884895  PCNRITEM    pci,pciFirst = NULL,pciNext,pciParent = NULL;
     
    14221433  }
    14231434  didonce = TRUE;
    1424   return 0L;
     1435  return 0;
    14251436}
    14261437
Note: See TracChangeset for help on using the changeset viewer.