Changeset 36


Ignore:
Timestamp:
Oct 17, 2002, 3:53:23 AM (23 years ago)
Author:
root
Message:

Handle large partitions

Location:
trunk/dll
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/datamin.c

    r30 r36  
    1010
    1111  Revisions     14 Sep 02 SHL - Handle large partitions
     12                16 Oct 02 SHL - Handle large partitions better
    1213
    1314***********************************************************************/
     
    618619    case UM_PAINT:
    619620      {
    620         CHAR        s[90],tpm[38],*kfree,path[] = " :",
     621        CHAR        s[90],szFreeQty[38],*pszFreeUM,path[] = " :",
    621622                   *szBuf = NULL,*FSystem = NULL;
    622         ULONG       freebytes,percentfree,wasx,size;
    623          ULONG       cbPerUnit;
    624          UINT         cShift;
     623        float       fltFreeQty;
     624        ULONG       percentfree,wasx,size;
    625625        HPS         hps = (HPS)mp2;
    626626        FSALLOCATE  fsa;
     
    637637          if(!WinQueryWindowPos(hwndTemp,&swp))
    638638            return 0;
    639           *tpm = 0;
     639          *szFreeQty = 0;
    640640          DosError(FERR_DISABLEHARDERR);
    641641          if(!DosQueryFSInfo((id - MINI_DRIVEA) + 1,
     
    643643                             &fsa,
    644644                             sizeof(FSALLOCATE))) {
    645              // Scale to avoid overflow on large drives
    646              cbPerUnit = fsa.cSectorUnit * fsa.cbSector;
    647              for (cShift = 0; cbPerUnit && ~cbPerUnit & 1 && cShift < 20; cShift++)
    648                cbPerUnit >>= 1;
    649             freebytes = fsa.cUnitAvail * cbPerUnit;             // Scaled by cShift
    650             if (freebytes >= (1024 * 1024) >> cShift) {
    651               freebytes /= (1024 * 1024) >> cShift;
    652               kfree = "mb";
    653             }
    654             else if (freebytes << cShift >= 1024) {
    655               freebytes <<= cShift;
    656               freebytes /= 1024;
    657               kfree = "kb";
     645            fltFreeQty = (float)fsa.cUnitAvail * (fsa.cSectorUnit * fsa.cbSector);
     646            if (fltFreeQty >= (1024 * 1024)) {
     647              fltFreeQty /= (1024 * 1024);
     648              pszFreeUM = "mb";
     649            }
     650            else if (fltFreeQty >= 1024) {
     651              fltFreeQty /= 1024;
     652              pszFreeUM = "kb";
    658653            }
    659654            else
    660              {
    661                 freebytes <<= cShift;
    662               kfree = "b";
    663              }
     655            {
     656              pszFreeUM = "b";
     657            }
    664658            percentfree = (fsa.cUnit && fsa.cUnitAvail) ?
    665                           (fsa.cUnitAvail * 100) / fsa.cUnit : 0;
    666             commafmt(tpm,sizeof(tpm),freebytes);
     659                            (fsa.cUnitAvail * 100) / fsa.cUnit : 0;
     660            commafmt(szFreeQty,sizeof(szFreeQty),(ULONG)fltFreeQty);
    667661            *path = (CHAR)(id - MINI_DRIVEA) + 'A';
    668662            if(!DosAllocMem((PVOID)&szBuf,
     
    687681                    " %s %s%s (%lu%%) %s%s%s%s",
    688682                    path,
    689                     tpm,
    690                     kfree,
     683                    szFreeQty,
     684                    pszFreeUM,
    691685                    percentfree,
    692686                    GetPString(IDS_FREETEXT),
     
    870864    case UM_SETUP2:
    871865      {
    872         CHAR         s[134],tm[38],tpm[38],*tmk,*tpmk;
    873         FILEFINDBUF3 ffb;
    874         ULONG        nm = 1L;
    875         HDIR         hdir =  HDIR_CREATE;
    876         FSALLOCATE   fsa;
     866        CHAR            s[134],szFileQty[38],szFreeQty[38],*pszFileUM,*pszFreeUM;
     867        FILEFINDBUF3    ffb;
     868        ULONG           nm = 1L;
     869        float           fltFreeQty;
     870        HDIR            hdir = HDIR_CREATE;
     871        FSALLOCATE      fsa;
    877872
    878873        if(*SwapperDat) {
     
    883878            priority_bumped();
    884879            DosFindClose(hdir);
    885             *tm = *tpm = 0;
     880            *szFileQty = *szFreeQty = 0;
    886881            DosError(FERR_DISABLEHARDERR);
    887882            if(!DosQueryFSInfo(toupper(*SwapperDat) - '@',FSIL_ALLOC,
    888883                               &fsa,sizeof(FSALLOCATE))) {
    889               nm = fsa.cUnitAvail * (fsa.cSectorUnit * fsa.cbSector);
    890               if(nm > 1024 * 1024) {
    891                 tpmk = "mb";
    892                 commafmt(tpm,sizeof(tpm),nm / (1024 * 1024));
     884              fltFreeQty = fsa.cUnitAvail * (fsa.cSectorUnit * fsa.cbSector);
     885              if(fltFreeQty > 1024 * 1024) {
     886                pszFreeUM = "mb";
     887                fltFreeQty /= (1024 * 1024);
    893888              }
    894               else if(nm > 1024) {
    895                 tpmk = "kb";
    896                 commafmt(tpm,sizeof(tpm),nm / 1024);
     889              else if(fltFreeQty > 1024) {
     890                pszFreeUM = "kb";
     891                fltFreeQty /= 1024;
    897892              }
    898893              else {
    899                 tpmk = "b";
    900                 commafmt(tpm,sizeof(tpm),nm);
     894                pszFreeUM = "b";
    901895              }
     896              commafmt(szFreeQty,sizeof(szFreeQty),(ULONG)fltFreeQty);
    902897            }
    903898            if(ffb.cbFile > 1024 * 1024) {
    904               tmk = "mb";
    905               commafmt(tm,sizeof(tm),ffb.cbFile / (1024 * 1024));
     899              pszFileUM = "mb";
     900              commafmt(szFileQty,sizeof(szFileQty),ffb.cbFile / (1024 * 1024));
    906901            }
    907902            else if(ffb.cbFile > 1024) {
    908               tmk = "kb";
    909               commafmt(tm,sizeof(tm),ffb.cbFile / 1024);
     903              pszFileUM = "kb";
     904              commafmt(szFileQty,sizeof(szFileQty),ffb.cbFile / 1024);
    910905            }
    911906            else {
    912               tmk = "b";
    913               commafmt(tm,sizeof(tm),ffb.cbFile);
     907              pszFileUM = "b";
     908              commafmt(szFileQty,sizeof(szFileQty),ffb.cbFile);
    914909            }
    915910            sprintf(s," %s %s%s%s%s%s",
    916911                    GetPString(IDS_SWAPTITLETEXT),
    917                     tm,
    918                     tmk,
    919                     (*tpm) ? "/" : NullStr,
    920                     tpm,
    921                     (*tpm) ? tpmk : NullStr);
     912                    szFileQty,
     913                    pszFileUM,
     914                    (*szFreeQty) ? "/" : NullStr,
     915                    szFreeQty,
     916                    (*szFreeQty) ? pszFreeUM : NullStr);
    922917            WinSetDlgItemText(hwnd,
    923918                              MINI_SWAP,
     
    930925    case UM_SETUP3:
    931926      {
    932         CHAR  s[134],tm[38],tpm[38],*tpmk,*tmk;
     927        CHAR  s[134],tm[38],szQty[38],*pszUM,*tmk;
    933928        ULONG amem = 0;
    934929
    935930        if(!DosQuerySysInfo(QSV_TOTAVAILMEM,QSV_TOTAVAILMEM,
    936931                            (PVOID)&amem,(ULONG)sizeof(amem))) {
    937           *tm = *tpm = 0;
     932          *tm = *szQty = 0;
    938933          if(amem > 1024 * 1024) {
    939934            tmk = "mb";
     
    950945          if(!Dos16MemAvail(&amem)) {
    951946            if(amem > 1024 * 1024) {
    952               tpmk = "mb";
    953               commafmt(tpm,sizeof(tpm),amem / (1024 * 1024));
     947              pszUM = "mb";
     948              commafmt(szQty,sizeof(szQty),amem / (1024 * 1024));
    954949            }
    955950            else if(amem > 1024) {
    956               tpmk = "kb";
    957               commafmt(tpm,sizeof(tpm),amem / 1024);
     951              pszUM = "kb";
     952              commafmt(szQty,sizeof(szQty),amem / 1024);
    958953            }
    959954            else {
    960               tpmk = "b";
    961               commafmt(tpm,sizeof(tpm),amem);
     955              pszUM = "b";
     956              commafmt(szQty,sizeof(szQty),amem);
    962957            }
    963958          }
    964959          sprintf(s," %s%s%s%s%s%s",
    965960                  GetPString(IDS_MEMTITLETEXT),
    966                   tpm,
    967                   (*tpm) ? tpmk : NullStr,
    968                   (*tpm) ? "/" : NullStr,
     961                  szQty,
     962                  (*szQty) ? pszUM : NullStr,
     963                  (*szQty) ? "/" : NullStr,
    969964                  tm,
    970965                  tmk);
     
    994989    case UM_SETUP5:
    995990      {
    996         CHAR s[134],tm[38],tpm[38];
     991        CHAR s[134],tm[38],szQty[38];
    997992
    998993        if(fUseQProcStat && !noqproc) {
     
    10181013                ppi = (PPROCESSINFO)(ppi->ptiFirst + ppi->usThreadCount);
    10191014              }
    1020               *tpm = *tm = 0;
    1021               commafmt(tpm,sizeof(tpm),numprocs);
     1015              *szQty = *tm = 0;
     1016              commafmt(szQty,sizeof(szQty),numprocs);
    10221017              commafmt(tm,sizeof(tm),numthreads);
    10231018              sprintf(s,
    10241019                      " %s%s  %s%s",
    10251020                      GetPString(IDS_PROCSTITLETEXT),
    1026                       tpm,
     1021                      szQty,
    10271022                      GetPString(IDS_THRDSTITLETEXT),
    10281023                      tm);
     
    10371032        }
    10381033        else {
    1039           *tpm = 0;
    1040           commafmt(tpm,sizeof(tpm),
     1034          *szQty = 0;
     1035          commafmt(szQty,sizeof(szQty),
    10411036                   WinQuerySwitchList(WinQueryAnchorBlock(hwnd),(PSWBLOCK)0,0));
    10421037          sprintf(s,
    10431038                  " %s%s",
    10441039                  GetPString(IDS_TASKSTITLETEXT),
    1045                   tpm);
     1040                  szQty);
    10461041          WinSetDlgItemText(hwnd,
    10471042                            MINI_PROC,
  • trunk/dll/dircnrs.c

    r2 r36  
     1
     2/***********************************************************************
     3
     4  $Id$
     5
     6  Directory containers
     7
     8  Copyright (c) 1993-98 M. Kimes
     9  Copyright (c) 2001, 2002 Steven H.Levine
     10
     11  Revisions     16 Oct 02 SHL - Handle large partitions
     12
     13***********************************************************************/
     14
    115#define INCL_DOS
    216#define INCL_WIN
     
    689703          strcpy(fbytes,"  {");
    690704          commafmt(fbytes + 3,sizeof(fbytes) - 5,
    691                    (fsa.cUnitAvail * (fsa.cSectorUnit * fsa.cbSector)) /
    692                     1024L);
     705                   (ULONG)(((float)fsa.cUnitAvail *
     706                     (fsa.cSectorUnit * fsa.cbSector)) / 1024L));
    693707          strcat(fbytes,GetPString(IDS_KFREETEXT));
    694708          strcat(fbytes,"}");
  • trunk/dll/dirsize.c

    r2 r36  
     1
     2/***********************************************************************
     3
     4  $Id$
     5
     6  Directory size
     7
     8  Copyright (c) 1993-98 M. Kimes
     9  Copyright (c) 2001, 2002 Steven H.Levine
     10
     11  Revisions     16 Oct 02 SHL - Handle large partitions
     12
     13***********************************************************************/
     14
    115#define INCL_DOS
    216#define INCL_WIN
     
    8599      return -1L;
    86100    }
    87 //printf("CM_ALLOCRECORD\n");
     101    //printf("CM_ALLOCRECORD\n");
    88102    pciP = WinSendMsg(hwndCnr,CM_ALLOCRECORD,MPFROMLONG(EXTRA_RECORD_BYTES2),
    89103                      MPFROMLONG(1L));
     
    168182    while(!rc) {
    169183      priority_normal();
    170 //printf("Found %lu\n",nm);
     184      //printf("Found %lu\n",nm);
    171185      for(x = 0L;x < nm;x++) {
    172186        pffbFile = (FILEFINDBUF4 *)fb;
    173 //printf("%s\n",pffbFile->achName);
    174 //fflush(stdout);
     187        //printf("%s\n",pffbFile->achName);
     188        //fflush(stdout);
    175189        if((*pffbFile->achName != '.' || (pffbFile->achName[1] &&
    176190           pffbFile->achName[1] != '.')) ||
     
    222236
    223237    CHAR           tf[80],tb[80],tt[80],br[80];
    224     register CHAR *p;
    225     register ULONG cntr,x;
    226     double         cntra = 0.0;
     238    register CHAR       *p;
     239    register ULONG      cntr,x;
     240    float               cntra = 0.0;
    227241
    228242    commafmt(tf,sizeof(tf),(pci->cbFile > 0L && pci->cbFile < 1024L) ? 1L :
     
    239253                            sizeof(FSALLOCATE));
    240254        if(!rc)
    241           cntra = ((totalbytes * 100.0) /
    242                     ((double)fsa.cUnit *
    243                      ((double)fsa.cSectorUnit * fsa.cbSector)));
     255          cntra = (totalbytes * 100.0) /
     256                    ((float)fsa.cUnit * (fsa.cSectorUnit * fsa.cbSector));
    244257        pci->Longname[1] = 1;
    245258      }
    246259      else
    247         cntra = ((((double)pci->cbFile + pci->easize) * 100.0) /
    248                           (double)totalbytes);
     260        cntra = (((float)pci->cbFile + pci->easize) * 100.0) / totalbytes;
    249261      cntr = (ULONG)cntra / 2;
    250262      p = br;
     
    449461            CHAR s[132],tf[80],tb[80],tu[80];
    450462
    451             commafmt(tf,sizeof(tf),(fsa.cUnitAvail * (fsa.cSectorUnit *
    452                      fsa.cbSector)) / 1024L);
    453             commafmt(tb,sizeof(tb),(fsa.cUnit * (fsa.cSectorUnit *
    454                      fsa.cbSector)) / 1024L);
    455             commafmt(tu,sizeof(tu),((fsa.cUnit - fsa.cUnitAvail) *
    456                      (fsa.cSectorUnit * fsa.cbSector)) / 1024L);
     463            commafmt(tf,sizeof(tf),
     464                     (ULONG)(((float)fsa.cUnitAvail *
     465                       (fsa.cSectorUnit * fsa.cbSector)) / 1024L));
     466            commafmt(tb,sizeof(tb),
     467                     (ULONG)(((float)fsa.cUnit *
     468                       (fsa.cSectorUnit * fsa.cbSector)) / 1024L));
     469            commafmt(tu,sizeof(tu),
     470                     (ULONG)(((float)(fsa.cUnit - fsa.cUnitAvail) *
     471                       (fsa.cSectorUnit * fsa.cbSector)) / 1024L));
    457472            sprintf(s,
    458473                    GetPString(IDS_FREESPACETEXT),
  • trunk/dll/info.c

    r2 r36  
     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     16 Oct 02 SHL - Handle large partitions
     12
     13***********************************************************************/
     14
    115#define INCL_DOS
    216#define INCL_WIN
     
    173187                                  s);
    174188                sprintf(s,
    175                         "%lu mb, %lu kb, %lu %s%s",((fsa.cUnit *
    176                         (fsa.cSectorUnit * fsa.cbSector)) / 1024L) / 1024L,
    177                         (fsa.cUnit * (fsa.cSectorUnit * fsa.cbSector)) / 1024L,
     189                        "%lu mb, %lu kb, %lu %s%s",
     190                        (ULONG)(((float)fsa.cUnit *
     191                          (fsa.cSectorUnit * fsa.cbSector)) / (1024L * 1024L)),
     192                        (ULONG)(((float)fsa.cUnit * (fsa.cSectorUnit * fsa.cbSector)) / 1024L),
    178193                        fsa.cUnit,
    179194                        GetPString(IDS_UNITTEXT),
     
    184199                sprintf(s,
    185200                        "%lu mb, %lu kb, %lu %s%s",
    186                         ((fsa.cUnitAvail * (fsa.cSectorUnit * fsa.cbSector)) / 1024L) / 1024L,
    187                         (fsa.cUnitAvail * (fsa.cSectorUnit * fsa.cbSector)) / 1024L,
     201                        (ULONG)(((float)fsa.cUnitAvail *
     202                          (fsa.cSectorUnit * fsa.cbSector)) / (1024L * 1024L)),
     203                        (ULONG)(((float)fsa.cUnitAvail * (fsa.cSectorUnit * fsa.cbSector)) / 1024L),
    188204                        fsa.cUnitAvail,
    189205                        GetPString(IDS_UNITTEXT),
     
    975991  return WinDefDlgProc(hwnd,msg,mp1,mp2);
    976992}
    977  
     993
    978994
    979995MRESULT EXPENTRY SetDrvProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
  • trunk/dll/mainwnd.c

    r33 r36  
    1010
    1111  Revisions     11 Jun 02 SHL - Drop obsolete xor code
     12                16 Oct 02 SHL - Handle large partitions
    1213
    1314***********************************************************************/
     
    5758
    5859
    59 MRESULT EXPENTRY MainObjectWndProc (HWND hwnd,ULONG msg,MPARAM mp1,
    60                                                                                                                                                 MPARAM mp2) {
     60MRESULT EXPENTRY MainObjectWndProc (HWND hwnd,ULONG msg,MPARAM mp1, MPARAM mp2) {
    6161
    6262        switch(msg) {
     
    9696
    9797          FSALLOCATE fsa;
    98           CHAR        s[90],tpm[38],*kfree;
    99           ULONG       freebytes,percentfree;
     98          CHAR        s[90],szQty[38],*pszUM;
     99          ULONG       ulPctFree;
     100          float       fltFreeQty;
    100101
    101102          if(!DosQueryFSInfo((d - 'A') + 1,
     
    103104                             &fsa,
    104105                             sizeof(FSALLOCATE))) {
    105             freebytes = fsa.cUnitAvail *
    106                          (fsa.cSectorUnit * fsa.cbSector);
    107             if(freebytes >= (1024 * 1024)) {
    108               freebytes /= (1024 * 1024);
    109               kfree = "mb";
     106            fltFreeQty = (float)fsa.cUnitAvail *
     107                           (fsa.cSectorUnit * fsa.cbSector);
     108            if(fltFreeQty >= (1024 * 1024)) {
     109              fltFreeQty /= (1024 * 1024);
     110              pszUM = "mb";
    110111            }
    111             else if(freebytes >= 1024) {
    112               freebytes /= 1024;
    113               kfree = "kb";
     112            else if(fltFreeQty >= 1024) {
     113              fltFreeQty /= 1024;
     114              pszUM = "kb";
    114115            }
    115116            else
    116               kfree = "b";
    117             percentfree = (fsa.cUnit && fsa.cUnitAvail) ?
    118                            (fsa.cUnitAvail * 100) / fsa.cUnit :
    119                            0;
    120             commafmt(tpm,
    121                      sizeof(tpm),
    122                      freebytes);
     117              pszUM = "b";
     118            ulPctFree = (fsa.cUnit && fsa.cUnitAvail) ?
     119                          (fsa.cUnitAvail * 100) / fsa.cUnit : 0;
     120            commafmt(szQty,
     121                     sizeof(szQty),
     122                     (ULONG)fltFreeQty);
    123123            sprintf(s,
    124124                    "%s%s (%lu%%) free",
    125                     tpm,
    126                     kfree,
    127                     percentfree);
     125                    szQty,
     126                    pszUM,
     127                    ulPctFree);
    128128          }
    129129          if((!hwndBubble ||
     
    210210VOID MakeMainObjWin (VOID *args) {
    211211
    212         HAB                             hab2;
    213         HMQ                             hmq2;
     212        HAB                             hab2;
     213        HMQ                             hmq2;
    214214        QMSG                            qmsg2;
    215215
     
    289289HWND TopWindowName (HWND hwndParent,HWND exclude,CHAR *ret) {
    290290
    291         HENUM           henum;
    292         HWND                    hwndC = (HWND)0,hwndDir,hwndClient;
     291        HENUM           henum;
     292        HWND            hwndC = (HWND)0,hwndDir,hwndClient;
    293293        USHORT          id;
    294294        PCNRITEM        pci = NULL;
     
    378378HWND FindDirCnrByName (CHAR *directory,BOOL restore) {
    379379
    380         HENUM                   henum;
    381         HWND                            hwndF = (HWND)0,hwndC,hwndDir;
    382         CHAR                            retstr[CCHMAXPATH];
     380        HENUM                   henum;
     381        HWND                    hwndF = (HWND)0,hwndC,hwndDir;
     382        CHAR                    retstr[CCHMAXPATH];
    383383
    384384        if(hwndMain) {
     
    456456VOID ResizeTools (HWND hwnd) {
    457457
    458         register ULONG butx = 18L;
    459         INT                                      attrib = SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER | SWP_NOREDRAW,
    460                                                                  noattrib;
    461         register TOOL *tool,*starttool;
    462         SWP                                     *swp;
    463         register ULONG numtools,x;
     458        register ULONG  butx = 18L;
     459        INT             attrib = SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER | SWP_NOREDRAW,
     460                        noattrib;
     461        register TOOL   *tool,*starttool;
     462        SWP             *swp;
     463        register ULONG  numtools,x;
    464464
    465465        if(!fToolbar)
     
    565565MRESULT EXPENTRY DropDownListProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
    566566
    567         PFNWP                           oldproc = (PFNWP)INSTDATA(hwnd);
    568         static HWND     hwndMenu = (HWND)0;
    569         USHORT                          id;
    570         static BOOL     emphasized = FALSE;
     567        PFNWP           oldproc = (PFNWP)INSTDATA(hwnd);
     568        static HWND     hwndMenu = (HWND)0;
     569        USHORT          id;
     570        static BOOL     emphasized = FALSE;
    571571
    572572        switch(msg) {
     
    815815        if(hwndBubble) {
    816816
    817                 HPS              hps;
    818                 POINTL   aptl[TXTBOX_COUNT],ptl,tptl;
    819                 LONG             lxScreen,sx,sy,extra = 0,lyScreen;
    820                 char            *p,*pp,*wp;
    821                 SWP              swp;
     817                HPS     hps;
     818                POINTL  aptl[TXTBOX_COUNT],ptl,tptl;
     819                LONG    lxScreen,sx,sy,extra = 0,lyScreen;
     820                char    *p,*pp,*wp;
     821                SWP     swp;
    822822
    823823                WinQueryWindowPos(hwnd,&swp);
     
    921921                case WM_PAINT:
    922922                        {
    923                                 HPS             hps;
    924                                 SWP             swp;
     923                                HPS     hps;
     924                                SWP     swp;
    925925                                POINTL  ptl,aptl[TXTBOX_COUNT];
    926                                 CHAR     *s,*p,*pp,*wp;
    927                                 ULONG   extra,tlen,y;
     926                                CHAR    *s,*p,*pp,*wp;
     927                                ULONG   extra,tlen,y;
    928928
    929929        hps = WinBeginPaint(hwnd,(HPS)0,NULL);
     
    11481148MRESULT EXPENTRY ChildButtonProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
    11491149
    1150         USHORT                           id;
    1151         register TOOL *tool;
    1152         static HWND      hwndMenu = (HWND)0;
     1150        USHORT          id;
     1151        register TOOL   *tool;
     1152        static HWND     hwndMenu = (HWND)0;
    11531153
    11541154        switch(msg) {
     
    11881188                                        break;
    11891189
    1190                                 case IDM_HIDEANYTOOL:            /* hide any tool */
    1191                                 case IDM_HIDETOOL:                               /* hide tool */
     1190                                case IDM_HIDEANYTOOL:           /* hide any tool */
     1191                                case IDM_HIDETOOL:              /* hide tool */
    11921192                                        if(SHORT1FROMMP(mp1) == IDM_HIDETOOL)
    11931193                                                id = WinQueryWindowUShort(hwnd,QWS_ID);
     
    12061206                                        break;
    12071207
    1208                                 case IDM_SHOWTOOLS:     /* show all tools */
     1208                                case IDM_SHOWTOOLS:     /* show all tools */
    12091209                                        tool = toolhead;
    12101210                                        while(tool) {
     
    12151215                                        break;
    12161216
    1217                                 case IDM_DELETEANYTOOL:         /* delete any button */
    1218                                 case IDM_DELETETOOL:                    /* delete button */
     1217                                case IDM_DELETEANYTOOL:         /* delete any button */
     1218                                case IDM_DELETETOOL:            /* delete button */
    12191219                                        if(SHORT1FROMMP(mp1) == IDM_DELETETOOL)
    12201220                                                id = WinQueryWindowUShort(hwnd,QWS_ID);
     
    12281228                                        return 0;
    12291229
    1230                                 case IDM_EDITANYTOOL:    /* edit any button */
    1231                                 case IDM_EDITTOOL:                       /* edit button */
     1230                                case IDM_EDITANYTOOL:           /* edit any button */
     1231                                case IDM_EDITTOOL:              /* edit button */
    12321232                                        if(SHORT1FROMMP(mp1) == IDM_EDITTOOL)
    12331233                                                id = WinQueryWindowUShort(hwnd,QWS_ID);
     
    12491249                                        break;
    12501250
    1251                                 case IDM_ADDTOOL:                       /* add tool */
     1251                                case IDM_ADDTOOL:               /* add tool */
    12521252                                        id = (USHORT)WinDlgBox(HWND_DESKTOP,hwnd,AddToolProc,FM3ModHandle,
    12531253                                                                                                                                 ADDBTN_FRAME,MPVOID);
     
    13061306                case DM_DRAGOVER:
    13071307                        {
    1308                                 PDRAGINFO pDInfo;                                                                                        /* Pointer to DRAGINFO         */
    1309 
    1310                                 pDInfo = (PDRAGINFO)mp1;                                                                 /* Get DRAGINFO pointer        */
    1311                                 DrgAccessDraginfo(pDInfo);                                                       /* Access DRAGINFO                     */
     1308                                PDRAGINFO pDInfo;               /* Pointer to DRAGINFO */
     1309
     1310                                pDInfo = (PDRAGINFO)mp1;        /* Get DRAGINFO pointer */
     1311                                DrgAccessDraginfo(pDInfo);      /* Access DRAGINFO */
    13121312                                id = WinQueryWindowUShort(hwnd,QWS_ID);
    13131313                                tool = find_tool(id);
    13141314                                if(!tool) {
    13151315                                        DrgFreeDraginfo(pDInfo);
    1316                                         return(MRFROM2SHORT(DOR_NEVERDROP,0));           /* Drop not valid                              */
     1316                                        return(MRFROM2SHORT(DOR_NEVERDROP,0));           /* Drop not valid  */
    13171317                                }
    13181318                                if(!(tool->flags & T_DROPABLE)) {
    13191319                                        DrgFreeDraginfo(pDInfo);
    1320                                         return(MRFROM2SHORT(DOR_NEVERDROP,0));           /* Drop not valid                              */
     1320                                        return(MRFROM2SHORT(DOR_NEVERDROP,0));           /* Drop not valid  */
    13211321                                }
    13221322                                {
    1323                                         PDRAGITEM pDItem;                                                                                        /* Pointer to DRAGITEM         */
    1324 
    1325                                         pDItem = DrgQueryDragitemPtr(pDInfo,             /* Access DRAGITEM                     */
    1326                                                                                                                                                          0);                             /* Index to DRAGITEM           */
    1327                                         if(DrgVerifyRMF(pDItem,                                                                  /* Check valid rendering */
    1328                           DRM_OS2FILE,             /* mechanisms and data   */
    1329                                                                                                         NULL)) {                                                                 /* formats                                                     */
     1323                                        PDRAGITEM pDItem;                                /* Pointer to DRAGITEM */
     1324
     1325                                        pDItem = DrgQueryDragitemPtr(pDInfo,            /* Access DRAGITEM */
     1326                                                                     0);                /* Index to DRAGITEM */
     1327                                        if(DrgVerifyRMF(pDItem,                         /* Check valid rendering */
     1328                                                        DRM_OS2FILE,                    /* mechanisms and data   */
     1329                                                        NULL)) {                        /* formats */
    13301330                                                if(!(tool->flags & T_EMPHASIZED)) {
    13311331                                                        tool->flags |= T_EMPHASIZED;
     
    13331333                                                        DrgFreeDraginfo(pDInfo);
    13341334                                                }
    1335                                                 return(MRFROM2SHORT(DOR_DROP,                            /* Return okay to drop         */
    1336                                                                                                                                 DO_MOVE));                               /* Move operation valid        */
     1335                                                return(MRFROM2SHORT(DOR_DROP,           /* Return okay to drop  */
     1336                                                       DO_MOVE));                       /* Move operation valid */
    13371337                                        }
    13381338                                        DrgFreeDraginfo(pDInfo);
     
    14091409VOID BuildTools (HWND hwndT,BOOL resize) {
    14101410
    1411         register TOOL    *tool;
    1412   register ULONG    ctrlxpos = 18L;
    1413         CHAR                                                    s[33];
    1414         HENUM                                           henum;
    1415         HWND                                                    hwndTool;
     1411        register TOOL   *tool;
     1412        register ULONG  ctrlxpos = 18L;
     1413        CHAR            s[33];
     1414        HENUM           henum;
     1415        HWND            hwndTool;
    14161416
    14171417        henum = WinBeginEnumWindows(hwndT);
     
    14481448                        if(!hwndTool) {
    14491449
    1450                                 HBITMAP         hbm;
     1450                                HBITMAP hbm;
    14511451
    14521452                                hbm = LoadBitmapFromFileNum(tool->id);
     
    15611561MRESULT EXPENTRY CommandLineProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
    15621562
    1563         PFNWP                   oldproc = (PFNWP)WinQueryWindowPtr(hwnd,0);
    1564         static BOOL lbup = FALSE;
     1563        PFNWP           oldproc = (PFNWP)WinQueryWindowPtr(hwnd,0);
     1564        static BOOL     lbup = FALSE;
    15651565
    15661566        switch(msg) {
     
    16361636                        {
    16371637                                static char directory[CCHMAXPATH],cl[1000];
    1638         char      **list = NULL;
    1639                                 ULONG                   len;
    1640                                 HWND                            hwndCnr;
     1638                                char    **list = NULL;
     1639                                ULONG   len;
     1640                                HWND    hwndCnr;
    16411641
    16421642                                *directory = *cl = 0;
    1643         strcpy(cl,GetCmdSpec(FALSE));
     1643                                strcpy(cl,GetCmdSpec(FALSE));
    16441644                                strcat(cl," /C ");
    16451645                                len = strlen(cl);
     
    20382038                                CNRDRAGINFO cnd;
    20392039                                LISTINFO         *li;
    2040                                 ULONG                   action = UM_ACTION;
     2040                                ULONG           action = UM_ACTION;
    20412041
    20422042
  • trunk/dll/seeall.c

    r2 r36  
     1
     2/***********************************************************************
     3
     4  $Id$
     5
     6  See all matching files
     7
     8  Copyright (c) 1993-98 M. Kimes
     9  Copyright (c) 2001, 2002 Steven H.Levine
     10
     11  Revisions     16 Oct 02 SHL - Handle large partitions
     12
     13***********************************************************************/
     14
    115#define INCL_DOS
    216#define INCL_DOSERRORS
     
    733747
    734748                    FSALLOCATE  fsa;
    735                     ULONG       totalsize;
     749                    ULONG       clFreeBytes;
    736750                    CHAR       *ptr;
    737751                    INT         cntr;
     
    742756                    if(!DosQueryFSInfo(toupper(*newname) - '@',
    743757                       FSIL_ALLOC,&fsa,sizeof(FSALLOCATE))) {
    744                       totalsize = fsa.cUnitAvail * fsa.cSectorUnit *
    745                                   fsa.cbSector;
    746                       if(totalsize) {
     758                      // Assume <2GB since file did not fit
     759                      clFreeBytes = fsa.cUnitAvail * fsa.cSectorUnit *
     760                                    fsa.cbSector;
     761                      if(clFreeBytes) {
     762                        // Find item that will fit in available space
    747763                        for(cntr = x + 1;list[cntr];cntr++) {
    748764                          DosError(FERR_DISABLEHARDERR);
     
    751767                                               &fs4,sizeof(fs4)) &&
    752768                             !(fs4.attrFile & FILE_DIRECTORY) &&
    753                              fs4.cbFile + fs4.cbList <= totalsize) {
     769                             fs4.cbFile + fs4.cbList <= clFreeBytes) {
     770                            // Swap with failing item
    754771                            ptr = list[x];
    755772                            list[x] = list[cntr];
  • trunk/dll/treecnr.c

    r2 r36  
     1
     2/***********************************************************************
     3
     4  $Id$
     5
     6  Tree containers
     7
     8  Copyright (c) 1993-98 M. Kimes
     9  Copyright (c) 2001, 2002 Steven H.Levine
     10
     11  Revisions     16 Oct 02 SHL - Handle large partitions
     12
     13***********************************************************************/
     14
    115#define INCL_DOS
    216#define INCL_WIN
     
    696710                  strcpy(fbytes,"  ");
    697711                  commafmt(fbytes + 2,sizeof(fbytes) - 4,
    698                            (fsa.cUnitAvail * (fsa.cSectorUnit * fsa.cbSector)) /
    699                             1024L);
     712                           (ULONG)(((float)fsa.cUnitAvail *
     713                             (fsa.cSectorUnit * fsa.cbSector)) / 1024L));
    700714                  strcat(fbytes,
    701715                         GetPString(IDS_KFREETEXT));
  • trunk/dll/worker.c

    r2 r36  
     1
     2/***********************************************************************
     3
     4  $Id$
     5
     6  Worker thread
     7
     8  Copyright (c) 1993-98 M. Kimes
     9  Copyright (c) 2001, 2002 Steven H.Levine
     10
     11  Revisions     16 Oct 02 SHL - Comments
     12
     13***********************************************************************/
     14
    115#define INCL_DOS
    216#define INCL_WIN
     
    689703                    existed = (IsFile(newname) != -1);
    690704                    isnewer = IsNewer(wk->li->list[x],newname);
    691 /*
    692 {
    693 static char temp[CCHMAXPATH * 3];
    694 
    695 sprintf(temp,"Target: %s\rSource: %s\rOverold: %lu\rOvernew: %lu\rIsNewer: %lu\rExisted: %lu",newname,wk->li->list[x],overold,overnew,isnewer,existed);
    696 saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,temp);
    697 }
    698 */
     705                    /*
     706                    {
     707                      char temp[CCHMAXPATH * 3];
     708                      sprintf(temp,"Target: %s\rSource: %s\rOverold: %lu\rOvernew: %lu\rIsNewer: %lu\rExisted: %lu",newname,wk->li->list[x],overold,overnew,isnewer,existed);
     709                      saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,temp);
     710                    }
     711                    */
    699712                    if(existed &&
    700713                       wk->li->type != IDM_RENAME &&
     
    810823
    811824                        FSALLOCATE  fsa;
    812                         ULONG       totalsize;
     825                        ULONG       clFreeBytes;
    813826                        CHAR       *ptr;
    814827                        INT         cntr;
     
    820833                                           &fsa,
    821834                                           sizeof(FSALLOCATE))) {
    822                           totalsize = fsa.cUnitAvail * fsa.cSectorUnit *
     835                          // Assume <2GB since file did not fit
     836                          clFreeBytes = fsa.cUnitAvail * fsa.cSectorUnit *
    823837                                      fsa.cbSector;
    824                           if(totalsize) {
     838                          if(clFreeBytes) {
     839                            // Find item that will fit in available space
    825840                            for(cntr = x + 1;wk->li->list[cntr];cntr++) {
    826841                              DosError(FERR_DISABLEHARDERR);
     
    830845                                                   sizeof(fs4)) &&
    831846                                 !(fs4.attrFile & FILE_DIRECTORY) &&
    832                                  fs4.cbFile + fs4.cbList <= totalsize) {
     847                                 fs4.cbFile + fs4.cbList <= clFreeBytes) {
     848                                // Swap with failing item
    833849                                ptr = wk->li->list[x];
    834850                                wk->li->list[x] = wk->li->list[cntr];
Note: See TracChangeset for help on using the changeset viewer.