Changeset 1564 for trunk/dll/grep.c
- Timestamp:
- May 30, 2011, 10:05:56 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/grep.c
r1544 r1564 36 36 Mostly cast CHAR CONSTANT * as CHAR *. 37 37 29 May 10 GKY Suppress ERROR_FILENAME_EXCED_RANGE error because of problem with NTFS 38 30 May 11 GKY Fixed potential trap caused by passing a nonexistant pci to FillInRecordFromFFB 39 in DoInsertion because pci is limited to 65535 files. (nRecord is a USHORT) 40 SHL's single loop fix. 38 41 39 42 ***********************************************************************/ … … 43 46 #include <ctype.h> 44 47 #include <share.h> 48 #include <limits.h> 45 49 46 50 #define INCL_DOS … … 718 722 PCNRITEM pci, pciFirst; 719 723 UINT x; 724 ULONG ulRecsToInsert; 720 725 721 726 if (!grep || !grep->toinsert || !grep->insertffb || !grep->dir) 722 727 return FALSE; 723 728 724 pci = WinSendMsg(grep->hwndFiles, 725 CM_ALLOCRECORD, 726 MPFROMLONG(EXTRA_RECORD_BYTES), 727 MPFROMLONG(grep->toinsert)); 728 if (!pci) { 729 Win_Error(grep->hwndFiles, grep->hwndFiles, pszSrcFile, __LINE__, 730 PCSZ_CM_ALLOCRECORD); 731 } 732 else { 733 if (grep->sayfiles) { 734 if (!hwndStatus) 735 WinSetWindowText(grep->hwndCurFile, (CHAR *) GetPString(IDS_GREPINSERTINGTEXT)); 729 pci = NULL; 730 dcd = INSTDATA(grep->hwndFiles); 731 for (x = 0; grep->insertffb[x]; x++) { 732 if (pci == NULL) { 733 ulRecsToInsert = grep->toinsert - x < USHRT_MAX ? grep->toinsert - x : USHRT_MAX; 734 pciFirst = WinSendMsg(grep->hwndFiles, CM_ALLOCRECORD, 735 MPFROMLONG(EXTRA_RECORD_BYTES), 736 MPFROMLONG(ulRecsToInsert)); 737 if (!pciFirst) { 738 Win_Error(grep->hwndFiles, grep->hwndFiles, pszSrcFile, __LINE__, 739 PCSZ_CM_ALLOCRECORD); 740 freegreplist(grep); 741 return FALSE; 742 } 736 743 else { 737 if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles) 738 WinSetWindowText(hwndStatus, (CHAR *) GetPString(IDS_GREPINSERTINGTEXT)); 744 pci = pciFirst; 745 if (grep->sayfiles) { 746 if (!hwndStatus) 747 WinSetWindowText(grep->hwndCurFile, (CHAR *) GetPString(IDS_GREPINSERTINGTEXT)); 748 else { 749 if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles) 750 WinSetWindowText(hwndStatus, (CHAR *) GetPString(IDS_GREPINSERTINGTEXT)); 751 } 752 } 739 753 } 740 754 } 741 pciFirst = pci; 742 dcd = INSTDATA(grep->hwndFiles); 743 for (x = 0; grep->insertffb[x]; x++) { 744 FillInRecordFromFFB(grep->hwndFiles, 745 pci, grep->dir[x], grep->insertffb[x], FALSE, dcd); 746 pci = (PCNRITEM) pci->rc.preccNextRecord; 747 SleepIfNeeded(pitdSleep, 1); 748 } // for 749 memset(&ri, 0, sizeof(RECORDINSERT)); 750 ri.cb = sizeof(RECORDINSERT); 751 ri.pRecordOrder = (PRECORDCORE) CMA_END; 752 ri.pRecordParent = (PRECORDCORE) NULL; 753 ri.zOrder = (USHORT) CMA_TOP; 754 ri.cRecordsInsert = grep->toinsert; 755 ri.fInvalidateRecord = TRUE; 756 WinSendMsg(grep->hwndFiles, 757 CM_INSERTRECORD, MPFROMP(pciFirst), MPFROMP(&ri)); 758 if (dcd) { 759 //DosEnterCritSec(); //GKY 11-29-08 760 DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT); 761 dcd->ullTotalBytes += grep->insertedbytes; 762 DosReleaseMutexSem(hmtxFM2Globals); 763 //DosExitCritSec(); 755 FillInRecordFromFFB(grep->hwndFiles, 756 pci, grep->dir[x], grep->insertffb[x], FALSE, dcd); 757 pci = (PCNRITEM) pci->rc.preccNextRecord; 758 //SleepIfNeeded(pitdSleep, 1); 759 if (pci == NULL && ulRecsToInsert) { 760 memset(&ri, 0, sizeof(RECORDINSERT)); 761 ri.cb = sizeof(RECORDINSERT); 762 ri.pRecordOrder = (PRECORDCORE) CMA_END; 763 ri.pRecordParent = (PRECORDCORE) NULL; 764 ri.zOrder = (USHORT) CMA_TOP; 765 ri.cRecordsInsert = ulRecsToInsert; 766 ri.fInvalidateRecord = TRUE; 767 WinSendMsg(grep->hwndFiles, 768 CM_INSERTRECORD, MPFROMP(pciFirst), MPFROMP(&ri)); 769 if (dcd) { 770 DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT); 771 dcd->ullTotalBytes += grep->insertedbytes; 772 DosReleaseMutexSem(hmtxFM2Globals); 773 } 774 pciFirst = NULL; 764 775 } 765 776 SleepIfNeeded(pitdSleep, 1); 777 }//for 766 778 // if (grep->toinsert == FilesToGet) // 07 Feb 08 SHL 767 779 // DosSleep(0); //26 Aug 07 GKY 1 // 07 Feb 08 SHL … … 769 781 PostMsg(grep->hwndFiles, UM_RESCAN, MPVOID, MPVOID); 770 782 return TRUE; 771 }772 freegreplist(grep);773 return FALSE;774 783 } 775 784
Note:
See TracChangeset
for help on using the changeset viewer.