Changeset 426 for trunk/dll/arccnrs.c


Ignore:
Timestamp:
Aug 3, 2006, 4:01:23 AM (19 years ago)
Author:
root
Message:

Add logic to stop processing large archives

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/arccnrs.c

    r423 r426  
    2828  29 Jul 06 SHL Use xfgets_bstripcr
    2929  31 Jul 06 SHL Lower priority for archives with more than 1000 entries
     30  02 Aug 06 SHL Add logic to stop processing large archives
    3031
    3132***********************************************************************/
     
    296297
    297298static INT FillArcCnr(HWND hwndCnr,CHAR *arcname,ARC_TYPE **arcinfo,
    298                       ULONGLONG *pullTotalBytes)
     299                      ULONGLONG *pullTotalBytes, volatile PCHAR pStopFlag)
    299300{
    300301  FILE         *fp;
     
    433434      gotstart = !info->startlist || !*info->startlist; // If list has no start marker
    434435
    435       while(!feof(fp) && !gotend) {
     436      while(!feof(fp) && !gotend && !*pStopFlag) {
    436437        if (!xfgets_bstripcr(s,sizeof(s),fp,pszSrcFile,__LINE__))
    437438          break;
     
    615616                lastpai = pai;
    616617              }
    617               // Avoid hogging system if large archive
    618               if (numarcfiles == 1000)
    619                   priority_idle();
     618              // Avoid hogging system for large archive
     619              if (numarcfiles == 100)
     620                priority_idle();
    620621            }
    621622          }
     
    625626      fclose(fp);
    626627
    627       if (!numarcfiles || !gotstart || (!gotend && info->endlist && *info->endlist))
     628      if (*pStopFlag)
     629        numarcfiles = 0;                // Request close
     630      else if (!numarcfiles || !gotstart || (!gotend && info->endlist && *info->endlist))
    628631      {
    629632        // Oops
     
    675678      }
    676679    } // if opened
     680
    677681    DosError(FERR_DISABLEHARDERR);
    678682    DosForceDelete(arctemp);
    679683  }
    680684
    681   if (numarcfiles >= 500)
     685  if (numarcfiles)
    682686    priority_normal();
    683687
     
    13371341                                     dcd->arcname,
    13381342                                     &dcd->info,
    1339                                      &dcd->ullTotalBytes);
     1343                                     &dcd->ullTotalBytes,
     1344                                     &dcd->stopflag);
    13401345        if (!dcd->totalfiles)
    13411346          PostMsg(dcd->hwndCnr,WM_CLOSE,MPVOID,MPVOID);
     
    27192724                                         dcd->arcname,
    27202725                                         &dcd->info,
    2721                                          &dcd->ullTotalBytes);
     2726                                         &dcd->ullTotalBytes,
     2727                                         &dcd->stopflag);
    27222728            PostMsg(dcd->hwndCnr,UM_RESCAN,MPVOID,MPVOID);
    27232729            PostMsg(dcd->hwndCnr,UM_SETUP2,MPVOID,MPVOID);
Note: See TracChangeset for help on using the changeset viewer.