Changeset 362
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/comp.c
r316 r362 16 16 25 May 05 SHL Rework with ULONGLONG 17 17 06 Jun 05 SHL Drop unused 18 12 Jul 06 SHL Renames and comments 18 12 Jul 06 SHL Renames and comments 19 13 Jul 06 SHL Use Runtime_Error 19 20 20 21 ***********************************************************************/ … … 49 50 } SNAPSTUFF; 50 51 52 static PSZ pszSrcFile = __FILE__; 53 51 54 //=== SnapShot() Write directory tree to file and recurse if requested === 52 55 … … 58 61 ULONG nm = 1L; 59 62 60 fb = malloc(sizeof(FILEFINDBUF4));63 fb = xmalloc(sizeof(FILEFINDBUF4),pszSrcFile,__LINE__); 61 64 if(fb) { 62 mask = malloc(CCHMAXPATH);65 mask = xmalloc(CCHMAXPATH,pszSrcFile,__LINE__); 63 66 if(mask) { 64 67 sprintf(mask, … … 127 130 p++; 128 131 } 129 fp = fopen(sf->filename,"w");130 if (fp) {132 fp = xfopen(sf->filename,"w",pszSrcFile,__LINE__); 133 if (fp) { 131 134 fprintf(fp,"\"%s\"\n",sf->dirname); 132 135 SnapShot(sf->dirname,fp,sf->recurse); … … 178 181 AddToListboxBottom(fc.hwndList,s); 179 182 fp1 = _fsopen(fc.file1,"rb",SH_DENYNO); 180 if(fp1) { 183 if (!fp1) { 184 sprintf(s,GetPString(IDS_COMPCANTOPENTEXT),fc.file1); 185 AddToListboxBottom(fc.hwndList,s); 186 WinSetWindowText(fc.hwndHelp,GetPString(IDS_ERRORTEXT)); 187 } 188 else { 181 189 fp2 = _fsopen(fc.file2,"rb",SH_DENYNO); 182 if(fp2) { 190 if (!fp2) { 191 sprintf(s,GetPString(IDS_COMPCANTOPENTEXT),fc.file2); 192 AddToListboxBottom(fc.hwndList,s); 193 WinSetWindowText(fc.hwndHelp,GetPString(IDS_ERRORTEXT)); 194 } 195 else { 183 196 len1 = filelength(fileno(fp1)); 184 197 len2 = filelength(fileno(fp2)); … … 246 259 fclose(fp2); 247 260 } 248 else {249 sprintf(s,GetPString(IDS_COMPCANTOPENTEXT),fc.file2);250 AddToListboxBottom(fc.hwndList,s);251 WinSetWindowText(fc.hwndHelp,GetPString(IDS_ERRORTEXT));252 }253 261 fclose(fp1); 254 }255 else {256 sprintf(s,GetPString(IDS_COMPCANTOPENTEXT),fc.file1);257 AddToListboxBottom(fc.hwndList,s);258 WinSetWindowText(fc.hwndHelp,GetPString(IDS_ERRORTEXT));259 262 } 260 263 WinDestroyMsgQueue(hmq2); … … 294 297 break; 295 298 } 296 if(_beginthread(CompareFilesThread, 297 NULL, 298 65536, 299 (PVOID)fc) == -1) { 300 Win_Error(hwnd,hwnd,__FILE__,__LINE__, 301 GetPString(IDS_CANTCOMPARETEXT)); 299 if (_beginthread(CompareFilesThread,NULL,65536,(PVOID)fc) == -1) { 300 Runtime_Error(pszSrcFile, __LINE__, GetPString(IDS_COULDNTSTARTTHREADTEXT)); 302 301 WinDismissDlg(hwnd,0); 303 302 } … … 392 391 break; 393 392 default: 394 DosBeep(250,100);393 Runtime_Error(pszSrcFile, __LINE__, "bad case %u", cmp->action); 395 394 goto Abort; 396 395 } … … 493 492 MPFROM2SHORT(1,CMA_ERASE | CMA_TEXTCHANGED)); 494 493 } 495 else if (rc) {494 else if (rc) { 496 495 rc = Dos_Error(MB_ENTERCANCEL, 497 496 rc, 498 497 HWND_DESKTOP, 499 __FILE__,498 pszSrcFile, 500 499 __LINE__, 501 500 GetPString(IDS_COMPMOVEFAILEDTEXT), … … 527 526 } 528 527 rc = docopyf(COPY,pci->szFileName,"%s",newname); 529 if(!rc) { 528 if (rc) { 529 rc = Dos_Error(MB_ENTERCANCEL, 530 rc, 531 HWND_DESKTOP, 532 pszSrcFile, 533 __LINE__, 534 GetPString(IDS_COMPCOPYFAILEDTEXT), 535 pci->szFileName, 536 newname); 537 if(rc == MBID_CANCEL) 538 pcin = NULL; /* cause loop to break */ 539 } 540 else { 530 541 WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pci), 531 542 MPFROM2SHORT(FALSE,CRA_SELECTED)); … … 562 573 MPFROM2SHORT(1,CMA_ERASE | CMA_TEXTCHANGED)); 563 574 } 564 else {565 rc = Dos_Error(MB_ENTERCANCEL,566 rc,567 HWND_DESKTOP,568 __FILE__,569 __LINE__,570 GetPString(IDS_COMPCOPYFAILEDTEXT),571 pci->szFileName,572 newname);573 if(rc == MBID_CANCEL) /* cause loop to break */574 pcin = NULL;575 }576 575 break; 577 576 … … 654 653 if(!recurse) 655 654 ulM = 128; 656 maskstr = malloc(CCHMAXPATH);655 maskstr = xmalloc(CCHMAXPATH,pszSrcFile,__LINE__); 657 656 if(!maskstr) 658 657 return; 659 ffb4 = malloc(sizeof(FILEFINDBUF4) * ulM);658 ffb4 = xmalloc(sizeof(FILEFINDBUF4) * ulM,pszSrcFile,__LINE__); 660 659 if(!ffb4) { 661 660 free(maskstr); … … 750 749 751 750 hab = WinInitialize(0); 752 if(hab) { 751 if(!hab) 752 Win_Error(NULLHANDLE,NULLHANDLE,pszSrcFile,__LINE__,"WinInitialize"); 753 else { 753 754 hmq = WinCreateMsgQueue(hab,0); 754 if(hmq) { 755 755 if(!hmq) 756 Win_Error(NULLHANDLE,NULLHANDLE,pszSrcFile,__LINE__,"WinCreateMsgQueue"); 757 else { 756 758 INT x; 757 759 INT l; … … 821 823 memset(&fb4,0,sizeof(fb4)); 822 824 fp = fopen(cmp->rightlist,"r"); 823 if(fp) { 825 if(!fp) 826 Runtime_Error(pszSrcFile, __LINE__, "can not open %s (%d)", cmp->rightlist, errno); 827 else { 824 828 while(!feof(fp)) { 825 829 /* first get name of directory */ … … 944 948 fclose(fp); 945 949 } 946 else947 DosBeep(50,100);948 950 } // if snapshot file 949 951 … … 982 984 MPFROMLONG(EXTRA_RECORD_BYTES2), 983 985 MPFROMLONG(recsNeeded)); 984 if(!pcilFirst) { 986 if (!pcilFirst) { 987 Runtime_Error(pszSrcFile, __LINE__, "CM_ALLOCRECORD %u failed", recsNeeded); 985 988 recsNeeded = 0; 986 DosBeep(100,100);987 989 } 988 990 } 989 if (recsNeeded) {991 if (recsNeeded) { 990 992 pcirFirst = WinSendMsg(hwndRight,CM_ALLOCRECORD, 991 993 MPFROMLONG(EXTRA_RECORD_BYTES2), 992 994 MPFROMLONG(recsNeeded)); 993 if(!pcirFirst) { 995 if (!pcirFirst) { 996 Runtime_Error(pszSrcFile, __LINE__, "CM_ALLOCRECORD %u failed", recsNeeded); 994 997 recsNeeded = 0; 995 DosBeep(100,100);996 998 pcil = pcilFirst; 997 999 while(pcil) { … … 1003 1005 } 1004 1006 } 1005 if (recsNeeded) {1007 if (recsNeeded) { 1006 1008 pcil = pcilFirst; 1007 1009 pcir = pcirFirst; … … 1058 1060 pcil->crtime.minutes = filesl[l]->crtime.minutes; 1059 1061 pcil->crtime.hours = filesl[l]->crtime.hours; 1060 if (*cmp->dcd.mask.szMask) {1062 if (*cmp->dcd.mask.szMask) { 1061 1063 if(!Filter((PMINIRECORDCORE)pcil,(PVOID)&cmp->dcd.mask)) { 1062 1064 pcil->rc.flRecordAttr |= CRA_FILTERED; … … 1194 1196 pcil->crtime.minutes = filesl[l]->crtime.minutes; 1195 1197 pcil->crtime.hours = filesl[l]->crtime.hours; 1196 if (*cmp->dcd.mask.szMask) {1197 if (!Filter((PMINIRECORDCORE)pcil,(PVOID)&cmp->dcd.mask)) {1198 if (*cmp->dcd.mask.szMask) { 1199 if (!Filter((PMINIRECORDCORE)pcil,(PVOID)&cmp->dcd.mask)) { 1198 1200 pcil->rc.flRecordAttr |= CRA_FILTERED; 1199 1201 pcir->rc.flRecordAttr |= CRA_FILTERED; … … 1212 1214 // pcir->rc.hptrIcon = hptrFile; 1213 1215 y = 0; 1214 for (x = 0;x < 6;x++)1215 if (attrstring[x])1216 for (x = 0;x < 6;x++) { 1217 if (attrstring[x]) 1216 1218 pcir->szDispAttr[y++] = (CHAR)((pcir->attrFile & (1 << x)) ? 1217 1219 attrstring[x] : '-'); 1220 } 1218 1221 pcir->szDispAttr[5] = 0; 1219 1222 pcir->cbFile = filesr[r]->cbFile; … … 1300 1303 // pcir->rc.hptrIcon = hptrFile; 1301 1304 y = 0; 1302 for (x = 0;x < 6;x++)1305 for (x = 0;x < 6;x++) { 1303 1306 if(attrstring[x]) 1304 1307 pcir->szDispAttr[y++] = (CHAR)((pcir->attrFile & (1 << x)) ? 1305 1308 attrstring[x] : '-'); 1309 } 1306 1310 pcir->szDispAttr[5] = 0; 1307 1311 pcir->cbFile = filesr[r]->cbFile; … … 1325 1329 pcir->crtime.minutes = filesr[r]->crtime.minutes; 1326 1330 pcir->crtime.hours = filesr[r]->crtime.hours; 1327 if (*cmp->dcd.mask.szMask) {1328 if (!Filter((PMINIRECORDCORE)pcir,(PVOID)&cmp->dcd.mask)) {1331 if (*cmp->dcd.mask.szMask) { 1332 if (!Filter((PMINIRECORDCORE)pcir,(PVOID)&cmp->dcd.mask)) { 1329 1333 pcir->rc.flRecordAttr |= CRA_FILTERED; 1330 1334 pcil->rc.flRecordAttr |= CRA_FILTERED; … … 1357 1361 ri.cRecordsInsert = recsNeeded; 1358 1362 ri.fInvalidateRecord = FALSE; 1359 if (!WinSendMsg(hwndLeft,CM_INSERTRECORD,1363 if (!WinSendMsg(hwndLeft,CM_INSERTRECORD, 1360 1364 MPFROMP(pcilFirst),MPFROMP(&ri))) { 1361 1365 pcil = pcilFirst; 1362 while (pcil) {1366 while (pcil) { 1363 1367 pcit = (PCNRITEM)pcil->rc.preccNextRecord; 1364 1368 WinSendMsg(hwndLeft,CM_FREERECORD, … … 1375 1379 ri.cRecordsInsert = recsNeeded; 1376 1380 ri.fInvalidateRecord = FALSE; 1377 if (!WinSendMsg(hwndRight,CM_INSERTRECORD,1381 if (!WinSendMsg(hwndRight,CM_INSERTRECORD, 1378 1382 MPFROMP(pcirFirst),MPFROMP(&ri))) { 1379 1383 WinSendMsg(hwndLeft,CM_REMOVERECORD, 1380 1384 MPVOID,MPFROM2SHORT(0,CMA_FREE | CMA_INVALIDATE)); 1381 1385 pcir = pcirFirst; 1382 while (pcir) {1386 while (pcir) { 1383 1387 pcit = (PCNRITEM)pcir->rc.preccNextRecord; 1384 1388 WinSendMsg(hwndRight,CM_FREERECORD, … … 1393 1397 Deselect(hwndLeft); 1394 1398 Deselect(hwndRight); 1395 if (!PostMsg(cmp->hwnd,UM_CONTAINER_FILLED,MPVOID,MPVOID))1396 WinSendMsg (cmp->hwnd,UM_CONTAINER_FILLED,MPVOID,MPVOID);1399 if (!PostMsg(cmp->hwnd,UM_CONTAINER_FILLED,MPVOID,MPVOID)) 1400 WinSendMsg (cmp->hwnd,UM_CONTAINER_FILLED,MPVOID,MPVOID); 1397 1401 notified = TRUE; 1398 if (filesl)1402 if (filesl) 1399 1403 FreeList((CHAR **)filesl); // Must have failed to create container 1400 if (filesr)1404 if (filesr) 1401 1405 FreeList((CHAR **)filesr); 1402 1406 WinDestroyMsgQueue(hmq); 1403 1407 } 1404 else1405 DosBeep(250,100);1406 1408 WinTerminate(hab); 1407 1409 } 1408 else 1409 DosBeep(50,100); 1410 if(!notified) 1410 if (!notified) 1411 1411 PostMsg(cmp->hwnd,UM_CONTAINER_FILLED,MPVOID,MPVOID); 1412 1412 free(cmp); … … 1422 1422 { 1423 1423 COMPARE *cmp; 1424 1424 1425 static HPOINTER hptr = (HPOINTER)0; 1425 1426 … … 1427 1428 case WM_INITDLG: 1428 1429 cmp = (COMPARE *)mp2; 1429 if(cmp) { 1430 if(!hptr) 1430 if (!cmp) { 1431 Runtime_Error(pszSrcFile, __LINE__, "no data"); 1432 WinDismissDlg(hwnd,0); 1433 } 1434 else { 1435 if (!hptr) 1431 1436 hptr = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,COMPARE_ICON); 1432 1437 WinDefDlgProc(hwnd,WM_SETICON,MPFROMLONG(hptr),MPVOID); 1433 1438 cmp->hwnd = hwnd; 1434 WinSetWindowPtr(hwnd, 0,(PVOID)cmp);1439 WinSetWindowPtr(hwnd,QWL_USER,(PVOID)cmp); 1435 1440 SetCnrCols(hwndLeft,TRUE); 1436 1441 SetCnrCols(hwndRight,TRUE); … … 1452 1457 } 1453 1458 } 1454 else1455 WinDismissDlg(hwnd,0);1456 1459 break; 1457 1460 … … 1640 1643 case UM_CONTAINER_FILLED: 1641 1644 cmp = INSTDATA(hwnd); 1642 if(cmp) { 1645 if (!cmp) { 1646 Runtime_Error(pszSrcFile, __LINE__, "pCompare NULL"); 1647 WinDismissDlg(hwnd,0); 1648 } 1649 else { 1643 1650 cmp->filling = FALSE; 1644 1651 WinEnableWindow(hwndLeft,TRUE); … … 1646 1653 WinEnableWindowUpdate(hwndLeft,TRUE); 1647 1654 WinEnableWindowUpdate(hwndRight,TRUE); 1648 // if(!mp1) {1649 1655 { 1650 1656 CHAR s[81]; … … 1697 1703 GetPString(IDS_COMPREADYTEXT)); 1698 1704 } 1699 else {1700 DosBeep(50,100);1701 WinDismissDlg(hwnd,0);1702 }1703 1705 break; 1704 1706 … … 1840 1842 break; 1841 1843 1844 // fixme to be gone - field edits not allowed 1842 1845 case CN_BEGINEDIT: 1843 1846 { … … 1845 1848 PCNRITEM pci = (PCNRITEM)((PCNREDITDATA)mp2)->pRecord; 1846 1849 1847 if (pfi || pci) {1850 if (pfi || pci) { 1848 1851 PostMsg(hwnd, 1849 1852 CM_CLOSEEDIT, 1850 1853 MPVOID, 1851 1854 MPVOID); 1852 DosBeep(250,100); 1855 // DosBeep(250,100); // fixme 1856 Runtime_Error(pszSrcFile, __LINE__, "CN_BEGINEDIT unexpected"); 1853 1857 } 1854 1858 } 1855 1859 break; 1856 1860 1861 // fixme to be gone - field edits not allowed 1857 1862 case CN_REALLOCPSZ: 1858 1863 cmp = INSTDATA(hwnd); 1859 if(cmp) { 1860 1864 if (!cmp) 1865 Runtime_Error(pszSrcFile, __LINE__, "no data"); 1866 else { 1861 1867 PFIELDINFO pfi = ((PCNREDITDATA)mp2)->pFieldInfo; 1862 1868 PCNRITEM pci = (PCNRITEM)((PCNREDITDATA)mp2)->pRecord; … … 1864 1870 CHAR szData[CCHMAXPATH],testname[CCHMAXPATH],*p; 1865 1871 1866 if(!pci && !pfi) { 1872 Runtime_Error(pszSrcFile, __LINE__, "CN_REALLOCPSZ unexpected"); 1873 if (!pci && !pfi) { 1867 1874 hwndMLE = WinWindowFromID(WinWindowFromID(hwnd, 1868 1875 SHORT1FROMMP(mp1)),CID_MLE); … … 1871 1878 szData); 1872 1879 p = strchr(szData,'\n'); 1873 if (p)1880 if (p) 1874 1881 *p = 0; 1875 1882 p = strchr(szData,'\r'); 1876 if (p)1883 if (p) 1877 1884 *p = 0; 1878 1885 bstrip(szData); 1879 if (*szData) {1880 if (!DosQueryPathInfo(szData,1886 if (*szData) { 1887 if (!DosQueryPathInfo(szData, 1881 1888 FIL_QUERYFULLNAME, 1882 1889 testname, 1883 1890 sizeof(testname))) { 1884 if (!SetDir(cmp->hwndParent,1891 if (!SetDir(cmp->hwndParent, 1885 1892 hwnd, 1886 1893 testname, 1887 1894 1)) { 1888 if (SHORT1FROMMP(mp1) == COMP_LEFTDIR)1895 if (SHORT1FROMMP(mp1) == COMP_LEFTDIR) 1889 1896 strcpy(cmp->leftdir,testname); 1890 1897 else { … … 2005 2012 MPFROMLONG(CMA_CNRTITLE | CMA_FLWINDOWATTR)); 2006 2013 cmp->filling = TRUE; 2007 forthread = malloc(sizeof(COMPARE)); 2008 if(forthread) { 2014 forthread = xmalloc(sizeof(COMPARE),pszSrcFile,__LINE__); 2015 if(!forthread) 2016 WinDismissDlg(hwnd,0); 2017 else { 2009 2018 *forthread = *cmp; 2010 2019 forthread->cmp = cmp; 2011 if(_beginthread(FillCnrsThread,NULL,122880,(PVOID)forthread) != -1) { 2020 if (_beginthread(FillCnrsThread,NULL,122880,(PVOID)forthread) == -1) { 2021 Runtime_Error(pszSrcFile, __LINE__, GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2022 WinDismissDlg(hwnd,0); 2023 free(forthread); 2024 } 2025 else { 2012 2026 WinEnableWindowUpdate(hwndLeft,FALSE); 2013 2027 WinEnableWindowUpdate(hwndRight,FALSE); … … 2051 2065 WinEnableWindow(WinWindowFromID(hwnd,COMP_FILTER),FALSE); 2052 2066 } 2053 else {2054 DosBeep(250,100);2055 WinDismissDlg(hwnd,0);2056 free(forthread);2057 }2058 }2059 else {2060 DosBeep(250,100);2061 WinDismissDlg(hwnd,0);2062 2067 } 2063 2068 } … … 2280 2285 if(export_filename(HWND_DESKTOP,fullname,1) && *fullname && 2281 2286 !strchr(fullname,'*') && !strchr(fullname,'?')) { 2282 sf = malloc(sizeof(SNAPSTUFF)); 2283 if(sf) { 2284 memset(sf,0,sizeof(SNAPSTUFF)); 2287 sf = xmallocz(sizeof(SNAPSTUFF),pszSrcFile,__LINE__); 2288 if (sf) { 2285 2289 strcpy(sf->filename,fullname); 2286 2290 if(hwndLeft == cmp->hwndCalling) … … 2289 2293 strcpy(sf->dirname,cmp->rightdir); 2290 2294 sf->recurse = cmp->includesubdirs; 2291 if(_beginthread(StartSnap,NULL,65536,(PVOID)sf) == -1) { 2295 if (_beginthread(StartSnap,NULL,65536,(PVOID)sf) == -1) { 2296 Runtime_Error(pszSrcFile, __LINE__, GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2292 2297 free(sf); 2293 DosBeep(50,100);2294 2298 } 2295 2299 } … … 2334 2338 2335 2339 cmp->filling = TRUE; 2336 forthread = malloc(sizeof(COMPARE));2337 if (forthread) {2340 forthread = xmalloc(sizeof(COMPARE),pszSrcFile,__LINE__); 2341 if (forthread) { 2338 2342 *forthread = *cmp; 2339 2343 forthread->cmp = cmp; 2340 2344 forthread->action = SHORT1FROMMP(mp1); 2341 if(_beginthread(ActionCnrThread,NULL,122880,(PVOID)forthread) != -1) { 2345 if (_beginthread(ActionCnrThread,NULL,122880,(PVOID)forthread) == -1) { 2346 Runtime_Error(pszSrcFile, __LINE__, GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2347 free(forthread); 2348 } 2349 else { 2342 2350 WinEnableWindowUpdate(hwndLeft,FALSE); 2343 2351 WinEnableWindowUpdate(hwndRight,FALSE); … … 2395 2403 WinEnableWindow(WinWindowFromID(hwnd,COMP_FILTER),FALSE); 2396 2404 } 2397 else {2398 DosBeep(250,100);2399 free(forthread);2400 }2401 2405 } 2402 else2403 DosBeep(250,100);2404 2406 } 2405 2407 break; … … 2437 2439 case IDM_INVERT: 2438 2440 cmp = INSTDATA(hwnd); 2439 if(cmp) { 2440 2441 if (!cmp) 2442 Runtime_Error(pszSrcFile, __LINE__, "no data"); 2443 else { 2441 2444 COMPARE *forthread; 2442 2445 2443 2446 cmp->filling = TRUE; 2444 forthread = malloc(sizeof(COMPARE));2445 if (forthread) {2447 forthread = xmalloc(sizeof(COMPARE),pszSrcFile,__LINE__); 2448 if (forthread) { 2446 2449 *forthread = *cmp; 2447 2450 forthread->cmp = cmp; 2448 2451 forthread->action = SHORT1FROMMP(mp1); 2449 if(_beginthread(SelectCnrsThread,NULL,65536,(PVOID)forthread) != -1) { 2452 if (_beginthread(SelectCnrsThread,NULL,65536,(PVOID)forthread) == -1) { 2453 Runtime_Error(pszSrcFile, __LINE__, GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2454 free(forthread); 2455 } 2456 else { 2450 2457 WinEnableWindowUpdate(hwndLeft,FALSE); 2451 2458 WinEnableWindowUpdate(hwndRight,FALSE); … … 2502 2509 WinEnableWindow(WinWindowFromID(hwnd,COMP_FILTER),FALSE); 2503 2510 } 2504 else {2505 DosBeep(250,100);2506 free(forthread);2507 }2508 2511 } 2509 else2510 DosBeep(250,100);2511 2512 } 2512 2513 break; -
trunk/dll/select.c
r317 r362 3 3 4 4 $Id$ 5 6 Container item selection support routines 5 7 6 8 Copyright (c) 1993-98 M. Kimes … … 11 13 06 Jun 05 SHL Drop unused code 12 14 06 Jul 06 SHL Support compare content (IDM_SELECTSAMECONTENT) 15 13 Jul 06 SHL Use Runtime_Error 13 16 14 17 ***********************************************************************/ … … 32 35 #pragma alloc_text(SELECT1,Deselect,HideAll,RemoveAll,ExpandAll,InvertAll) 33 36 37 static PSZ pszSrcFile = __FILE__; 38 34 39 VOID UnHilite (HWND hwndCnr,BOOL all,CHAR ***list) 35 40 { … … 38 43 INT attribute = CRA_CURSORED; 39 44 40 if (all && list && *list) {45 if (all && list && *list) { 41 46 FreeList(*list); 42 47 *list = NULL; 43 48 } 44 49 pci = (PCNRITEM)CurrentRecord(hwndCnr); 45 if (pci && (INT)pci != -1) {46 if (pci->rc.flRecordAttr & CRA_SELECTED) {50 if (pci && (INT)pci != -1) { 51 if (pci->rc.flRecordAttr & CRA_SELECTED) { 47 52 attribute = CRA_SELECTED; 48 53 pci = WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS,MPFROMLONG(CMA_FIRST), 49 54 MPFROMSHORT(attribute)); 50 55 } 51 while (pci && (INT)pci != -1) {56 while (pci && (INT)pci != -1) { 52 57 WinSendMsg(hwndCnr,CM_SETRECORDEMPHASIS,MPFROMP(pci), 53 58 MPFROM2SHORT(FALSE,CRA_SELECTED)); 54 if (!all)59 if (!all) 55 60 break; 56 if (list)61 if (list) 57 62 AddToList(pci->szFileName,list,&numfiles,&numalloc); 58 63 pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS, … … 64 69 65 70 VOID SelectList (HWND hwndCnr,BOOL partial,BOOL deselect,BOOL clearfirst, 66 PCNRITEM pciParent,CHAR *filename,CHAR **list) { 71 PCNRITEM pciParent,CHAR *filename,CHAR **list) 72 { 67 73 68 74 PCNRITEM pci; … … 71 77 ULONG errs = 0L; 72 78 73 if (clearfirst && !deselect)79 if (clearfirst && !deselect) 74 80 UnHilite(hwndCnr,TRUE,NULL); 75 if (list && list[0]) {76 for (x = 0;list[x];x++) {81 if (list && list[0]) { 82 for (x = 0;list[x];x++) { 77 83 pci = FindCnrRecord(hwndCnr, 78 84 list[x], … … 81 87 partial, 82 88 TRUE); 83 if (pci) {89 if (pci) { 84 90 WinSendMsg(hwndCnr, 85 91 CM_SETRECORDEMPHASIS, … … 90 96 } 91 97 } 92 if (!foundone)93 DosBeep(250,50);94 } 95 else if (filename && *filename) {98 if (!foundone) 99 Runtime_Error(pszSrcFile, __LINE__, "select failed"); 100 } 101 else if (filename && *filename) { 96 102 97 103 FILE *fp; … … 99 105 100 106 fp = _fsopen(filename,"r",SH_DENYNO); 101 if (fp) {102 while (!feof(fp)) {103 if (!fgets(input,1024,fp))107 if (fp) { 108 while (!feof(fp)) { 109 if (!fgets(input,1024,fp)) 104 110 break; 105 111 input[1023] = 0; 106 112 bstripcr(input); 107 if (*input == '\"') {113 if (*input == '\"') { 108 114 memmove(input,input + 1,strlen(input) + 1); 109 115 lstrip(input); 110 116 p = strchr(input,'\"'); 111 if (p)117 if (p) 112 118 *p = 0; 113 119 rstrip(input); … … 115 121 else { 116 122 p = strchr(input,' '); 117 if (p)123 if (p) 118 124 *p = 0; 119 125 } … … 125 131 partial, 126 132 TRUE); 127 if (pci) /* found it? */133 if (pci) /* found it? */ 128 134 WinSendMsg(hwndCnr, 129 135 CM_SETRECORDEMPHASIS, … … 133 139 else 134 140 errs++; 135 if (errs > 50L) { /* prevent runaway on bad file */141 if (errs > 50L) { /* prevent runaway on bad file */ 136 142 137 143 APIRET ret; … … 142 148 GetPString(IDS_MAYNOTBELISTTEXT), 143 149 filename); 144 if (ret == MBID_NO)150 if (ret == MBID_NO) 145 151 break; 146 152 errs = 0L; … … 153 159 154 160 VOID SelectAll (HWND hwndCnr,BOOL files,BOOL dirs,CHAR *mask, 155 CHAR *text,BOOL arc) { 161 CHAR *text,BOOL is_arc) 162 { 156 163 157 164 PCNRITEM pci; … … 162 169 ULONG textlen = 0; 163 170 164 if (text)171 if (text) 165 172 textlen = strlen(text); 166 173 memset(&Mask,0,sizeof(Mask)); 167 if (mask && *mask)174 if (mask && *mask) 168 175 SetMask(mask,&Mask); 169 176 pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPVOID, 170 177 MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER)); 171 while ( pci && (INT)pci != -1 ) {178 while ( pci && (INT)pci != -1 ) { 172 179 markit = FALSE; 173 if (!(pci->rc.flRecordAttr & CRA_FILTERED)) {174 if (!arc) {175 if (files && !(pci->attrFile & FILE_DIRECTORY))180 if (!(pci->rc.flRecordAttr & CRA_FILTERED)) { 181 if (!is_arc) { 182 if (files && !(pci->attrFile & FILE_DIRECTORY)) 176 183 markit = TRUE; 177 if (dirs && (pci->attrFile & FILE_DIRECTORY))184 if (dirs && (pci->attrFile & FILE_DIRECTORY)) 178 185 markit = TRUE; 179 186 } 180 187 else 181 188 markit = TRUE; 182 if (mask && *mask && markit) {189 if (mask && *mask && markit) { 183 190 markit = FALSE; 184 191 file = strrchr(pci->szFileName,'\\'); 185 if (!file)192 if (!file) 186 193 file = strrchr(pci->szFileName,':'); 187 if (file)194 if (file) 188 195 file++; 189 196 else 190 197 file = pci->szFileName; 191 for (x = 0;Mask.pszMasks[x];x++) {192 if (*Mask.pszMasks[x]) {193 if (*Mask.pszMasks[x] != '/') {194 if (wildcard((strchr(Mask.pszMasks[x],'\\') ||198 for (x = 0;Mask.pszMasks[x];x++) { 199 if (*Mask.pszMasks[x]) { 200 if (*Mask.pszMasks[x] != '/') { 201 if (wildcard((strchr(Mask.pszMasks[x],'\\') || 195 202 strchr(Mask.pszMasks[x],':')) ? 196 203 pci->szFileName : file,Mask.pszMasks[x],FALSE)) … … 198 205 } 199 206 else { 200 if (wildcard((strchr(Mask.pszMasks[x],'\\') ||207 if (wildcard((strchr(Mask.pszMasks[x],'\\') || 201 208 strchr(Mask.pszMasks[x],':'),FALSE) ? 202 209 pci->szFileName : file,Mask.pszMasks[x] + 1, … … 210 217 } 211 218 } 212 if (markit && text && *text && !(pci->attrFile & FILE_DIRECTORY)) {219 if (markit && text && *text && !(pci->attrFile & FILE_DIRECTORY)) { 213 220 214 221 CHAR *input; 215 222 216 223 markit = FALSE; 217 input = malloc(65537); 218 if(input) { 219 224 input = xmalloc(65537,pszSrcFile,__LINE__); 225 if (input) { 220 226 ULONG pos; 221 227 LONG len; 222 228 FILE *inputFile; 223 229 224 if ((inputFile = _fsopen(pci->szFileName,"rb",SH_DENYNO)) != NULL) {230 if ((inputFile = _fsopen(pci->szFileName,"rb",SH_DENYNO)) != NULL) { 225 231 pos = ftell(inputFile); 226 while (!feof(inputFile)) {227 if (pos)232 while (!feof(inputFile)) { 233 if (pos) 228 234 fseek(inputFile,pos - 256,SEEK_SET); 229 235 len = fread(input,1,65536,inputFile); 230 if (len >= 0) {231 if (findstring(text,textlen,input,len,FALSE)) {236 if (len >= 0) { 237 if (findstring(text,textlen,input,len,FALSE)) { 232 238 markit = TRUE; 233 239 break; … … 243 249 } 244 250 } 245 else if (markit && text && *text && (pci->attrFile & FILE_DIRECTORY))251 else if (markit && text && *text && (pci->attrFile & FILE_DIRECTORY)) 246 252 markit = FALSE; 247 if (markit)253 if (markit) 248 254 WinSendMsg(hwndCnr,CM_SETRECORDEMPHASIS,MPFROMP(pci), 249 255 MPFROM2SHORT(TRUE,CRA_SELECTED)); … … 254 260 255 261 VOID DeselectAll (HWND hwndCnr,BOOL files,BOOL dirs,CHAR *mask,CHAR *text, 256 BOOL arc) {257 262 BOOL is_arc) 263 { 258 264 PCNRITEM pci; 259 265 BOOL unmarkit; … … 263 269 ULONG textlen = 0; 264 270 265 if (text)271 if (text) 266 272 textlen = strlen(text); 267 273 memset(&Mask,0,sizeof(Mask)); 268 if (mask && *mask)274 if (mask && *mask) 269 275 SetMask(mask,&Mask); 270 276 pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPVOID, 271 277 MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER)); 272 while ( pci && (INT)pci != -1 ) {278 while ( pci && (INT)pci != -1 ) { 273 279 unmarkit = FALSE; 274 if (!(pci->rc.flRecordAttr & CRA_FILTERED)) {275 if (!arc) {276 if (files && !(pci->attrFile & FILE_DIRECTORY))280 if (!(pci->rc.flRecordAttr & CRA_FILTERED)) { 281 if (!is_arc) { 282 if (files && !(pci->attrFile & FILE_DIRECTORY)) 277 283 unmarkit = TRUE; 278 if (dirs && (pci->attrFile & FILE_DIRECTORY))284 if (dirs && (pci->attrFile & FILE_DIRECTORY)) 279 285 unmarkit = TRUE; 280 286 } 281 287 else 282 288 unmarkit = TRUE; 283 if (mask && *mask && unmarkit) {289 if (mask && *mask && unmarkit) { 284 290 unmarkit = FALSE; 285 291 file = strrchr(pci->szFileName,'\\'); 286 if (!file)292 if (!file) 287 293 file = strrchr(pci->szFileName,':'); 288 if (file)294 if (file) 289 295 file++; 290 296 else 291 297 file = pci->szFileName; 292 for (x = 0;Mask.pszMasks[x];x++) {293 if (*Mask.pszMasks[x]) {294 if (*Mask.pszMasks[x] != '/') {295 if (wildcard((strchr(Mask.pszMasks[x],'\\') ||298 for (x = 0;Mask.pszMasks[x];x++) { 299 if (*Mask.pszMasks[x]) { 300 if (*Mask.pszMasks[x] != '/') { 301 if (wildcard((strchr(Mask.pszMasks[x],'\\') || 296 302 strchr(Mask.pszMasks[x],':')) ? 297 303 pci->szFileName : file,Mask.pszMasks[x],FALSE)) … … 299 305 } 300 306 else { 301 if (wildcard((strchr(Mask.pszMasks[x],'\\') ||307 if (wildcard((strchr(Mask.pszMasks[x],'\\') || 302 308 strchr(Mask.pszMasks[x],':')) ? 303 309 pci->szFileName : file,Mask.pszMasks[x] + 1, … … 311 317 } 312 318 } 313 if (unmarkit && text && *text && !(pci->attrFile & FILE_DIRECTORY)) {319 if (unmarkit && text && *text && !(pci->attrFile & FILE_DIRECTORY)) { 314 320 315 321 CHAR *input; 316 322 317 323 unmarkit = FALSE; 318 input = malloc(65537); 319 if(input) { 320 324 input = xmalloc(65537,pszSrcFile,__LINE__); 325 if (input) { 321 326 ULONG pos; 322 327 LONG len; 323 328 FILE *inputFile; 324 329 325 if ((inputFile = _fsopen(pci->szFileName,"rb",SH_DENYNO)) != NULL) {330 if ((inputFile = _fsopen(pci->szFileName,"rb",SH_DENYNO)) != NULL) { 326 331 pos = ftell(inputFile); 327 while (!feof(inputFile)) {328 if (pos)332 while (!feof(inputFile)) { 333 if (pos) 329 334 fseek(inputFile,pos - 256,SEEK_SET); 330 335 len = fread(input,1,65536,inputFile); 331 if (len >= 0) {332 if (findstring(text,textlen,input,len,FALSE)) {336 if (len >= 0) { 337 if (findstring(text,textlen,input,len,FALSE)) { 333 338 unmarkit = TRUE; 334 339 break; … … 344 349 } 345 350 } 346 else if (unmarkit && text && *text && (pci->attrFile & FILE_DIRECTORY))351 else if (unmarkit && text && *text && (pci->attrFile & FILE_DIRECTORY)) 347 352 unmarkit = FALSE; 348 if (unmarkit)353 if (unmarkit) 349 354 WinSendMsg(hwndCnr,CM_SETRECORDEMPHASIS,pci, 350 355 MPFROM2SHORT(FALSE,CRA_SELECTED | CRA_CURSORED | … … 362 367 MPFROMLONG(CMA_FIRST), 363 368 MPFROMSHORT(CRA_SELECTED)); 364 while (pcil && (INT)pcil != -1) {369 while (pcil && (INT)pcil != -1) { 365 370 WinSendMsg(hwndCnr,CM_SETRECORDEMPHASIS,MPFROMP(pcil), 366 371 MPFROM2SHORT(FALSE,CRA_SELECTED)); … … 384 389 MPFROMLONG(sizeof(CNRINFO))); 385 390 pci = (PCNRITEM)CurrentRecord(hwndCnr); 386 if (pci && (INT)pci != -1) {387 if (pci->rc.flRecordAttr & CRA_SELECTED) {391 if (pci && (INT)pci != -1) { 392 if (pci->rc.flRecordAttr & CRA_SELECTED) { 388 393 attribute = CRA_SELECTED; 389 394 pci = WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS,MPFROMLONG(CMA_FIRST), … … 391 396 } 392 397 } 393 while (pci && (INT)pci != -1) {398 while (pci && (INT)pci != -1) { 394 399 pciH = WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS,MPFROMP(pci), 395 400 MPFROMSHORT(attribute)); … … 399 404 pci->rc.flRecordAttr |= CRA_FILTERED; 400 405 didone = TRUE; 401 if (fSyncUpdates) {402 if (cnri.flWindowAttr & CV_DETAIL)406 if (fSyncUpdates) { 407 if (cnri.flWindowAttr & CV_DETAIL) 403 408 WinSendMsg(hwndCnr,CM_INVALIDATERECORD,MPVOID, 404 409 MPFROM2SHORT(0,CMA_REPOSITION | CMA_ERASE)); … … 409 414 pci = pciH; 410 415 } 411 if (didone && !fSyncUpdates)416 if (didone && !fSyncUpdates) 412 417 WinSendMsg(hwndCnr,CM_INVALIDATERECORD,MPVOID, 413 418 MPFROM2SHORT(0,CMA_ERASE | CMA_REPOSITION)); … … 419 424 INT attribute = CRA_CURSORED; 420 425 421 if (quitit)426 if (quitit) 422 427 attribute = (target) ? CRA_TARGET : (source) ? CRA_SOURCE : CRA_INUSE; 423 428 pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS, 424 429 MPFROMLONG(CMA_FIRST), 425 430 MPFROMSHORT(attribute)); 426 if (pci && (INT)pci != -1) {427 if (attribute == CRA_CURSORED) {428 if (pci->rc.flRecordAttr & CRA_SELECTED) {431 if (pci && (INT)pci != -1) { 432 if (attribute == CRA_CURSORED) { 433 if (pci->rc.flRecordAttr & CRA_SELECTED) { 429 434 attribute = CRA_SELECTED; 430 435 pci = WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS,MPFROMLONG(CMA_FIRST), … … 433 438 } 434 439 } 435 while ( pci && (INT)pci != -1) {440 while ( pci && (INT)pci != -1) { 436 441 WinSendMsg(hwndCnr,CM_SETRECORDEMPHASIS,MPFROMP(pci), 437 442 MPFROM2SHORT(!quitit, … … 449 454 450 455 pci = (PCNRITEM)CurrentRecord(hwndCnr); 451 if (pci && (INT)pci != -1) {452 if (pci->rc.flRecordAttr & CRA_SELECTED) {456 if (pci && (INT)pci != -1) { 457 if (pci->rc.flRecordAttr & CRA_SELECTED) { 453 458 attribute = CRA_SELECTED; 454 459 pci = WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS,MPFROMLONG(CMA_FIRST), … … 456 461 } 457 462 } 458 while (pci && (INT)pci != -1) {463 while (pci && (INT)pci != -1) { 459 464 if (!(pci->rc.flRecordAttr & CRA_FILTERED)) 460 465 { … … 466 471 WinSendMsg(hwndCnr,CM_SETRECORDEMPHASIS,MPFROMP(pci), 467 472 MPFROM2SHORT(0,CRA_SELECTED)); 468 if (fSyncUpdates)473 if (fSyncUpdates) 469 474 WinSendMsg(hwndCnr,CM_REMOVERECORD,MPFROMP(&pci), 470 475 MPFROM2SHORT(1,CMA_FREE | CMA_INVALIDATE)); … … 472 477 WinSendMsg(hwndCnr,CM_REMOVERECORD,MPFROMP(&pci), 473 478 MPFROM2SHORT(1,CMA_FREE)); 474 if (attribute == CRA_CURSORED)479 if (attribute == CRA_CURSORED) 475 480 break; 476 481 pci = WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS,MPFROMLONG(CMA_FIRST), … … 481 486 MPFROMSHORT(attribute)); 482 487 } 483 if (didone && !fSyncUpdates)488 if (didone && !fSyncUpdates) 484 489 WinSendMsg(hwndCnr,CM_INVALIDATERECORD,MPVOID, 485 490 MPFROM2SHORT(0,CMA_REPOSITION)); … … 491 496 register CHAR *p; 492 497 493 if (str != mask->szMask)498 if (str != mask->szMask) 494 499 strcpy(mask->szMask,str); 495 500 strcpy(mask->szMaskCopy,mask->szMask); 496 501 memset(mask->pszMasks,0,sizeof(CHAR *) * 26); 497 502 p = mask->pszMasks[0] = mask->szMaskCopy; 498 for (x = 1;x < 24;x++) {499 while (*p && *p != ';')503 for (x = 1;x < 24;x++) { 504 while (*p && *p != ';') 500 505 p++; 501 if (*p) {506 if (*p) { 502 507 *p = 0; 503 508 p++; … … 516 521 PCNRITEM pci; 517 522 518 if (!pciParent)523 if (!pciParent) 519 524 pciParent = WinSendMsg(hwndCnr,CM_QUERYRECORD,MPFROMP(NULL), 520 525 MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER)); 521 if (pciParent) {522 if (expand && !(pciParent->rc.flRecordAttr & CRA_EXPANDED))526 if (pciParent) { 527 if (expand && !(pciParent->rc.flRecordAttr & CRA_EXPANDED)) 523 528 WinSendMsg(hwndCnr,CM_EXPANDTREE,MPFROMP(pciParent),MPVOID); 524 else if (!expand && (pciParent->rc.flRecordAttr & CRA_EXPANDED))529 else if (!expand && (pciParent->rc.flRecordAttr & CRA_EXPANDED)) 525 530 WinSendMsg(hwndCnr,CM_COLLAPSETREE,MPFROMP(pciParent),MPVOID); 526 531 pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPFROMP(pciParent), 527 532 MPFROM2SHORT(CMA_FIRSTCHILD,CMA_ITEMORDER)); 528 if (pci)533 if (pci) 529 534 DosSleep(1L); 530 while (pci && (INT)pci != -1) {535 while (pci && (INT)pci != -1) { 531 536 ExpandAll(hwndCnr,expand,pci); 532 537 pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPFROMP(pci), … … 543 548 pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPVOID, 544 549 MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER)); 545 while ( pci && (INT)pci != -1 ) {546 if (!(pci->rc.flRecordAttr & CRA_FILTERED)) {547 if (!(pci->rc.flRecordAttr & CRA_SELECTED))550 while ( pci && (INT)pci != -1 ) { 551 if (!(pci->rc.flRecordAttr & CRA_FILTERED)) { 552 if (!(pci->rc.flRecordAttr & CRA_SELECTED)) 548 553 WinSendMsg(hwndCnr,CM_SETRECORDEMPHASIS,MPFROMP(pci), 549 554 MPFROM2SHORT(TRUE,CRA_SELECTED)); … … 567 572 register INT x,numD,numS; 568 573 569 if (!hwndCnrS || !hwndCnrD)574 if (!hwndCnrS || !hwndCnrD) 570 575 return; 571 576 … … 580 585 MPFROMLONG(sizeof(CNRINFO))); 581 586 numS = (INT)cnri.cRecords; 582 if(!numD || numS != numD) { 583 DosBeep(250,100); 587 if (!numD || numS != numD) { 584 588 saymsg(MB_ENTER, 585 589 HWND_DESKTOP, … … 590 594 return; 591 595 } 592 pciDa = malloc(sizeof(PCNRITEM) * numD); 593 if(!pciDa) { 594 DosBeep(250,100); 596 pciDa = xmalloc(sizeof(PCNRITEM) * numD,pszSrcFile,__LINE__); 597 if (!pciDa) 595 598 return; 596 } 597 598 pciSa = malloc(sizeof(PCNRITEM) * numS); 599 if(!pciSa) { 600 if(pciDa) 601 free(pciDa); 602 DosBeep(250,100); 599 600 pciSa = xmalloc(sizeof(PCNRITEM) * numS,pszSrcFile,__LINE__); 601 if (!pciSa) { 602 free(pciDa); 603 603 return; 604 604 } … … 612 612 MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER)); 613 613 x = 0; 614 while ( pciD && (INT)pciD != -1 && x < numD) {615 if (reset)614 while ( pciD && (INT)pciD != -1 && x < numD) { 615 if (reset) 616 616 pciD->flags = 0; 617 617 pciDa[x] = pciD; 618 618 x++; 619 if (!slow)619 if (!slow) 620 620 pciD = (PCNRITEM)pciD->rc.preccNextRecord; 621 621 else 622 622 pciD = (PCNRITEM)WinSendMsg(hwndCnrD,CM_QUERYRECORD,MPFROMP(pciD), 623 623 MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER)); 624 if (!(x % 500))624 if (!(x % 500)) 625 625 DosSleep(1L); 626 else if (!(x % 50))626 else if (!(x % 50)) 627 627 DosSleep(0L); 628 628 } 629 if (numD != x) {630 if (!slow) {629 if (numD != x) { 630 if (!slow) { 631 631 slow = TRUE; 632 632 goto Restart; … … 634 634 free(pciDa); 635 635 free(pciSa); 636 DosBeep(250,100);637 636 saymsg(MB_ENTER, 638 637 HWND_DESKTOP, … … 647 646 MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER)); 648 647 x = 0; 649 while (pciS && (INT)pciS != -1 && x < numS) {650 if (reset)648 while (pciS && (INT)pciS != -1 && x < numS) { 649 if (reset) 651 650 pciS->flags = 0; 652 651 pciSa[x] = pciS; 653 652 x++; 654 if (!slow)653 if (!slow) 655 654 pciS = (PCNRITEM)pciS->rc.preccNextRecord; 656 655 else 657 656 pciS = (PCNRITEM)WinSendMsg(hwndCnrS,CM_QUERYRECORD,MPFROMP(pciS), 658 657 MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER)); 659 if (!(x % 500))658 if (!(x % 500)) 660 659 DosSleep(1L); 661 else if (!(x % 50))660 else if (!(x % 50)) 662 661 DosSleep(0L); 663 662 } 664 if (numS != x) {665 if (!slow) {663 if (numS != x) { 664 if (!slow) { 666 665 slow = TRUE; 667 666 goto Restart; … … 669 668 free(pciSa); 670 669 free(pciDa); 671 DosBeep(250,100); 672 saymsg(MB_ENTER, 673 HWND_DESKTOP, 674 DEBUG_STRING, 675 "numS (%lu) != x (%lu)", 676 numS, 677 x); 670 Runtime_Error(pszSrcFile, __LINE__, 671 "numS (%lu) != x (%lu)", numS, x); 678 672 return; 679 673 } 680 674 681 if (reset) {682 for (x = 0;x < numS;x++) {683 if (!*pciSa[x]->szFileName || !*pciDa[x]->szFileName)675 if (reset) { 676 for (x = 0;x < numS;x++) { 677 if (!*pciSa[x]->szFileName || !*pciDa[x]->szFileName) 684 678 continue; 685 679 pciSa[x]->flags |= CNRITEM_EXISTS; 686 680 pciDa[x]->flags |= CNRITEM_EXISTS; 687 if (pciSa[x]->cbFile + pciSa[x]->easize >681 if (pciSa[x]->cbFile + pciSa[x]->easize > 688 682 pciDa[x]->cbFile + pciDa[x]->easize) { 689 683 pciSa[x]->flags |= CNRITEM_LARGER; 690 684 pciDa[x]->flags |= CNRITEM_SMALLER; 691 685 } 692 else if (pciSa[x]->cbFile + pciSa[x]->easize <686 else if (pciSa[x]->cbFile + pciSa[x]->easize < 693 687 pciDa[x]->cbFile + pciDa[x]->easize) { 694 688 pciSa[x]->flags |= CNRITEM_SMALLER; 695 689 pciDa[x]->flags |= CNRITEM_LARGER; 696 690 } 697 if ((pciSa[x]->date.year > pciDa[x]->date.year) ? TRUE :691 if ((pciSa[x]->date.year > pciDa[x]->date.year) ? TRUE : 698 692 (pciSa[x]->date.year < pciDa[x]->date.year) ? FALSE : 699 693 (pciSa[x]->date.month > pciDa[x]->date.month) ? TRUE : … … 710 704 pciDa[x]->flags |= CNRITEM_OLDER; 711 705 } 712 else if ((pciSa[x]->date.year < pciDa[x]->date.year) ? TRUE :706 else if ((pciSa[x]->date.year < pciDa[x]->date.year) ? TRUE : 713 707 (pciSa[x]->date.year > pciDa[x]->date.year) ? FALSE : 714 708 (pciSa[x]->date.month < pciDa[x]->date.month) ? TRUE : … … 726 720 pciDa[x]->flags |= CNRITEM_NEWER; 727 721 } 728 if (!(x % 500))722 if (!(x % 500)) 729 723 DosSleep(1L); 730 else if (!(x % 50))724 else if (!(x % 50)) 731 725 DosSleep(0L); 732 726 } … … 735 729 switch(action) { 736 730 case IDM_SELECTIDENTICAL: 737 for (x = 0;x < numS;x++) {738 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED)) {739 if (*pciSa[x]->szFileName &&731 for (x = 0;x < numS;x++) { 732 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED)) { 733 if (*pciSa[x]->szFileName && 740 734 (pciSa[x]->flags & CNRITEM_EXISTS) && 741 735 !(pciSa[x]->flags & CNRITEM_SMALLER) && … … 743 737 !(pciSa[x]->flags & CNRITEM_NEWER) && 744 738 !(pciSa[x]->flags & CNRITEM_OLDER)) { 745 if (!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED))739 if (!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED)) 746 740 WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]), 747 741 MPFROM2SHORT(TRUE,CRA_SELECTED)); 748 if (!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED))742 if (!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED)) 749 743 WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]), 750 744 MPFROM2SHORT(TRUE,CRA_SELECTED)); 751 745 } 752 if (!(x % 500))746 if (!(x % 500)) 753 747 DosSleep(1L); 754 else if (!(x % 50))748 else if (!(x % 50)) 755 749 DosSleep(0L); 756 750 } … … 759 753 760 754 case IDM_SELECTSAME: 761 for (x = 0;x < numS;x++) {762 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&755 for (x = 0;x < numS;x++) { 756 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) && 763 757 *pciSa[x]->szFileName && 764 758 (pciSa[x]->flags & CNRITEM_EXISTS) && 765 759 !(pciSa[x]->flags & CNRITEM_SMALLER) && 766 760 !(pciSa[x]->flags & CNRITEM_LARGER)) { 767 if (!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED))761 if (!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED)) 768 762 WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]), 769 763 MPFROM2SHORT(TRUE,CRA_SELECTED)); 770 if (!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED))764 if (!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED)) 771 765 WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]), 772 766 MPFROM2SHORT(TRUE,CRA_SELECTED)); 773 767 } 774 if (!(x % 500))768 if (!(x % 500)) 775 769 DosSleep(1L); 776 else if (!(x % 50))770 else if (!(x % 50)) 777 771 DosSleep(0L); 778 772 } … … 791 785 FILE *fp2 = NULL; 792 786 BOOL gotMatch = FALSE; 793 BOOL gotError = FALSE; 787 UINT errLineNo = 0; 788 UINT compErrno = 0; 794 789 CHAR buf1[1024]; 795 790 CHAR buf2[1024]; … … 797 792 798 793 fp1 = _fsopen(pciSa[x]->szFileName,"rb",SH_DENYNO); 799 if(!fp1) { 800 gotError = TRUE; 794 if (!fp1) { 795 errLineNo = __LINE__; 796 compErrno = errno; 801 797 } 802 798 else { 803 799 fp2 = _fsopen(pciDa[x]->szFileName,"rb",SH_DENYNO); 804 if(!fp2) { 805 gotError = TRUE; 800 if (!fp2) { 801 errLineNo = __LINE__; 802 compErrno = errno; 806 803 } 807 804 else { … … 815 812 size_t numread2 = fread(buf2,1,1024,fp2); 816 813 if (!numread1 || !numread2 || numread1 != numread2) { 817 if (ferror(fp1) || ferror(fp2)) 818 gotError = TRUE; 814 if (ferror(fp1) || ferror(fp2)) { 815 errLineNo = __LINE__; 816 compErrno = errno; 817 } 819 818 else if (feof(fp1) && feof(fp2)) 820 819 gotMatch = TRUE; … … 834 833 fclose(fp2); 835 834 836 if (gotError) { 837 // fixme 838 DosBeep(250,100); 839 saymsg(MB_CANCEL,HWND_DESKTOP, 840 "Compare Content", 841 "Unexpected error comparing..." 842 ); 835 if (errLineNo) { 836 Runtime_Error(pszSrcFile, errLineNo, 837 "error %d while comparing", compErrno); 843 838 } 844 839 if (gotMatch) { … … 859 854 860 855 case IDM_SELECTBOTH: 861 for (x = 0;x < numS;x++) {862 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&856 for (x = 0;x < numS;x++) { 857 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) && 863 858 *pciSa[x]->szFileName && 864 859 (pciSa[x]->flags & CNRITEM_EXISTS)) { 865 if (!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED))860 if (!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED)) 866 861 WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]), 867 862 MPFROM2SHORT(TRUE,CRA_SELECTED)); 868 if (!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED))863 if (!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED)) 869 864 WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]), 870 865 MPFROM2SHORT(TRUE,CRA_SELECTED)); 871 866 } 872 if (!(x % 500))867 if (!(x % 500)) 873 868 DosSleep(1L); 874 else if (!(x % 50))869 else if (!(x % 50)) 875 870 DosSleep(0L); 876 871 } … … 878 873 879 874 case IDM_SELECTONE: 880 for (x = 0;x < numS;x++) {881 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&875 for (x = 0;x < numS;x++) { 876 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) && 882 877 *pciSa[x]->szFileName && 883 878 !(pciSa[x]->flags & CNRITEM_EXISTS)) { 884 if (!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED))879 if (!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED)) 885 880 WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]), 886 881 MPFROM2SHORT(TRUE,CRA_SELECTED)); 887 882 } 888 else if (*pciDa[x]->szFileName &&883 else if (*pciDa[x]->szFileName && 889 884 !(pciDa[x]->flags & CNRITEM_EXISTS)) { 890 if (!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED))885 if (!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED)) 891 886 WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]), 892 887 MPFROM2SHORT(TRUE,CRA_SELECTED)); 893 888 } 894 if (!(x % 500))889 if (!(x % 500)) 895 890 DosSleep(1L); 896 else if (!(x % 50))891 else if (!(x % 50)) 897 892 DosSleep(0L); 898 893 } … … 900 895 901 896 case IDM_SELECTBIGGER: 902 for (x = 0;x < numS;x++) {903 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&897 for (x = 0;x < numS;x++) { 898 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) && 904 899 *pciSa[x]->szFileName && 905 900 (pciSa[x]->flags & CNRITEM_LARGER)) { 906 if (!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED))901 if (!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED)) 907 902 WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]), 908 903 MPFROM2SHORT(TRUE,CRA_SELECTED)); 909 904 } 910 else if (!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) &&905 else if (!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) && 911 906 *pciDa[x]->szFileName && 912 907 (pciDa[x]->flags & CNRITEM_LARGER)) { 913 if (!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED))908 if (!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED)) 914 909 WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]), 915 910 MPFROM2SHORT(TRUE,CRA_SELECTED)); 916 911 } 917 if (!(x % 500))912 if (!(x % 500)) 918 913 DosSleep(1L); 919 else if (!(x % 50))914 else if (!(x % 50)) 920 915 DosSleep(0L); 921 916 } … … 923 918 924 919 case IDM_SELECTSMALLER: 925 for (x = 0;x < numS;x++) {926 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&920 for (x = 0;x < numS;x++) { 921 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) && 927 922 *pciSa[x]->szFileName && 928 923 (pciSa[x]->flags & CNRITEM_SMALLER)) { 929 if (!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED))924 if (!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED)) 930 925 WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]), 931 926 MPFROM2SHORT(TRUE,CRA_SELECTED)); 932 927 } 933 else if (!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) &&928 else if (!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) && 934 929 *pciDa[x]->szFileName && 935 930 (pciDa[x]->flags & CNRITEM_SMALLER)) { 936 if (!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED))931 if (!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED)) 937 932 WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]), 938 933 MPFROM2SHORT(TRUE,CRA_SELECTED)); 939 934 } 940 if (!(x % 500))935 if (!(x % 500)) 941 936 DosSleep(1L); 942 else if (!(x % 50))937 else if (!(x % 50)) 943 938 DosSleep(0L); 944 939 } … … 946 941 947 942 case IDM_SELECTNEWER: 948 for (x = 0;x < numS;x++) {949 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&943 for (x = 0;x < numS;x++) { 944 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) && 950 945 *pciSa[x]->szFileName && 951 946 (pciSa[x]->flags & CNRITEM_NEWER)) { 952 if (!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED))947 if (!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED)) 953 948 WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]), 954 949 MPFROM2SHORT(TRUE,CRA_SELECTED)); 955 950 } 956 else if (!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) &&951 else if (!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) && 957 952 *pciDa[x]->szFileName && 958 953 (pciDa[x]->flags & CNRITEM_NEWER)) { 959 if (!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED))954 if (!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED)) 960 955 WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]), 961 956 MPFROM2SHORT(TRUE,CRA_SELECTED)); 962 957 } 963 if (!(x % 500))958 if (!(x % 500)) 964 959 DosSleep(1L); 965 else if (!(x % 50))960 else if (!(x % 50)) 966 961 DosSleep(0L); 967 962 } … … 969 964 970 965 case IDM_SELECTOLDER: 971 for (x = 0;x < numS;x++) {972 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&966 for (x = 0;x < numS;x++) { 967 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) && 973 968 *pciSa[x]->szFileName && 974 969 (pciSa[x]->flags & CNRITEM_OLDER)) { 975 if (!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED))970 if (!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED)) 976 971 WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]), 977 972 MPFROM2SHORT(TRUE,CRA_SELECTED)); 978 973 } 979 else if (!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) &&974 else if (!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) && 980 975 *pciDa[x]->szFileName && 981 976 (pciDa[x]->flags & CNRITEM_OLDER)) { 982 if (!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED))977 if (!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED)) 983 978 WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]), 984 979 MPFROM2SHORT(TRUE,CRA_SELECTED)); 985 980 } 986 if (!(x % 500))981 if (!(x % 500)) 987 982 DosSleep(1L); 988 else if (!(x % 50))983 else if (!(x % 50)) 989 984 DosSleep(0L); 990 985 } … … 992 987 993 988 case IDM_DESELECTBOTH: 994 for (x = 0;x < numS;x++) {995 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&989 for (x = 0;x < numS;x++) { 990 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) && 996 991 *pciSa[x]->szFileName && 997 992 (pciSa[x]->flags & CNRITEM_EXISTS)) { 998 if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED)993 if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED) 999 994 WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]), 1000 995 MPFROM2SHORT(FALSE,CRA_SELECTED)); 1001 if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED)996 if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED) 1002 997 WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]), 1003 998 MPFROM2SHORT(FALSE,CRA_SELECTED)); 1004 999 } 1005 if (!(x % 500))1000 if (!(x % 500)) 1006 1001 DosSleep(1L); 1007 else if (!(x % 50))1002 else if (!(x % 50)) 1008 1003 DosSleep(0L); 1009 1004 } … … 1011 1006 1012 1007 case IDM_DESELECTONE: 1013 for (x = 0;x < numS;x++) {1014 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&1008 for (x = 0;x < numS;x++) { 1009 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) && 1015 1010 *pciSa[x]->szFileName && 1016 1011 !(pciSa[x]->flags & CNRITEM_EXISTS)) { 1017 if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED)1012 if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED) 1018 1013 WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]), 1019 1014 MPFROM2SHORT(FALSE,CRA_SELECTED)); 1020 1015 } 1021 else if (*pciDa[x]->szFileName &&1016 else if (*pciDa[x]->szFileName && 1022 1017 !(pciDa[x]->flags & CNRITEM_EXISTS)) { 1023 if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED)1018 if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED) 1024 1019 WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]), 1025 1020 MPFROM2SHORT(FALSE,CRA_SELECTED)); 1026 1021 } 1027 if (!(x % 500))1022 if (!(x % 500)) 1028 1023 DosSleep(1L); 1029 else if (!(x % 50))1024 else if (!(x % 50)) 1030 1025 DosSleep(0L); 1031 1026 } … … 1033 1028 1034 1029 case IDM_DESELECTBIGGER: 1035 for (x = 0;x < numS;x++) {1036 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&1030 for (x = 0;x < numS;x++) { 1031 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) && 1037 1032 *pciSa[x]->szFileName && 1038 1033 (pciSa[x]->flags & CNRITEM_LARGER)) { 1039 if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED)1034 if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED) 1040 1035 WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]), 1041 1036 MPFROM2SHORT(FALSE,CRA_SELECTED)); 1042 1037 } 1043 else if (!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) &&1038 else if (!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) && 1044 1039 *pciDa[x]->szFileName && 1045 1040 (pciDa[x]->flags & CNRITEM_LARGER)) { 1046 if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED)1041 if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED) 1047 1042 WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]), 1048 1043 MPFROM2SHORT(FALSE,CRA_SELECTED)); 1049 1044 } 1050 if (!(x % 500))1045 if (!(x % 500)) 1051 1046 DosSleep(1L); 1052 else if (!(x % 50))1047 else if (!(x % 50)) 1053 1048 DosSleep(0L); 1054 1049 } … … 1056 1051 1057 1052 case IDM_DESELECTSMALLER: 1058 for (x = 0;x < numS;x++) {1059 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&1053 for (x = 0;x < numS;x++) { 1054 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) && 1060 1055 *pciSa[x]->szFileName && 1061 1056 (pciSa[x]->flags & CNRITEM_SMALLER)) { 1062 if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED)1057 if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED) 1063 1058 WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]), 1064 1059 MPFROM2SHORT(FALSE,CRA_SELECTED)); 1065 1060 } 1066 else if (!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) &&1061 else if (!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) && 1067 1062 *pciDa[x]->szFileName && 1068 1063 (pciDa[x]->flags & CNRITEM_SMALLER)) { 1069 if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED)1064 if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED) 1070 1065 WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]), 1071 1066 MPFROM2SHORT(FALSE,CRA_SELECTED)); 1072 1067 } 1073 if (!(x % 500))1068 if (!(x % 500)) 1074 1069 DosSleep(1L); 1075 else if (!(x % 50))1070 else if (!(x % 50)) 1076 1071 DosSleep(0L); 1077 1072 } … … 1079 1074 1080 1075 case IDM_DESELECTNEWER: 1081 for (x = 0;x < numS;x++) {1082 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&1076 for (x = 0;x < numS;x++) { 1077 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) && 1083 1078 *pciSa[x]->szFileName && 1084 1079 (pciSa[x]->flags & CNRITEM_NEWER)) { 1085 if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED)1080 if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED) 1086 1081 WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]), 1087 1082 MPFROM2SHORT(FALSE,CRA_SELECTED)); 1088 1083 } 1089 else if (!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) &&1084 else if (!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) && 1090 1085 *pciDa[x]->szFileName && 1091 1086 (pciDa[x]->flags & CNRITEM_NEWER)) { 1092 if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED)1087 if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED) 1093 1088 WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]), 1094 1089 MPFROM2SHORT(FALSE,CRA_SELECTED)); 1095 1090 } 1096 if (!(x % 500))1091 if (!(x % 500)) 1097 1092 DosSleep(1L); 1098 else if (!(x % 50))1093 else if (!(x % 50)) 1099 1094 DosSleep(0L); 1100 1095 } … … 1102 1097 1103 1098 case IDM_DESELECTOLDER: 1104 for (x = 0;x < numS;x++) {1105 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&1099 for (x = 0;x < numS;x++) { 1100 if (!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) && 1106 1101 *pciSa[x]->szFileName && 1107 1102 (pciSa[x]->flags & CNRITEM_OLDER)) { 1108 if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED)1103 if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED) 1109 1104 WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]), 1110 1105 MPFROM2SHORT(FALSE,CRA_SELECTED)); 1111 1106 } 1112 else if (!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) &&1107 else if (!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) && 1113 1108 *pciDa[x]->szFileName && 1114 1109 (pciDa[x]->flags & CNRITEM_OLDER)) { 1115 if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED)1110 if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED) 1116 1111 WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]), 1117 1112 MPFROM2SHORT(FALSE,CRA_SELECTED)); 1118 1113 } 1119 if (!(x % 500))1114 if (!(x % 500)) 1120 1115 DosSleep(1L); 1121 else if (!(x % 50))1116 else if (!(x % 50)) 1122 1117 DosSleep(0L); 1123 1118 } … … 1128 1123 } 1129 1124 1130 if (reset) {1131 while (numS) {1125 if (reset) { 1126 while (numS) { 1132 1127 WinSendMsg(hwndCnrS,CM_INVALIDATERECORD, 1133 1128 MPFROMP(pciSa), … … 1138 1133 MPFROM2SHORT((min(numD,65535)),0)); 1139 1134 numS -= min(numS,65535); 1140 if (numS)1135 if (numS) 1141 1136 DosSleep(0L); 1142 1137 } … … 1183 1178 register INT z; 1184 1179 1185 for (z = 0;z < numw;z++) {1186 if (Cnrs[z].ss)1180 for (z = 0;z < numw;z++) { 1181 if (Cnrs[z].ss) 1187 1182 free(Cnrs[z].ss); 1188 1183 } … … 1200 1195 struct SS *bsres; 1201 1196 1202 if (!hwndParent)1197 if (!hwndParent) 1203 1198 return; 1204 1199 1205 1200 /* count directory containers, build array of hwnds */ 1206 1201 henum = WinBeginEnumWindows(hwndParent); 1207 while ((hwnd = WinGetNextWindow(henum)) != NULLHANDLE) {1208 if (WinWindowFromID(WinWindowFromID(hwnd,FID_CLIENT),DIR_CNR)) {1209 Cnrs = realloc(Cnrs,(numwindows + 1) * sizeof(struct Cnr));1210 if (!Cnrs) {1202 while ((hwnd = WinGetNextWindow(henum)) != NULLHANDLE) { 1203 if (WinWindowFromID(WinWindowFromID(hwnd,FID_CLIENT),DIR_CNR)) { 1204 Cnrs = xrealloc(Cnrs,(numwindows + 1) * sizeof(struct Cnr),pszSrcFile,__LINE__); 1205 if (!Cnrs) { 1211 1206 Notify(GetPString(IDS_OUTOFMEMORY)); 1212 1207 return; … … 1219 1214 } 1220 1215 WinEndEnumWindows(henum); 1221 if (numwindows < 2) {1216 if (numwindows < 2) { 1222 1217 FreeCnrs(Cnrs,numwindows); 1223 DosBeep(250,100); 1218 Runtime_Error(pszSrcFile, __LINE__, "expected two windows"); 1219 // fixme DosBeep(250,100); 1224 1220 Notify(GetPString(IDS_COMPSEL2ORMORETEXT)); 1225 1221 return; 1226 1222 } 1227 if (numwindows > 4) {1223 if (numwindows > 4) { 1228 1224 WinSendMsg(Cnrs[0]. 1229 1225 hwndCnr, … … 1235 1231 1236 1232 /* count records, build array of pointers to records */ 1237 for (z = 0;z < numwindows;z++) {1233 for (z = 0;z < numwindows;z++) { 1238 1234 pci = (PCNRITEM)WinSendMsg(Cnrs[z].hwndCnr, 1239 1235 CM_QUERYRECORD, … … 1242 1238 CMA_ITEMORDER)); 1243 1239 x = 0; 1244 while (pci && (INT)pci != -1) {1245 if (!(pci->rc.flRecordAttr & CRA_FILTERED) &&1240 while (pci && (INT)pci != -1) { 1241 if (!(pci->rc.flRecordAttr & CRA_FILTERED) && 1246 1242 !(pci->attrFile & FILE_DIRECTORY)) { 1247 Cnrs[z].ss = realloc(Cnrs[z].ss,(x + 1) * sizeof(struct SS));1248 if (!Cnrs[z].ss) {1243 Cnrs[z].ss = xrealloc(Cnrs[z].ss,(x + 1) * sizeof(struct SS),pszSrcFile,__LINE__); 1244 if (!Cnrs[z].ss) { 1249 1245 FreeCnrs(Cnrs,numwindows); 1250 1246 Notify(GetPString(IDS_OUTOFMEMORY)); … … 1263 1259 DosSleep(0L); 1264 1260 Cnrs[z].numfiles = x; 1265 if (Cnrs[z].numfiles)1261 if (Cnrs[z].numfiles) 1266 1262 qsort(Cnrs[z].ss,Cnrs[z].numfiles,sizeof(struct SS),CompSSNames); 1267 1263 } 1268 1264 1269 for (z = 0;z < numwindows;z++) {1270 for (x = 0;x < Cnrs[z].numfiles;x++) {1265 for (z = 0;z < numwindows;z++) { 1266 for (x = 0;x < Cnrs[z].numfiles;x++) { 1271 1267 Cnrs[z].ss[x].all = Cnrs[z].ss[x].unique = Cnrs[z].ss[x].newest = 1272 1268 Cnrs[z].ss[x].oldest = Cnrs[z].ss[x].smallest = 1273 1269 Cnrs[z].ss[x].largest = TRUE; 1274 for (w = 0;w < numwindows;w++) {1275 if (w != z && Cnrs[w].numfiles) {1270 for (w = 0;w < numwindows;w++) { 1271 if (w != z && Cnrs[w].numfiles) { 1276 1272 bsres = (struct SS *)bsearch(Cnrs[z].ss[x].pci->pszFileName, 1277 1273 Cnrs[w].ss,Cnrs[w].numfiles, 1278 1274 sizeof(struct SS),CompSSNamesB); 1279 if (bsres) {1275 if (bsres) { 1280 1276 Cnrs[z].ss[x].unique = FALSE; 1281 if (Cnrs[z].ss[x].pci->cbFile + Cnrs[z].ss[x].pci->easize >1277 if (Cnrs[z].ss[x].pci->cbFile + Cnrs[z].ss[x].pci->easize > 1282 1278 bsres->pci->cbFile + bsres->pci->easize) 1283 1279 Cnrs[z].ss[x].smallest = FALSE; 1284 if (Cnrs[z].ss[x].pci->cbFile + Cnrs[z].ss[x].pci->easize <1280 if (Cnrs[z].ss[x].pci->cbFile + Cnrs[z].ss[x].pci->easize < 1285 1281 bsres->pci->cbFile + bsres->pci->easize) 1286 1282 Cnrs[z].ss[x].largest = FALSE; … … 1298 1294 (Cnrs[z].ss[x].pci->time.seconds < bsres->pci->time.seconds) ? FALSE : 1299 1295 FALSE; 1300 if (!cmp)1296 if (!cmp) 1301 1297 Cnrs[z].ss[x].newest = FALSE; 1302 1298 cmp = (Cnrs[z].ss[x].pci->date.year < bsres->pci->date.year) ? TRUE : … … 1313 1309 (Cnrs[z].ss[x].pci->time.seconds > bsres->pci->time.seconds) ? FALSE : 1314 1310 FALSE; 1315 if (!cmp)1311 if (!cmp) 1316 1312 Cnrs[z].ss[x].oldest = FALSE; 1317 1313 cmp = 0; … … 1322 1318 } 1323 1319 } 1324 if (Cnrs[z].ss[x].unique)1320 if (Cnrs[z].ss[x].unique) 1325 1321 Cnrs[z].ss[x].oldest = Cnrs[z].ss[x].newest = Cnrs[z].ss[x].all = 1326 1322 Cnrs[z].ss[x].largest = Cnrs[z].ss[x].smallest = FALSE; … … 1332 1328 switch(action) { 1333 1329 case IDM_SELECTBOTH: 1334 for (z = 0;z < numwindows;z++) {1335 for (x = 0;x < Cnrs[z].numfiles;x++) {1336 if (Cnrs[z].ss[x].all)1330 for (z = 0;z < numwindows;z++) { 1331 for (x = 0;x < Cnrs[z].numfiles;x++) { 1332 if (Cnrs[z].ss[x].all) 1337 1333 WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS, 1338 1334 MPFROMP(Cnrs[z].ss[x].pci), … … 1343 1339 break; 1344 1340 case IDM_SELECTMORE: 1345 for (z = 0;z < numwindows;z++) {1346 for (x = 0;x < Cnrs[z].numfiles;x++) {1347 if (!Cnrs[z].ss[x].unique)1341 for (z = 0;z < numwindows;z++) { 1342 for (x = 0;x < Cnrs[z].numfiles;x++) { 1343 if (!Cnrs[z].ss[x].unique) 1348 1344 WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS, 1349 1345 MPFROMP(Cnrs[z].ss[x].pci), … … 1354 1350 break; 1355 1351 case IDM_SELECTONE: 1356 for (z = 0;z < numwindows;z++) {1357 for (x = 0;x < Cnrs[z].numfiles;x++) {1358 if (Cnrs[z].ss[x].unique)1352 for (z = 0;z < numwindows;z++) { 1353 for (x = 0;x < Cnrs[z].numfiles;x++) { 1354 if (Cnrs[z].ss[x].unique) 1359 1355 WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS, 1360 1356 MPFROMP(Cnrs[z].ss[x].pci), … … 1365 1361 break; 1366 1362 case IDM_SELECTNEWER: 1367 for (z = 0;z < numwindows;z++) {1368 for (x = 0;x < Cnrs[z].numfiles;x++) {1369 if (Cnrs[z].ss[x].newest)1363 for (z = 0;z < numwindows;z++) { 1364 for (x = 0;x < Cnrs[z].numfiles;x++) { 1365 if (Cnrs[z].ss[x].newest) 1370 1366 WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS, 1371 1367 MPFROMP(Cnrs[z].ss[x].pci), … … 1376 1372 break; 1377 1373 case IDM_SELECTOLDER: 1378 for (z = 0;z < numwindows;z++) {1379 for (x = 0;x < Cnrs[z].numfiles;x++) {1380 if (Cnrs[z].ss[x].oldest)1374 for (z = 0;z < numwindows;z++) { 1375 for (x = 0;x < Cnrs[z].numfiles;x++) { 1376 if (Cnrs[z].ss[x].oldest) 1381 1377 WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS, 1382 1378 MPFROMP(Cnrs[z].ss[x].pci), … … 1387 1383 break; 1388 1384 case IDM_SELECTBIGGER: 1389 for (z = 0;z < numwindows;z++) {1390 for (x = 0;x < Cnrs[z].numfiles;x++) {1391 if (Cnrs[z].ss[x].largest)1385 for (z = 0;z < numwindows;z++) { 1386 for (x = 0;x < Cnrs[z].numfiles;x++) { 1387 if (Cnrs[z].ss[x].largest) 1392 1388 WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS, 1393 1389 MPFROMP(Cnrs[z].ss[x].pci), … … 1398 1394 break; 1399 1395 case IDM_SELECTSMALLER: 1400 for (z = 0;z < numwindows;z++) {1401 for (x = 0;x < Cnrs[z].numfiles;x++) {1402 if (Cnrs[z].ss[x].smallest)1396 for (z = 0;z < numwindows;z++) { 1397 for (x = 0;x < Cnrs[z].numfiles;x++) { 1398 if (Cnrs[z].ss[x].smallest) 1403 1399 WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS, 1404 1400 MPFROMP(Cnrs[z].ss[x].pci), … … 1410 1406 1411 1407 case IDM_DESELECTBOTH: 1412 for (z = 0;z < numwindows;z++) {1413 for (x = 0;x < Cnrs[z].numfiles;x++) {1414 if (Cnrs[z].ss[x].all)1408 for (z = 0;z < numwindows;z++) { 1409 for (x = 0;x < Cnrs[z].numfiles;x++) { 1410 if (Cnrs[z].ss[x].all) 1415 1411 WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS, 1416 1412 MPFROMP(Cnrs[z].ss[x].pci), … … 1421 1417 break; 1422 1418 case IDM_DESELECTMORE: 1423 for (z = 0;z < numwindows;z++) {1424 for (x = 0;x < Cnrs[z].numfiles;x++) {1425 if (!Cnrs[z].ss[x].unique)1419 for (z = 0;z < numwindows;z++) { 1420 for (x = 0;x < Cnrs[z].numfiles;x++) { 1421 if (!Cnrs[z].ss[x].unique) 1426 1422 WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS, 1427 1423 MPFROMP(Cnrs[z].ss[x].pci), … … 1432 1428 break; 1433 1429 case IDM_DESELECTONE: 1434 for (z = 0;z < numwindows;z++) {1435 for (x = 0;x < Cnrs[z].numfiles;x++) {1436 if (Cnrs[z].ss[x].unique)1430 for (z = 0;z < numwindows;z++) { 1431 for (x = 0;x < Cnrs[z].numfiles;x++) { 1432 if (Cnrs[z].ss[x].unique) 1437 1433 WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS, 1438 1434 MPFROMP(Cnrs[z].ss[x].pci), … … 1443 1439 break; 1444 1440 case IDM_DESELECTNEWER: 1445 for (z = 0;z < numwindows;z++) {1446 for (x = 0;x < Cnrs[z].numfiles;x++) {1447 if (Cnrs[z].ss[x].newest)1441 for (z = 0;z < numwindows;z++) { 1442 for (x = 0;x < Cnrs[z].numfiles;x++) { 1443 if (Cnrs[z].ss[x].newest) 1448 1444 WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS, 1449 1445 MPFROMP(Cnrs[z].ss[x].pci), … … 1454 1450 break; 1455 1451 case IDM_DESELECTOLDER: 1456 for (z = 0;z < numwindows;z++) {1457 for (x = 0;x < Cnrs[z].numfiles;x++) {1458 if (Cnrs[z].ss[x].oldest)1452 for (z = 0;z < numwindows;z++) { 1453 for (x = 0;x < Cnrs[z].numfiles;x++) { 1454 if (Cnrs[z].ss[x].oldest) 1459 1455 WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS, 1460 1456 MPFROMP(Cnrs[z].ss[x].pci), … … 1465 1461 break; 1466 1462 case IDM_DESELECTBIGGER: 1467 for (z = 0;z < numwindows;z++) {1468 for (x = 0;x < Cnrs[z].numfiles;x++) {1469 if (Cnrs[z].ss[x].largest)1463 for (z = 0;z < numwindows;z++) { 1464 for (x = 0;x < Cnrs[z].numfiles;x++) { 1465 if (Cnrs[z].ss[x].largest) 1470 1466 WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS, 1471 1467 MPFROMP(Cnrs[z].ss[x].pci), … … 1476 1472 break; 1477 1473 case IDM_DESELECTSMALLER: 1478 for (z = 0;z < numwindows;z++) {1479 for (x = 0;x < Cnrs[z].numfiles;x++) {1480 if (Cnrs[z].ss[x].smallest)1474 for (z = 0;z < numwindows;z++) { 1475 for (x = 0;x < Cnrs[z].numfiles;x++) { 1476 if (Cnrs[z].ss[x].smallest) 1481 1477 WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS, 1482 1478 MPFROMP(Cnrs[z].ss[x].pci),
Note:
See TracChangeset
for help on using the changeset viewer.