Changeset 762 for trunk/dll/arccnrs.c
- Timestamp:
- Aug 5, 2007, 1:19:21 AM (18 years ago)
- File:
-
- 1 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;
Note:
See TracChangeset
for help on using the changeset viewer.