Skip to content

Commit e642287

Browse files
fuzuncraigwi
authored andcommitted
Squashed commit of the following; slight edits noted below; all credit to fuzun <[email protected]>!
Addresses PR microsoft#55. See comments there for more details. commit 19057a2 Author: fuzun <[email protected]> Date: Wed Apr 11 02:22:52 2018 +0300 Resource file fix for VS17 commit 3ae873d Author: fuzun <[email protected]> Date: Tue Apr 10 14:18:48 2018 +0300 Unsafe casting correction commit 1c76579 Author: fuzun <[email protected]> Date: Tue Apr 10 14:17:28 2018 +0300 Fixed formats for wsprintf commit 16eac5a Author: fuzun <[email protected]> Date: Tue Apr 10 14:13:59 2018 +0300 Added some allocation checks craigwi edits: wfcopy.c change not needed due to test above the code; put {} around the changes in wfdir.c commit 309fcd8 Author: fuzun <[email protected]> Date: Tue Apr 10 14:06:32 2018 +0300 Macro format fix commit 7ba9f5d Author: fuzun <[email protected]> Date: Tue Apr 10 14:01:07 2018 +0300 Removed unnecessary code
1 parent dc4c149 commit e642287

File tree

10 files changed

+34
-32
lines changed

10 files changed

+34
-32
lines changed

src/lfnmisc.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,9 @@ WORD I_LFNEditName( LPTSTR lpSrc, LPTSTR lpEd, LPTSTR lpRes, INT iResBufSize )
244244
( *lpSrc != CHAR_NULL ) && ( *lpSrc != delimit )) {
245245
#endif
246246

247-
if (ResLen < iResBufSize) {
247+
*(lpRes++) = *(lpSrc++);
248+
ResLen++;
248249

249-
*(lpRes++) = *(lpSrc++);
250-
ResLen++;
251-
}
252-
else
253-
return ERROR_INVALID_PARAMETER ;
254250
}
255251
}
256252
break;

src/res.rc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@
77

88
********************************************************************/
99

10+
// fix loading in VS per https://stackoverflow.com/questions/16537289/rc2247-cannot-open-rc-file-resource-explorer-cannot-load-resource-load-fai/18317658#18317658
11+
12+
#define APSTUDIO_HIDDEN_SYMBOLS
1013
#include "winfile.h"
14+
#include <prsht.h>
15+
#undef APSTUDIO_HIDDEN_SYMBOLS
1116
#include "wfcopy.h"
1217

18+
1319
BITMAPS BITMAP PRELOAD wbbitmap.bmp
1420

1521
IDB_TOOLBAR BITMAP PRELOAD toolbar.bmp

src/suggest.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,3 @@ PDWORD FormatSuggest(DWORD dwError);
4545
#define DE_UPDATING (DE_BEGIN+16)
4646
#define DE_DELEXTWRONGMODE (DE_BEGIN+17)
4747
#define DE_REGNAME (DE_BEGIN+18)
48-

src/wfassoc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3464,7 +3464,7 @@ RegExtDelete(HWND hDlg, HKEY hk, PEXT pExt)
34643464

34653465
dwError = RegNodeDelete(hk, pExt->szExt);
34663466

3467-
if (pExt->pftOrig && ERROR_SUCCESS == dwError)
3467+
if (ERROR_SUCCESS == dwError)
34683468
{
34693469
i = SendDlgItemMessage( hDlg,
34703470
IDD_EXT,

src/wfcopy.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2526,14 +2526,11 @@ WFMoveCopyDriverThread(PCOPYINFO pCopyInfo)
25262526
#endif
25272527
} else {
25282528

2529-
if (pCopyInfo->dwFunc == FUNC_MOVE) {
2530-
2531-
//
2532-
// On move, must delete destination file
2533-
// on copy, the fs does this for us.
2534-
//
2535-
ret = SafeFileRemove (szDest);
2536-
}
2529+
//
2530+
// On move, must delete destination file
2531+
// on copy, the fs does this for us.
2532+
//
2533+
ret = SafeFileRemove (szDest);
25372534

25382535
//
25392536
// Reset the file attributes that may have been

src/wfdir.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,7 +1838,7 @@ PutSize(
18381838
/*
18391839
* Convert it into a string.
18401840
*/
1841-
wsprintf(szBuffer, TEXT("%I64u"), pqSize->QuadPart);
1841+
wsprintf(szBuffer, TEXT("%lld"), pqSize->QuadPart);
18421842

18431843
/*
18441844
* Format the string.
@@ -2900,8 +2900,10 @@ DirGetSelection(
29002900
if (iSelType & 1)
29012901
goto GDSExit;
29022902

2903-
if ((!bLFNTest) && ((i + 1) < iMac))
2904-
lstrcat(p, szBlank);
2903+
if ((!bLFNTest) && ((i + 1) < iMac)) {
2904+
if (p)
2905+
lstrcat(p, szBlank);
2906+
}
29052907
}
29062908

29072909
GDSExit:

src/wfdlgs.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ SaveWindows(HWND hwndMain)
4545
// WINDOWPLACEMENT coordinates for top-level windows are in Workspace coordinates;
4646
// we tranlate this into screen coordinates prior to saving;
4747
// also, the values saved for the third and fourth values are width and height.
48-
49-
wsprintf(buf2, TEXT("%d,%d,%d,%d, , ,%d"), rcT.left + wp.rcNormalPosition.left,
48+
wsprintf(buf2, TEXT("%ld,%ld,%ld,%ld, , ,%u"), rcT.left + wp.rcNormalPosition.left,
5049
rcT.top + wp.rcNormalPosition.top,
5150
wp.rcNormalPosition.right - wp.rcNormalPosition.left,
5251
wp.rcNormalPosition.bottom - wp.rcNormalPosition.top,
@@ -95,8 +94,7 @@ SaveWindows(HWND hwndMain)
9594
// show_window, view, sort, attribs, split, directory
9695

9796
// NOTE: MDI child windows are in child coordinats; no translation is done.
98-
99-
wsprintf(buf2, TEXT("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%s"),
97+
wsprintf(buf2, TEXT("%ld,%ld,%ld,%ld,%ld,%ld,%u,%lu,%lu,%lu,%d,%s"),
10098
wp.rcNormalPosition.left, wp.rcNormalPosition.top,
10199
wp.rcNormalPosition.right, wp.rcNormalPosition.bottom,
102100
wp.ptMinPosition.x, wp.ptMinPosition.y,

src/wfdlgs3.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ FormatDrive( IN PVOID ThreadParameter )
785785
CancelInfo.Info.Format.fmMediaType,
786786
wszFileSystem,
787787
wszLabel,
788-
(BOOLEAN)CancelInfo.Info.Format.fQuick,
788+
(BOOLEAN)(CancelInfo.Info.Format.fQuick ? TRUE : FALSE),
789789
(FMIFS_CALLBACK)&Callback_Function);
790790
} while (CancelInfo.Info.Format.fFlags & FF_RETRY);
791791

@@ -1444,7 +1444,6 @@ DrivesDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam)
14441444
INT nCurDrive;
14451445
DRIVEIND nIndex;
14461446
LPTSTR lpszVolShare;
1447-
TCHAR szDrive[] = SZ_ACOLON;
14481447

14491448
nCurDrive = GetSelectedDrive();
14501449
nIndex = 0;

src/wfdrop.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -609,12 +609,17 @@ WF_IDropTarget * WF_IDropTarget_new(HWND hwnd)
609609

610610
result = calloc(1, sizeof(WF_IDropTarget));
611611

612-
result->idt.lpVtbl = (IDropTargetVtbl*)&idt_vtbl;
612+
if (result)
613+
{
614+
result->idt.lpVtbl = (IDropTargetVtbl*)&idt_vtbl;
615+
616+
result->m_lRefCount = 1;
617+
result->m_hWnd = hwnd;
618+
result->m_fAllowDrop = FALSE;
619+
620+
// return result;
621+
}
613622

614-
result->m_lRefCount = 1;
615-
result->m_hWnd = hwnd;
616-
result->m_fAllowDrop = FALSE;
617-
618623
return result;
619624
}
620625

src/wfutil.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,11 +461,11 @@ AddCommasInternal(LPTSTR szBuf, DWORD dw)
461461
// if *szComma[0] == NULL, get out now
462462

463463
if (!szComma[0]) {
464-
wsprintf(szBuf,TEXT("%ld"),dw);
464+
wsprintf(szBuf,TEXT("%lu"),dw);
465465
return szBuf;
466466
}
467467

468-
len = wsprintf(szTemp, TEXT("%ld"), dw);
468+
len = wsprintf(szTemp, TEXT("%lu"), dw);
469469
iCommaLen = lstrlen(szComma);
470470

471471
pTemp = szTemp + len - 1;

0 commit comments

Comments
 (0)