Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3e7647ad
Commit
3e7647ad
authored
May 07, 2009
by
Michael Stefaniuc
Committed by
Alexandre Julliard
May 07, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
notepad: Use the explicit W-form of the types.
parent
4bc8e87a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
53 deletions
+52
-53
dialog.c
programs/notepad/dialog.c
+13
-14
main.c
programs/notepad/main.c
+18
-18
main.h
programs/notepad/main.h
+21
-21
No files found.
programs/notepad/dialog.c
View file @
3e7647ad
...
...
@@ -50,8 +50,7 @@ VOID ShowLastError(void)
LoadString
(
Globals
.
hInstance
,
STRING_ERROR
,
szTitle
,
SIZEOF
(
szTitle
));
FormatMessage
(
FORMAT_MESSAGE_ALLOCATE_BUFFER
|
FORMAT_MESSAGE_FROM_SYSTEM
,
NULL
,
error
,
0
,
(
LPTSTR
)
&
lpMsgBuf
,
0
,
NULL
);
NULL
,
error
,
0
,
(
LPWSTR
)
&
lpMsgBuf
,
0
,
NULL
);
MessageBox
(
NULL
,
lpMsgBuf
,
szTitle
,
MB_OK
|
MB_ICONERROR
);
LocalFree
(
lpMsgBuf
);
}
...
...
@@ -122,7 +121,7 @@ static int AlertFileNotSaved(LPCWSTR szFileName)
*/
BOOL
FileExists
(
LPCWSTR
szFilename
)
{
WIN32_FIND_DATA
entry
;
WIN32_FIND_DATA
W
entry
;
HANDLE
hFile
;
hFile
=
FindFirstFile
(
szFilename
,
&
entry
);
...
...
@@ -287,7 +286,7 @@ VOID DIALOG_FileNew(VOID)
VOID
DIALOG_FileOpen
(
VOID
)
{
OPENFILENAME
openfilename
;
OPENFILENAME
W
openfilename
;
WCHAR
szPath
[
MAX_PATH
];
WCHAR
szDir
[
MAX_PATH
];
static
const
WCHAR
szDefaultExt
[]
=
{
't'
,
'x'
,
't'
,
0
};
...
...
@@ -326,7 +325,7 @@ BOOL DIALOG_FileSave(VOID)
BOOL
DIALOG_FileSaveAs
(
VOID
)
{
OPENFILENAME
saveas
;
OPENFILENAME
W
saveas
;
WCHAR
szPath
[
MAX_PATH
];
WCHAR
szDir
[
MAX_PATH
];
static
const
WCHAR
szDefaultExt
[]
=
{
't'
,
'x'
,
't'
,
0
};
...
...
@@ -337,7 +336,7 @@ BOOL DIALOG_FileSaveAs(VOID)
GetCurrentDirectory
(
SIZEOF
(
szDir
),
szDir
);
lstrcpy
(
szPath
,
txt_files
);
saveas
.
lStructSize
=
sizeof
(
OPENFILENAME
);
saveas
.
lStructSize
=
sizeof
(
OPENFILENAME
W
);
saveas
.
hwndOwner
=
Globals
.
hMainWnd
;
saveas
.
hInstance
=
Globals
.
hInstance
;
saveas
.
lpstrFilter
=
Globals
.
szFilter
;
...
...
@@ -384,7 +383,7 @@ static int notepad_print_header(HDC hdc, RECT *rc, BOOL dopage, BOOL header, int
static
BOOL
notepad_print_page
(
HDC
hdc
,
RECT
*
rc
,
BOOL
dopage
,
int
page
,
LPTEXTINFO
tInfo
)
{
int
b
,
y
;
TEXTMETRIC
tm
;
TEXTMETRIC
W
tm
;
SIZE
szMetrics
;
if
(
dopage
)
...
...
@@ -478,10 +477,10 @@ static BOOL notepad_print_page(HDC hdc, RECT *rc, BOOL dopage, int page, LPTEXTI
VOID
DIALOG_FilePrint
(
VOID
)
{
DOCINFO
di
;
PRINTDLG
printer
;
DOCINFO
W
di
;
PRINTDLG
W
printer
;
int
page
,
dopage
,
copy
;
LOGFONT
lfFont
;
LOGFONT
W
lfFont
;
HFONT
hTextFont
,
old_font
=
0
;
DWORD
size
;
BOOL
ret
=
FALSE
;
...
...
@@ -516,7 +515,7 @@ VOID DIALOG_FilePrint(VOID)
SetMapMode
(
printer
.
hDC
,
MM_TEXT
);
/* initialize DOCINFO */
di
.
cbSize
=
sizeof
(
DOCINFO
);
di
.
cbSize
=
sizeof
(
DOCINFO
W
);
di
.
lpszDocName
=
Globals
.
szFileTitle
;
di
.
lpszOutput
=
NULL
;
di
.
lpszDatatype
=
NULL
;
...
...
@@ -594,7 +593,7 @@ VOID DIALOG_FilePrint(VOID)
VOID
DIALOG_FilePrinterSetup
(
VOID
)
{
PRINTDLG
printer
;
PRINTDLG
W
printer
;
ZeroMemory
(
&
printer
,
sizeof
(
printer
));
printer
.
lStructSize
=
sizeof
(
printer
);
...
...
@@ -701,8 +700,8 @@ VOID DIALOG_EditWrap(VOID)
VOID
DIALOG_SelectFont
(
VOID
)
{
CHOOSEFONT
cf
;
LOGFONT
lf
=
Globals
.
lfFont
;
CHOOSEFONT
W
cf
;
LOGFONT
W
lf
=
Globals
.
lfFont
;
ZeroMemory
(
&
cf
,
sizeof
(
cf
)
);
cf
.
lStructSize
=
sizeof
(
cf
);
...
...
programs/notepad/main.c
View file @
3e7647ad
...
...
@@ -356,7 +356,7 @@ static VOID NOTEPAD_InitMenuPopup(HMENU menu, int index)
GetWindowTextLength
(
Globals
.
hEdit
)
?
MF_ENABLED
:
MF_GRAYED
);
}
static
LP
TSTR
NOTEPAD_StrRStr
(
LPTSTR
pszSource
,
LPTSTR
pszLast
,
LPT
STR
pszSrch
)
static
LP
WSTR
NOTEPAD_StrRStr
(
LPWSTR
pszSource
,
LPWSTR
pszLast
,
LPW
STR
pszSrch
)
{
int
len
=
lstrlen
(
pszSrch
);
pszLast
--
;
...
...
@@ -372,16 +372,16 @@ static LPTSTR NOTEPAD_StrRStr(LPTSTR pszSource, LPTSTR pszLast, LPTSTR pszSrch)
/***********************************************************************
* The user activated the Find dialog
*/
void
NOTEPAD_DoFind
(
FINDREPLACE
*
fr
)
void
NOTEPAD_DoFind
(
FINDREPLACE
W
*
fr
)
{
LP
T
STR
content
;
LP
T
STR
found
;
LP
W
STR
content
;
LP
W
STR
found
;
int
len
=
lstrlen
(
fr
->
lpstrFindWhat
);
int
fileLen
;
DWORD
pos
;
fileLen
=
GetWindowTextLength
(
Globals
.
hEdit
)
+
1
;
content
=
HeapAlloc
(
GetProcessHeap
(),
0
,
fileLen
*
sizeof
(
T
CHAR
));
content
=
HeapAlloc
(
GetProcessHeap
(),
0
,
fileLen
*
sizeof
(
W
CHAR
));
if
(
!
content
)
return
;
GetWindowText
(
Globals
.
hEdit
,
content
,
fileLen
);
...
...
@@ -415,16 +415,16 @@ void NOTEPAD_DoFind(FINDREPLACE *fr)
SendMessageW
(
Globals
.
hEdit
,
EM_SETSEL
,
found
-
content
,
found
-
content
+
len
);
}
static
void
NOTEPAD_DoReplace
(
FINDREPLACE
*
fr
)
static
void
NOTEPAD_DoReplace
(
FINDREPLACE
W
*
fr
)
{
LP
T
STR
content
;
LP
W
STR
content
;
int
len
=
lstrlen
(
fr
->
lpstrFindWhat
);
int
fileLen
;
DWORD
pos
;
DWORD
pos_start
;
fileLen
=
GetWindowTextLength
(
Globals
.
hEdit
)
+
1
;
content
=
HeapAlloc
(
GetProcessHeap
(),
0
,
fileLen
*
sizeof
(
T
CHAR
));
content
=
HeapAlloc
(
GetProcessHeap
(),
0
,
fileLen
*
sizeof
(
W
CHAR
));
if
(
!
content
)
return
;
GetWindowText
(
Globals
.
hEdit
,
content
,
fileLen
);
...
...
@@ -447,10 +447,10 @@ static void NOTEPAD_DoReplace(FINDREPLACE *fr)
NOTEPAD_DoFind
(
fr
);
}
static
void
NOTEPAD_DoReplaceAll
(
FINDREPLACE
*
fr
)
static
void
NOTEPAD_DoReplaceAll
(
FINDREPLACE
W
*
fr
)
{
LP
T
STR
content
;
LP
T
STR
found
;
LP
W
STR
content
;
LP
W
STR
found
;
int
len
=
lstrlen
(
fr
->
lpstrFindWhat
);
int
fileLen
;
DWORD
pos
;
...
...
@@ -458,7 +458,7 @@ static void NOTEPAD_DoReplaceAll(FINDREPLACE *fr)
SendMessageW
(
Globals
.
hEdit
,
EM_SETSEL
,
0
,
0
);
while
(
TRUE
){
fileLen
=
GetWindowTextLength
(
Globals
.
hEdit
)
+
1
;
content
=
HeapAlloc
(
GetProcessHeap
(),
0
,
fileLen
*
sizeof
(
T
CHAR
));
content
=
HeapAlloc
(
GetProcessHeap
(),
0
,
fileLen
*
sizeof
(
W
CHAR
));
if
(
!
content
)
return
;
GetWindowText
(
Globals
.
hEdit
,
content
,
fileLen
);
...
...
@@ -495,8 +495,8 @@ static LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
{
if
(
msg
==
aFINDMSGSTRING
)
/* not a constant so can't be used in switch */
{
FINDREPLACE
*
fr
=
(
FINDREPLACE
*
)
lParam
;
FINDREPLACE
W
*
fr
=
(
FINDREPLACEW
*
)
lParam
;
if
(
fr
->
Flags
&
FR_DIALOGTERM
)
Globals
.
hFindReplaceDlg
=
NULL
;
if
(
fr
->
Flags
&
FR_FINDNEXT
)
...
...
@@ -717,9 +717,9 @@ static void HandleCommandLine(LPWSTR cmdline)
*/
int
PASCAL
WinMain
(
HINSTANCE
hInstance
,
HINSTANCE
prev
,
LPSTR
cmdline
,
int
show
)
{
MSG
msg
;
HACCEL
hAccel
;
WNDCLASSEX
class
;
MSG
msg
;
HACCEL
hAccel
;
WNDCLASSEX
W
class
;
HMONITOR
monitor
;
MONITORINFO
info
;
INT
x
,
y
;
...
...
programs/notepad/main.h
View file @
3e7647ad
...
...
@@ -27,27 +27,27 @@
typedef
struct
{
HANDLE
hInstance
;
HWND
hMainWnd
;
HWND
hFindReplaceDlg
;
HWND
hEdit
;
HFONT
hFont
;
/* Font used by the edit control */
LOGFONT
lfFont
;
BOOL
bWrapLongLines
;
WCHAR
szFindText
[
MAX_PATH
];
WCHAR
szReplaceText
[
MAX_PATH
];
WCHAR
szFileName
[
MAX_PATH
];
WCHAR
szFileTitle
[
MAX_PATH
];
WCHAR
szFilter
[
2
*
MAX_STRING_LEN
+
100
];
INT
iMarginTop
;
INT
iMarginBottom
;
INT
iMarginLeft
;
INT
iMarginRight
;
WCHAR
szHeader
[
MAX_PATH
];
WCHAR
szFooter
[
MAX_PATH
];
HANDLE
hInstance
;
HWND
hMainWnd
;
HWND
hFindReplaceDlg
;
HWND
hEdit
;
HFONT
hFont
;
/* Font used by the edit control */
LOGFONT
W
lfFont
;
BOOL
bWrapLongLines
;
WCHAR
szFindText
[
MAX_PATH
];
WCHAR
szReplaceText
[
MAX_PATH
];
WCHAR
szFileName
[
MAX_PATH
];
WCHAR
szFileTitle
[
MAX_PATH
];
WCHAR
szFilter
[
2
*
MAX_STRING_LEN
+
100
];
INT
iMarginTop
;
INT
iMarginBottom
;
INT
iMarginLeft
;
INT
iMarginRight
;
WCHAR
szHeader
[
MAX_PATH
];
WCHAR
szFooter
[
MAX_PATH
];
FINDREPLACE
find
;
FINDREPLACE
lastFind
;
FINDREPLACE
W
find
;
FINDREPLACE
W
lastFind
;
HGLOBAL
hDevMode
;
/* printer mode */
HGLOBAL
hDevNames
;
/* printer names */
}
NOTEPAD_GLOBALS
;
...
...
@@ -55,5 +55,5 @@ typedef struct
extern
NOTEPAD_GLOBALS
Globals
;
VOID
SetFileName
(
LPCWSTR
szFileName
);
void
NOTEPAD_DoFind
(
FINDREPLACE
*
fr
);
void
NOTEPAD_DoFind
(
FINDREPLACE
W
*
fr
);
DWORD
get_dpi
(
void
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment