Changeset 51


Ignore:
Timestamp:
Feb 12, 2003, 9:22:14 PM (23 years ago)
Author:
root
Message:

Standardize EA match

Location:
trunk/dll
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/autoview.c

    r41 r51  
    1111  Revisions     12 Sep 02 SHL - AutoObjProc: catch buff2 overflows
    1212                25 Oct 02 SHL - CreateHexDump: catch buffer overflow
     13                12 Feb 03 SHL - AutoObjProc: standardize EA math
    1314
    1415***********************************************************************/
     
    269270
    270271
    271 MRESULT EXPENTRY AutoObjProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
     272MRESULT EXPENTRY AutoObjProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)
     273{
    272274
    273275  switch(msg) {
     
    471473                              pffbFile->achName,
    472474                              pffbFile->cbFile +
    473                                ((pffbFile->cbList > 4) ?
    474                                 pffbFile->cbList / 2 :
    475                                 0),
     475                               CBLIST_TO_EASIZE(pffbFile->cbList),
    476476                              ((pffbFile->attrFile & FILE_READONLY) != 0) ?
    477477                               "R" : "-",
  • trunk/dll/dirsize.c

    r36 r51  
    1010
    1111  Revisions     16 Oct 02 SHL - Handle large partitions
     12                12 Feb 03 SHL - Use CBLIST_TO_EASIZE
    1213
    1314***********************************************************************/
     
    5758
    5859static ULONG ProcessDir (HWND hwndCnr,CHAR *filename,PCNRITEM pciParent,
    59                          CHAR *stopflag,BOOL top) {
    60 
     60                         CHAR *stopflag,BOOL top)
     61{
    6162  CHAR           maskstr[CCHMAXPATH],*endpath;
    6263  register char *p,*sp,*pp;
     
    107108    }
    108109    if(!rc)
    109       totalbytes = ffb->cbFile + (ffb->cbList > 4L) ? (ffb->cbList / 2) : 0L;
     110      totalbytes = ffb->cbFile + CBLIST_TO_EASIZE(ffb->cbList);
    110111    else
    111112      DosError(FERR_DISABLEHARDERR);
     
    190191           pffbFile->achName[1] != '.')) ||
    191192           !(pffbFile->attrFile & FILE_DIRECTORY)) {
    192             totalbytes += (pffbFile->cbFile +
    193                           ((pffbFile->cbList > 4L) ?
    194                             (pffbFile->cbList / 2) : 0L));
     193            totalbytes += pffbFile->cbFile +
     194                          CBLIST_TO_EASIZE(pffbFile->cbList);
    195195          if(!(pffbFile->attrFile & FILE_DIRECTORY))
    196196            pciP->attrFile++;
  • trunk/dll/droplist.c

    r2 r51  
     1
     2/***********************************************************************
     3
     4  $Id$
     5
     6  Fill Directory Tree Containers
     7
     8  Copyright (c) 1993-98 M. Kimes
     9  Copyright (c) 2003 Steven H.Levine
     10
     11  Revisions     22 Nov 02 SHL - Baseline
     12                08 Feb 03 SHL - DropHelp: calc EA size consistently
     13
     14***********************************************************************/
     15
     16
    117#define INCL_DOS
    218#define INCL_WIN
     
    246262  if(Operation == DO_MOVE &&
    247263     !(pDItem->fsSupportedOps & DO_MOVEABLE)) {
     264    saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"forcing DO_COPY");       // SHL
    248265    DosBeep(50,100);
    249266    Operation = DO_COPY;
     
    375392                             &fsa4,
    376393                             sizeof(fsa4)))
    377           cbFile[numfiles] = fsa4.cbFile + ((fsa4.cbList > 4L) ?
    378                                             fsa4.cbList : 0L);
     394          cbFile[numfiles] = fsa4.cbFile + CBLIST_TO_EASIZE(fsa4.cbList);
    379395      }
    380396      ulitemID[numfiles] = pDItem->ulItemID;
  • trunk/dll/filldir.c

    r42 r51  
    1010
    1111  Revisions     12 Sep 02 SHL - Rework symbols to understand code
     12                08 Feb 03 SHL - DropHelp: calc EA size consistently
    1213
    1314***********************************************************************/
     
    8283  }
    8384  /* load the object's Subject, if required */
    84   if(pffb->cbList > 4L && dcd && fLoadSubject &&
     85  if(pffb->cbList > 4L &&
     86     dcd && fLoadSubject &&
    8587     (isalpha(*pci->szFileName) &&
    8688      !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADSUBJS))) {
     
    127129  /* load the object's longname */
    128130  *pci->Longname = 0;
    129   if(pffb->cbList > 4L && dcd && fLoadLongnames &&
     131  if(pffb->cbList > 4L &&
     132     dcd && fLoadLongnames &&
    130133     (isalpha(*pci->szFileName) &&
    131134      (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLONGNAMES) &&
     
    250253  pci->crtime.minutes = pffb->ftimeCreation.minutes;
    251254  pci->crtime.hours   = pffb->ftimeCreation.hours;
    252   pci->easize         = (pffb->cbList > 4L) ? (pffb->cbList / 2) : 0L;
     255  pci->easize         = CBLIST_TO_EASIZE(pffb->cbList);
    253256  pci->cbFile         = pffb->cbFile;
    254257  pci->attrFile       = pffb->attrFile;
     
    305308  strcpy(pci->szFileName,pszFileName);
    306309  /* load the object's Subject, if required */
    307   if(pfsa4->cbList > 4L && dcd && fLoadSubject &&
     310  if(pfsa4->cbList > 4L &&
     311     dcd && fLoadSubject &&
    308312     (!isalpha(*pci->szFileName) ||
    309313      !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADSUBJS))) {
     
    350354  pci->pszSubject = pci->subject;
    351355  *pci->Longname = 0;
    352   if(pfsa4->cbList > 4L && dcd && fLoadLongnames &&
     356  if(pfsa4->cbList > 4L &&
     357     dcd && fLoadLongnames &&
    353358     (!isalpha(*pci->szFileName) ||
    354359      ((driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLONGNAMES) &&
    355       !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADLONGS)))) {
    356 
     360      !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADLONGS))))
     361  {
    357362    APIRET    rc;
    358363    EAOP2     eaop;
     
    466471  pci->crtime.minutes = pfsa4->ftimeCreation.minutes;
    467472  pci->crtime.hours   = pfsa4->ftimeCreation.hours;
    468   pci->easize         = (pfsa4->cbList > 4L) ? (pfsa4->cbList / 2) : 0L;
     473  pci->easize         = CBLIST_TO_EASIZE(pfsa4->cbList);
    469474  pci->cbFile         = pfsa4->cbFile;
    470475  pci->attrFile       = pfsa4->attrFile;
  • trunk/dll/grep.c

    r2 r51  
     1
     2/***********************************************************************
     3
     4  $Id$
     5
     6  Info window
     7
     8  Copyright (c) 1993-98 M. Kimes
     9  Copyright (c) 2001, 2002 Steven H.Levine
     10
     11  Revisions     12 Feb 03 SHL - insert_grepfile: standardize EA math
     12                12 Feb 03 SHL - doonefile: standardize EA math
     13
     14***********************************************************************/
     15
    116#define INCL_DOS
    217#define INCL_WIN
     
    3853
    3954
    40 ULONG SecsSince1980 (FDATE *date,FTIME *time) {
    41 
     55ULONG SecsSince1980 (FDATE *date,FTIME *time)
     56{
    4257  ULONG        total = 0L;
    4358  register int x;
     
    208223
    209224
    210 VOID dogrep (VOID *arg) {
    211 
     225VOID dogrep (VOID *arg)
     226{
    212227  HAB           ghab;
    213228  HMQ           ghmq;
     
    360375
    361376
    362 static BOOL IsExcluded (char *name,char **fle,int numfls) {
    363 
     377static BOOL IsExcluded (char *name,char **fle,int numfls)
     378{
    364379  register int x;
    365380  char        *n;
     
    439454
    440455
    441 static INT domatchingfiles (GREP *grep,CHAR *path,char **fle,int numfls) {
    442 
     456static INT domatchingfiles (GREP *grep,CHAR *path,char **fle,int numfls)
     457{
    443458  /* process all matching files in a directory */
    444459
     
    530545
    531546
    532 static VOID freegreplist (GREP *grep) {
    533 
     547static VOID freegreplist (GREP *grep)
     548{
    534549  register INT x;
    535550
     
    553568
    554569
    555 static BOOL doinsertion (GREP *grep) {
    556 
     570static BOOL doinsertion (GREP *grep)
     571{
    557572  RECORDINSERT ri;
    558573  DIRCNRDATA  *dcd;
     
    614629
    615630
    616 static BOOL insert_grepfile (GREP *grep,CHAR *filename,FILEFINDBUF4 *f) {
    617 
     631static BOOL insert_grepfile (GREP *grep,CHAR *filename,FILEFINDBUF4 *f)
     632{
    618633  CHAR        *p,szDirectory[CCHMAXPATH];
    619634
     
    649664        return FALSE;
    650665      }
    651       grep->insertedbytes += (f->cbFile + ((f->cbList > 4L) ? f->cbList : 0L));
     666      grep->insertedbytes += f->cbFile + CBLIST_TO_EASIZE(f->cbList);
    652667      grep->toinsert++;
    653668      if(grep->toinsert == grep->FilesToGet)
     
    662677
    663678
    664 static BOOL doonefile (GREP *grep,CHAR *filename,FILEFINDBUF4 *f) {
    665 
     679static BOOL doonefile (GREP *grep,CHAR *filename,FILEFINDBUF4 *f)
     680{
    666681  /* process a single file */
    667682
     
    681696    ULONG adjsize;
    682697
    683     adjsize = f->cbFile + ((grep->searchEAs) ?
    684                            ((f->cbList > 4L) ?
    685                             0L :
    686                             f->cbList) :
    687                            0L);
     698    adjsize = f->cbFile +
     699              (grep->searchEAs ? CBLIST_TO_EASIZE(f->cbList) : 0);
    688700    if(grep->greaterthan) {
    689701      if(adjsize < grep->greaterthan)
     
    964976
    965977
    966 LONG CRCBlock (register CHAR *str, register INT blklen, register LONG crc) {
    967 
     978LONG CRCBlock (register CHAR *str, register INT blklen, register LONG crc)
     979{
    968980  while (blklen--) {
    969981    crc = cr3tab[((INT) crc ^ *str) & 0xff] ^ ((crc >> 8) & 0x00FFFFFF);
     
    974986
    975987
    976 LONG CRCFile (CHAR *filename,INT *error) {
    977 
     988LONG CRCFile (CHAR *filename,INT *error)
     989{
    978990  LONG CRC = -1L,len;
    979991  FILE *fp;
     
    10061018
    10071019
    1008 static VOID FreeDupes (GREP *g) {
    1009 
     1020static VOID FreeDupes (GREP *g)
     1021{
    10101022  DUPES *i,*next;
    10111023
     
    10271039
    10281040
    1029 int comparenamesq (const void *v1,const void *v2) {
    1030 
     1041int comparenamesq (const void *v1,const void *v2)
     1042{
    10311043  DUPES *d1 = *(DUPES **)v1;
    10321044  DUPES *d2 = *(DUPES **)v2;
     
    10471059
    10481060
    1049 int comparenamesqe (const void *v1,const void *v2) {
    1050 
     1061int comparenamesqe (const void *v1,const void *v2)
     1062{
    10511063  DUPES *d1 = *(DUPES **)v1;
    10521064  DUPES *d2 = *(DUPES **)v2;
     
    10831095
    10841096
    1085 int comparesizesq (const void *v1,const void *v2) {
    1086 
     1097int comparesizesq (const void *v1,const void *v2)
     1098{
    10871099  DUPES *d1 = *(DUPES **)v1;
    10881100  DUPES *d2 = *(DUPES **)v2;
     
    10921104
    10931105
    1094 int comparenamesb (const void *v1,const void *v2) {
    1095 
     1106int comparenamesb (const void *v1,const void *v2)
     1107{
    10961108  DUPES *d1 = (DUPES *)v1;
    10971109  DUPES *d2 = *(DUPES **)v2;
     
    11121124
    11131125
    1114 int comparenamesbe (const void *v1,const void *v2) {
    1115 
     1126int comparenamesbe (const void *v1,const void *v2)
     1127{
    11161128  DUPES *d1 = (DUPES *)v1;
    11171129  DUPES *d2 = *(DUPES **)v2;
     
    11481160
    11491161
    1150 int comparesizesb (const void *v1,const void *v2) {
    1151 
     1162int comparesizesb (const void *v1,const void *v2)
     1163{
    11521164  DUPES *d1 = (DUPES *)v1;
    11531165  DUPES *d2 = *(DUPES **)v2;
     
    11571169
    11581170
    1159 static VOID FillDupes (GREP *g) {
    1160 
     1171static VOID FillDupes (GREP *g)
     1172{
    11611173  DUPES         *c,*i,**r;
    11621174  register CHAR *pc,*pi;
     
    14921504
    14931505
    1494 static BOOL InsertDupe (GREP *g,CHAR *dir,FILEFINDBUF4 *f) {
    1495 
     1506static BOOL InsertDupe (GREP *g,CHAR *dir,FILEFINDBUF4 *f)
     1507{
    14961508  DUPES *info;
    14971509
     
    15231535  return TRUE;
    15241536}
    1525 
  • trunk/dll/info.c

    r36 r51  
    1010
    1111  Revisions     16 Oct 02 SHL - Handle large partitions
     12                12 Feb 03 SHL - FileInfoProc: standardize EA math
    1213
    1314***********************************************************************/
     
    778779                              s);
    779780          }
    780           if(fs.cbList == 4L)   /* OS/2 artifact */
    781             fs.cbList = 0L;
    782781          sprintf(s,
    783782                  GetPString(IDS_SIZEINCLEASTEXT),
    784783                  fs.cbFile,
    785                   fs.cbList,
    786                   fs.cbFile + fs.cbList,
    787                   (fs.cbFile + fs.cbList) / 1024);
     784                  CBLIST_TO_EASIZE(fs.cbList),
     785                  fs.cbFile + CBLIST_TO_EASIZE(fs.cbList),
     786                  (fs.cbFile + CBLIST_TO_EASIZE(fs.cbList)) / 1024);
    788787          WinSetDlgItemText(hwnd,
    789788                            FLE_SIZES,
     
    873872                          TRUE);
    874873          }
    875           WinShowWindow(WinWindowFromID(hwnd,FLE_EAS),
    876                         (fs.cbList > 4));
     874          WinShowWindow(WinWindowFromID(hwnd,FLE_EAS), fs.cbList > 4);
    877875          if(!(fs.attrFile & FILE_DIRECTORY)) {
    878876            WinEnableWindow(WinWindowFromID(hwnd,FLE_READABLE),TRUE);
  • trunk/dll/makelist.c

    r2 r51  
     1
     2/***********************************************************************
     3
     4  $Id$
     5
     6  Make file lists
     7
     8  Copyright (c) 1993-98 M. Kimes
     9  Copyright (c) 2003 Steven H.Levine
     10
     11  Revisions     12 Feb 03 SHL - AddToFileList: standardize EA math
     12
     13***********************************************************************/
    114#define INCL_DOS
    215#define INCL_WIN
     
    8194
    8295INT AddToFileList (CHAR *string,FILEFINDBUF4 *ffb4,FILELIST ***list,
    83                    INT *numfiles,INT *numalloced) {
     96                   INT *numfiles,INT *numalloced)
     97{
    8498
    8599  FILELIST **test;
     
    104118    (*list)[*numfiles]->crtime = ffb4->ftimeCreation;
    105119    (*list)[*numfiles]->cbFile = ffb4->cbFile;
    106     (*list)[*numfiles]->easize = (ffb4->cbList > 4L) ? (ffb4->cbList / 2): 0L;
     120    (*list)[*numfiles]->easize = CBLIST_TO_EASIZE(ffb4->cbList);
    107121    strcpy((*list)[*numfiles]->fname,string);
    108122    (*numfiles)++;
  • trunk/dll/saveclip.c

    r2 r51  
     1
     2/***********************************************************************
     3
     4  $Id$
     5
     6  Save file list to clipboard
     7
     8  Copyright (c) 1993-98 M. Kimes
     9  Copyright (c) 2003 Steven H.Levine
     10
     11  Revisions     12 Feb 03 SHL - SaveListDlgProc: standardize EA math
     12
     13***********************************************************************/
     14
    115#define INCL_DOS
    216#define INCL_WIN
     
    180194#pragma alloc_text(SAVELIST,SaveListDlgProc,SaveAllListDlgProc)
    181195
    182 MRESULT EXPENTRY SaveListDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
    183 
     196MRESULT EXPENTRY SaveListDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)
     197{
    184198  HWND  hwndCnr;
    185199  CHAR  savename[CCHMAXPATH] = "",pattern[81];
     
    858872                                   FIL_QUERYEASIZE)) {
    859873                    /* load the object's Subject, if required */
    860                     if(ffb4.cbList > 4L) {
    861 
     874                    if(ffb4.cbList > 4L)
     875                    {
    862876                      APIRET    rc;
    863877                      EAOP2     eaop;
     
    875889                        pgea->cbName = strlen(pgea->szName);
    876890                        pgea->oNextEntryOffset = 0L;
    877                         pgealist->cbList = (sizeof(GEA2LIST) + pgea->cbName);
     891                        pgealist->cbList = sizeof(GEA2LIST) + pgea->cbName;
    878892                        pfealist = malloc(1024);
    879893                        if(pfealist) {
     
    902916                    }
    903917                    /* load the object's longname */
    904                     if(ffb4.cbList > 4L) {
    905 
     918                    if(ffb4.cbList > 4L)
     919                    {
    906920                      APIRET    rc;
    907921                      EAOP2     eaop;
     
    919933                        pgea->cbName = strlen(pgea->szName);
    920934                        pgea->oNextEntryOffset = 0L;
    921                         pgealist->cbList = (sizeof(GEA2LIST) + pgea->cbName);
     935                        pgealist->cbList = sizeof(GEA2LIST) + pgea->cbName;
    922936                        pfealist = malloc(1024);
    923937                        if(pfealist) {
     
    964978                            break;
    965979                          case 'E':
    966                             fprintf(fp,"%-5u",ffb4.cbList);
     980                            fprintf(fp,"%-5u",CBLIST_TO_EASIZE(ffb4.cbList));
    967981                            break;
    968982                          case 'e':
    969                             fprintf(fp,"%u",ffb4.cbList);
     983                            fprintf(fp,"%u",CBLIST_TO_EASIZE(ffb4.cbList));
    970984                            break;
    971985                          case 'd':
  • trunk/dll/update.c

    r2 r51  
     1
     2/***********************************************************************
     3
     4  $Id$
     5
     6  Update Container record/list
     7
     8  Copyright (c) 1993-98 M. Kimes
     9  Copyright (c) 2003 Steven H.Levine
     10
     11  Revisions     12 Feb 03 SHL - Standardize EA math
     12
     13***********************************************************************/
     14
    115#define INCL_DOS
    216#define INCL_WIN
     
    1428
    1529PCNRITEM UpdateCnrRecord (HWND hwndCnr,CHAR *filename,BOOL partial,
    16                           DIRCNRDATA *dcd) {
     30                          DIRCNRDATA *dcd)
     31{
    1732
    1833  PCNRITEM      pci;
     
    91106         strcmp(pci->szFileName,filename)) ||
    92107         pci->cbFile != ffb.cbFile || pci->attrFile != ffb.attrFile ||
    93          pci->easize != ((ffb.cbList > 4L) ? (ffb.cbList / 2) : 0L) ||
     108         pci->easize != CBLIST_TO_EASIZE(ffb.cbList) ||
    94109         pci->date.day != ffb.fdateLastWrite.day ||
    95110         pci->date.month != ffb.fdateLastWrite.month ||
     
    408423
    409424BOOL UpdateCnrList (HWND hwndCnr,CHAR **filename,INT howmany,BOOL partial,
    410                     DIRCNRDATA *dcd) {
     425                    DIRCNRDATA *dcd)
     426{
    411427
    412428  PCNRITEM      pci,*pciList = NULL;
     
    488504           strcmp(pci->szFileName,filename[x])) ||
    489505           pci->cbFile != ffb.cbFile || pci->attrFile != ffb.attrFile ||
    490            pci->easize != ((ffb.cbList > 4L) ? (ffb.cbList / 2) : 0L) ||
     506           pci->easize != CBLIST_TO_EASIZE(ffb.cbList) ||
    491507           pci->date.day != ffb.fdateLastWrite.day ||
    492508           pci->date.month != ffb.fdateLastWrite.month ||
  • trunk/dll/worker.c

    r40 r51  
    846846                                                   sizeof(fs4)) &&
    847847                                 !(fs4.attrFile & FILE_DIRECTORY) &&
     848                                 // fixme to use CBLIST_TO_EASIZE?
    848849                                 fs4.cbFile + fs4.cbList <= clFreeBytes) {
    849850                                // Swap with failing item
Note: See TracChangeset for help on using the changeset viewer.