Changeset 762
- Timestamp:
- Aug 4, 2007, 11:19:21 PM (13 years ago)
- Location:
- trunk/dll
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/arccnrs.c
r751 r762 61 61 #include <limits.h> 62 62 #include <process.h> // _beginthread 63 64 #if 0 63 65 #include <malloc.h> // _heapchk 66 #endif 64 67 65 68 #include "fm3dll.h" … … 317 320 { 318 321 // DbgMsg(pszSrcFile, __LINE__, "FreeArcItemData %p", pai); 319 320 if (pai->pszFileName && pai->pszFileName != NullStr) 321 xfree(pai->pszFileName); 322 PSZ psz; 323 324 if (pai->pszFileName && pai->pszFileName != NullStr) { 325 psz = pai->pszFileName; 326 pai->pszFileName = NullStr; 327 free(psz); 328 } 322 329 } 323 330 324 331 /** 325 * Remove item from archive container and free associated storage if requested 332 * Remove item(s) from archive container and free associated storage if requested 333 * @param paiFirst points to first item to remove or NULL to remove all 334 * @param usCnt is remove count or 0 to remove all 326 335 */ 327 336 328 static VOID RemoveArcItems(HWND hwnd, PARCITEM pai , USHORT usCnt, USHORT usFlags)337 static VOID RemoveArcItems(HWND hwnd, PARCITEM paiFirst, USHORT usCnt, USHORT usFlags) 329 338 { 330 if (usCnt == 0) { 331 if (pai != NULL) 332 Runtime_Error(pszSrcFile, __LINE__, "pai not NULL"); 333 else { 334 for (;;) { 339 INT remaining = usCnt; 340 PARCITEM pai; 341 342 if ((usCnt && !paiFirst) || (!usCnt && paiFirst)) 343 Runtime_Error(pszSrcFile, __LINE__, "paiFirst %p usCnt %u mismatch", paiFirst, usCnt); 344 else { 345 // Free our buffers if free requested 346 if (usFlags & CMA_FREE) { 347 if (paiFirst) 348 pai = paiFirst; 349 else { 335 350 pai = (PARCITEM)WinSendMsg(hwnd, CM_QUERYRECORD, MPVOID, 336 351 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); 337 if (!pai) 352 if ((INT)pai == -1) { 353 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_QUERYRECORD"); 354 remaining = -1; 355 pai = NULL; 356 } 357 } 358 while (pai) { 359 FreeArcItemData(pai); 360 pai = (PARCITEM)pai->rc.preccNextRecord; 361 if (remaining && --remaining == 0) 338 362 break; 339 else if ((INT)pai == -1) {340 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_QUERYRECORD");341 break;342 }343 else344 RemoveArcItems(hwnd, pai, 1, usFlags);345 363 } 346 364 } 347 365 } 348 else if (usCnt != 1) 349 Runtime_Error(pszSrcFile, __LINE__, "count not 1"); 350 else { 351 // DbgMsg(pszSrcFile, __LINE__, "RemoveArcItems %p %u %s", pai, usCnt, pai->pszFileName); 352 353 if (usFlags & CMA_FREE) 354 FreeArcItemData(pai); 355 356 if ((INT)WinSendMsg(hwnd, CM_REMOVERECORD, MPFROMP(&pai), MPFROM2SHORT(usCnt, usFlags)) == -1) { 366 367 // DbgMsg(pszSrcFile, __LINE__, "RemoveArcItems %p %u %s", pai, usCnt, pai->pszFileName); 368 369 if (remaining != - 1) { 370 remaining = (INT)WinSendMsg(hwnd, CM_REMOVERECORD, MPFROMP(&paiFirst), MPFROM2SHORT(usCnt, usFlags)); 371 if (remaining == -1) { 357 372 // Win_Error2(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,IDS_CMREMOVEERRTEXT); 358 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_REMOVERECORD hwnd %x pai %p ", hwnd, pai);373 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_REMOVERECORD hwnd %x pai %p cnt %u", hwnd, paiFirst, usCnt); 359 374 } 360 375 } … … 362 377 363 378 /** 364 * Empty all records from an archive container and free associated storage and365 * Free up field infos379 * Empty all records from an archive container and 380 * free associated storage and free up field infos 366 381 */ 367 382 368 383 static VOID EmptyArcCnr(HWND hwnd) 369 384 { 370 #if 1// fixme to disable or to be configurable385 #if 0 // fixme to disable or to be configurable 371 386 { 372 387 int state = _heapchk(); 373 388 if (state != _HEAPOK) 374 389 Runtime_Error(pszSrcFile, __LINE__, "heap corrupted %d", state); 390 else 391 DbgMsg(pszSrcFile, __LINE__, "_memavl %u", _memavl()); 375 392 } 376 393 #endif … … 659 676 pai->flags = ARCFLAGS_REALDIR; 660 677 pai->pszFileName = xstrdup(fname,pszSrcFile, __LINE__); 661 662 678 pai->pszDisplayName = pai->pszFileName; 679 pai->rc.pszIcon = pai->pszDisplayName; 663 680 if (fdate) 664 681 strcpy(pai->szDate, fdate); … … 1211 1228 cni.pDragInfo = (PDRAGINFO) mp1; 1212 1229 li = DoFileDrop(dcd->hwndCnr, 1213 1230 dcd->directory, FALSE, MPVOID, MPFROMP(&cni)); 1214 1231 CheckPmDrgLimit(cni.pDragInfo); 1215 1232 if (li) { … … 1843 1860 if (li->type == IDM_MCIPLAY) { 1844 1861 1845 1862 FILE *fp; 1846 1863 1847 1864 fp = xfopen("$FM2PLAY.$$$", "w", pszSrcFile, __LINE__); … … 1851 1868 fprintf(fp, "%s\n", li->list[x]); 1852 1869 fprintf(fp, ";end\n"); 1853 1854 1855 1870 fclose(fp); 1871 RunFM2Util("FM2PLAY.EXE", "/@$FM2PLAY.$$$"); 1872 } 1856 1873 } 1857 1874 else if (li->type == IDM_PRINT) { … … 2242 2259 } 2243 2260 if ((dcd->arcfilled && !dcd->totalfiles) || 2244 2261 !IsArcThere(hwnd, dcd->arcname)) 2245 2262 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); 2246 2263 } … … 2611 2628 WinSetFocus(HWND_DESKTOP, 2612 2629 hwndActive == hwnd ? 2613 2614 2630 WinWindowFromID(dcd->hwndClient, ARC_EXTRACTDIR) : 2631 hwnd); 2615 2632 } 2616 2633 break; … … 3111 3128 DosBeep(500, 100); // fixme to know why beep? 3112 3129 li = DoFileDrop(hwnd, dcd->arcname, FALSE, mp1, mp2); 3113 3114 3130 DosBeep(50, 100); // fixme to know why beep? 3131 CheckPmDrgLimit(((PCNRDRAGINFO)mp2)->pDragInfo); 3115 3132 if (li) { 3116 3133 li->type = li->type == DO_MOVE ? IDM_ARCHIVEM : IDM_ARCHIVE; -
trunk/dll/comp.c
r756 r762 442 442 // Other side is not blank - update just this side 443 443 FreeCnrItemData(pci); 444 pci->pszFileName = NullStr;445 444 pci->pszDisplayName = pci->pszFileName; 446 445 pci->rc.pszIcon = pci->pszFileName; 447 pci->pszLongname = NullStr;448 pci->pszSubject = NullStr;449 446 pci->flags = 0; 450 447 WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pci), … … 503 500 } 504 501 // 02 Aug 07 SHL fixme to know Longname transfer is correct? 505 pciD->pszLong name = pci->pszLongname;502 pciD->pszLongName = pci->pszLongName; 506 503 if (pciD->pszSubject != NullStr) { 507 504 xfree(pciD->pszSubject); … … 510 507 pciD->attrFile = pci->attrFile; 511 508 pciD->pszDispAttr = pci->pszDispAttr; 512 pciD->flags = 0;509 pciD->flags = CNRITEM_EXISTS; // 04 Aug 07 SHL 513 510 pciD->date = pci->date; 514 511 pciD->time = pci->time; … … 593 590 FreeCnrItemData(pciD); 594 591 pciD->pszFileName = xstrdup(newname, pszSrcFile, __LINE__); 595 pciD->pszLongname = NullStr;596 pciD->pszSubject = NullStr;597 592 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) { 598 593 pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->leftdir); … … 623 618 } 624 619 // 02 Aug 07 SHL fixme to know why - should already be set? 625 pci->flags = CNRITEM_EXISTS;620 // pci->flags = CNRITEM_EXISTS; 626 621 627 622 WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pci), … … 1253 1248 } 1254 1249 1255 #if 0 //============================ fixme to be gone =================1256 1257 if (filesl && filesl[l] && filesr && filesr[r]) {1258 // Got two names1259 x = stricmp(filesl[l]->fname, filesr[r]->fname);1260 if (!x) {1261 // Names match - insert on both sides1262 sprintf(szBuf, "%s%s%s", cmp->leftdir,1263 (cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\') ?1264 NullStr : "\\", filesl[l]->fname);1265 // pcil->rc.hptrIcon = hptrFile;1266 pcil->pszFileName = xstrdup(szBuf, pszSrcFile, __LINE__); // 31 Jul 07 SHL1267 pcil->pszDisplayName = pcil->pszFileName + lenl;1268 pcil->attrFile = filesl[l]->attrFile;1269 y = 0;1270 for (x = 0; x < 6; x++) {1271 if (attrstring[x])1272 pcil->szDispAttr[y++] =1273 (CHAR) ((pcil->1274 attrFile & (1 << x)) ? attrstring[x] : '-');1275 }1276 pcil->szDispAttr[5] = 0;1277 pcil->cbFile = filesl[l]->cbFile;1278 pcil->easize = filesl[l]->easize;1279 pcil->date.day = filesl[l]->date.day;1280 pcil->date.month = filesl[l]->date.month;1281 pcil->date.year = filesl[l]->date.year + 1980;1282 pcil->time.seconds = filesl[l]->time.twosecs * 2;1283 pcil->time.minutes = filesl[l]->time.minutes;1284 pcil->time.hours = filesl[l]->time.hours;1285 pcil->ladate.day = filesl[l]->ladate.day;1286 pcil->ladate.month = filesl[l]->ladate.month;1287 pcil->ladate.year = filesl[l]->ladate.year + 1980;1288 pcil->latime.seconds = filesl[l]->latime.twosecs * 2;1289 pcil->latime.minutes = filesl[l]->latime.minutes;1290 pcil->latime.hours = filesl[l]->latime.hours;1291 pcil->crdate.day = filesl[l]->crdate.day;1292 pcil->crdate.month = filesl[l]->crdate.month;1293 pcil->crdate.year = filesl[l]->crdate.year + 1980;1294 pcil->crtime.seconds = filesl[l]->crtime.twosecs * 2;1295 pcil->crtime.minutes = filesl[l]->crtime.minutes;1296 pcil->crtime.hours = filesl[l]->crtime.hours;1297 if (*cmp->dcd.mask.szMask) {1298 if (!Filter((PMINIRECORDCORE) pcil, (PVOID) & cmp->dcd.mask)) {1299 pcil->rc.flRecordAttr |= CRA_FILTERED;1300 pcir->rc.flRecordAttr |= CRA_FILTERED;1301 }1302 }1303 sprintf(szBuf, "%s%s%s", cmp->rightdir,1304 (cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\') ?1305 NullStr : "\\", filesr[r]->fname);1306 pcir->pszFileName = xstrdup(szBuf, pszSrcFile, __LINE__); // 31 Jul 07 SHL1307 pcir->pszDisplayName = pcir->pszFileName + lenr;1308 pcir->attrFile = filesr[r]->attrFile;1309 // pcir->rc.hptrIcon = hptrFile;1310 y = 0;1311 for (x = 0; x < 6; x++)1312 if (attrstring[x])1313 pcir->szDispAttr[y++] =1314 (CHAR) ((pcir->1315 attrFile & (1 << x)) ? attrstring[x] : '-');1316 pcir->szDispAttr[5] = 0;1317 pcir->cbFile = filesr[r]->cbFile;1318 pcir->easize = filesr[r]->easize;1319 pcir->date.day = filesr[r]->date.day;1320 pcir->date.month = filesr[r]->date.month;1321 pcir->date.year = filesr[r]->date.year + 1980;1322 pcir->time.seconds = filesr[r]->time.twosecs * 2;1323 pcir->time.minutes = filesr[r]->time.minutes;1324 pcir->time.hours = filesr[r]->time.hours;1325 pcir->ladate.day = filesr[r]->ladate.day;1326 pcir->ladate.month = filesr[r]->ladate.month;1327 pcir->ladate.year = filesr[r]->ladate.year + 1980;1328 pcir->latime.seconds = filesr[r]->latime.twosecs * 2;1329 pcir->latime.minutes = filesr[r]->latime.minutes;1330 pcir->latime.hours = filesr[r]->latime.hours;1331 pcir->crdate.day = filesr[r]->crdate.day;1332 pcir->crdate.month = filesr[r]->crdate.month;1333 pcir->crdate.year = filesr[r]->crdate.year + 1980;1334 pcir->crtime.seconds = filesr[r]->crtime.twosecs * 2;1335 pcir->crtime.minutes = filesr[r]->crtime.minutes;1336 pcir->crtime.hours = filesr[r]->crtime.hours;1337 pcil->flags |= CNRITEM_EXISTS;1338 pcir->flags |= CNRITEM_EXISTS;1339 pch = szBuf;1340 // Subject field holds status messages1341 // pch = pcil->pszSubject;1342 *pch = 0;1343 if (pcil->cbFile + pcil->easize > pcir->cbFile + pcir->easize) {1344 pcil->flags |= CNRITEM_LARGER;1345 pcir->flags |= CNRITEM_SMALLER;1346 strcpy(pch, GetPString(IDS_LARGERTEXT));1347 pch += 6;1348 }1349 else if (pcil->cbFile + pcil->easize <1350 pcir->cbFile + pcir->easize) {1351 pcil->flags |= CNRITEM_SMALLER;1352 pcir->flags |= CNRITEM_LARGER;1353 strcpy(pch, GetPString(IDS_SMALLERTEXT));1354 pch += 7;1355 }1356 if ((pcil->date.year > pcir->date.year) ? TRUE :1357 (pcil->date.year < pcir->date.year) ? FALSE :1358 (pcil->date.month > pcir->date.month) ? TRUE :1359 (pcil->date.month < pcir->date.month) ? FALSE :1360 (pcil->date.day > pcir->date.day) ? TRUE :1361 (pcil->date.day < pcir->date.day) ? FALSE :1362 (pcil->time.hours > pcir->time.hours) ? TRUE :1363 (pcil->time.hours < pcir->time.hours) ? FALSE :1364 (pcil->time.minutes > pcir->time.minutes) ? TRUE :1365 (pcil->time.minutes < pcir->time.minutes) ? FALSE :1366 (pcil->time.seconds > pcir->time.seconds) ? TRUE :1367 (pcil->time.seconds < pcir->time.seconds) ? FALSE : FALSE) {1368 pcil->flags |= CNRITEM_NEWER;1369 pcir->flags |= CNRITEM_OLDER;1370 if (pch != szBuf) {1371 strcpy(pch, ", ");1372 pch += 2;1373 }1374 strcpy(pch, GetPString(IDS_NEWERTEXT));1375 pch += 5;1376 }1377 else if ((pcil->date.year < pcir->date.year) ? TRUE :1378 (pcil->date.year > pcir->date.year) ? FALSE :1379 (pcil->date.month < pcir->date.month) ? TRUE :1380 (pcil->date.month > pcir->date.month) ? FALSE :1381 (pcil->date.day < pcir->date.day) ? TRUE :1382 (pcil->date.day > pcir->date.day) ? FALSE :1383 (pcil->time.hours < pcir->time.hours) ? TRUE :1384 (pcil->time.hours > pcir->time.hours) ? FALSE :1385 (pcil->time.minutes < pcir->time.minutes) ? TRUE :1386 (pcil->time.minutes > pcir->time.minutes) ? FALSE :1387 (pcil->time.seconds < pcir->time.seconds) ? TRUE :1388 (pcil->time.seconds > pcir->time.seconds) ? FALSE :1389 FALSE) {1390 pcil->flags |= CNRITEM_OLDER;1391 pcir->flags |= CNRITEM_NEWER;1392 if (pch != szBuf) {1393 strcpy(pch, ", ");1394 pch += 2;1395 }1396 strcpy(pch, GetPString(IDS_OLDERTEXT));1397 pch += 5;1398 }1399 *pch = 0;1400 pcil->pszSubject = *szBuf ? strdup(szBuf) : NullStr;1401 r++;1402 l++;1403 }1404 else if (x < 0) {1405 // Left side name less than right side name1406 // Insert name on left, leave blank filler on right1407 sprintf(szBuf, "%s%s%s", cmp->leftdir,1408 cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\' ?1409 NullStr : "\\",1410 filesl[l]->fname);1411 pcil->pszFileName = xstrdup(szBuf, pszSrcFile, __LINE__);1412 pcil->pszDisplayName = pcil->pszFileName + lenl;1413 pcil->attrFile = filesl[l]->attrFile;1414 // pcil->rc.hptrIcon = hptrFile;1415 y = 0;1416 for (x = 0; x < 6; x++)1417 if (attrstring[x])1418 pcil->szDispAttr[y++] =1419 (CHAR) ((pcil->1420 attrFile & (1 << x)) ? attrstring[x] : '-');1421 pcil->szDispAttr[5] = 0;1422 pcil->cbFile = filesl[l]->cbFile;1423 pcil->easize = filesl[l]->easize;1424 pcil->date.day = filesl[l]->date.day;1425 pcil->date.month = filesl[l]->date.month;1426 pcil->date.year = filesl[l]->date.year + 1980;1427 pcil->time.seconds = filesl[l]->time.twosecs * 2;1428 pcil->time.minutes = filesl[l]->time.minutes;1429 pcil->time.hours = filesl[l]->time.hours;1430 pcil->ladate.day = filesl[l]->ladate.day;1431 pcil->ladate.month = filesl[l]->ladate.month;1432 pcil->ladate.year = filesl[l]->ladate.year + 1980;1433 pcil->latime.seconds = filesl[l]->latime.twosecs * 2;1434 pcil->latime.minutes = filesl[l]->latime.minutes;1435 pcil->latime.hours = filesl[l]->latime.hours;1436 pcil->crdate.day = filesl[l]->crdate.day;1437 pcil->crdate.month = filesl[l]->crdate.month;1438 pcil->crdate.year = filesl[l]->crdate.year + 1980;1439 pcil->crtime.seconds = filesl[l]->crtime.twosecs * 2;1440 pcil->crtime.minutes = filesl[l]->crtime.minutes;1441 pcil->crtime.hours = filesl[l]->crtime.hours;1442 if (*cmp->dcd.mask.szMask) {1443 if (!Filter((PMINIRECORDCORE) pcil, (PVOID) & cmp->dcd.mask)) {1444 pcil->rc.flRecordAttr |= CRA_FILTERED;1445 pcir->rc.flRecordAttr |= CRA_FILTERED;1446 }1447 }1448 free(filesl[l]);1449 l++;1450 }1451 else {1452 // Left side name larger than right side name1453 // Insert name on right, leave blank filler on left1454 sprintf(szBuf, "%s%s%s", cmp->rightdir,1455 cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\' ?1456 NullStr : "\\",1457 filesr[r]->fname);1458 pcir->pszFileName = xstrdup(szBuf, pszSrcFile, __LINE__);1459 pcir->pszDisplayName = pcir->pszFileName + lenr;1460 pcir->attrFile = filesr[r]->attrFile;1461 // pcir->rc.hptrIcon = hptrFile;1462 y = 0;1463 for (x = 0; x < 6; x++) {1464 if (attrstring[x])1465 pcir->szDispAttr[y++] =1466 (CHAR) ((pcir->1467 attrFile & (1 << x)) ? attrstring[x] : '-');1468 }1469 pcir->szDispAttr[5] = 0;1470 pcir->cbFile = filesr[r]->cbFile;1471 pcir->easize = filesr[r]->easize;1472 pcir->date.day = filesr[r]->date.day;1473 pcir->date.month = filesr[r]->date.month;1474 pcir->date.year = filesr[r]->date.year + 1980;1475 pcir->time.seconds = filesr[r]->time.twosecs * 2;1476 pcir->time.minutes = filesr[r]->time.minutes;1477 pcir->time.hours = filesr[r]->time.hours;1478 pcir->ladate.day = filesr[r]->ladate.day;1479 pcir->ladate.month = filesr[r]->ladate.month;1480 pcir->ladate.year = filesr[r]->ladate.year + 1980;1481 pcir->latime.seconds = filesr[r]->latime.twosecs * 2;1482 pcir->latime.minutes = filesr[r]->latime.minutes;1483 pcir->latime.hours = filesr[r]->latime.hours;1484 pcir->crdate.day = filesr[r]->crdate.day;1485 pcir->crdate.month = filesr[r]->crdate.month;1486 pcir->crdate.year = filesr[r]->crdate.year + 1980;1487 pcir->crtime.seconds = filesr[r]->crtime.twosecs * 2;1488 pcir->crtime.minutes = filesr[r]->crtime.minutes;1489 pcir->crtime.hours = filesr[r]->crtime.hours;1490 if (*cmp->dcd.mask.szMask) {1491 if (!Filter((PMINIRECORDCORE) pcir, (PVOID) & cmp->dcd.mask)) {1492 pcir->rc.flRecordAttr |= CRA_FILTERED;1493 pcil->rc.flRecordAttr |= CRA_FILTERED;1494 }1495 }1496 free(filesr[r]);1497 r++;1498 }1499 }1500 else if (filesl && filesl[l]) {1501 // Left side list longer than right side list1502 // Insert name on left, leave blank filler on right1503 sprintf(szBuf, "%s%s%s", cmp->leftdir,1504 cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\' ?1505 NullStr : "\\",1506 filesl[l]->fname);1507 pcil->pszFileName = xstrdup(szBuf, pszSrcFile, __LINE__);1508 pcil->pszDisplayName = pcil->pszFileName + lenl;1509 pcil->attrFile = filesl[l]->attrFile;1510 // pcil->rc.hptrIcon = hptrFile;1511 y = 0;1512 for (x = 0; x < 6; x++)1513 if (attrstring[x])1514 pcil->szDispAttr[y++] = (CHAR) ((pcil->attrFile & (1 << x)) ?1515 attrstring[x] : '-');1516 pcil->szDispAttr[5] = 0;1517 pcil->cbFile = filesl[l]->cbFile;1518 pcil->easize = filesl[l]->easize;1519 pcil->date.day = filesl[l]->date.day;1520 pcil->date.month = filesl[l]->date.month;1521 pcil->date.year = filesl[l]->date.year + 1980;1522 pcil->time.seconds = filesl[l]->time.twosecs * 2;1523 pcil->time.minutes = filesl[l]->time.minutes;1524 pcil->time.hours = filesl[l]->time.hours;1525 pcil->ladate.day = filesl[l]->ladate.day;1526 pcil->ladate.month = filesl[l]->ladate.month;1527 pcil->ladate.year = filesl[l]->ladate.year + 1980;1528 pcil->latime.seconds = filesl[l]->latime.twosecs * 2;1529 pcil->latime.minutes = filesl[l]->latime.minutes;1530 pcil->latime.hours = filesl[l]->latime.hours;1531 pcil->crdate.day = filesl[l]->crdate.day;1532 pcil->crdate.month = filesl[l]->crdate.month;1533 pcil->crdate.year = filesl[l]->crdate.year + 1980;1534 pcil->crtime.seconds = filesl[l]->crtime.twosecs * 2;1535 pcil->crtime.minutes = filesl[l]->crtime.minutes;1536 pcil->crtime.hours = filesl[l]->crtime.hours;1537 if (*cmp->dcd.mask.szMask) {1538 if (!Filter((PMINIRECORDCORE) pcil, (PVOID) & cmp->dcd.mask)) {1539 pcil->rc.flRecordAttr |= CRA_FILTERED;1540 pcir->rc.flRecordAttr |= CRA_FILTERED;1541 }1542 }1543 free(filesl[l]);1544 l++;1545 }1546 else {1547 // filesr && filesr[r]1548 // Right side list longer than left side1549 // Insert name on right, leave blank filler on left1550 sprintf(szBuf, "%s%s%s", cmp->rightdir,1551 cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\' ?1552 NullStr : "\\",1553 filesr[r]->fname);1554 pcir->pszFileName = xstrdup(szBuf, pszSrcFile, __LINE__);1555 pcir->pszDisplayName = pcir->pszFileName + lenr;1556 pcir->attrFile = filesr[r]->attrFile;1557 // pcir->rc.hptrIcon = hptrFile;1558 y = 0;1559 for (x = 0; x < 6; x++) {1560 if (attrstring[x])1561 pcir->szDispAttr[y++] = (CHAR) ((pcir->attrFile & (1 << x)) ?1562 attrstring[x] : '-');1563 }1564 pcir->szDispAttr[5] = 0;1565 pcir->cbFile = filesr[r]->cbFile;1566 pcir->easize = filesr[r]->easize;1567 pcir->date.day = filesr[r]->date.day;1568 pcir->date.month = filesr[r]->date.month;1569 pcir->date.year = filesr[r]->date.year + 1980;1570 pcir->time.seconds = filesr[r]->time.twosecs * 2;1571 pcir->time.minutes = filesr[r]->time.minutes;1572 pcir->time.hours = filesr[r]->time.hours;1573 pcir->ladate.day = filesr[r]->ladate.day;1574 pcir->ladate.month = filesr[r]->ladate.month;1575 pcir->ladate.year = filesr[r]->ladate.year + 1980;1576 pcir->latime.seconds = filesr[r]->latime.twosecs * 2;1577 pcir->latime.minutes = filesr[r]->latime.minutes;1578 pcir->latime.hours = filesr[r]->latime.hours;1579 pcir->crdate.day = filesr[r]->crdate.day;1580 pcir->crdate.month = filesr[r]->crdate.month;1581 pcir->crdate.year = filesr[r]->crdate.year + 1980;1582 pcir->crtime.seconds = filesr[r]->crtime.twosecs * 2;1583 pcir->crtime.minutes = filesr[r]->crtime.minutes;1584 pcir->crtime.hours = filesr[r]->crtime.hours;1585 if (*cmp->dcd.mask.szMask) {1586 if (!Filter((PMINIRECORDCORE) pcir, (PVOID) & cmp->dcd.mask)) {1587 pcir->rc.flRecordAttr |= CRA_FILTERED;1588 pcil->rc.flRecordAttr |= CRA_FILTERED;1589 }1590 }1591 free(filesr[r]);1592 r++;1593 }1594 1595 #endif //=========================== fixme to be gone =================1596 1597 1250 // Ensure empty buffers point somewhere 1598 1251 if (!pcil->pszFileName) { … … 1609 1262 pcir->rc.pszIcon = pcir->pszDisplayName; 1610 1263 1611 pcil->pszLong name = NullStr;1612 pcir->pszLong name = NullStr;1264 pcil->pszLongName = NullStr; 1265 pcir->pszLongName = NullStr; 1613 1266 1614 1267 if (!pcil->pszSubject) -
trunk/dll/dircnrs.c
r761 r762 3045 3045 CHAR s[CCHMAXPATHCOMP + 91], tb[81], tf[81]; 3046 3046 3047 pci = (PCNRITEM) ( (pre)? pre->pRecord : NULL);3047 pci = (PCNRITEM) (pre ? pre->pRecord : NULL); 3048 3048 if (!pci) { 3049 3049 if (hwndStatus2) -
trunk/dll/dirsize.c
r761 r762 185 185 // fixme to know why - it appears to be indirectly saving length, but why? 186 186 pci->pszDisplayName = pci->pszFileName + strlen(pci->pszFileName); 187 pci->pszLong name = pci->pszFileName; // fixme to be sure?187 pci->pszLongName = pci->pszFileName; // fixme to be sure? 188 188 pci->rc.pszIcon = pci->pszFileName; 189 189 pci->rc.flRecordAttr |= CRA_RECORDREADONLY; … … 304 304 } 305 305 // Need unique buffer 23 Jul 07 SHL 306 pci->pszLong name = xmalloc(2, pszSrcFile, __LINE__);307 pci->pszLong name[0] = 0; // Make null string308 pci->pszLong name[1] = 1; // Flag root - hack cough306 pci->pszLongName = xmalloc(2, pszSrcFile, __LINE__); 307 pci->pszLongName[0] = 0; // Make null string 308 pci->pszLongName[1] = 1; // Flag root - hack cough 309 309 } 310 310 else … … 699 699 /* fill box with graph bar, flags is integer % */ 700 700 if (pci->flags) { 701 if (*(pci->pszLong name + 1) == 1) /* is root record */701 if (*(pci->pszLongName + 1) == 1) /* is root record */ 702 702 GpiSetColor(oi->hps, CLR_DARKGREEN); 703 703 else … … 711 711 712 712 /* draw highlights and shadows on graph */ 713 if (*(pci->pszLong name + 1) == 1)713 if (*(pci->pszLongName + 1) == 1) 714 714 GpiSetColor(oi->hps, CLR_GREEN); 715 715 else … … 728 728 ptl.x = oi->rclItem.xLeft + pci->flags; 729 729 GpiLine(oi->hps, &ptl); 730 if (*(pci->pszLong name + 1) != 1) {730 if (*(pci->pszLongName + 1) != 1) { 731 731 GpiSetColor(oi->hps, CLR_DARKRED); 732 732 ptl.x = oi->rclItem.xLeft + 2; -
trunk/dll/filldir.c
r760 r762 310 310 311 311 /* load the object's longname */ 312 pci->pszLong name = 0;312 pci->pszLongName = 0; 313 313 if (fLoadLongnames && 314 314 dcd && … … 346 346 value[pfea->cbValue] = 0; 347 347 if (*(USHORT *) value == EAT_ASCII) 348 pci->pszLong name = xstrdup(value + (sizeof(USHORT) * 2), pszSrcFile, __LINE__);348 pci->pszLongName = xstrdup(value + (sizeof(USHORT) * 2), pszSrcFile, __LINE__); 349 349 } 350 350 free(pfealist); … … 353 353 } 354 354 } 355 if (!pci->pszLong name)356 pci->pszLong name = NullStr;355 if (!pci->pszLongName) 356 pci->pszLongName = NullStr; 357 357 358 358 /* do anything required to case of filename */ … … 527 527 pci->pszSubject = NullStr; 528 528 529 pci->pszLong name = 0;529 pci->pszLongName = 0; 530 530 if (fLoadLongnames && 531 531 dcd && … … 564 564 if (*(USHORT *) value == EAT_ASCII) { 565 565 p = value + sizeof(USHORT) * 2; // Point at value string 566 pci->pszLong name = xstrdup(p, pszSrcFile, __LINE__);566 pci->pszLongName = xstrdup(p, pszSrcFile, __LINE__); 567 567 } 568 568 } … … 572 572 } 573 573 } 574 if (!pci->pszLong name)575 pci->pszLong name = NullStr;574 if (!pci->pszLongName) 575 pci->pszLongName = NullStr; 576 576 577 577 if (fForceUpper) … … 964 964 pci = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pciParent), 965 965 MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER)); 966 while (pci && (INT) 966 while (pci && (INT)pci != -1) { 967 967 if (pci->attrFile & FILE_DIRECTORY) 968 968 Stubby(hwndCnr, pci); … … 996 996 DosPostEventSem(CompactSem); 997 997 998 #if 0 // fixme to disable or to be configurable998 #if 0 // fixme to be gone or to be configurable 999 999 { 1000 1000 int state = _heapchk(); … … 1251 1251 MPVOID, 1252 1252 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); 1253 while (pci && (INT) 1253 while (pci && (INT)pci != -1) { 1254 1254 if ((ULONG) (toupper(*pci->pszFileName) - '@') == ulCurDriveNum) { 1255 1255 WinSendMsg(hwndCnr, … … 1352 1352 MPVOID, 1353 1353 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); 1354 while (pci && (INT) 1354 while (pci && (INT)pci != -1) { 1355 1355 pciNext = (PCNRITEM) WinSendMsg(hwndCnr, 1356 1356 CM_QUERYRECORD, … … 1401 1401 MPVOID, 1402 1402 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); 1403 while (pci && (INT) 1403 while (pci && (INT)pci != -1) { 1404 1404 pciNext = (PCNRITEM) WinSendMsg(hwndCnr, 1405 1405 CM_QUERYRECORD, … … 1412 1412 MPFROM2SHORT(CMA_FIRSTCHILD, 1413 1413 CMA_ITEMORDER)); 1414 while (pci && (INT) 1414 while (pci && (INT)pci != -1) { 1415 1415 if (pci->flags & RECFLAGS_ENV) 1416 1416 FleshEnv(hwndCnr, pci); … … 1498 1498 PFIELDINFO pfi; 1499 1499 1500 #if 0 // fixme to disable or to be configurable1500 #if 0 // fixme to be gone or to be configurable 1501 1501 { 1502 1502 int state = _heapchk(); … … 1521 1521 /** 1522 1522 * Free storage associated with container item 1523 * Caller is responsible for correcting pointers1524 1523 */ 1525 1524 1526 1525 VOID FreeCnrItemData(PCNRITEM pci) 1527 1526 { 1527 PSZ psz; 1528 1528 // DbgMsg(pszSrcFile, __LINE__, "FreeCnrItemData %p", pci); 1529 1529 1530 if (pci->pszSubject && pci->pszSubject != NullStr) 1531 xfree(pci->pszSubject); 1532 1533 if (pci->pszLongname && pci->pszLongname != NullStr && 1534 pci->pszLongname != pci->pszFileName && pci->pszLongname != pci->pszDisplayName) 1535 xfree(pci->pszLongname); 1536 1537 if (pci->pszFileName && pci->pszFileName != NullStr) 1538 xfree(pci->pszFileName); 1530 if (pci->pszSubject && pci->pszSubject != NullStr) { 1531 1532 psz = pci->pszSubject; 1533 pci->pszSubject = NullStr; 1534 free(psz); 1535 } 1536 1537 // +1 in case long name pointing after last backslash 1538 if (pci->pszLongName && 1539 pci->pszLongName != NullStr && 1540 pci->pszLongName != pci->pszFileName && 1541 pci->pszLongName != pci->pszDisplayName && 1542 pci->pszLongName != pci->pszDisplayName + 1) { 1543 psz = pci->pszLongName; 1544 pci->pszLongName = NullStr; 1545 free(psz); 1546 } 1547 1548 if (pci->pszFileName && pci->pszFileName != NullStr) { 1549 psz = pci->pszFileName; 1550 pci->pszFileName = NullStr; 1551 free(psz); 1552 } 1539 1553 } 1540 1554 1541 1555 /** 1542 * Free container item and associated storage1556 * Free single container item and associated storage 1543 1557 */ 1544 1558 1545 INTFreeCnrItem(HWND hwnd, PCNRITEM pci)1559 VOID FreeCnrItem(HWND hwnd, PCNRITEM pci) 1546 1560 { 1547 INT remaining;1548 1549 1561 // DbgMsg(pszSrcFile, __LINE__, "FreeCnrItem hwnd %x pci %p", hwnd, pci); 1550 1562 1551 1563 FreeCnrItemData(pci); 1552 1564 1553 remaining = (INT)WinSendMsg(hwnd, CM_FREERECORD, MPFROMP(&pci), MPFROMSHORT(1)); 1554 if (remaining == -1) { 1565 if (!WinSendMsg(hwnd, CM_FREERECORD, MPFROMP(&pci), MPFROMSHORT(1))) { 1555 1566 // Win_Error2(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,IDS_CMFREEERRTEXT); 1556 1567 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_FREERECORD hwnd %x pci %p", hwnd, pci); 1557 1568 } 1558 return remaining;1559 1569 } 1560 1570 … … 1567 1577 PCNRITEM pci = pciFirst; 1568 1578 PCNRITEM pciNext; 1569 1570 while (pci) { 1579 USHORT usCount; 1580 1581 for (usCount = 0; pci; usCount++) { 1571 1582 pciNext = (PCNRITEM) pci->rc.preccNextRecord; 1572 if (FreeCnrItem(hwnd, pci) == -1) 1573 break; // Avoid cascading errors 1583 FreeCnrItemData(pci); 1574 1584 pci = pciNext; 1585 } 1586 1587 if (usCount) { 1588 if (!WinSendMsg(hwnd, CM_FREERECORD, MPFROMP(&pci), MPFROMSHORT(usCount))) { 1589 // Win_Error2(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,IDS_CMFREEERRTEXT); 1590 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_FREERECORD hwnd %x pci %p cnt %u", hwnd, pci, usCount); 1591 } 1575 1592 } 1576 1593 } … … 1578 1595 /** 1579 1596 * Remove item(s) from container and free associated storage if requested 1597 * @param pciFirst points to first item to remove or NULL to remove all 1598 * @param usCnt is remove count or 0 to remove all 1580 1599 * @returns count of items remaining in container or -1 if error 1581 1600 */ 1582 1601 1583 INT RemoveCnrItems(HWND hwnd, PCNRITEM pci , USHORT usCnt, USHORT usFlags)1602 INT RemoveCnrItems(HWND hwnd, PCNRITEM pciFirst, USHORT usCnt, USHORT usFlags) 1584 1603 { 1585 INT remaining ;1586 1587 if (usCnt == 0) { 1588 if (pci != NULL) {1589 Runtime_Error(pszSrcFile, __LINE__, "pci not NULL");1604 INT remaining = usCnt; 1605 PCNRITEM pci; 1606 1607 if ((usCnt && !pciFirst) || (!usCnt && pciFirst)) { 1608 Runtime_Error(pszSrcFile, __LINE__, "pciFirst %p usCnt %u mismatch", pciFirst, usCnt); 1590 1609 remaining = -1; 1591 } 1592 else { 1593 for (;;) { 1610 } 1611 else { 1612 // Free our buffers if free requested 1613 if (usFlags & CMA_FREE) { 1614 if (pciFirst) 1615 pci = pciFirst; 1616 else { 1594 1617 pci = (PCNRITEM)WinSendMsg(hwnd, CM_QUERYRECORD, MPVOID, 1595 1618 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); 1596 if (!pci) { 1597 remaining = 0; 1598 break; // Done 1599 } 1600 else if ((INT)pci == -1) { 1619 if ((INT)pci == -1) { 1601 1620 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_QUERYRECORD"); 1602 1621 remaining = -1; 1622 pci = NULL; 1623 } 1624 } 1625 while (pci) { 1626 FreeCnrItemData(pci); 1627 pci = (PCNRITEM)pci->rc.preccNextRecord; 1628 if (remaining && --remaining == 0) 1603 1629 break; 1604 } 1605 else { 1606 remaining = RemoveCnrItems(hwnd, pci, 1, usFlags); 1607 if (remaining == -1) 1608 break; 1609 } 1610 } // for 1611 } 1612 } 1613 else if (usCnt != 1) { 1614 Runtime_Error(pszSrcFile, __LINE__, "count not 1"); 1615 remaining = -1; 1616 } 1617 else { 1618 // DbgMsg(pszSrcFile, __LINE__, "RemoveCnrItems %p %u %s", pci, usCnt, pci->pszFileName); 1619 1620 if (usFlags & CMA_FREE) 1621 FreeCnrItemData(pci); 1622 1623 remaining = (INT)WinSendMsg(hwnd, CM_REMOVERECORD, MPFROMP(&pci), MPFROM2SHORT(usCnt, usFlags)); 1630 } 1631 } 1632 } 1633 1634 // DbgMsg(pszSrcFile, __LINE__, "RemoveCnrItems %p %u %s", pci, usCnt, pci->pszFileName); 1635 1636 if (remaining != - 1) { 1637 remaining = (INT)WinSendMsg(hwnd, CM_REMOVERECORD, MPFROMP(&pciFirst), MPFROM2SHORT(usCnt, usFlags)); 1624 1638 if (remaining == -1) { 1625 1639 // Win_Error2(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,IDS_CMREMOVEERRTEXT); 1626 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_REMOVERECORD hwnd %x pci %p", hwnd, pci); 1627 } 1628 } 1640 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_REMOVERECORD hwnd %x pci %p cnt %u", hwnd, pciFirst, usCnt); 1641 } 1642 } 1643 1629 1644 return remaining; 1630 1645 } -
trunk/dll/fm3dll.h
r751 r762 419 419 CDATE crdate; /* Creation date of file */ 420 420 CTIME crtime; /* Creation time of file */ 421 CHAR *pszLong name; // Points to long name buffer - used by code and by CFA_STRING421 CHAR *pszLongName; // Points to long name buffer - used by code and by CFA_STRING 422 422 ULONGLONG cbFile; /* File size */ 423 423 ULONGLONG easize; // Size of EAs - dirsize uses this - hack cough … … 639 639 const PSZ pszFileName, const PFILESTATUS4 pfsa4, 640 640 const BOOL partial, DIRCNRDATA *pdcd); 641 INTFreeCnrItem(HWND hwnd, PCNRITEM pci);641 VOID FreeCnrItem(HWND hwnd, PCNRITEM pci); 642 642 VOID FreeCnrItemList(HWND hwnd, PCNRITEM pciFirst); 643 643 VOID FreeCnrItemData(PCNRITEM pci); -
trunk/dll/misc.c
r756 r762 514 514 pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY; 515 515 pfi->pTitleData = GetPString(IDS_LNAME); 516 pfi->offStruct = FIELDOFFSET(CNRITEM, pszLong name);516 pfi->offStruct = FIELDOFFSET(CNRITEM, pszLongName); 517 517 518 518 // Store the current pfi value as that will be used to indicate the … … 740 740 return (MRESULT) TRUE; 741 741 } 742 else if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszLong name)) {742 else if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszLongName)) { 743 743 744 744 CHAR longname[CCHMAXPATHCOMP]; … … 749 749 longname[retlen + 1] = 0; 750 750 //chop_at_crnl(longname); 751 pci->pszLong name = xrealloc(pci->pszLongname, retlen + 1, pszSrcFile, __LINE__);751 pci->pszLongName = xrealloc(pci->pszLongName, retlen + 1, pszSrcFile, __LINE__); 752 752 WinSetWindowText(hwndMLE, longname); 753 753 pci->pszFileName = xrealloc(pci->pszFileName, retlen + 1, pszSrcFile, __LINE__); -
trunk/dll/objcnr.c
r761 r762 104 104 pciP->pszDispAttr = NullStr; 105 105 pciP->pszSubject = NullStr; 106 pciP->pszLong name = NullStr;106 pciP->pszLongName = NullStr; 107 107 if (strlen(filename) < 4) 108 108 pciP->pszDisplayName = pciP->pszFileName; -
trunk/dll/saveclip.c
r761 r762 478 478 break; 479 479 case 'l': 480 fputs(pci->pszLong name, fp);480 fputs(pci->pszLongName, fp); 481 481 break; 482 482 case 'L': 483 fprintf(fp, "%-40s", pci->pszLong name);483 fprintf(fp, "%-40s", pci->pszLongName); 484 484 break; 485 485 case 'F': -
trunk/dll/select.c
r751 r762 21 21 14 Jun 07 SHL SelectAll: make odd expression go away 22 22 02 Aug 07 SHL Sync with CNRITEM mods 23 04 Aug 07 SHL Use Runtime_Error 23 24 24 25 ***********************************************************************/ … … 574 575 #pragma alloc_text(SELECT4,FreeCnrs,SpecialSelect2,CompSSNames,CompSSNamesB) 575 576 577 /** 578 * Do select actions for compare directories containers 579 * 580 */ 581 576 582 VOID SpecialSelect(HWND hwndCnrS, HWND hwndCnrD, INT action, BOOL reset) 577 583 { … … 582 588 583 589 584 if (!hwndCnrS || !hwndCnrD) 590 if (!hwndCnrS || !hwndCnrD) { 591 Runtime_Error(pszSrcFile, __LINE__, "hwndCnrS %p hwndCnrD %p", hwndCnrS, hwndCnrD); 585 592 return; 593 } 586 594 587 595 memset(&cnri, 0, sizeof(CNRINFO)); … … 596 604 numS = (INT) cnri.cRecords; 597 605 if (!numD || numS != numD) { 598 saymsg(MB_ENTER, 599 HWND_DESKTOP, 600 DEBUG_STRING, "numD (%lu) != numS (%lu)", numD, numS); 606 Runtime_Error(pszSrcFile, __LINE__, "numD %u != numS %u", numD, numS); 601 607 return; 602 608 } … … 630 636 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 631 637 if (!(x % 500)) 632 DosSleep(1 L);638 DosSleep(1); 633 639 else if (!(x % 50)) 634 640 DosSleep(1); 635 } 641 } // while 642 636 643 if (numD != x) { 637 644 if (!slow) { … … 641 648 free(pciDa); 642 649 free(pciSa); 643 saymsg(MB_ENTER, 644 HWND_DESKTOP, DEBUG_STRING, "numD (%lu) != x (%lu)", numD, x); 650 Runtime_Error(pszSrcFile, __LINE__, "numD %u != x %lu", numD, x); 645 651 return; 646 652 } … … 660 666 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 661 667 if (!(x % 500)) 662 DosSleep(1 L);668 DosSleep(1); 663 669 else if (!(x % 50)) 664 670 DosSleep(1); 665 } 671 } // while 672 666 673 if (numS != x) { 667 674 if (!slow) { … … 725 732 } 726 733 if (!(x % 500)) 727 DosSleep(1 L);734 DosSleep(1); 728 735 else if (!(x % 50)) 729 736 DosSleep(1); … … 1186 1193 DosPostEventSem(CompactSem); 1187 1194 } 1195 1196 /** 1197 * Do select actions for single container 1198 * 1199 */ 1188 1200 1189 1201 VOID SpecialSelect2(HWND hwndParent, INT action)
Note: See TracChangeset
for help on using the changeset viewer.