Commit 3e7647ad authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

notepad: Use the explicit W-form of the types.

parent 4bc8e87a
......@@ -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_DATAW entry;
HANDLE hFile;
hFile = FindFirstFile(szFilename, &entry);
......@@ -287,7 +286,7 @@ VOID DIALOG_FileNew(VOID)
VOID DIALOG_FileOpen(VOID)
{
OPENFILENAME openfilename;
OPENFILENAMEW 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;
OPENFILENAMEW 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(OPENFILENAMEW);
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;
TEXTMETRICW 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;
DOCINFOW di;
PRINTDLGW printer;
int page, dopage, copy;
LOGFONT lfFont;
LOGFONTW 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(DOCINFOW);
di.lpszDocName = Globals.szFileTitle;
di.lpszOutput = NULL;
di.lpszDatatype = NULL;
......@@ -594,7 +593,7 @@ VOID DIALOG_FilePrint(VOID)
VOID DIALOG_FilePrinterSetup(VOID)
{
PRINTDLG printer;
PRINTDLGW 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;
CHOOSEFONTW cf;
LOGFONTW lf=Globals.lfFont;
ZeroMemory( &cf, sizeof(cf) );
cf.lStructSize=sizeof(cf);
......
......@@ -356,7 +356,7 @@ static VOID NOTEPAD_InitMenuPopup(HMENU menu, int index)
GetWindowTextLength(Globals.hEdit) ? MF_ENABLED : MF_GRAYED);
}
static LPTSTR NOTEPAD_StrRStr(LPTSTR pszSource, LPTSTR pszLast, LPTSTR pszSrch)
static LPWSTR NOTEPAD_StrRStr(LPWSTR pszSource, LPWSTR pszLast, LPWSTR 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(FINDREPLACEW *fr)
{
LPTSTR content;
LPTSTR found;
LPWSTR content;
LPWSTR found;
int len = lstrlen(fr->lpstrFindWhat);
int fileLen;
DWORD pos;
fileLen = GetWindowTextLength(Globals.hEdit) + 1;
content = HeapAlloc(GetProcessHeap(), 0, fileLen * sizeof(TCHAR));
content = HeapAlloc(GetProcessHeap(), 0, fileLen * sizeof(WCHAR));
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(FINDREPLACEW *fr)
{
LPTSTR content;
LPWSTR content;
int len = lstrlen(fr->lpstrFindWhat);
int fileLen;
DWORD pos;
DWORD pos_start;
fileLen = GetWindowTextLength(Globals.hEdit) + 1;
content = HeapAlloc(GetProcessHeap(), 0, fileLen * sizeof(TCHAR));
content = HeapAlloc(GetProcessHeap(), 0, fileLen * sizeof(WCHAR));
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(FINDREPLACEW *fr)
{
LPTSTR content;
LPTSTR found;
LPWSTR content;
LPWSTR 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(TCHAR));
content = HeapAlloc(GetProcessHeap(), 0, fileLen * sizeof(WCHAR));
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;
FINDREPLACEW *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;
WNDCLASSEXW class;
HMONITOR monitor;
MONITORINFO info;
INT x, y;
......
......@@ -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 */
LOGFONTW 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;
FINDREPLACEW find;
FINDREPLACEW 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(FINDREPLACEW *fr);
DWORD get_dpi(void);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment