Changeset 763
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/autoview.c
r689 r763 412 412 413 413 static FILEFINDBUF4 ffb[130]; 414 static char fullname[CCHMAXPATH + 4]; 414 CHAR fullname[CCHMAXPATH + 4]; 415 PSZ pszFullName = fullname, pszCurrFile = currfile, psz; 415 416 HDIR hdir = HDIR_CREATE; 416 417 ULONG x, nm, ml, mc, bufflen; 417 418 PBYTE fb; 418 419 PFILEFINDBUF4 pffbFile; 419 char *buff, *p; 420 APIRET rc; 421 422 sprintf(fullname, 423 "%s%s*", 424 currfile, 425 (currfile[strlen(currfile) - 1] == '\\') ? "" : "\\"); 420 CHAR *buff, *p = "*"; 421 APIRET rc; 422 423 psz = p; 424 BldFullPathName(pszFullName, pszCurrFile, psz); 425 *p = 0; 426 //sprintf(fullname, 427 // "%s%s*", 428 // currfile, 429 // (currfile[strlen(currfile) - 1] == '\\') ? "" : "\\"); 426 430 DosError(FERR_DISABLEHARDERR); 427 431 nm = sizeof(ffb) / sizeof(FILEFINDBUF4); -
trunk/dll/comp.c
r762 r763 72 72 char *mask, *enddir; 73 73 HDIR hdir = HDIR_CREATE; 74 ULONG nm = 1 L;74 ULONG nm = 1; 75 75 76 76 fb = xmalloc(sizeof(FILEFINDBUF4), pszSrcFile, __LINE__); … … 103 103 fb->ftimeLastWrite.minutes, 104 104 fb->ftimeLastWrite.twosecs, 105 fb->attrFile, (fb->cbList > 4 L) ? (fb->cbList / 2L) : 0L);105 fb->attrFile, (fb->cbList > 4) ? (fb->cbList / 2) : 0); 106 106 // Skip . and .. 107 107 else if (recurse && … … 111 111 SnapShot(mask, fp, recurse); 112 112 } 113 nm = 1 L;113 nm = 1; 114 114 } while (!DosFindNext(hdir, fb, sizeof(FILEFINDBUF4), &nm)); 115 115 DosFindClose(hdir); … … 358 358 PCNRITEM pci, pciD, pciNextS, pciNextD; 359 359 CHAR newname[CCHMAXPATH], dirname[CCHMAXPATH], *p; 360 PSZ pszNewName = newname; 360 361 APIRET rc; 361 362 … … 458 459 case IDM_MOVE: 459 460 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) 460 // 02 Aug 07 SHL fixme to replace this kind of stuff with _makepath or equivalent 461 sprintf(newname, "%s%s%s", 462 cmp->leftdir, 463 cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\' ? 464 NullStr : "\\", 465 pci->pszDisplayName); 466 else 467 sprintf(newname, "%s%s%s", 468 cmp->rightdir, 469 cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\' ? 470 NullStr : "\\", 471 pci->pszDisplayName); 461 // 02 Aug 07 SHL fixme to replace this kind of stuff with _makepath or equivalent 462 BldFullPathName(pszNewName, cmp->leftdir, pci->pszDisplayName); 463 //sprintf(newname, "%s%s%s", 464 // cmp->leftdir, 465 // cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\' ? 466 // NullStr : "\\", 467 // pci->pszDisplayName); 468 else 469 BldFullPathName(pszNewName, cmp->rightdir, pci->pszDisplayName); 470 //sprintf(newname, "%s%s%s", 471 // cmp->rightdir, 472 // cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\' ? 473 // NullStr : "\\", 474 // pci->pszDisplayName); 472 475 // Make directory if required 473 476 strcpy(dirname, newname); … … 548 551 549 552 case IDM_COPY: 550 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) 551 sprintf(newname, "%s%s%s", 552 cmp->leftdir, 553 cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\' ? 554 NullStr : "\\", 555 pci->pszDisplayName); 556 else 557 sprintf(newname, "%s%s%s", 558 cmp->rightdir, 559 cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\' ? 560 NullStr : "\\", 561 pci->pszDisplayName); 553 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) 554 BldFullPathName(pszNewName, cmp->leftdir, pci->pszDisplayName); 555 //sprintf(newname, "%s%s%s", 556 // cmp->leftdir, 557 // cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\' ? 558 // NullStr : "\\", 559 // pci->pszDisplayName); 560 else 561 BldFullPathName(pszNewName, cmp->rightdir, pci->pszDisplayName); 562 //sprintf(newname, "%s%s%s", 563 // cmp->rightdir, 564 // cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\' ? 565 // NullStr : "\\", 566 // pci->pszDisplayName); 562 567 // Make directory if required 563 568 strcpy(dirname, newname); … … 709 714 FILEFINDBUF4 *ffb4, *pffb; 710 715 HDIR hDir; 711 ULONG nm, fl = 0, ulM = 64;716 ULONG nm, fl = 0, ulM = FilesToGet; 712 717 APIRET rc; 713 718 … … 717 722 } 718 723 719 if (!recurse)720 ulM = FilesToGet;724 //if (!recurse) 725 // ulM = FilesToGet; 721 726 maskstr = xmalloc(CCHMAXPATH, pszSrcFile, __LINE__); 722 727 if (!maskstr) … … 812 817 HWND hwndLeft, hwndRight; 813 818 CHAR szBuf[CCHMAXPATH]; 819 PSZ pszBuf = szBuf; 814 820 CNRINFO cnri; 815 821 … … 1093 1099 1094 1100 if (x <= 0) { 1095 // File appears on left side 1096 sprintf(szBuf, "%s%s%s", cmp->leftdir, 1097 (cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\') ? 1098 NullStr : "\\", filesl[l]->fname); 1101 // File appears on left side 1102 BldFullPathName(pszBuf, cmp->leftdir, filesl[l]->fname); 1103 //sprintf(szBuf, "%s%s%s", cmp->leftdir, 1104 // (cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\') ? 1105 // NullStr : "\\", filesl[l]->fname); 1099 1106 pcil->pszFileName = xstrdup(szBuf, pszSrcFile, __LINE__); 1100 1107 pcil->pszDisplayName = pcil->pszFileName + lenl; … … 1131 1138 1132 1139 if (x >= 0) { 1133 // File appears on right side 1134 sprintf(szBuf, "%s%s%s", cmp->rightdir, 1135 (cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\') ? 1136 NullStr : "\\", filesr[r]->fname); 1140 // File appears on right side 1141 BldFullPathName(pszBuf, cmp->rightdir, filesl[r]->fname); 1142 //sprintf(szBuf, "%s%s%s", cmp->rightdir, 1143 // (cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\') ? 1144 // NullStr : "\\", filesr[r]->fname); 1137 1145 pcir->pszFileName = xstrdup(szBuf, pszSrcFile, __LINE__); // 31 Jul 07 SHL 1138 1146 pcir->pszDisplayName = pcir->pszFileName + lenr; -
trunk/dll/filldir.c
r762 r763 50 50 #include <ctype.h> 51 51 #include <time.h> 52 #include <time.h> 53 54 #if 1 // fixme to disable or to be configurable 52 55 #include <malloc.h> // _heapchk 56 #endif 53 57 54 58 #include "fm3dll.h" … … 56 60 57 61 static PSZ pszSrcFile = __FILE__; 62 extern BOOL needs_quoting(PSZ psz); 58 63 59 64 #pragma alloc_text(FILLDIR,FillInRecordFromFFB,FillInRecordFromFSA,IDFile) 60 65 #pragma alloc_text(FILLDIR1,ProcessDirectory,FillDirCnr,FillTreeCnr,FileAttrToString) 66 #pragma alloc_text(BldFullPathName, BldQuotedFullPathName, BldQuotedFileName) 61 67 #pragma alloc_text(EMPTYCNR,EmptyCnr,FreeCnrItemData,FreeCnrItem,FreeCnrItemList,RemoveCnrItems) 68 69 /** 70 * Build full path name in callers buffer given directory 71 * name and filename 72 * @returns pointer to users buffers 73 * 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] != '\\') 82 pszFullPathName[c++] = '\\'; 83 } 84 strcpy(pszFullPathName + c, pszFileName); 85 return pszFullPathName; 86 } 87 88 /** 89 * Build quoted full path name in callers buffer given directory 90 * name and filename 91 * @returns pointer to users buffers 92 * 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] != '\\') 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 directory 120 * name and filename 121 * @returns pointer to users buffers 122 * 123 */ 124 125 PSZ BldQuotedFileName(PSZ pszQuotedFileName, PSZ pszFileName) 126 { 127 BOOL q = needs_quoting(pszFileName); 128 PSZ psz = pszQuotedFileName; 129 130 if (q) 131 *psz++ = '"'; 132 strcpy(psz, pszFileName); 133 if (q) { 134 psz += strlen(psz); 135 *psz++ = '"'; 136 *psz = 0; 137 } 138 return pszQuotedFileName; 139 } 62 140 63 141 /** … … 246 324 (like in update.c) 247 325 */ 248 if (!*pffb->achName) 249 pci->pszFileName = xstrdup(pszDirectory, pszSrcFile, __LINE__); 326 if (!*pffb->achName) { 327 // pci->pszFileName = xstrdup(pszDirectory, pszSrcFile, __LINE__); 328 pci->pszFileName = pci->szFileName; 329 strcpy(pci->pszFileName, pszDirectory); 330 } 250 331 else { 251 332 INT c = strlen(pszDirectory); … … 253 334 if (pszDirectory[c - 1] != '\\') 254 335 c2++; 255 pci->pszFileName = xmalloc(c + c2, pszSrcFile, __LINE__); 336 // pci->pszFileName = xmalloc(c + c2, pszSrcFile, __LINE__); 337 pci->pszFileName = pci->szFileName; 256 338 memcpy(pci->pszFileName, pszDirectory, c + 1); 257 339 p = pci->pszFileName + c - 1; … … 479 561 480 562 pci->hwndCnr = hwndCnr; 481 pci->pszFileName = xstrdup(pszFileName, pszSrcFile, __LINE__); 563 // pci->pszFileName = xstrdup(pszFileName, pszSrcFile, __LINE__); 564 pci->pszFileName = pci->szFileName; 565 strcpy(pci->pszFileName, pszFileName); 482 566 483 567 /* load the object's Subject, if required */ … … 788 872 } 789 873 pByte += pffbFile->oNextEntryOffset; 790 } 874 } // for 791 875 if (ulFileCnt) { 792 876 if (stopflag && *stopflag) … … 1001 1085 if (state != _HEAPOK) 1002 1086 Runtime_Error(pszSrcFile, __LINE__, "heap corrupted %d", state); 1087 else 1088 DbgMsg(pszSrcFile, __LINE__, "_memavl %u", _memavl()); 1003 1089 } 1004 1090 #endif … … 1175 1261 } 1176 1262 sprintf(suggest + strlen(suggest), "%c" , toupper(*szDrive)); 1177 pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1263 // pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1264 pci->pszFileName = pci->szFileName; 1265 strcpy(pci->pszFileName, szDrive); 1178 1266 pci->pszDisplayName = pci->pszFileName; 1179 1267 pci->rc.pszIcon = pci->pszDisplayName; … … 1187 1275 else { 1188 1276 // Removable volume 1189 pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1277 // pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1278 pci->pszFileName = pci->szFileName; 1279 strcpy(pci->pszFileName, szDrive); 1190 1280 pci->pszDisplayName = pci->pszFileName; 1191 1281 pci->rc.pszIcon = pci->pszDisplayName; … … 1197 1287 else { 1198 1288 pci->rc.hptrIcon = hptrDunno; 1199 pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1289 // pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1290 pci->pszFileName = pci->szFileName; 1291 strcpy(pci->pszFileName, szDrive); 1200 1292 pci->pszDisplayName = pci->pszFileName; 1201 1293 pci->rc.pszIcon = pci->pszFileName; … … 1208 1300 // diskette drive (A or B) 1209 1301 pci->rc.hptrIcon = hptrFloppy; 1210 pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1302 // pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1303 pci->pszFileName = pci->szFileName; 1304 strcpy(pci->pszFileName, szDrive); 1211 1305 pci->pszDisplayName = pci->pszFileName; 1212 1306 pci->rc.pszIcon = pci->pszDisplayName; … … 1279 1373 if (pciParent) { 1280 1374 pciParent->flags |= RECFLAGS_ENV; 1281 pciParent->pszFileName = xstrdup(GetPString(IDS_ENVVARSTEXT), pszSrcFile, __LINE__); 1375 // pciParent->pszFileName = xstrdup(GetPString(IDS_ENVVARSTEXT), pszSrcFile, __LINE__); 1376 pciParent->pszFileName = pciParent->szFileName; 1377 strcpy(pciParent->pszFileName, GetPString(IDS_ENVVARSTEXT)); 1378 pciParent->pszDisplayName = pciParent->pszFileName; // 03 Aug 07 SHL 1282 1379 pciParent->rc.hptrIcon = hptrEnv; 1283 1380 pciParent->rc.pszIcon = pciParent->pszFileName; -
trunk/dll/fm3dll.h
r762 r763 424 424 ULONG attrFile; /* Attributes of this file */ 425 425 ULONG flags; 426 CHAR szFileName[CCHMAXPATH]; // Full path name - fixed size for speed 426 427 } 427 428 CNRITEM, *PCNRITEM; … … 622 623 623 624 /* filldir.c */ 625 PSZ BldFullPathName(PSZ pszFullPathName, PSZ pszPathName, PSZ pszFileName); 626 PSZ BldQuotedFullPathName(PSZ pszFullPathName, PSZ pszPathName, PSZ pszFileName); 627 PSZ BldQuotedFileName(PSZ pszQuotedFileName, PSZ pszFileName); 624 628 VOID EmptyCnr(HWND hwnd); 625 629 const PSZ FileAttrToString(ULONG fileAttr);
Note:
See TracChangeset
for help on using the changeset viewer.