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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
32 deletions
+31
-32
dialog.c
programs/notepad/dialog.c
+13
-14
main.c
programs/notepad/main.c
+14
-14
main.h
programs/notepad/main.h
+4
-4
No files found.
programs/notepad/dialog.c
View file @
3e7647ad
...
@@ -50,8 +50,7 @@ VOID ShowLastError(void)
...
@@ -50,8 +50,7 @@ VOID ShowLastError(void)
LoadString
(
Globals
.
hInstance
,
STRING_ERROR
,
szTitle
,
SIZEOF
(
szTitle
));
LoadString
(
Globals
.
hInstance
,
STRING_ERROR
,
szTitle
,
SIZEOF
(
szTitle
));
FormatMessage
(
FormatMessage
(
FORMAT_MESSAGE_ALLOCATE_BUFFER
|
FORMAT_MESSAGE_FROM_SYSTEM
,
FORMAT_MESSAGE_ALLOCATE_BUFFER
|
FORMAT_MESSAGE_FROM_SYSTEM
,
NULL
,
error
,
0
,
NULL
,
error
,
0
,
(
LPWSTR
)
&
lpMsgBuf
,
0
,
NULL
);
(
LPTSTR
)
&
lpMsgBuf
,
0
,
NULL
);
MessageBox
(
NULL
,
lpMsgBuf
,
szTitle
,
MB_OK
|
MB_ICONERROR
);
MessageBox
(
NULL
,
lpMsgBuf
,
szTitle
,
MB_OK
|
MB_ICONERROR
);
LocalFree
(
lpMsgBuf
);
LocalFree
(
lpMsgBuf
);
}
}
...
@@ -122,7 +121,7 @@ static int AlertFileNotSaved(LPCWSTR szFileName)
...
@@ -122,7 +121,7 @@ static int AlertFileNotSaved(LPCWSTR szFileName)
*/
*/
BOOL
FileExists
(
LPCWSTR
szFilename
)
BOOL
FileExists
(
LPCWSTR
szFilename
)
{
{
WIN32_FIND_DATA
entry
;
WIN32_FIND_DATA
W
entry
;
HANDLE
hFile
;
HANDLE
hFile
;
hFile
=
FindFirstFile
(
szFilename
,
&
entry
);
hFile
=
FindFirstFile
(
szFilename
,
&
entry
);
...
@@ -287,7 +286,7 @@ VOID DIALOG_FileNew(VOID)
...
@@ -287,7 +286,7 @@ VOID DIALOG_FileNew(VOID)
VOID
DIALOG_FileOpen
(
VOID
)
VOID
DIALOG_FileOpen
(
VOID
)
{
{
OPENFILENAME
openfilename
;
OPENFILENAME
W
openfilename
;
WCHAR
szPath
[
MAX_PATH
];
WCHAR
szPath
[
MAX_PATH
];
WCHAR
szDir
[
MAX_PATH
];
WCHAR
szDir
[
MAX_PATH
];
static
const
WCHAR
szDefaultExt
[]
=
{
't'
,
'x'
,
't'
,
0
};
static
const
WCHAR
szDefaultExt
[]
=
{
't'
,
'x'
,
't'
,
0
};
...
@@ -326,7 +325,7 @@ BOOL DIALOG_FileSave(VOID)
...
@@ -326,7 +325,7 @@ BOOL DIALOG_FileSave(VOID)
BOOL
DIALOG_FileSaveAs
(
VOID
)
BOOL
DIALOG_FileSaveAs
(
VOID
)
{
{
OPENFILENAME
saveas
;
OPENFILENAME
W
saveas
;
WCHAR
szPath
[
MAX_PATH
];
WCHAR
szPath
[
MAX_PATH
];
WCHAR
szDir
[
MAX_PATH
];
WCHAR
szDir
[
MAX_PATH
];
static
const
WCHAR
szDefaultExt
[]
=
{
't'
,
'x'
,
't'
,
0
};
static
const
WCHAR
szDefaultExt
[]
=
{
't'
,
'x'
,
't'
,
0
};
...
@@ -337,7 +336,7 @@ BOOL DIALOG_FileSaveAs(VOID)
...
@@ -337,7 +336,7 @@ BOOL DIALOG_FileSaveAs(VOID)
GetCurrentDirectory
(
SIZEOF
(
szDir
),
szDir
);
GetCurrentDirectory
(
SIZEOF
(
szDir
),
szDir
);
lstrcpy
(
szPath
,
txt_files
);
lstrcpy
(
szPath
,
txt_files
);
saveas
.
lStructSize
=
sizeof
(
OPENFILENAME
);
saveas
.
lStructSize
=
sizeof
(
OPENFILENAME
W
);
saveas
.
hwndOwner
=
Globals
.
hMainWnd
;
saveas
.
hwndOwner
=
Globals
.
hMainWnd
;
saveas
.
hInstance
=
Globals
.
hInstance
;
saveas
.
hInstance
=
Globals
.
hInstance
;
saveas
.
lpstrFilter
=
Globals
.
szFilter
;
saveas
.
lpstrFilter
=
Globals
.
szFilter
;
...
@@ -384,7 +383,7 @@ static int notepad_print_header(HDC hdc, RECT *rc, BOOL dopage, BOOL header, int
...
@@ -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
)
static
BOOL
notepad_print_page
(
HDC
hdc
,
RECT
*
rc
,
BOOL
dopage
,
int
page
,
LPTEXTINFO
tInfo
)
{
{
int
b
,
y
;
int
b
,
y
;
TEXTMETRIC
tm
;
TEXTMETRIC
W
tm
;
SIZE
szMetrics
;
SIZE
szMetrics
;
if
(
dopage
)
if
(
dopage
)
...
@@ -478,10 +477,10 @@ static BOOL notepad_print_page(HDC hdc, RECT *rc, BOOL dopage, int page, LPTEXTI
...
@@ -478,10 +477,10 @@ static BOOL notepad_print_page(HDC hdc, RECT *rc, BOOL dopage, int page, LPTEXTI
VOID
DIALOG_FilePrint
(
VOID
)
VOID
DIALOG_FilePrint
(
VOID
)
{
{
DOCINFO
di
;
DOCINFO
W
di
;
PRINTDLG
printer
;
PRINTDLG
W
printer
;
int
page
,
dopage
,
copy
;
int
page
,
dopage
,
copy
;
LOGFONT
lfFont
;
LOGFONT
W
lfFont
;
HFONT
hTextFont
,
old_font
=
0
;
HFONT
hTextFont
,
old_font
=
0
;
DWORD
size
;
DWORD
size
;
BOOL
ret
=
FALSE
;
BOOL
ret
=
FALSE
;
...
@@ -516,7 +515,7 @@ VOID DIALOG_FilePrint(VOID)
...
@@ -516,7 +515,7 @@ VOID DIALOG_FilePrint(VOID)
SetMapMode
(
printer
.
hDC
,
MM_TEXT
);
SetMapMode
(
printer
.
hDC
,
MM_TEXT
);
/* initialize DOCINFO */
/* initialize DOCINFO */
di
.
cbSize
=
sizeof
(
DOCINFO
);
di
.
cbSize
=
sizeof
(
DOCINFO
W
);
di
.
lpszDocName
=
Globals
.
szFileTitle
;
di
.
lpszDocName
=
Globals
.
szFileTitle
;
di
.
lpszOutput
=
NULL
;
di
.
lpszOutput
=
NULL
;
di
.
lpszDatatype
=
NULL
;
di
.
lpszDatatype
=
NULL
;
...
@@ -594,7 +593,7 @@ VOID DIALOG_FilePrint(VOID)
...
@@ -594,7 +593,7 @@ VOID DIALOG_FilePrint(VOID)
VOID
DIALOG_FilePrinterSetup
(
VOID
)
VOID
DIALOG_FilePrinterSetup
(
VOID
)
{
{
PRINTDLG
printer
;
PRINTDLG
W
printer
;
ZeroMemory
(
&
printer
,
sizeof
(
printer
));
ZeroMemory
(
&
printer
,
sizeof
(
printer
));
printer
.
lStructSize
=
sizeof
(
printer
);
printer
.
lStructSize
=
sizeof
(
printer
);
...
@@ -701,8 +700,8 @@ VOID DIALOG_EditWrap(VOID)
...
@@ -701,8 +700,8 @@ VOID DIALOG_EditWrap(VOID)
VOID
DIALOG_SelectFont
(
VOID
)
VOID
DIALOG_SelectFont
(
VOID
)
{
{
CHOOSEFONT
cf
;
CHOOSEFONT
W
cf
;
LOGFONT
lf
=
Globals
.
lfFont
;
LOGFONT
W
lf
=
Globals
.
lfFont
;
ZeroMemory
(
&
cf
,
sizeof
(
cf
)
);
ZeroMemory
(
&
cf
,
sizeof
(
cf
)
);
cf
.
lStructSize
=
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)
...
@@ -356,7 +356,7 @@ static VOID NOTEPAD_InitMenuPopup(HMENU menu, int index)
GetWindowTextLength
(
Globals
.
hEdit
)
?
MF_ENABLED
:
MF_GRAYED
);
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
);
int
len
=
lstrlen
(
pszSrch
);
pszLast
--
;
pszLast
--
;
...
@@ -372,16 +372,16 @@ static LPTSTR NOTEPAD_StrRStr(LPTSTR pszSource, LPTSTR pszLast, LPTSTR pszSrch)
...
@@ -372,16 +372,16 @@ static LPTSTR NOTEPAD_StrRStr(LPTSTR pszSource, LPTSTR pszLast, LPTSTR pszSrch)
/***********************************************************************
/***********************************************************************
* The user activated the Find dialog
* The user activated the Find dialog
*/
*/
void
NOTEPAD_DoFind
(
FINDREPLACE
*
fr
)
void
NOTEPAD_DoFind
(
FINDREPLACE
W
*
fr
)
{
{
LP
T
STR
content
;
LP
W
STR
content
;
LP
T
STR
found
;
LP
W
STR
found
;
int
len
=
lstrlen
(
fr
->
lpstrFindWhat
);
int
len
=
lstrlen
(
fr
->
lpstrFindWhat
);
int
fileLen
;
int
fileLen
;
DWORD
pos
;
DWORD
pos
;
fileLen
=
GetWindowTextLength
(
Globals
.
hEdit
)
+
1
;
fileLen
=
GetWindowTextLength
(
Globals
.
hEdit
)
+
1
;
content
=
HeapAlloc
(
GetProcessHeap
(),
0
,
fileLen
*
sizeof
(
T
CHAR
));
content
=
HeapAlloc
(
GetProcessHeap
(),
0
,
fileLen
*
sizeof
(
W
CHAR
));
if
(
!
content
)
return
;
if
(
!
content
)
return
;
GetWindowText
(
Globals
.
hEdit
,
content
,
fileLen
);
GetWindowText
(
Globals
.
hEdit
,
content
,
fileLen
);
...
@@ -415,16 +415,16 @@ void NOTEPAD_DoFind(FINDREPLACE *fr)
...
@@ -415,16 +415,16 @@ void NOTEPAD_DoFind(FINDREPLACE *fr)
SendMessageW
(
Globals
.
hEdit
,
EM_SETSEL
,
found
-
content
,
found
-
content
+
len
);
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
len
=
lstrlen
(
fr
->
lpstrFindWhat
);
int
fileLen
;
int
fileLen
;
DWORD
pos
;
DWORD
pos
;
DWORD
pos_start
;
DWORD
pos_start
;
fileLen
=
GetWindowTextLength
(
Globals
.
hEdit
)
+
1
;
fileLen
=
GetWindowTextLength
(
Globals
.
hEdit
)
+
1
;
content
=
HeapAlloc
(
GetProcessHeap
(),
0
,
fileLen
*
sizeof
(
T
CHAR
));
content
=
HeapAlloc
(
GetProcessHeap
(),
0
,
fileLen
*
sizeof
(
W
CHAR
));
if
(
!
content
)
return
;
if
(
!
content
)
return
;
GetWindowText
(
Globals
.
hEdit
,
content
,
fileLen
);
GetWindowText
(
Globals
.
hEdit
,
content
,
fileLen
);
...
@@ -447,10 +447,10 @@ static void NOTEPAD_DoReplace(FINDREPLACE *fr)
...
@@ -447,10 +447,10 @@ static void NOTEPAD_DoReplace(FINDREPLACE *fr)
NOTEPAD_DoFind
(
fr
);
NOTEPAD_DoFind
(
fr
);
}
}
static
void
NOTEPAD_DoReplaceAll
(
FINDREPLACE
*
fr
)
static
void
NOTEPAD_DoReplaceAll
(
FINDREPLACE
W
*
fr
)
{
{
LP
T
STR
content
;
LP
W
STR
content
;
LP
T
STR
found
;
LP
W
STR
found
;
int
len
=
lstrlen
(
fr
->
lpstrFindWhat
);
int
len
=
lstrlen
(
fr
->
lpstrFindWhat
);
int
fileLen
;
int
fileLen
;
DWORD
pos
;
DWORD
pos
;
...
@@ -458,7 +458,7 @@ static void NOTEPAD_DoReplaceAll(FINDREPLACE *fr)
...
@@ -458,7 +458,7 @@ static void NOTEPAD_DoReplaceAll(FINDREPLACE *fr)
SendMessageW
(
Globals
.
hEdit
,
EM_SETSEL
,
0
,
0
);
SendMessageW
(
Globals
.
hEdit
,
EM_SETSEL
,
0
,
0
);
while
(
TRUE
){
while
(
TRUE
){
fileLen
=
GetWindowTextLength
(
Globals
.
hEdit
)
+
1
;
fileLen
=
GetWindowTextLength
(
Globals
.
hEdit
)
+
1
;
content
=
HeapAlloc
(
GetProcessHeap
(),
0
,
fileLen
*
sizeof
(
T
CHAR
));
content
=
HeapAlloc
(
GetProcessHeap
(),
0
,
fileLen
*
sizeof
(
W
CHAR
));
if
(
!
content
)
return
;
if
(
!
content
)
return
;
GetWindowText
(
Globals
.
hEdit
,
content
,
fileLen
);
GetWindowText
(
Globals
.
hEdit
,
content
,
fileLen
);
...
@@ -495,7 +495,7 @@ static LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
...
@@ -495,7 +495,7 @@ static LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
{
{
if
(
msg
==
aFINDMSGSTRING
)
/* not a constant so can't be used in switch */
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
)
if
(
fr
->
Flags
&
FR_DIALOGTERM
)
Globals
.
hFindReplaceDlg
=
NULL
;
Globals
.
hFindReplaceDlg
=
NULL
;
...
@@ -719,7 +719,7 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
...
@@ -719,7 +719,7 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
{
{
MSG
msg
;
MSG
msg
;
HACCEL
hAccel
;
HACCEL
hAccel
;
WNDCLASSEX
class
;
WNDCLASSEX
W
class
;
HMONITOR
monitor
;
HMONITOR
monitor
;
MONITORINFO
info
;
MONITORINFO
info
;
INT
x
,
y
;
INT
x
,
y
;
...
...
programs/notepad/main.h
View file @
3e7647ad
...
@@ -32,7 +32,7 @@ typedef struct
...
@@ -32,7 +32,7 @@ typedef struct
HWND
hFindReplaceDlg
;
HWND
hFindReplaceDlg
;
HWND
hEdit
;
HWND
hEdit
;
HFONT
hFont
;
/* Font used by the edit control */
HFONT
hFont
;
/* Font used by the edit control */
LOGFONT
lfFont
;
LOGFONT
W
lfFont
;
BOOL
bWrapLongLines
;
BOOL
bWrapLongLines
;
WCHAR
szFindText
[
MAX_PATH
];
WCHAR
szFindText
[
MAX_PATH
];
WCHAR
szReplaceText
[
MAX_PATH
];
WCHAR
szReplaceText
[
MAX_PATH
];
...
@@ -46,8 +46,8 @@ typedef struct
...
@@ -46,8 +46,8 @@ typedef struct
WCHAR
szHeader
[
MAX_PATH
];
WCHAR
szHeader
[
MAX_PATH
];
WCHAR
szFooter
[
MAX_PATH
];
WCHAR
szFooter
[
MAX_PATH
];
FINDREPLACE
find
;
FINDREPLACE
W
find
;
FINDREPLACE
lastFind
;
FINDREPLACE
W
lastFind
;
HGLOBAL
hDevMode
;
/* printer mode */
HGLOBAL
hDevMode
;
/* printer mode */
HGLOBAL
hDevNames
;
/* printer names */
HGLOBAL
hDevNames
;
/* printer names */
}
NOTEPAD_GLOBALS
;
}
NOTEPAD_GLOBALS
;
...
@@ -55,5 +55,5 @@ typedef struct
...
@@ -55,5 +55,5 @@ typedef struct
extern
NOTEPAD_GLOBALS
Globals
;
extern
NOTEPAD_GLOBALS
Globals
;
VOID
SetFileName
(
LPCWSTR
szFileName
);
VOID
SetFileName
(
LPCWSTR
szFileName
);
void
NOTEPAD_DoFind
(
FINDREPLACE
*
fr
);
void
NOTEPAD_DoFind
(
FINDREPLACE
W
*
fr
);
DWORD
get_dpi
(
void
);
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