Changeset 30 for trunk/dll/datamin.c
- Timestamp:
- Oct 17, 2002, 1:26:16 AM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/datamin.c
r2 r30 1 2 /*********************************************************************** 3 4 $Id$ 5 6 Minimized data bar 7 8 Copyright (c) 1993-98 M. Kimes 9 Copyright (c) 2001, 2002 Steven H.Levine 10 11 Revisions 14 Sep 02 SHL - Handle large partitions 12 13 ***********************************************************************/ 14 1 15 #define INCL_DOS 2 16 #define INCL_WIN … … 607 621 *szBuf = NULL,*FSystem = NULL; 608 622 ULONG freebytes,percentfree,wasx,size; 623 ULONG cbPerUnit; 624 UINT cShift; 609 625 HPS hps = (HPS)mp2; 610 626 FSALLOCATE fsa; … … 627 643 &fsa, 628 644 sizeof(FSALLOCATE))) { 629 freebytes = fsa.cUnitAvail * (fsa.cSectorUnit * fsa.cbSector); 630 if(freebytes >= (1024 * 1024)) { 631 freebytes /= (1024 * 1024); 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; 632 652 kfree = "mb"; 633 653 } 634 else if(freebytes >= 1024) { 654 else if (freebytes << cShift >= 1024) { 655 freebytes <<= cShift; 635 656 freebytes /= 1024; 636 657 kfree = "kb"; 637 658 } 638 659 else 660 { 661 freebytes <<= cShift; 639 662 kfree = "b"; 663 } 640 664 percentfree = (fsa.cUnit && fsa.cUnitAvail) ? 641 665 (fsa.cUnitAvail * 100) / fsa.cUnit : 0;
Note:
See TracChangeset
for help on using the changeset viewer.