Changeset 152 for trunk/dll/update.c
- Timestamp:
- May 26, 2005, 4:12:12 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/update.c
r85 r152 7 7 8 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 10 Jan 04 SHL - Add some intermin large drive error avoidance 9 Copyright (c) 2003, 2005 Steven H. Levine 10 11 12 Feb 03 SHL Standardize EA math 12 10 Jan 04 SHL Add some intermin large drive error avoidance 13 25 May 05 SHL Rework for ULONGLONG 14 25 May 05 SHL Rework for FillInRecordFromFFB 13 15 14 16 ***********************************************************************/ … … 16 18 #define INCL_DOS 17 19 #define INCL_WIN 18 20 #define INCL_LONGLONG 19 21 #include <os2.h> 22 20 23 #include <stdarg.h> 21 24 #include <stdio.h> … … 23 26 #include <string.h> 24 27 #include <ctype.h> 28 25 29 #include "fm3dll.h" 26 30 27 31 #pragma alloc_text(UPDATECNR,UpdateCnrRecord,UpdateCnrList) 28 29 32 30 33 PCNRITEM UpdateCnrRecord (HWND hwndCnr,CHAR *filename,BOOL partial, 31 34 DIRCNRDATA *dcd) 32 35 { 33 34 36 PCNRITEM pci; 35 37 FILEFINDBUF4 ffb; … … 173 175 174 176 RECORDINSERT ri; 175 ULONG totalbytes;177 ULONGLONG ullTotalBytes; 176 178 177 179 pci = WinSendMsg(hwndCnr, … … 181 183 if(pci) { 182 184 *ffb.achName = 0; 183 totalbytes = FillInRecordFromFFB(hwndCnr,184 pci,185 filename,186 &ffb,187 partial,188 dcd);185 ullTotalBytes = FillInRecordFromFFB(hwndCnr, 186 pci, 187 filename, 188 &ffb, 189 partial, 190 dcd); 189 191 if(strlen(pci->szFileName) < 4) { 190 192 *pci->szFileName = toupper(*pci->szFileName); … … 211 213 ri.cRecordsInsert = 1L; 212 214 ri.fInvalidateRecord = TRUE; 213 if (WinSendMsg(hwndCnr,215 if (WinSendMsg(hwndCnr, 214 216 CM_INSERTRECORD, 215 217 MPFROMP(pci), 216 218 MPFROMP(&ri)) && 217 totalbytes != -1 && 218 totalbytes) 219 ullTotalBytes) 219 220 { 220 dcd->totalbytes += totalbytes; 221 if (dcd->totalbytes == -1) 222 dcd->totalbytes--; 221 dcd->ullTotalBytes += ullTotalBytes; 223 222 PostMsg(hwndCnr, 224 223 UM_RESCAN, … … 331 330 332 331 RECORDINSERT ri; 333 ULONG totalbytes; 332 ULONGLONG ullTotalBytes; 333 BOOL rc; 334 334 335 335 *ffb.achName = 0; 336 totalbytes = FillInRecordFromFFB(hwndCnr,337 pci, 338 filename,339 &ffb,340 partial,341 dcd);336 ullTotalBytes = FillInRecordFromFFB(hwndCnr, 337 pci, 338 filename, 339 &ffb, 340 partial, 341 dcd); 342 342 if(strlen(pci->szFileName) < 4) { 343 343 *pci->szFileName = toupper(*pci->szFileName); … … 368 368 MPFROMP(pci), 369 369 MPFROMP(&ri)) && 370 totalbytes != -1 && 371 totalbytes) 370 ullTotalBytes) 372 371 { 373 372 if (dcd->type == DIR_FRAME) { 374 dcd->totalbytes += totalbytes; 375 if (dcd->totalbytes == -1) 376 dcd->totalbytes--; // fixme for real someday 373 dcd->ullTotalBytes += ullTotalBytes; 377 374 } 378 375 Stubby(hwndCnr,pci); … … 403 400 CRA_SELECTED)); 404 401 if(dcd->type == DIR_FRAME) 405 dcd-> totalbytes -= pci->cbFile + pci->easize;402 dcd->ullTotalBytes -= pci->cbFile + pci->easize; 406 403 WinSendMsg(hwndCnr, 407 404 CM_REMOVERECORD, … … 428 425 429 426 430 431 427 BOOL UpdateCnrList (HWND hwndCnr,CHAR **filename,INT howmany,BOOL partial, 432 428 DIRCNRDATA *dcd) 433 429 { 434 435 430 PCNRITEM pci,*pciList = NULL; 436 431 FILEFINDBUF4 ffb; 437 432 HDIR hDir; 438 433 ULONG nm = 1L; 439 register INT x,numlist = 0,numremain; 440 BOOL repos = FALSE,needtosort = FALSE,ret = FALSE; 434 INT x; 435 INT numlist = 0; 436 INT numremain; 437 BOOL repos = FALSE; 438 BOOL needtosort = FALSE; 439 BOOL ret = FALSE; 441 440 APIRET status; 442 441 … … 507 506 FALSE, 508 507 TRUE); 509 if(pci) { /* update record? */ 510 if((!fForceUpper && !fForceLower && 511 strcmp(pci->szFileName,filename[x])) || 512 pci->cbFile != ffb.cbFile || pci->attrFile != ffb.attrFile || 513 pci->easize != CBLIST_TO_EASIZE(ffb.cbList) || 514 pci->date.day != ffb.fdateLastWrite.day || 515 pci->date.month != ffb.fdateLastWrite.month || 516 pci->date.year != ffb.fdateLastWrite.year + 1980 || 517 pci->time.seconds != ffb.ftimeLastWrite.twosecs * 2 || 518 pci->time.minutes != ffb.ftimeLastWrite.minutes || 519 pci->time.hours != ffb.ftimeLastWrite.hours || 520 pci->ladate.day != ffb.fdateLastAccess.day || 521 pci->ladate.month != ffb.fdateLastAccess.month || 522 pci->ladate.year != ffb.fdateLastAccess.year + 1980 || 523 pci->latime.seconds != ffb.ftimeLastAccess.twosecs * 2 || 524 pci->latime.minutes != ffb.ftimeLastAccess.minutes || 525 pci->latime.hours != ffb.ftimeLastAccess.hours) { /* changed; update */ 508 if (pci) 509 { 510 /* update record? */ 511 if ((!fForceUpper && !fForceLower && 512 strcmp(pci->szFileName,filename[x])) || 513 pci->cbFile != ffb.cbFile || pci->attrFile != ffb.attrFile || 514 pci->easize != CBLIST_TO_EASIZE(ffb.cbList) || 515 pci->date.day != ffb.fdateLastWrite.day || 516 pci->date.month != ffb.fdateLastWrite.month || 517 pci->date.year != ffb.fdateLastWrite.year + 1980 || 518 pci->time.seconds != ffb.ftimeLastWrite.twosecs * 2 || 519 pci->time.minutes != ffb.ftimeLastWrite.minutes || 520 pci->time.hours != ffb.ftimeLastWrite.hours || 521 pci->ladate.day != ffb.fdateLastAccess.day || 522 pci->ladate.month != ffb.fdateLastAccess.month || 523 pci->ladate.year != ffb.fdateLastAccess.year + 1980 || 524 pci->latime.seconds != ffb.ftimeLastAccess.twosecs * 2 || 525 pci->latime.minutes != ffb.ftimeLastAccess.minutes || 526 pci->latime.hours != ffb.ftimeLastAccess.hours) 527 { 528 /* changed; update */ 526 529 pciList[numlist++] = pci; 527 530 *ffb.achName = 0; … … 533 536 partial, 534 537 dcd); 535 if(IsRoot(pci->szFileName)) { 538 if (IsRoot(pci->szFileName)) 539 { 536 540 *pci->szFileName = toupper(*pci->szFileName); 537 if(isalpha(*pci->szFileName) && 538 toupper(*pci->szFileName) > 'B') { 539 if(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM) 541 if (isalpha(*pci->szFileName) && 542 toupper(*pci->szFileName) > 'B') 543 { 544 if (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM) 540 545 pci->rc.hptrIcon = hptrCDROM; 541 546 else … … 557 562 } 558 563 } 559 else { /* add record */ 564 else 565 { 566 /* add record */ 560 567 needtosort = TRUE; 561 if (dcd->type == DIR_FRAME) {562 568 if (dcd->type == DIR_FRAME) 569 { 563 570 RECORDINSERT ri; 564 ULONG totalbytes;571 ULONGLONG ullTotalBytes; 565 572 566 573 pci = WinSendMsg(hwndCnr, … … 568 575 MPFROMLONG(EXTRA_RECORD_BYTES), 569 576 MPFROMLONG(1L)); 570 if(pci) { 577 if (pci) 578 { 571 579 ret = TRUE; 572 580 *ffb.achName = 0; 573 totalbytes = FillInRecordFromFFB(hwndCnr,574 pci,575 filename[x],576 &ffb,577 partial,578 dcd);581 ullTotalBytes = FillInRecordFromFFB(hwndCnr, 582 pci, 583 filename[x], 584 &ffb, 585 partial, 586 dcd); 579 587 if(strlen(pci->szFileName) < 4) { 580 588 *pci->szFileName = toupper(*pci->szFileName); … … 601 609 ri.cRecordsInsert = 1L; 602 610 ri.fInvalidateRecord = FALSE; 603 if(WinSendMsg(hwndCnr, 604 CM_INSERTRECORD, 605 MPFROMP(pci), 606 MPFROMP(&ri))) { 607 if (totalbytes != -1 && 608 totalbytes) 611 if (WinSendMsg(hwndCnr, 612 CM_INSERTRECORD, 613 MPFROMP(pci), 614 MPFROMP(&ri))) 609 615 { 610 dcd->totalbytes += totalbytes;611 if (dcd->totalbytes == -1) 612 dcd->totalbytes--; // fixme for real someday616 if (ullTotalBytes) 617 { 618 dcd->ullTotalBytes += ullTotalBytes; 613 619 numremain++; 614 620 } … … 624 630 } 625 631 } 626 else if(ffb.attrFile & FILE_DIRECTORY) { /* check all parts and insert as required */ 627 632 else if (ffb.attrFile & FILE_DIRECTORY) 633 { 634 /* check all parts and insert as required */ 628 635 CHAR *p,temp; 629 636 PCNRITEM pciParent = NULL,pciT; … … 650 657 651 658 RECORDINSERT ri; 652 ULONG totalbytes;659 ULONGLONG ullTotalBytes; 653 660 654 661 ret = TRUE; 655 662 *ffb.achName = 0; 656 totalbytes = FillInRecordFromFFB(hwndCnr,657 pci,658 filename[x],659 &ffb,660 partial,661 dcd);663 ullTotalBytes = FillInRecordFromFFB(hwndCnr, 664 pci, 665 filename[x], 666 &ffb, 667 partial, 668 dcd); 662 669 if(strlen(pci->szFileName) < 4) { 663 670 *pci->szFileName = toupper(*pci->szFileName); … … 688 695 MPFROMP(pci), 689 696 MPFROMP(&ri))) { 690 if (totalbytes != -1 && 691 totalbytes) 697 if (ullTotalBytes) 692 698 { 693 699 numremain++; 694 if(dcd->type == DIR_FRAME) { 695 dcd->totalbytes += totalbytes; 696 if (dcd->totalbytes == -1) 697 dcd->totalbytes--; // fixme for real someday 698 } 700 if (dcd->type == DIR_FRAME) 701 dcd->ullTotalBytes += ullTotalBytes; 699 702 } 700 703 repos = TRUE; … … 721 724 722 725 RECORDINSERT ri; 723 ULONG totalbytes; 726 ULONG ullTotalBytes; 727 BOOL rc; 724 728 725 729 ret = TRUE; 726 730 *ffb.achName = 0; 727 totalbytes = FillInRecordFromFFB(hwndCnr,728 pci,729 filename[x],730 &ffb,731 partial,732 dcd);731 ullTotalBytes = FillInRecordFromFFB(hwndCnr, 732 pci, 733 filename[x], 734 &ffb, 735 partial, 736 dcd); 733 737 if(strlen(pci->szFileName) < 4) { 734 738 *pci->szFileName = toupper(*pci->szFileName); … … 759 763 MPFROMP(pci), 760 764 MPFROMP(&ri))) { 761 if (totalbytes != -1 && 762 totalbytes) 765 if (ullTotalBytes) 763 766 { 764 767 numremain++; 765 if (dcd->type == DIR_FRAME) { 766 dcd->totalbytes += totalbytes; 767 if (dcd->totalbytes == -1) 768 dcd->totalbytes--; // fixme for real someday 769 } 768 if (dcd->type == DIR_FRAME) 769 dcd->ullTotalBytes += ullTotalBytes; 770 770 } 771 771 repos = TRUE; … … 782 782 } 783 783 } 784 else if((pci = FindCnrRecord(hwndCnr, 785 filename[x], 786 (PCNRITEM)NULL, 787 partial, 788 FALSE, 789 TRUE)) != NULL && 790 (INT)pci != -1 && !IsRoot(pci->szFileName)) { 784 else if ((pci = FindCnrRecord(hwndCnr, 785 filename[x], 786 (PCNRITEM)NULL, 787 partial, 788 FALSE, 789 TRUE)) != NULL && 790 (INT)pci != -1 && 791 !IsRoot(pci->szFileName)) 792 { 791 793 /* file doesn't exist; delete record */ 792 794 if(pci->rc.flRecordAttr & CRA_SELECTED) … … 796 798 MPFROM2SHORT(FALSE, 797 799 CRA_SELECTED)); 798 if(dcd->type == DIR_FRAME) 799 dcd->totalbytes -= (pci->cbFile + pci->easize); 800 if(WinSendMsg(hwndCnr, 801 CM_REMOVERECORD, 802 MPFROMP(&pci), 803 MPFROM2SHORT(1, 804 CMA_FREE | 805 ((numremain == 1) ? 806 CMA_INVALIDATE : 0)))) { 800 if (dcd->type == DIR_FRAME) 801 dcd->ullTotalBytes -= (pci->cbFile + pci->easize); 802 if (WinSendMsg(hwndCnr, 803 CM_REMOVERECORD, 804 MPFROMP(&pci), 805 MPFROM2SHORT(1, CMA_FREE | (numremain == 1 ? CMA_INVALIDATE : 0)))) 806 { 807 807 numremain--; 808 808 repos = TRUE; … … 810 810 } 811 811 } 812 if (repos || (pciList && numlist)) {813 812 if (repos || (pciList && numlist)) 813 { 814 814 QUERYRECORDRECT qrr; 815 815 RECTL rCnr,rCItem; … … 819 819 MPFROMLONG(CMA_FIRST), 820 820 MPFROMLONG(CRA_CURSORED)); 821 if(pci && (INT)pci != -1) { 821 if (pci && (INT)pci != -1) 822 { 822 823 memset(&qrr, 0, sizeof(QUERYRECORDRECT)); 823 824 qrr.cb = sizeof(QUERYRECORDRECT); … … 832 833 } 833 834 if(pciList && numlist && !repos) 835 { 834 836 WinSendMsg(hwndCnr, 835 837 CM_INVALIDATERECORD, 836 838 MPFROMP(pciList), 837 MPFROM2SHORT(numlist,((repos) ? 838 CMA_NOREPOSITION : 839 CMA_REPOSITION | CMA_ERASE))); 840 if(repos) 839 MPFROM2SHORT(numlist, 840 (repos ? CMA_NOREPOSITION : 841 CMA_REPOSITION | CMA_ERASE))); 842 } 843 if (repos) 841 844 WinSendMsg(hwndCnr, 842 845 CM_INVALIDATERECORD, … … 866 869 return ret; 867 870 } 868
Note:
See TracChangeset
for help on using the changeset viewer.