Changeset 773
- Timestamp:
- Aug 7, 2007, 11:23:27 PM (18 years ago)
- Location:
- trunk/dll
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/arccnrs.c
r771 r773 41 41 16 Jun 07 SHL Use DosQueryAppType not DosQAppType 42 42 02 Aug 07 SHL Sync with ARCITEM mods 43 06 Aug 07 SHL Use BldFullPathName and BldQuotedFileName 44 06 Aug 07 SHL Move BldQuotedFileName and BldQuotedFullPathNamehere 45 to be near primary caller 43 46 44 47 ***********************************************************************/ … … 76 79 static PSZ pszSrcFile = __FILE__; 77 80 78 #pragma alloc_text(ARCCNRS,ArcCnrWndProc,ArcObjWndProc,ArcClientWndProc )79 #pragma alloc_text(ARCCNRS,ArcTextProc,FillArcCnr,ArcFilter )81 #pragma alloc_text(ARCCNRS,ArcCnrWndProc,ArcObjWndProc,ArcClientWndProc,BldQuotedFullPathName) 82 #pragma alloc_text(ARCCNRS,ArcTextProc,FillArcCnr,ArcFilter,BldQuotedFileName) 80 83 #pragma alloc_text(ARCCNRS,ArcSort,ArcFrameWndProc,IsArcThere,ArcErrProc) 81 84 #pragma alloc_text(STARTUP,StartArcCnr) 85 86 /** 87 * Build quoted full path name in callers buffer given 88 * directory name and filename 89 * @param pszPathName points to drive/directory if not NULL 90 * @returns pointer to quoted path name in caller's buffer 91 */ 92 93 PSZ BldQuotedFullPathName(PSZ pszFullPathName, PSZ pszPathName, PSZ pszFileName) 94 { 95 UINT c = pszPathName ? strlen(pszPathName) : 0; 96 BOOL q = needs_quoting(pszPathName) || 97 needs_quoting(pszFileName); 98 PSZ psz = pszFullPathName; 99 100 if (q) 101 *psz++ = '"'; 102 if (c > 0) { 103 memcpy(psz, pszPathName, c); 104 psz += c; 105 if (*(psz - 1) != '\\') 106 *psz++ = '\\'; 107 } 108 strcpy(psz, pszFileName); 109 if (q) { 110 psz += strlen(psz); 111 *psz++ = '"'; 112 *psz = 0; 113 } 114 return pszFullPathName; 115 } 116 117 /** 118 * Build quoted full path name in callers buffer given a filename 119 * @returns pointer to quoted file name in caller's buffer 120 */ 121 122 PSZ BldQuotedFileName(PSZ pszQuotedFileName, PSZ pszFileName) 123 { 124 BOOL q = needs_quoting(pszFileName); 125 PSZ psz = pszQuotedFileName; 126 127 if (q) 128 *psz++ = '"'; 129 strcpy(psz, pszFileName); 130 if (q) { 131 psz += strlen(psz); 132 *psz++ = '"'; 133 *psz = 0; 134 } 135 return pszQuotedFileName; 136 } 82 137 83 138 static MRESULT EXPENTRY ArcErrProc(HWND hwnd, ULONG msg, MPARAM mp1, … … 85 140 { 86 141 ARCDUMP *ad; 142 CHAR szQuotedArcName[CCHMAXPATH]; 87 143 88 144 switch (msg) { … … 158 214 ad = WinQueryWindowPtr(hwnd, QWL_USER); 159 215 runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED, 160 hwnd, NULL, NULL, "%s %s%s%s", ad->info->test, 161 needs_quoting(ad->arcname) ? "\"" : NullStr, 162 ad->arcname, 163 needs_quoting(ad->arcname) ? "\"" : NullStr); 216 hwnd, NULL, NULL, 217 "%s %s", 218 ad->info->test, 219 BldQuotedFileName(szQuotedArcName, ad->arcname)); 220 // runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED, 221 // hwnd, NULL, NULL, "%s %s%s%s", ad->info->test, 222 // needs_quoting(ad->arcname) ? "\"" : NullStr, 223 // ad->arcname, 224 // needs_quoting(ad->arcname) ? "\"" : NullStr); 164 225 break; 165 226 } … … 383 444 static VOID EmptyArcCnr(HWND hwnd) 384 445 { 385 #if 0 // fixme to disable or to be configurable446 #if 0 // fixme to be gone or to be configurable 386 447 { 387 448 int state = _heapchk(); … … 409 470 HFILE newstdout; 410 471 CHAR s[CCHMAXPATH * 2], lonename[CCHMAXPATH + 2], 411 *nsize, *osize, *fdate, *fname, *p, *pp, arctemp[33];472 *nsize, *osize, *fdate, *fname, *p, *pp, arctemp[33]; 412 473 BOOL gotstart; 413 474 BOOL gotend; 414 475 BOOL wasquote; 415 BOOL nomove = FALSE; // fixme to be gone?476 BOOL nomove = FALSE; // fixme to be gone? 416 477 INT highest = 0, x, counter = 0, numarcfiles = 0; 417 478 PARCITEM lastpai; … … 484 545 p = GetCmdSpec(TRUE); 485 546 runemf2(SEPARATE | INVISIBLE | MINIMIZED | BACKGROUND | WAIT, 486 hwndCnr, 487 NULL, 488 "DOS_BACKGROUND_EXECUTION=1", 489 "%s /C %s %s%s%s > %s", 490 p, 491 info->list, 492 needs_quoting(arcname) ? "\"" : NullStr, 493 arcname, 494 needs_quoting(arcname) ? "\"" : NullStr, 547 hwndCnr, NULL, "DOS_BACKGROUND_EXECUTION=1", 548 "%s /C %s %s >%s", 549 p, // shell 550 info->list, // list command 551 BldQuotedFileName(s, arcname), 495 552 arctemp); 553 // runemf2(SEPARATE | INVISIBLE | MINIMIZED | BACKGROUND | WAIT, 554 // hwndCnr, 555 // NULL, 556 // "DOS_BACKGROUND_EXECUTION=1", 557 // "%s /C %s %s%s%s > %s", 558 // p, 559 // info->list, 560 // needs_quoting(arcname) ? "\"" : NullStr, 561 // arcname, 562 // needs_quoting(arcname) ? "\"" : NullStr, 563 // arctemp); 496 564 } 497 565 else { … … 519 587 else { 520 588 runemf2(SEPARATE | INVISIBLE | FULLSCREEN | BACKGROUND | WAIT, 521 hwndCnr, NULL, NULL, "%s %s%s%s", info->list, 522 needs_quoting(arcname) ? "\"" : NullStr, 523 arcname, 524 needs_quoting(arcname) ? "\"" : NullStr); 589 hwndCnr, NULL, NULL, 590 "%s %s", 591 info->list, 592 BldQuotedFileName(s, arcname)); 593 // runemf2(SEPARATE | INVISIBLE | FULLSCREEN | BACKGROUND | WAIT, 594 // hwndCnr, NULL, NULL, "%s %s%s%s", info->list, 595 // needs_quoting(arcname) ? "\"" : NullStr, 596 // arcname, 597 // needs_quoting(arcname) ? "\"" : NullStr); 525 598 oldstdout = fileno(stdout); 526 599 DosError(FERR_DISABLEHARDERR); … … 1215 1288 DIRCNRDATA *dcd; 1216 1289 PSZ psz; 1290 CHAR szQuotedArcName[CCHMAXPATH]; 1291 CHAR szQuotedMemberName[CCHMAXPATH]; 1217 1292 1218 1293 switch (msg) { … … 1312 1387 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"%s %s %s\r[%s]",dcd->info->extract,dcd->arcname,membername,construct); 1313 1388 runemf2(SEPARATE | WINDOWED | WAIT | 1314 (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED) |1315 WAIT,1316 dcd->hwndClient, construct, NULL, "%s %s%s%s %s%s%s",1389 (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED), 1390 dcd->hwndClient, construct, NULL, 1391 "%s %s %s", 1317 1392 dcd->info->extract, 1318 needs_quoting(dcd->arcname) ? "\"" : NullStr, 1319 dcd->arcname, 1320 needs_quoting(dcd->arcname) ? "\"" : NullStr, 1321 needs_quoting(membername) ? "\"" : NullStr, 1322 membername, 1323 needs_quoting(membername) ? "\"" : NullStr); 1324 if (*construct && construct[strlen(construct) - 1] != '\\') 1325 strcat(construct, "\\"); 1326 strcat(construct, membername); 1393 BldQuotedFileName(szQuotedArcName, dcd->arcname), 1394 BldQuotedFileName(szQuotedMemberName, membername)); 1395 // runemf2(SEPARATE | WINDOWED | WAIT | 1396 // (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED) | 1397 // WAIT, 1398 // dcd->hwndClient, construct, NULL, "%s %s%s%s %s%s%s", 1399 // dcd->info->extract, 1400 // needs_quoting(dcd->arcname) ? "\"" : NullStr, 1401 // dcd->arcname, 1402 // needs_quoting(dcd->arcname) ? "\"" : NullStr, 1403 // needs_quoting(membername) ? "\"" : NullStr, 1404 // membername, 1405 // needs_quoting(membername) ? "\"" : NullStr); 1406 BldFullPathName(construct, construct, membername); 1407 // if (*construct && construct[strlen(construct) - 1] != '\\') 1408 // strcat(construct, "\\"); 1409 // strcat(construct, membername); 1327 1410 if (IsFile(construct) != -1) { 1328 1411 rename(construct, filename); … … 1439 1522 return 0; 1440 1523 } 1441 runemf2(SEPARATE | WINDOWED | 1442 (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED) |1443 WAIT,1444 dcd->hwndClient, dcd->workdir, NULL, "%s %s%s%s %s%s%s",1524 runemf2(SEPARATE | WINDOWED | WAIT | 1525 (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED), 1526 dcd->hwndClient, dcd->workdir, NULL, 1527 "%s %s %s", 1445 1528 dcd->info->exwdirs ? dcd->info->exwdirs : 1446 1529 dcd->info->extract, 1447 needs_quoting(dcd->arcname) ? "\"" : NullStr, 1448 dcd->arcname, 1449 needs_quoting(dcd->arcname) ? "\"" : NullStr, 1450 needs_quoting(s) ? "\"" : NullStr, 1451 s, 1452 needs_quoting(s) ? "\"" : NullStr); 1453 1454 // printf("%s %d runemf2 returned\n", __FILE__, __LINE__); fflush(stdout); // 10 Mar 07 SHL 1530 BldQuotedFileName(szQuotedArcName, dcd->arcname), 1531 BldQuotedFileName(szQuotedMemberName, s)); 1532 // runemf2(SEPARATE | WINDOWED | 1533 // (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED) | 1534 // WAIT, 1535 // dcd->hwndClient, dcd->workdir, NULL, "%s %s%s%s %s%s%s", 1536 // dcd->info->exwdirs ? dcd->info->exwdirs : 1537 // dcd->info->extract, 1538 // needs_quoting(dcd->arcname) ? "\"" : NullStr, 1539 // dcd->arcname, 1540 // needs_quoting(dcd->arcname) ? "\"" : NullStr, 1541 // needs_quoting(s) ? "\"" : NullStr, 1542 // s, 1543 // needs_quoting(s) ? "\"" : NullStr); 1455 1544 if (!dcd->info->exwdirs) { 1456 1545 p = s; … … 1517 1606 strcpy(szBuffer, ad.command); 1518 1607 strcat(szBuffer, " "); 1519 if (needs_quoting(ad.arcname)) 1520 strcat(szBuffer, "\""); 1521 strcat(szBuffer, ad.arcname); 1522 if (needs_quoting(ad.arcname)) 1523 strcat(szBuffer, "\""); 1524 p = &szBuffer[strlen(szBuffer)]; 1608 1609 BldQuotedFileName(szBuffer + strlen(szBuffer), ad.arcname); 1610 // if (needs_quoting(ad.arcname)) 1611 // strcat(szBuffer, "\""); 1612 // strcat(szBuffer, ad.arcname); 1613 // if (needs_quoting(ad.arcname)) 1614 // strcat(szBuffer, "\""); 1615 1616 p = &szBuffer[strlen(szBuffer)]; // Remeber where archiver name ends 1617 1525 1618 if (ad.mask.szMask) { 1526 1619 strcat(szBuffer, " "); 1527 if (needs_quoting(ad.mask.szMask)) 1528 strcat(szBuffer, "\""); 1529 strcat(szBuffer, ad.mask.szMask); 1530 if (needs_quoting(ad.mask.szMask)) 1531 strcat(szBuffer, "\""); 1620 1621 BldQuotedFileName(szBuffer + strlen(szBuffer), ad.mask.szMask); 1622 // if (needs_quoting(ad.mask.szMask)) 1623 // strcat(szBuffer, "\""); 1624 // strcat(szBuffer, ad.mask.szMask); 1625 // if (needs_quoting(ad.mask.szMask)) 1626 // strcat(szBuffer, "\""); 1532 1627 } 1533 1628 strcat(szBuffer, " "); 1534 1629 x = 0; 1630 1631 // Run commands avoiding command line overflow 1535 1632 while (li->list[x]) { 1536 if (needs_quoting(li->list[x])) 1537 strcat(szBuffer, "\""); 1538 strcat(szBuffer, li->list[x]); 1539 if (!IsFile(li->list[x])) { 1540 if (szBuffer[strlen(szBuffer) - 1] != '\\') 1541 strcat(szBuffer, "\\"); 1542 strcat(szBuffer, "*"); 1543 } 1544 if (needs_quoting(li->list[x])) 1545 strcat(szBuffer, "\""); 1633 1634 if (IsFile(li->list[x])) 1635 BldQuotedFileName(szBuffer + strlen(szBuffer), li->list[x]); 1636 else 1637 BldQuotedFullPathName(szBuffer + strlen(szBuffer), li->list[x], "*"); 1638 1639 // if (needs_quoting(li->list[x])) 1640 // strcat(szBuffer, "\""); 1641 // strcat(szBuffer, li->list[x]); 1642 // if (!IsFile(li->list[x])) { 1643 // if (szBuffer[strlen(szBuffer) - 1] != '\\') 1644 // strcat(szBuffer, "\\"); 1645 // strcat(szBuffer, "*"); 1646 // } 1647 // if (needs_quoting(li->list[x])) 1648 // strcat(szBuffer, "\""); 1649 1546 1650 x++; 1547 1651 if (!li->list[x] || strlen(szBuffer) + … … 1554 1658 } 1555 1659 strcat(szBuffer, " "); 1556 } 1660 } // while 1661 1557 1662 PostMsg(dcd->hwndCnr, UM_RESCAN, MPFROMSHORT(1), MPVOID); 1558 1663 Broadcast(WinQueryAnchorBlock(hwnd), … … 1594 1699 if (!li->list || !li->list[0]) 1595 1700 break; 1596 if (li->type == IDM_DELETE) 1597 sprintf(cl, "%s %s%s%s", dcd->info->delete, 1598 (needs_quoting(dcd->arcname)) ? "\"" : NullStr, 1599 dcd->arcname, 1600 (needs_quoting(dcd->arcname)) ? "\"" : NullStr); 1601 else 1602 sprintf(cl, "%s %s%s%s", dcd->info->create, 1603 (needs_quoting(dcd->arcname)) ? "\"" : NullStr, 1604 dcd->arcname, 1605 (needs_quoting(dcd->arcname)) ? "\"" : NullStr); 1701 strcpy(cl, li->type == IDM_DELETE ? 1702 dcd->info->delete : 1703 dcd->info->create); 1704 strcat(cl, " "); 1705 BldQuotedFileName(cl + strlen(cl), dcd->arcname); 1706 // if (li->type == IDM_DELETE) 1707 // sprintf(cl, "%s %s%s%s", dcd->info->delete, 1708 // (needs_quoting(dcd->arcname)) ? "\"" : NullStr, 1709 // dcd->arcname, 1710 // (needs_quoting(dcd->arcname)) ? "\"" : NullStr); 1711 // else 1712 // sprintf(cl, "%s %s%s%s", dcd->info->create, 1713 // (needs_quoting(dcd->arcname)) ? "\"" : NullStr, 1714 // dcd->arcname, 1715 // (needs_quoting(dcd->arcname)) ? "\"" : NullStr); 1606 1716 endofit = &cl[strlen(cl)]; 1607 1717 z = 0; … … 1610 1720 strlen(cl) + strlen(li->list[x]) < 999; x++) { 1611 1721 strcat(cl, " "); 1612 if (needs_quoting(li->list[x])) 1613 strcat(cl, "\""); 1614 strcat(cl, li->list[x]); 1615 if (needs_quoting(li->list[x])) 1616 strcat(cl, "\""); 1722 BldQuotedFileName(cl + strlen(cl), li->list[x]); 1723 // if (needs_quoting(li->list[x])) 1724 // strcat(cl, "\""); 1725 // strcat(cl, li->list[x]); 1726 // if (needs_quoting(li->list[x])) 1727 // strcat(cl, "\""); 1617 1728 } 1618 1729 z = x; 1619 runemf2(SEPARATE | WINDOWED | 1620 (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED) | 1621 WAIT, 1730 runemf2(SEPARATE | WINDOWED | WAIT | 1731 (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED), 1622 1732 hwnd, NullStr, NULL, "%s", cl); 1623 1733 *endofit = 0; … … 1670 1780 1671 1781 for (x = 0; li->list[x]; x++) { 1672 sprintf(fullname, "%s%s%s", 1673 li->targetpath, 1674 (li->targetpath[strlen(li->targetpath) - 1] == '\\') ? 1675 NullStr : "\\", li->list[x]); 1782 BldFullPathName(fullname, li->targetpath, li->list[x]); 1783 // sprintf(fullname, "%s%s%s", 1784 // li->targetpath, 1785 // (li->targetpath[strlen(li->targetpath) - 1] == '\\') ? 1786 // NullStr : "\\", li->list[x]); 1676 1787 if (IsFile(fullname) != -1) { 1677 1788 AddToList(li->list[x], &exfiles, &numfiles, &numalloc); … … 1708 1819 if (!li->list || !li->list[0]) 1709 1820 break; 1710 sprintf(cl, "%s %s%s%s", (li->type == IDM_EXTRACT || 1711 ((li->type == IDM_VIEW 1712 || li->type == IDM_VIEWTEXT 1713 || li->type == IDM_VIEWBINARY 1714 || li->type == IDM_VIEWARCHIVE 1715 || li->type == IDM_PRINT 1716 || li->type == IDM_EDIT 1717 || li->type == IDM_EDITTEXT 1718 || li->type == IDM_EDITBINARY 1719 && li->type == IDM_MCIPLAY) 1720 && !li->info->exwdirs)) ? li->info-> 1721 extract : li->info->exwdirs, 1722 needs_quoting(li->arcname) ? "\"" : NullStr, 1723 li->arcname, 1724 needs_quoting(li->arcname) ? "\"" : NullStr); 1821 strcpy(cl, 1822 (li->type == IDM_EXTRACT || 1823 ((li->type == IDM_VIEW || 1824 li->type == IDM_VIEWTEXT || 1825 li->type == IDM_VIEWBINARY || 1826 li->type == IDM_VIEWARCHIVE || 1827 li->type == IDM_PRINT || 1828 li->type == IDM_EDIT || 1829 li->type == IDM_EDITTEXT || 1830 (li->type == IDM_EDITBINARY && 1831 li->type == IDM_MCIPLAY)) && 1832 !li->info->exwdirs)) ? 1833 li->info->extract : 1834 li->info->exwdirs); 1835 strcat(cl, " "); 1836 BldQuotedFileName(cl + strlen(cl), li->arcname); 1837 // sprintf(cl, "%s %s%s%s", (li->type == IDM_EXTRACT || 1838 // ((li->type == IDM_VIEW 1839 // || li->type == IDM_VIEWTEXT 1840 // || li->type == IDM_VIEWBINARY 1841 // || li->type == IDM_VIEWARCHIVE 1842 // || li->type == IDM_PRINT 1843 // || li->type == IDM_EDIT 1844 // || li->type == IDM_EDITTEXT 1845 // || li->type == IDM_EDITBINARY 1846 // && li->type == IDM_MCIPLAY) 1847 // && !li->info->exwdirs)) ? li->info-> 1848 // extract : li->info->exwdirs, 1849 // needs_quoting(li->arcname) ? "\"" : NullStr, 1850 // li->arcname, 1851 // needs_quoting(li->arcname) ? "\"" : NullStr); 1725 1852 endofit = &cl[strlen(cl)]; 1726 1853 z = 0; … … 1729 1856 strlen(cl) + strlen(li->list[x]) < 999; x++) { 1730 1857 strcat(cl, " "); 1731 if (needs_quoting(li->list[x])) 1732 strcat(cl, "\""); 1733 strcat(cl, li->list[x]); 1734 if (needs_quoting(li->list[x])) 1735 strcat(cl, "\""); 1858 BldQuotedFileName(cl + strlen(cl), li->list[x]); 1859 // if (needs_quoting(li->list[x])) 1860 // strcat(cl, "\""); 1861 // strcat(cl, li->list[x]); 1862 // if (needs_quoting(li->list[x])) 1863 // strcat(cl, "\""); 1736 1864 ptr = li->list[x]; 1737 1865 while (*ptr) { … … 1831 1959 } 1832 1960 } 1833 sprintf(cl, "%s%s%s", li->targetpath, 1834 (li->targetpath[strlen(li->targetpath) - 1] == '\\') ? 1835 NullStr : "\\", li->list[x]); 1961 BldFullPathName(cl, li->targetpath, li->list[x]); 1962 // sprintf(cl, "%s%s%s", li->targetpath, 1963 // (li->targetpath[strlen(li->targetpath) - 1] == '\\') ? 1964 // NullStr : "\\", li->list[x]); 1836 1965 temp = li->list[x]; 1837 1966 li->list[x] = xstrdup(cl, pszSrcFile, __LINE__); … … 1953 2082 p++; 1954 2083 } 1955 sprintf(fullname, "%s%s%s", dcd->directory, 1956 (dcd->directory[strlen(dcd->directory) - 1] == '\\') ? 1957 NullStr : "\\", li->list[x]); 2084 BldFullPathName(fullname, dcd->directory, li->list[x]); 2085 // sprintf(fullname, "%s%s%s", dcd->directory, 2086 // (dcd->directory[strlen(dcd->directory) - 1] == '\\') ? 2087 // NullStr : "\\", li->list[x]); 1958 2088 if (IsFile(fullname) != -1) 1959 2089 if (AddToList(fullname, &list2, &numfiles, &numalloced)) … … 1964 2094 p++; 1965 2095 if (*p) { 1966 sprintf(fullname, "%s%s%s", dcd->directory, 1967 (dcd->directory[strlen(dcd->directory) - 1] == 1968 '\\') ? NullStr : "\\", 1969 p); 2096 BldFullPathName(fullname, dcd->directory, p); 2097 // sprintf(fullname, "%s%s%s", dcd->directory, 2098 // (dcd->directory[strlen(dcd->directory) - 1] == 2099 // '\\') ? NullStr : "\\", 2100 // p); 1970 2101 if (IsFile(fullname) != -1) 1971 2102 if (AddToList(fullname, &list2, &numfiles, &numalloced)) … … 2029 2160 { 2030 2161 DIRCNRDATA *dcd = INSTDATA(hwnd); 2162 CHAR szQuotedArcName[CCHMAXPATH]; 2031 2163 2032 2164 switch (msg) { … … 2805 2937 runemf2(SEPARATE | WINDOWED | 2806 2938 (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED), 2807 hwnd, dcd->directory, NULL, "%s %s %s%s",2939 hwnd, dcd->directory, NULL, "%s %s", 2808 2940 dcd->info->extract, 2809 needs_quoting(dcd->arcname) ? "\"" : NullStr, 2810 dcd->arcname, 2811 needs_quoting(dcd->arcname) ? "\"" : NullStr); 2941 BldQuotedFileName(szQuotedArcName, dcd->arcname)); 2942 // runemf2(SEPARATE | WINDOWED | 2943 // (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED), 2944 // hwnd, dcd->directory, NULL, "%s %s%s%s", 2945 // dcd->info->extract, 2946 // needs_quoting(dcd->arcname) ? "\"" : NullStr, 2947 // dcd->arcname, 2948 // needs_quoting(dcd->arcname) ? "\"" : NullStr); 2812 2949 if (SHORT1FROMMP(mp1) == IDM_ARCEXTRACTEXIT) 2813 2950 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); … … 2819 2956 runemf2(SEPARATE | WINDOWED | 2820 2957 (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED), 2821 hwnd, dcd->directory, NULL, "%s %s%s%s", 2958 hwnd, dcd->directory, NULL, 2959 "%s %s", 2822 2960 dcd->info->exwdirs, 2823 needs_quoting(dcd->arcname) ? "\"" : NullStr, 2824 dcd->arcname, 2825 needs_quoting(dcd->arcname) ? "\"" : NullStr); 2961 BldQuotedFileName(szQuotedArcName, dcd->arcname)); 2962 // runemf2(SEPARATE | WINDOWED | 2963 // (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED), 2964 // hwnd, dcd->directory, NULL, "%s %s%s%s", 2965 // dcd->info->exwdirs, 2966 // needs_quoting(dcd->arcname) ? "\"" : NullStr, 2967 // dcd->arcname, 2968 // needs_quoting(dcd->arcname) ? "\"" : NullStr); 2826 2969 if (SHORT1FROMMP(mp1) == IDM_ARCEXTRACTWDIRSEXIT) 2827 2970 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); … … 2891 3034 if (dcd->info->test) 2892 3035 runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED, 2893 hwnd, NULL, NULL, "%s %s%s%s", dcd->info->test, 2894 needs_quoting(dcd->arcname) ? "\"" : NullStr, 2895 dcd->arcname, 2896 needs_quoting(dcd->arcname) ? "\"" : NullStr); 3036 hwnd, NULL, NULL, 3037 "%s %s",dcd->info->test, 3038 BldQuotedFileName(szQuotedArcName, dcd->arcname)); 3039 // runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED, 3040 // hwnd, NULL, NULL, "%s %s%s%s",dcd->info->test, 3041 // needs_quoting(dcd->arcname) ? "\"" : NullStr, 3042 // dcd->arcname, 3043 // needs_quoting(dcd->arcname) ? "\"" : NullStr); 2897 3044 break; 2898 3045 … … 2926 3073 2927 3074 for (x = 0; li->list && li->list[x]; x++) { 2928 sprintf(s, "%s%s%s", dcd->workdir, 2929 (dcd->workdir[strlen(dcd->workdir) - 1] == '\\') ? 2930 NullStr : "\\", li->list[x]); 3075 BldFullPathName(s, dcd->workdir, li->list[x]); 3076 // sprintf(s, "%s%s%s", dcd->workdir, 3077 // (dcd->workdir[strlen(dcd->workdir) - 1] == '\\') ? 3078 // NullStr : "\\", li->list[x]); 2931 3079 if (IsFile(s) != 1) { 2932 3080 free(li->list[x]); … … 3048 3196 if (mp2) { 3049 3197 3050 PDRAGITEM pDItem; /* Pointer to DRAGITEM */3051 PDRAGINFO pDInfo; /* Pointer to DRAGINFO */3198 PDRAGITEM pDItem; /* Pointer to DRAGITEM */ 3199 PDRAGINFO pDInfo; /* Pointer to DRAGINFO */ 3052 3200 PARCITEM pci; 3053 3201 … … 3073 3221 DRM_OS2FILE, /* mechanisms and data */ 3074 3222 NULL) && !(pDItem->fsControl & DC_PREPARE)) { 3075 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO 3223 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */ 3076 3224 return MRFROM2SHORT(DOR_DROP, /* Return okay to drop */ 3077 3225 fCopyDefault ? DO_COPY : DO_MOVE); -
trunk/dll/autoview.c
r763 r773 351 351 if (info) { 352 352 sprintf(p, "**%s%s%s\n", 353 (info->id)? info->id : "",354 (info->id)? " " : "",353 info->id ? info->id : "", 354 info->id ? " " : "", 355 355 GetPString(IDS_ARCHIVETEXT)); 356 356 p += strlen(p); … … 412 412 413 413 static FILEFINDBUF4 ffb[130]; 414 CHAR fullname[CCHMAXPATH + 4]; 415 PSZ pszFullName = fullname, pszCurrFile = currfile, psz; 414 CHAR fullname[CCHMAXPATH + 4]; 416 415 HDIR hdir = HDIR_CREATE; 417 416 ULONG x, nm, ml, mc, bufflen; 418 417 PBYTE fb; 419 418 PFILEFINDBUF4 pffbFile; 420 CHAR *buff, *p = "*"; 421 APIRET rc; 422 423 psz = p; 424 BldFullPathName(pszFullName, pszCurrFile, psz); 425 *p = 0; 419 PSZ pszBuf; 420 PSZ p; 421 APIRET rc; 422 423 BldFullPathName(fullname, currfile, "*"); 426 424 //sprintf(fullname, 427 425 // "%s%s*", … … 452 450 } 453 451 bufflen = (CCHMAXPATHCOMP + 42) * nm; 454 buff = xmalloc(bufflen, pszSrcFile, __LINE__);455 if ( buff) {456 p = buff;452 pszBuf = xmalloc(bufflen, pszSrcFile, __LINE__); 453 if (pszBuf) { 454 p = pszBuf; 457 455 *p = 0; 458 456 fb = (PBYTE) & ffb; … … 497 495 x++; 498 496 } // while 499 if (p - buff >= bufflen)497 if (p - pszBuf >= bufflen) 500 498 Runtime_Error(pszSrcFile, __LINE__, pszBufOvfMsg); 501 if (* buff)502 WinSetWindowText(hwndAutoview, buff);503 free( buff);499 if (*pszBuf) 500 WinSetWindowText(hwndAutoview, pszBuf); 501 free(pszBuf); 504 502 } 505 503 } … … 516 514 PGEA2 pgea; 517 515 PFEA2 pfea; 518 CHAR *value, * buff, *p, *data;516 CHAR *value, *pszBuf, *p, *data; 519 517 USHORT len, type, plen, dlen; 520 518 BOOL readonly = FALSE; … … 542 540 value[pfea->cbValue] = 0; 543 541 if (*(USHORT *) value == EAT_MVMT) { 544 buff = xmalloc(65536, pszSrcFile, __LINE__);545 if ( buff) {546 p = buff;547 * buff = 0;542 pszBuf = xmalloc(65536, pszSrcFile, __LINE__); 543 if (pszBuf) { 544 p = pszBuf; 545 *pszBuf = 0; 548 546 data = value + (sizeof(USHORT) * 3); 549 547 type = *(USHORT *) data; … … 579 577 data += sizeof(USHORT); 580 578 } // while 581 if (p - buff >= 65536) {579 if (p - pszBuf >= 65536) { 582 580 Runtime_Error(pszSrcFile, __LINE__, pszBufOvfMsg); 583 buff[65535] = 0; // Try to stay alive581 pszBuf[65535] = 0; // Try to stay alive 584 582 break; 585 583 } 586 WinSetWindowText(hwndAutoMLE, buff);587 free( buff);584 WinSetWindowText(hwndAutoMLE, pszBuf); 585 free(pszBuf); 588 586 } 589 587 } -
trunk/dll/comp.c
r771 r773 28 28 01 Aug 07 SHL Rework to remove vast amount of duplicate code 29 29 03 Aug 07 GKY Enlarged and made setable everywhere Findbuf (speed file loading) 30 06 Aug 07 SHL Move BldFullPathName here to be near primary caller 31 07 Aug 07 SHL COMP_COLLECT: Avoid collecting empty entries when nothing selected 30 32 31 33 ***********************************************************************/ … … 49 51 #include "fm3str.h" 50 52 51 #pragma alloc_text(COMPAREDIR,FillCnrsThread,FillDirList,CompNames )53 #pragma alloc_text(COMPAREDIR,FillCnrsThread,FillDirList,CompNames,BldFullPathName) 52 54 #pragma alloc_text(COMPAREDIR1,CompareDlgProc) 53 55 #pragma alloc_text(COMPAREDIR2,SelectCnrsThread,ActionCnrThread) … … 64 66 65 67 static PSZ pszSrcFile = __FILE__; 68 69 /** 70 * Build full path name in callers buffer given directory 71 * name and filename 72 * @param pszPathName points to drive/directory if not NULL 73 * @returns pointer to full path name in caller's buffer 74 * @note OK for pszFullPathName and pszPathName to point to same buffer 75 * 76 */ 77 78 PSZ BldFullPathName(PSZ pszFullPathName, PSZ pszPathName, PSZ pszFileName) 79 { 80 UINT c = pszPathName ? strlen(pszPathName) : 0; 81 if (c > 0) { 82 memcpy(pszFullPathName, pszPathName, c); 83 if (pszFullPathName[c - 1] != '\\') 84 pszFullPathName[c++] = '\\'; 85 } 86 strcpy(pszFullPathName + c, pszFileName); 87 return pszFullPathName; 88 } 66 89 67 90 //=== SnapShot() Write directory tree to file and recurse if requested === … … 361 384 362 385 if (!cmp) { 363 Runtime_Error (pszSrcFile, __LINE__, "no data");386 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 364 387 return; 365 388 } … … 458 481 case IDM_MOVE: 459 482 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) 460 // 02 Aug 07 SHL fixme to replace this kind of stuff with _makepath or equivalent461 483 BldFullPathName(szNewName, cmp->leftdir, pci->pszDisplayName); 462 484 //sprintf(szNewName, "%s%s%s", … … 716 738 717 739 if (!str || !*str) { 718 Runtime_Error (pszSrcFile, __LINE__, "no data");740 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 719 741 return; 720 742 } … … 818 840 819 841 if (!cmp) { 820 Runtime_Error (pszSrcFile, __LINE__, "no data");842 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 821 843 _endthread(); 822 844 } … … 1136 1158 if (x >= 0) { 1137 1159 // File appears on right side 1138 BldFullPathName(szBuf, cmp->rightdir, files l[r]->fname);1160 BldFullPathName(szBuf, cmp->rightdir, filesr[r]->fname); 1139 1161 //sprintf(szBuf, "%s%s%s", cmp->rightdir, 1140 1162 // (cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\') ? … … 1360 1382 } 1361 1383 1362 #define hwndLeft (WinWindowFromID(hwnd,COMP_LEFTDIR)) 1363 #define hwndRight (WinWindowFromID(hwnd,COMP_RIGHTDIR)) 1384 // fixme to be gone - use variable 1385 #define hwndLeft (WinWindowFromID(hwnd,COMP_LEFTDIR)) 1386 #define hwndRight (WinWindowFromID(hwnd,COMP_RIGHTDIR)) 1364 1387 1365 1388 //=== CompareDlgProc() Compare directories dialog procedure === … … 1368 1391 { 1369 1392 COMPARE *cmp; 1370 1371 static HPOINTER hptr = (HPOINTER) 0; 1393 BOOL temp; 1394 1395 static HPOINTER hptr; 1372 1396 1373 1397 switch (msg) { … … 2376 2400 case COMP_COLLECT: 2377 2401 cmp = INSTDATA(hwnd); 2378 if (cmp) { 2379 2380 CHAR **listl, **listr = NULL; 2381 2402 if (!cmp) 2403 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2404 else { 2405 CHAR **listl; 2406 CHAR **listr = NULL; 2382 2407 if (!Collector) { 2383 2384 2408 SWP swp; 2385 2409 HWND hwndC; 2386 2387 if (!fAutoTile && !ParentIsDesktop(hwnd, cmp->hwndParent) && 2388 (!fExternalCollector && !strcmp(realappname, FM3Str))) 2410 if (!fAutoTile && 2411 !ParentIsDesktop(hwnd, cmp->hwndParent) && 2412 !fExternalCollector && 2413 !strcmp(realappname, FM3Str)) { 2389 2414 GetNextWindowPos(cmp->hwndParent, &swp, NULL, NULL); 2390 hwndC = StartCollector((fExternalCollector || 2391 strcmp(realappname, FM3Str)) ? 2392 HWND_DESKTOP : cmp->hwndParent, 4); 2415 } 2416 hwndC = StartCollector(fExternalCollector || 2417 strcmp(realappname, FM3Str) ? 2418 HWND_DESKTOP : 2419 cmp->hwndParent, 2420 4); 2393 2421 if (hwndC) { 2394 if (!fAutoTile && !ParentIsDesktop(hwnd, cmp->hwndParent) && 2395 (!fExternalCollector && !strcmp(realappname, FM3Str))) 2396 WinSetWindowPos(hwndC, HWND_TOP, swp.x, swp.y, 2397 swp.cx, swp.cy, SWP_MOVE | SWP_SIZE | 2398 SWP_SHOW | SWP_ZORDER); 2399 else if (!ParentIsDesktop(hwnd, cmp->hwndParent) && fAutoTile && 2400 !strcmp(realappname, FM3Str)) 2422 if (!fAutoTile && 2423 !ParentIsDesktop(hwnd, cmp->hwndParent) && 2424 !fExternalCollector && 2425 !strcmp(realappname, FM3Str)) { 2426 WinSetWindowPos(hwndC, HWND_TOP, 2427 swp.x, swp.y, swp.cx, swp.cy, 2428 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER); 2429 } 2430 else if (!ParentIsDesktop(hwnd, cmp->hwndParent) && 2431 fAutoTile && 2432 !strcmp(realappname, FM3Str)) { 2401 2433 TileChildren(cmp->hwndParent, TRUE); 2402 DosSleep(32); //05 Aug 07 GKY 64 2434 } 2435 DosSleep(32); // 05 Aug 07 GKY 64 2403 2436 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(COMP_COLLECT, 0), MPVOID); 2404 2437 break; … … 2407 2440 else 2408 2441 StartCollector(cmp->hwndParent, 4); 2409 { 2410 BOOL temp; 2411 2412 temp = fSelectedAlways; 2413 fSelectedAlways = TRUE; 2414 listl = BuildList(hwndLeft); 2415 if (!*cmp->rightlist) 2416 listr = BuildList(hwndRight); 2417 fSelectedAlways = temp; 2418 } 2442 2443 temp = fSelectedAlways; 2444 fSelectedAlways = TRUE; 2445 listl = BuildList(hwndLeft); 2446 if (!*cmp->rightlist) 2447 listr = BuildList(hwndRight); 2448 fSelectedAlways = temp; 2449 2419 2450 if (listl || listr) { 2420 2451 if (Collector) { 2421 if (listl) { 2422 if (!PostMsg(Collector, WM_COMMAND, 2423 MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(listl))) 2424 FreeList(listl); 2425 } 2426 if (listr) { 2427 if (!PostMsg(Collector, WM_COMMAND, 2428 MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(listr))) 2429 FreeList(listr); 2452 // 07 Aug 07 SHL Avoid collected from empty list 2453 if (listl && listl[0] && *listl[0]) { 2454 if (PostMsg(Collector, WM_COMMAND, 2455 MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(listl))) 2456 listl = NULL; // Collector will free 2457 } 2458 if (listr && listr[0] && *listr[0]) { 2459 if (PostMsg(Collector, WM_COMMAND, 2460 MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(listr))) 2461 listr = NULL; // Collector will free 2430 2462 } 2431 2463 WinSetWindowPos(WinQueryWindow(WinQueryWindow(Collector, 2432 2464 QW_PARENT), 2433 QW_PARENT), HWND_TOP, 0, 0, 0, 0, 2465 QW_PARENT), 2466 HWND_TOP, 0, 0, 0, 0, 2434 2467 SWP_ACTIVATE); 2435 2468 } 2436 else { 2437 FreeList(listl); 2438 FreeList(listr); 2439 } 2469 FreeList(listl); 2470 FreeList(listr); 2440 2471 } 2441 2472 } -
trunk/dll/filldir.c
r771 r773 60 60 61 61 static PSZ pszSrcFile = __FILE__; 62 extern BOOL needs_quoting(PSZ psz);63 62 64 63 #pragma alloc_text(FILLDIR,FillInRecordFromFFB,FillInRecordFromFSA,IDFile) 65 64 #pragma alloc_text(FILLDIR1,ProcessDirectory,FillDirCnr,FillTreeCnr,FileAttrToString) 66 #pragma alloc_text(BldFullPathName, BldQuotedFullPathName, BldQuotedFileName)67 65 #pragma alloc_text(EMPTYCNR,EmptyCnr,FreeCnrItemData,FreeCnrItem,FreeCnrItemList,RemoveCnrItems) 68 69 /**70 * Build full path name in callers buffer given directory71 * name and filename72 * @returns pointer to full path name in caller's buffer73 *74 */75 76 PSZ BldFullPathName(PSZ pszFullPathName, PSZ pszPathName, PSZ pszFileName)77 {78 UINT c = strlen(pszPathName);79 if (c > 0) {80 memcpy(pszFullPathName, pszPathName, c);81 if (pszFullPathName[c - 1] != '\\')82 pszFullPathName[c++] = '\\';83 }84 strcpy(pszFullPathName + c, pszFileName);85 return pszFullPathName;86 }87 88 /**89 * Build quoted full path name in callers buffer given90 * directory name and filename91 * @returns pointer to quoted path name in caller's buffer92 *93 */94 95 PSZ BldQuotedFullPathName(PSZ pszFullPathName, PSZ pszPathName, PSZ pszFileName)96 {97 UINT c = strlen(pszPathName);98 BOOL q = needs_quoting(pszPathName) ||99 needs_quoting(pszFileName);100 PSZ psz = pszFullPathName;101 102 if (q)103 *psz++ = '"';104 if (c > 0) {105 memcpy(pszFullPathName, pszPathName, c);106 if (pszFullPathName[c - 1] != '\\')107 pszFullPathName[c++] = '\\';108 }109 strcpy(pszFullPathName + c, pszFileName);110 if (q) {111 *psz++ = '"';112 *psz = 0;113 }114 return pszFullPathName;115 }116 117 118 /**119 * Build quoted full path name in callers buffer given a filename120 * @returns pointer to quoted file name in caller's buffer121 *122 */123 124 PSZ BldQuotedFileName(PSZ pszQuotedFileName, PSZ pszFileName)125 {126 BOOL q = needs_quoting(pszFileName);127 PSZ psz = pszQuotedFileName;128 129 if (q)130 *psz++ = '"';131 strcpy(psz, pszFileName);132 if (q) {133 psz += strlen(psz);134 *psz++ = '"';135 *psz = 0;136 }137 return pszQuotedFileName;138 }139 66 140 67 /** … … 324 251 */ 325 252 if (!*pffb->achName) { 326 // pci->pszFileName = xstrdup(pszDirectory, pszSrcFile, __LINE__); 327 pci->pszFileName = pci->szFileName; 253 pci->pszFileName = xstrdup(pszDirectory, pszSrcFile, __LINE__); 328 254 strcpy(pci->pszFileName, pszDirectory); 329 255 } … … 333 259 if (pszDirectory[c - 1] != '\\') 334 260 c2++; 335 // pci->pszFileName = xmalloc(c + c2, pszSrcFile, __LINE__); 336 pci->pszFileName = pci->szFileName; 261 pci->pszFileName = xmalloc(c + c2, pszSrcFile, __LINE__); 337 262 memcpy(pci->pszFileName, pszDirectory, c + 1); 338 263 p = pci->pszFileName + c - 1; … … 560 485 561 486 pci->hwndCnr = hwndCnr; 562 // pci->pszFileName = xstrdup(pszFileName, pszSrcFile, __LINE__); 563 pci->pszFileName = pci->szFileName; 487 pci->pszFileName = xstrdup(pszFileName, pszSrcFile, __LINE__); 564 488 strcpy(pci->pszFileName, pszFileName); 565 489 … … 1260 1184 } 1261 1185 sprintf(suggest + strlen(suggest), "%c" , toupper(*szDrive)); 1262 // pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1263 pci->pszFileName = pci->szFileName; 1186 pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1264 1187 strcpy(pci->pszFileName, szDrive); 1265 1188 pci->pszDisplayName = pci->pszFileName; … … 1274 1197 else { 1275 1198 // Removable volume 1276 // pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1277 pci->pszFileName = pci->szFileName; 1199 pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1278 1200 strcpy(pci->pszFileName, szDrive); 1279 1201 pci->pszDisplayName = pci->pszFileName; … … 1286 1208 else { 1287 1209 pci->rc.hptrIcon = hptrDunno; 1288 // pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1289 pci->pszFileName = pci->szFileName; 1210 pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1290 1211 strcpy(pci->pszFileName, szDrive); 1291 1212 pci->pszDisplayName = pci->pszFileName; … … 1299 1220 // diskette drive (A or B) 1300 1221 pci->rc.hptrIcon = hptrFloppy; 1301 // pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1302 pci->pszFileName = pci->szFileName; 1222 pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1303 1223 strcpy(pci->pszFileName, szDrive); 1304 1224 pci->pszDisplayName = pci->pszFileName; … … 1372 1292 if (pciParent) { 1373 1293 pciParent->flags |= RECFLAGS_ENV; 1374 // pciParent->pszFileName = xstrdup(GetPString(IDS_ENVVARSTEXT), pszSrcFile, __LINE__); 1375 pciParent->pszFileName = pciParent->szFileName; 1294 pciParent->pszFileName = xstrdup(GetPString(IDS_ENVVARSTEXT), pszSrcFile, __LINE__); 1376 1295 strcpy(pciParent->pszFileName, GetPString(IDS_ENVVARSTEXT)); 1377 1296 pciParent->pszDisplayName = pciParent->pszFileName; // 03 Aug 07 SHL … … 1661 1580 if (!WinSendMsg(hwnd, CM_FREERECORD, MPFROMP(&pci), MPFROMSHORT(1))) { 1662 1581 // Win_Error2(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,IDS_CMFREEERRTEXT); 1663 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_FREERECORD hwnd %x pci %p", hwnd, pci); 1582 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, 1583 "CM_FREERECORD hwnd %x pci %p file %s", 1584 hwnd, pci, 1585 pci && pci->pszFileName ? pci->pszFileName : "n/a"); 1664 1586 } 1665 1587 } -
trunk/dll/fm3dll.h
r769 r773 425 425 ULONG attrFile; /* Attributes of this file */ 426 426 ULONG flags; 427 CHAR szFileName[CCHMAXPATH]; // Full path name - fixed size for speed428 427 } 429 428 CNRITEM, *PCNRITEM; … … 624 623 625 624 /* filldir.c */ 626 PSZ BldFullPathName(PSZ pszFullPathName, PSZ pszPathName, PSZ pszFileName);627 PSZ BldQuotedFullPathName(PSZ pszFullPathName, PSZ pszPathName, PSZ pszFileName);628 PSZ BldQuotedFileName(PSZ pszQuotedFileName, PSZ pszFileName);629 625 VOID EmptyCnr(HWND hwnd); 630 626 const PSZ FileAttrToString(ULONG fileAttr); … … 900 896 HAPP Exec(HWND hwndNotify, BOOL child, char *startdir, char *env, 901 897 PROGTYPE * progt, ULONG fl, char *formatstring, ...); 898 #define RUNTYPE_MASK 0xf 902 899 #define SYNCHRONOUS 1 903 900 #define ASYNCHRONOUS 2 … … 1064 1061 MRESULT EXPENTRY ArcFolderProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 1065 1062 MRESULT EXPENTRY ArcObjWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 1063 PSZ BldQuotedFullPathName(PSZ pszFullPathName, PSZ pszPathName, PSZ pszFileName); 1064 PSZ BldQuotedFileName(PSZ pszQuotedFileName, PSZ pszFileName); 1066 1065 1067 1066 /* assoc.c */ … … 1117 1116 1118 1117 /* comp.c */ 1118 PSZ BldFullPathName(PSZ pszFullPathName, PSZ pszPathName, PSZ pszFileName); 1119 1119 MRESULT EXPENTRY CFileDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 1120 1120 MRESULT EXPENTRY CompareDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); -
trunk/dll/mainwnd.c
r771 r773 35 35 12 May 07 SHL Use dcd->ulItemsToUnHilite 36 36 10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit 37 07 Aug 07 SHL Use BldQuotedFileName 37 38 38 39 ***********************************************************************/ … … 1810 1811 li = DoFileDrop(hwnd, 1811 1812 NULL, 1812 1813 TRUE, MPFROM2SHORT(TREE_CNR, CN_DROP), MPFROMP(&cnd)); 1813 1814 CheckPmDrgLimit(cnd.pDragInfo); 1814 1815 if (li) { … … 4109 4110 else { 4110 4111 4111 CHAR d1[] = "\""; 4112 CHAR d2[] = "\""; 4113 4114 if (!needs_quoting(wa.szCurrentPath1)) 4115 *d1 = 0; 4116 if (!needs_quoting(wa.szCurrentPath2)) 4117 *d2 = 0; 4112 CHAR szPath1[CCHMAXPATH]; 4113 CHAR szPath2[CCHMAXPATH]; 4118 4114 runemf2(SEPARATE, 4119 HWND_DESKTOP, 4120 NULL, 4121 NULL, 4122 "%s %s%s%s %s%s%s", 4115 HWND_DESKTOP, NULL, NULL, 4116 "%s %s %s", 4123 4117 dircompare, 4124 d1, wa.szCurrentPath1, d1, d2, wa.szCurrentPath2, d2); 4118 BldQuotedFileName(szPath1, wa.szCurrentPath1), 4119 BldQuotedFileName(szPath2, wa.szCurrentPath2)); 4120 // CHAR d1[] = "\""; 4121 // CHAR d2[] = "\""; 4122 // if (!needs_quoting(wa.szCurrentPath1)) 4123 // *d1 = 0; 4124 // if (!needs_quoting(wa.szCurrentPath2)) 4125 // *d2 = 0; 4126 // runemf2(SEPARATE, 4127 // HWND_DESKTOP, NULL, NULL, 4128 // "%s %s%s%s %s%s%s", 4129 // dircompare, 4130 // d1, wa.szCurrentPath1, d1, d2, wa.szCurrentPath2, d2); 4125 4131 } 4126 4132 } … … 4818 4824 DIRCNRDATA *dcd = NULL; 4819 4825 4820 // 12 May 07 SHL fixme to understand? 4826 // 12 May 07 SHL fixme to understand? backwards maybe? looking for DIR_CNR? 4821 4827 if (WinQueryWindowUShort(hwndCnr, QWS_ID) != TREE_CNR) 4822 4828 dcd = INSTDATA(hwndCnr); -
trunk/dll/mainwnd2.c
r771 r773 17 17 30 Mar 07 GKY Remove GetPString for window class names 18 18 12 May 07 SHL Pass ulItemsToUnHilite to UnHilite 19 07 Aug 07 SHL Use BldQuotedFileName 19 20 20 21 ***********************************************************************/ … … 124 125 /* 125 126 * Calculate the position of the client rectangle. 126 * Otherwise, 127 * Otherwise, we'll see a lot of redraw when we move the 127 128 * client during WM_FORMATFRAME. 128 129 */ … … 498 499 } 499 500 else { 500 501 CHAR *d1 = "\"", *d2 = "\""; 502 503 if (!needs_quoting(wa.szCurrentPath1)) 504 *d1 = 0; 505 if (!needs_quoting(wa.szCurrentPath2)) 506 *d2 = 0; 501 CHAR szPath1[CCHMAXPATH]; 502 CHAR szPath2[CCHMAXPATH]; 507 503 runemf2(SEPARATE, 508 HWND_DESKTOP, 509 NULL, 510 NULL, 511 "%s %s%s%s %s%s%s", 504 HWND_DESKTOP, NULL, NULL, 505 "%s %s %s", 512 506 dircompare, 513 d1, wa.szCurrentPath1, d1, d2, wa.szCurrentPath2, d2); 507 BldQuotedFileName(szPath1, wa.szCurrentPath1), 508 BldQuotedFileName(szPath2, wa.szCurrentPath2)); 509 // CHAR *d1 = "\"", *d2 = "\""; 510 // if (!needs_quoting(wa.szCurrentPath1)) 511 // *d1 = 0; 512 // if (!needs_quoting(wa.szCurrentPath2)) 513 // *d2 = 0; 514 // runemf2(SEPARATE, 515 // HWND_DESKTOP, 516 // NULL, 517 // NULL, 518 // "%s %s%s%s %s%s%s", 519 // dircompare, 520 // d1, wa.szCurrentPath1, d1, d2, wa.szCurrentPath2, d2); 514 521 } 515 522 } -
trunk/dll/makelist.c
r772 r773 146 146 } 147 147 148 /** 149 * Add string to string list 150 * Enlarges as needed 151 * Ensures 2 NULL end markers exist 152 */ 153 148 154 INT AddToList(CHAR * string, CHAR *** list, INT * numfiles, INT * numalloced) 149 155 { … … 169 175 } 170 176 (*list)[*numfiles] = psz; 171 strcpy((*list)[*numfiles], string); 177 strcpy((*list)[*numfiles], string); // Add entry 172 178 (*numfiles)++; 173 (*list)[*numfiles] = NULL; 174 (*list)[(*numfiles) + 1] = NULL; 179 (*list)[*numfiles] = NULL; // Add end marker 180 (*list)[(*numfiles) + 1] = NULL; // Add 2nd end marker - fixme to know why? 175 181 #ifdef __DEBUG_ALLOC__ 176 182 _heap_check(); … … 207 213 else 208 214 list = test; 209 } 215 } // while 210 216 return list; 211 217 } -
trunk/dll/misc.c
r771 r773 28 28 31 Jul 07 SHL Clean up and report errors (ticket#24) 29 29 03 Aug 07 GKY Direct editting fixed (ticket#24) 30 06 Aug 07 SHL Use BldQuotedFileName 30 31 31 32 ***********************************************************************/ … … 922 923 *path = 0; 923 924 *cl = 0; 924 if (needs_quoting(filename)) 925 strcat(cl, "\""); 926 strcat(cl, filename); 927 if (needs_quoting(filename)) 928 strcat(cl, "\""); 925 BldQuotedFileName(cl, filename); 926 // *cl = 0; 927 // if (needs_quoting(filename)) 928 // strcat(cl, "\""); 929 // strcat(cl, filename); 930 // if (needs_quoting(filename)) 931 // strcat(cl, "\""); 929 932 memset(&ex, 0, sizeof(ex)); 930 933 ex.flags = lastflags; -
trunk/dll/seeall.c
r771 r773 23 23 30 Mar 07 GKY Remove GetPString for window class names 24 24 03 Aug 07 GKY Enlarged and made setable everywhere Findbuf (speed file loading) 25 07 Aug 07 SHL Use BldQuotedFullPathName and BldQuotedFileName 25 26 26 27 ***********************************************************************/ … … 465 466 x = 0; 466 467 while (list[x]) { 467 468 468 FILESTATUS3 fsa; 469 BOOL spaces; 470 471 if (needs_quoting(list[x])) { 472 spaces = TRUE; 473 strcat(szBuffer, "\""); 474 } 475 else 476 spaces = FALSE; 477 strcat(szBuffer, list[x]); 469 // BOOL spaces; 470 // if (needs_quoting(list[x])) { 471 // spaces = TRUE; 472 // strcat(szBuffer, "\""); 473 // } 474 // else 475 // spaces = FALSE; 476 // strcat(szBuffer, list[x]); 478 477 memset(&fsa, 0, sizeof(fsa)); 479 478 DosError(FERR_DISABLEHARDERR); 480 DosQueryPathInfo(list[x], FIL_STANDARD, 481 &fsa, (ULONG) sizeof(fsa)); 479 DosQueryPathInfo(list[x], FIL_STANDARD, &fsa, sizeof(fsa)); 482 480 if (fsa.attrFile & FILE_DIRECTORY) { 483 if (szBuffer[strlen(szBuffer) - 1] != '\\') 484 strcat(szBuffer, "\\"); 485 strcat(szBuffer, "*"); 486 } 487 if (spaces) 488 strcat(szBuffer, "\""); 481 BldQuotedFullPathName(szBuffer + strlen(szBuffer), 482 list[x], "*"); 483 // if (szBuffer[strlen(szBuffer) - 1] != '\\') 484 // strcat(szBuffer, "\\"); 485 // strcat(szBuffer, "*"); 486 } 487 else 488 BldQuotedFileName(szBuffer + strlen(szBuffer), list[x]); 489 // if (spaces) 490 // strcat(szBuffer, "\""); 489 491 x++; 490 492 if (!list[x] || strlen(szBuffer) + strlen(list[x]) + 5 > 1024) { 491 runemf2(SEPARATE | WINDOWED | 492 ( (fArcStuffVisible) ? 0 :493 (BACKGROUND | MINIMIZED)) |494 WAIT, HWND_DESKTOP, NULL, NULL,"%s", szBuffer);493 runemf2(SEPARATE | WINDOWED | WAIT | 494 (fArcStuffVisible ? 0 : (BACKGROUND | MINIMIZED)), 495 HWND_DESKTOP, NULL, NULL, 496 "%s", szBuffer); 495 497 DosSleep(1); 496 498 *p = 0; … … 829 831 maskspaces = TRUE; 830 832 runemf2(SEPARATE | WINDOWED | 831 ((fArcStuffVisible) ? 0 : 832 (BACKGROUND | MINIMIZED)), 833 HWND_DESKTOP, 834 ex.extractdir, 835 NULL, 833 (fArcStuffVisible ? 0 : (BACKGROUND | MINIMIZED)), 834 HWND_DESKTOP, ex.extractdir, NULL, 836 835 "%s %s %s%s%s", 837 836 ex.command, 838 837 ex.arcname, 839 (maskspaces)? "\"" : NullStr,840 (*ex.masks)? ex.masks : "*",841 (maskspaces)? "\"" : NullStr);838 maskspaces ? "\"" : NullStr, 839 *ex.masks ? ex.masks : "*", 840 maskspaces ? "\"" : NullStr); 842 841 } 843 842 } … … 3012 3011 list = BuildAList(hwnd); 3013 3012 if (!list) 3014 Runtime_Error (pszSrcFile, __LINE__, "no data");3013 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 3015 3014 else { 3016 3015 WinSetWindowText(pAD->hwndStatus, GetPString(IDS_DRAGGINGFILESTEXT)); … … 4105 4104 4106 4105 if (!list) 4107 Runtime_Error (pszSrcFile, __LINE__, "no data");4106 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 4108 4107 else { 4109 4108 switch (SHORT1FROMMP(mp1)) { -
trunk/dll/shadow.c
r766 r773 11 11 22 Jul 06 SHL Check more run time errors 12 12 16 Jun 07 SHL Update for OpenWatcom 13 06 Aug 07 SHL Use BldFullPathName 13 14 14 15 ***********************************************************************/ … … 70 71 if (!cnr) 71 72 return obj; 72 sprintf(s, "%s%s%s", (path) ? path : "", (path) ? "\\" : "", objtitle); 73 BldFullPathName(s, path, objtitle); 74 // sprintf(s, "%s%s%s", (path) ? path : "", (path) ? "\\" : "", objtitle); 73 75 p = strrchr(objtitle, '.'); 74 76 if (p) { … … 132 134 CHAR *p, temp[CCHMAXPATH + 1]; 133 135 134 sprintf(temp, 135 "%s%s%s", (path) ? path : "", (path) ? "\\" : "", objtitle); 136 BldFullPathName(temp, path, objtitle); 137 // sprintf(temp, 138 // "%s%s%s", (path) ? path : "", (path) ? "\\" : "", objtitle); 136 139 p = strrchr(temp, '.'); 137 140 if (p) { -
trunk/dll/systemf.c
r771 r773 731 731 } 732 732 733 if ((type & 15) == SYNCHRONOUS ||734 (type & 15) == ASYNCHRONOUS ||735 (type & 15) == DETACHED)733 if ((type & RUNTYPE_MASK) == SYNCHRONOUS || 734 (type & RUNTYPE_MASK) == ASYNCHRONOUS || 735 (type & RUNTYPE_MASK) == DETACHED) 736 736 { 737 737 strip_lead_char(" \t", pszPgm); … … 826 826 } 827 827 ret = DosExecPgm(szObject, sizeof(szObject), 828 ((type & 15) == ASYNCHRONOUS ? EXEC_ASYNC : 0) +829 ((type & 15) == DETACHED ? EXEC_BACKGROUND : 0),828 ((type & RUNTYPE_MASK) == ASYNCHRONOUS ? EXEC_ASYNC : 0) + 829 ((type & RUNTYPE_MASK) == DETACHED ? EXEC_BACKGROUND : 0), 830 830 pszPgm, pszEnvironment, &results, pszPgm); 831 831 if (pszDirectory && *pszDirectory) … … 1068 1068 sdata.ObjectBuffer = szObject; 1069 1069 sdata.ObjectBuffLen = sizeof(szObject); 1070 if ((type & 15) == SEPARATEKEEP)1070 if ((type & RUNTYPE_MASK) == SEPARATEKEEP) 1071 1071 sdata.PgmControl |= SSF_CONTROL_NOAUTOCLOSE; 1072 1072 if (type & MAXIMIZED) -
trunk/dll/worker.c
r771 r773 20 20 21 Apr 07 GKY Find FM2Utils by path or utils directory 21 21 16 Jun 07 SHL Update for OpenWatcom 22 07 Aug 07 SHL Use BldQuotedFileName 22 23 23 24 ***********************************************************************/ … … 110 111 VOID Action(VOID * args) 111 112 { 112 WORKER *wk = (WORKER *) 113 WORKER *wk = (WORKER *)args; 113 114 HAB hab2; 114 115 HMQ hmq2; … … 116 117 INT numfiles = 0, numalloc = 0, plen = 0; 117 118 CHAR *p, *pp; 119 CHAR szQuotedDirName[CCHMAXPATH]; 120 CHAR szQuotedFileName[CCHMAXPATH]; 118 121 119 122 if (wk) { … … 407 410 maskspaces = TRUE; 408 411 if (!runemf2(SEPARATE | WINDOWED | 409 ((fArcStuffVisible) ? 0 : 410 (BACKGROUND | MINIMIZED)), 411 HWND_DESKTOP, 412 ex.extractdir, 413 NULL, 412 fArcStuffVisible ? 0 : (BACKGROUND | MINIMIZED), 413 HWND_DESKTOP, ex.extractdir, NULL, 414 414 "%s %s %s%s%s", 415 415 ex.command, 416 416 ex.arcname, 417 (maskspaces)? "\"" : NullStr,418 (*ex.masks)? ex.masks : "*",419 (maskspaces)? "\"" : NullStr) &&417 maskspaces ? "\"" : NullStr, 418 *ex.masks ? ex.masks : "*", 419 maskspaces ? "\"" : NullStr) && 420 420 !stricmp(ex.extractdir, wk->directory)) { 421 421 if (WinIsWindow(hab2, wk->hwndCnr)) … … 855 855 MPFROMP(wk->li->list[x])); 856 856 else { 857 CHAR d1[] = "\"";858 CHAR d2[] = "\"";859 860 if (!needs_quoting(wk->li->targetpath))861 *d1 = 0;862 if (!needs_quoting(wk->li->list[x]))863 *d2 = 0;864 857 runemf2(SEPARATE, 865 HWND_DESKTOP, 866 NULL, 867 NULL, 868 "%s %s%s%s %s%s%s", 858 HWND_DESKTOP, NULL, NULL, 859 "%s %s %s", 869 860 dircompare, 870 d1, 871 wk->li->targetpath, d1, d2, wk->li->list[x], d2); 861 BldQuotedFileName(szQuotedDirName, wk->li->targetpath), 862 BldQuotedFileName(szQuotedFileName, wk->li->list[x])); 863 // CHAR d1[] = "\""; 864 // CHAR d2[] = "\""; 865 // if (!needs_quoting(wk->li->targetpath)) 866 // *d1 = 0; 867 // if (!needs_quoting(wk->li->list[x])) 868 // *d2 = 0; 869 // runemf2(SEPARATE, 870 // HWND_DESKTOP, NULL, NULL, 871 // "%s %s%s%s %s%s%s", 872 // dircompare, 873 // d1, wk->li->targetpath, d1, 874 // d2, wk->li->list[x], d2); 872 875 } 873 876 } … … 1076 1079 wk->li->info->exwdirs : wk->li->info->extract); 1077 1080 strcat(szBuffer, " "); 1078 if (needs_quoting(wk->li->arcname)) 1079 strcat(szBuffer, "\""); 1080 strcat(szBuffer, wk->li->arcname); 1081 if (needs_quoting(wk->li->arcname)) 1082 strcat(szBuffer, "\""); 1081 BldQuotedFileName(szBuffer + strlen(szBuffer), wk->li->arcname); 1082 // if (needs_quoting(wk->li->arcname)) 1083 // strcat(szBuffer, "\""); 1084 // strcat(szBuffer, wk->li->arcname); 1085 // if (needs_quoting(wk->li->arcname)) 1086 // strcat(szBuffer, "\""); 1083 1087 } 1084 1088 else { … … 1100 1104 pp++; 1101 1105 } 1102 if (needs_quoting(wk->li->list[x])) 1103 strcat(szBuffer, "\""); 1104 strcat(szBuffer, wk->li->list[x]); 1105 if (needs_quoting(wk->li->list[x])) 1106 strcat(szBuffer, "\""); 1106 BldQuotedFileName(szBuffer + strlen(szBuffer), wk->li->list[x]); 1107 // if (needs_quoting(wk->li->list[x])) 1108 // strcat(szBuffer, "\""); 1109 // strcat(szBuffer, wk->li->list[x]); 1110 // if (needs_quoting(wk->li->list[x])) 1111 // strcat(szBuffer, "\""); 1107 1112 x++; 1108 1113 if (!wk->li->list[x] || strlen(szBuffer) + … … 1110 1115 runemf2(SEPARATE | WINDOWED | BACKGROUND | MINIMIZED | WAIT, 1111 1116 HWND_DESKTOP, 1112 ((wk->li->type == IDM_FAKEEXTRACT || 1113 wk->li->type == IDM_FAKEEXTRACTM) ? 1114 wk->li->targetpath : NULL), NULL, "%s", szBuffer); 1117 (wk->li->type == IDM_FAKEEXTRACT || 1118 wk->li->type == IDM_FAKEEXTRACTM) ? 1119 wk->li->targetpath : NULL, 1120 NULL, 1121 "%s", szBuffer); 1115 1122 DosSleep(1); 1116 1123 *p = 0; … … 1226 1233 strcpy(szBuffer, ad.command); 1227 1234 strcat(szBuffer, " "); 1228 if (needs_quoting(ad.arcname)) 1229 strcat(szBuffer, "\""); 1230 strcat(szBuffer, ad.arcname); 1231 if (needs_quoting(ad.arcname)) 1232 strcat(szBuffer, "\""); 1235 BldQuotedFileName(szBuffer + strlen(szBuffer), ad.arcname); 1236 // if (needs_quoting(ad.arcname)) 1237 // strcat(szBuffer, "\""); 1238 // strcat(szBuffer, ad.arcname); 1239 // if (needs_quoting(ad.arcname)) 1240 // strcat(szBuffer, "\""); 1233 1241 p = &szBuffer[strlen(szBuffer)]; 1234 1242 if (ad.mask.szMask) { … … 1239 1247 x = 0; 1240 1248 while (wk->li->list[x]) { 1241 1242 1249 FILESTATUS3 fsa; 1243 BOOL spaces; 1244 1245 if (needs_quoting(wk->li->list[x])) { 1246 spaces = TRUE; 1247 strcat(szBuffer, "\""); 1248 } 1249 else 1250 spaces = FALSE; 1251 strcat(szBuffer, wk->li->list[x]); 1250 // BOOL spaces; 1251 // if (needs_quoting(wk->li->list[x])) { 1252 // spaces = TRUE; 1253 // strcat(szBuffer, "\""); 1254 // } 1255 // else 1256 // spaces = FALSE; 1257 // strcat(szBuffer, wk->li->list[x]); 1252 1258 memset(&fsa, 0, sizeof(FILESTATUS3)); 1253 1259 DosError(FERR_DISABLEHARDERR); … … 1256 1262 &fsa, (ULONG) sizeof(FILESTATUS3)); 1257 1263 if (fsa.attrFile & FILE_DIRECTORY) { 1258 if (szBuffer[strlen(szBuffer) - 1] != '\\') 1259 strcat(szBuffer, "\\"); 1260 strcat(szBuffer, "*"); 1261 } 1262 if (spaces) 1263 strcat(szBuffer, "\""); 1264 BldQuotedFullPathName(szBuffer + strlen(szBuffer), wk->li->list[x], "*"); 1265 // if (szBuffer[strlen(szBuffer) - 1] != '\\') 1266 // strcat(szBuffer, "\\"); 1267 // strcat(szBuffer, "*"); 1268 } 1269 else 1270 BldQuotedFileName(szBuffer + strlen(szBuffer), wk->li->list[x]); 1271 // if (spaces) 1272 // strcat(szBuffer, "\""); 1264 1273 x++; 1265 1274 if (!wk->li->list[x] || 1266 1275 strlen(szBuffer) + strlen(wk->li->list[x]) + 5 > 1024) { 1267 runemf2(SEPARATE | WINDOWED | 1268 ( (fArcStuffVisible) ? 0 :1269 (BACKGROUND | MINIMIZED)) |1270 WAIT, HWND_DESKTOP, NULL, NULL,"%s", szBuffer);1276 runemf2(SEPARATE | WINDOWED | WAIT | 1277 (fArcStuffVisible ? 0 : (BACKGROUND | MINIMIZED)), 1278 HWND_DESKTOP, NULL, NULL, 1279 "%s", szBuffer); 1271 1280 DosSleep(1); 1272 1281 *p = 0;
Note:
See TracChangeset
for help on using the changeset viewer.