mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 12:54:13 +00:00
notepad: Use the explicit W-form for some string functions.
This commit is contained in:
parent
717ac52dda
commit
1a60da74f9
2 changed files with 39 additions and 39 deletions
|
@ -68,13 +68,13 @@ static void UpdateWindowCaption(void)
|
||||||
static const WCHAR hyphenW[] = { ' ','-',' ',0 };
|
static const WCHAR hyphenW[] = { ' ','-',' ',0 };
|
||||||
|
|
||||||
if (Globals.szFileTitle[0] != '\0')
|
if (Globals.szFileTitle[0] != '\0')
|
||||||
lstrcpy(szCaption, Globals.szFileTitle);
|
lstrcpyW(szCaption, Globals.szFileTitle);
|
||||||
else
|
else
|
||||||
LoadString(Globals.hInstance, STRING_UNTITLED, szCaption, SIZEOF(szCaption));
|
LoadString(Globals.hInstance, STRING_UNTITLED, szCaption, SIZEOF(szCaption));
|
||||||
|
|
||||||
LoadString(Globals.hInstance, STRING_NOTEPAD, szNotepad, SIZEOF(szNotepad));
|
LoadString(Globals.hInstance, STRING_NOTEPAD, szNotepad, SIZEOF(szNotepad));
|
||||||
lstrcat(szCaption, hyphenW);
|
lstrcatW(szCaption, hyphenW);
|
||||||
lstrcat(szCaption, szNotepad);
|
lstrcatW(szCaption, szNotepad);
|
||||||
|
|
||||||
SetWindowText(Globals.hMainWnd, szCaption);
|
SetWindowText(Globals.hMainWnd, szCaption);
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ int DIALOG_StringMsgBox(HWND hParent, int formatId, LPCWSTR szString, DWORD dwFl
|
||||||
|
|
||||||
/* Load and format szMessage */
|
/* Load and format szMessage */
|
||||||
LoadString(Globals.hInstance, formatId, szResource, SIZEOF(szResource));
|
LoadString(Globals.hInstance, formatId, szResource, SIZEOF(szResource));
|
||||||
wnsprintf(szMessage, SIZEOF(szMessage), szResource, szString);
|
wnsprintfW(szMessage, SIZEOF(szMessage), szResource, szString);
|
||||||
|
|
||||||
/* Load szCaption */
|
/* Load szCaption */
|
||||||
if ((dwFlags & MB_ICONMASK) == MB_ICONEXCLAMATION)
|
if ((dwFlags & MB_ICONMASK) == MB_ICONEXCLAMATION)
|
||||||
|
@ -259,7 +259,7 @@ void DoOpenFile(LPCWSTR szFileName)
|
||||||
SetFocus(Globals.hEdit);
|
SetFocus(Globals.hEdit);
|
||||||
|
|
||||||
/* If the file starts with .LOG, add a time/date at the end and set cursor after */
|
/* If the file starts with .LOG, add a time/date at the end and set cursor after */
|
||||||
if (GetWindowTextW(Globals.hEdit, log, sizeof(log)/sizeof(log[0])) && !lstrcmp(log, dotlog))
|
if (GetWindowTextW(Globals.hEdit, log, sizeof(log)/sizeof(log[0])) && !lstrcmpW(log, dotlog))
|
||||||
{
|
{
|
||||||
static const WCHAR lfW[] = { '\r','\n',0 };
|
static const WCHAR lfW[] = { '\r','\n',0 };
|
||||||
SendMessageW(Globals.hEdit, EM_SETSEL, GetWindowTextLength(Globals.hEdit), -1);
|
SendMessageW(Globals.hEdit, EM_SETSEL, GetWindowTextLength(Globals.hEdit), -1);
|
||||||
|
@ -295,7 +295,7 @@ VOID DIALOG_FileOpen(VOID)
|
||||||
ZeroMemory(&openfilename, sizeof(openfilename));
|
ZeroMemory(&openfilename, sizeof(openfilename));
|
||||||
|
|
||||||
GetCurrentDirectory(SIZEOF(szDir), szDir);
|
GetCurrentDirectory(SIZEOF(szDir), szDir);
|
||||||
lstrcpy(szPath, txt_files);
|
lstrcpyW(szPath, txt_files);
|
||||||
|
|
||||||
openfilename.lStructSize = sizeof(openfilename);
|
openfilename.lStructSize = sizeof(openfilename);
|
||||||
openfilename.hwndOwner = Globals.hMainWnd;
|
openfilename.hwndOwner = Globals.hMainWnd;
|
||||||
|
@ -334,7 +334,7 @@ BOOL DIALOG_FileSaveAs(VOID)
|
||||||
ZeroMemory(&saveas, sizeof(saveas));
|
ZeroMemory(&saveas, sizeof(saveas));
|
||||||
|
|
||||||
GetCurrentDirectory(SIZEOF(szDir), szDir);
|
GetCurrentDirectory(SIZEOF(szDir), szDir);
|
||||||
lstrcpy(szPath, txt_files);
|
lstrcpyW(szPath, txt_files);
|
||||||
|
|
||||||
saveas.lStructSize = sizeof(OPENFILENAMEW);
|
saveas.lStructSize = sizeof(OPENFILENAMEW);
|
||||||
saveas.hwndOwner = Globals.hMainWnd;
|
saveas.hwndOwner = Globals.hMainWnd;
|
||||||
|
@ -370,11 +370,11 @@ static int notepad_print_header(HDC hdc, RECT *rc, BOOL dopage, BOOL header, int
|
||||||
if (*text)
|
if (*text)
|
||||||
{
|
{
|
||||||
/* Write the header or footer */
|
/* Write the header or footer */
|
||||||
GetTextExtentPoint32(hdc, text, lstrlen(text), &szMetric);
|
GetTextExtentPoint32W(hdc, text, lstrlenW(text), &szMetric);
|
||||||
if (dopage)
|
if (dopage)
|
||||||
ExtTextOut(hdc, (rc->left + rc->right - szMetric.cx) / 2,
|
ExtTextOut(hdc, (rc->left + rc->right - szMetric.cx) / 2,
|
||||||
header ? rc->top : rc->bottom - szMetric.cy,
|
header ? rc->top : rc->bottom - szMetric.cy,
|
||||||
ETO_CLIPPED, rc, text, lstrlen(text), NULL);
|
ETO_CLIPPED, rc, text, lstrlenW(text), NULL);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -72,7 +72,7 @@ static const WCHAR value_szFooter[] = {'s','z','T','r','a','i','l','e','
|
||||||
*/
|
*/
|
||||||
VOID SetFileName(LPCWSTR szFileName)
|
VOID SetFileName(LPCWSTR szFileName)
|
||||||
{
|
{
|
||||||
lstrcpy(Globals.szFileName, szFileName);
|
lstrcpyW(Globals.szFileName, szFileName);
|
||||||
Globals.szFileTitle[0] = 0;
|
Globals.szFileTitle[0] = 0;
|
||||||
GetFileTitle(szFileName, Globals.szFileTitle, sizeof(Globals.szFileTitle));
|
GetFileTitle(szFileName, Globals.szFileTitle, sizeof(Globals.szFileTitle));
|
||||||
}
|
}
|
||||||
|
@ -153,13 +153,13 @@ static VOID NOTEPAD_SaveSettingToRegistry(void)
|
||||||
RegSetValueEx(hkey, value_iPointSize, 0, REG_DWORD, (LPBYTE)&data, sizeof(DWORD));
|
RegSetValueEx(hkey, value_iPointSize, 0, REG_DWORD, (LPBYTE)&data, sizeof(DWORD));
|
||||||
|
|
||||||
RegSetValueEx(hkey, value_lfFaceName, 0, REG_SZ, (LPBYTE)&Globals.lfFont.lfFaceName,
|
RegSetValueEx(hkey, value_lfFaceName, 0, REG_SZ, (LPBYTE)&Globals.lfFont.lfFaceName,
|
||||||
lstrlen(Globals.lfFont.lfFaceName) * sizeof(Globals.lfFont.lfFaceName[0]));
|
lstrlenW(Globals.lfFont.lfFaceName) * sizeof(Globals.lfFont.lfFaceName[0]));
|
||||||
|
|
||||||
RegSetValueEx(hkey, value_szHeader, 0, REG_SZ, (LPBYTE)&Globals.szHeader,
|
RegSetValueEx(hkey, value_szHeader, 0, REG_SZ, (LPBYTE)&Globals.szHeader,
|
||||||
lstrlen(Globals.szHeader) * sizeof(Globals.szHeader[0]));
|
lstrlenW(Globals.szHeader) * sizeof(Globals.szHeader[0]));
|
||||||
|
|
||||||
RegSetValueEx(hkey, value_szFooter, 0, REG_SZ, (LPBYTE)&Globals.szFooter,
|
RegSetValueEx(hkey, value_szFooter, 0, REG_SZ, (LPBYTE)&Globals.szFooter,
|
||||||
lstrlen(Globals.szFooter) * sizeof(Globals.szFooter[0]));
|
lstrlenW(Globals.szFooter) * sizeof(Globals.szFooter[0]));
|
||||||
|
|
||||||
RegCloseKey(hkey);
|
RegCloseKey(hkey);
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ static VOID NOTEPAD_LoadSettingFromRegistry(void)
|
||||||
Globals.lfFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
Globals.lfFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
||||||
Globals.lfFont.lfQuality = DEFAULT_QUALITY;
|
Globals.lfFont.lfQuality = DEFAULT_QUALITY;
|
||||||
Globals.lfFont.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
|
Globals.lfFont.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
|
||||||
lstrcpy(Globals.lfFont.lfFaceName, systemW);
|
lstrcpyW(Globals.lfFont.lfFaceName, systemW);
|
||||||
|
|
||||||
LoadString(Globals.hInstance, STRING_PAGESETUP_HEADERVALUE, Globals.szHeader,
|
LoadString(Globals.hInstance, STRING_PAGESETUP_HEADERVALUE, Globals.szHeader,
|
||||||
sizeof(Globals.szHeader) / sizeof(Globals.szHeader[0]));
|
sizeof(Globals.szHeader) / sizeof(Globals.szHeader[0]));
|
||||||
|
@ -250,17 +250,17 @@ static VOID NOTEPAD_LoadSettingFromRegistry(void)
|
||||||
size = sizeof(Globals.lfFont.lfFaceName);
|
size = sizeof(Globals.lfFont.lfFaceName);
|
||||||
if(RegQueryValueEx(hkey, value_lfFaceName, 0, &type, (LPBYTE)&data_helper, &size) == ERROR_SUCCESS)
|
if(RegQueryValueEx(hkey, value_lfFaceName, 0, &type, (LPBYTE)&data_helper, &size) == ERROR_SUCCESS)
|
||||||
if(type == REG_SZ)
|
if(type == REG_SZ)
|
||||||
lstrcpy(Globals.lfFont.lfFaceName, data_helper);
|
lstrcpyW(Globals.lfFont.lfFaceName, data_helper);
|
||||||
|
|
||||||
size = sizeof(Globals.szHeader);
|
size = sizeof(Globals.szHeader);
|
||||||
if(RegQueryValueEx(hkey, value_szHeader, 0, &type, (LPBYTE)&data_helper, &size) == ERROR_SUCCESS)
|
if(RegQueryValueEx(hkey, value_szHeader, 0, &type, (LPBYTE)&data_helper, &size) == ERROR_SUCCESS)
|
||||||
if(type == REG_SZ)
|
if(type == REG_SZ)
|
||||||
lstrcpy(Globals.szHeader, data_helper);
|
lstrcpyW(Globals.szHeader, data_helper);
|
||||||
|
|
||||||
size = sizeof(Globals.szFooter);
|
size = sizeof(Globals.szFooter);
|
||||||
if(RegQueryValueEx(hkey, value_szFooter, 0, &type, (LPBYTE)&data_helper, &size) == ERROR_SUCCESS)
|
if(RegQueryValueEx(hkey, value_szFooter, 0, &type, (LPBYTE)&data_helper, &size) == ERROR_SUCCESS)
|
||||||
if(type == REG_SZ)
|
if(type == REG_SZ)
|
||||||
lstrcpy(Globals.szFooter, data_helper);
|
lstrcpyW(Globals.szFooter, data_helper);
|
||||||
RegCloseKey(hkey);
|
RegCloseKey(hkey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,13 +320,13 @@ static VOID NOTEPAD_InitData(VOID)
|
||||||
static const WCHAR all_files[] = { '*','.','*',0 };
|
static const WCHAR all_files[] = { '*','.','*',0 };
|
||||||
|
|
||||||
LoadString(Globals.hInstance, STRING_TEXT_FILES_TXT, p, MAX_STRING_LEN);
|
LoadString(Globals.hInstance, STRING_TEXT_FILES_TXT, p, MAX_STRING_LEN);
|
||||||
p += lstrlen(p) + 1;
|
p += lstrlenW(p) + 1;
|
||||||
lstrcpy(p, txt_files);
|
lstrcpyW(p, txt_files);
|
||||||
p += lstrlen(p) + 1;
|
p += lstrlenW(p) + 1;
|
||||||
LoadString(Globals.hInstance, STRING_ALL_FILES, p, MAX_STRING_LEN);
|
LoadString(Globals.hInstance, STRING_ALL_FILES, p, MAX_STRING_LEN);
|
||||||
p += lstrlen(p) + 1;
|
p += lstrlenW(p) + 1;
|
||||||
lstrcpy(p, all_files);
|
lstrcpyW(p, all_files);
|
||||||
p += lstrlen(p) + 1;
|
p += lstrlenW(p) + 1;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
Globals.hDevMode = NULL;
|
Globals.hDevMode = NULL;
|
||||||
Globals.hDevNames = NULL;
|
Globals.hDevNames = NULL;
|
||||||
|
@ -358,11 +358,11 @@ static VOID NOTEPAD_InitMenuPopup(HMENU menu, int index)
|
||||||
|
|
||||||
static LPWSTR NOTEPAD_StrRStr(LPWSTR pszSource, LPWSTR pszLast, LPWSTR pszSrch)
|
static LPWSTR NOTEPAD_StrRStr(LPWSTR pszSource, LPWSTR pszLast, LPWSTR pszSrch)
|
||||||
{
|
{
|
||||||
int len = lstrlen(pszSrch);
|
int len = lstrlenW(pszSrch);
|
||||||
pszLast--;
|
pszLast--;
|
||||||
while (pszLast >= pszSource)
|
while (pszLast >= pszSource)
|
||||||
{
|
{
|
||||||
if (StrCmpN(pszLast, pszSrch, len) == 0)
|
if (StrCmpNW(pszLast, pszSrch, len) == 0)
|
||||||
return pszLast;
|
return pszLast;
|
||||||
pszLast--;
|
pszLast--;
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ void NOTEPAD_DoFind(FINDREPLACEW *fr)
|
||||||
{
|
{
|
||||||
LPWSTR content;
|
LPWSTR content;
|
||||||
LPWSTR found;
|
LPWSTR found;
|
||||||
int len = lstrlen(fr->lpstrFindWhat);
|
int len = lstrlenW(fr->lpstrFindWhat);
|
||||||
int fileLen;
|
int fileLen;
|
||||||
DWORD pos;
|
DWORD pos;
|
||||||
|
|
||||||
|
@ -389,16 +389,16 @@ void NOTEPAD_DoFind(FINDREPLACEW *fr)
|
||||||
switch (fr->Flags & (FR_DOWN|FR_MATCHCASE))
|
switch (fr->Flags & (FR_DOWN|FR_MATCHCASE))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
found = StrRStrI(content, content+pos-len, fr->lpstrFindWhat);
|
found = StrRStrIW(content, content+pos-len, fr->lpstrFindWhat);
|
||||||
break;
|
break;
|
||||||
case FR_DOWN:
|
case FR_DOWN:
|
||||||
found = StrStrI(content+pos, fr->lpstrFindWhat);
|
found = StrStrIW(content+pos, fr->lpstrFindWhat);
|
||||||
break;
|
break;
|
||||||
case FR_MATCHCASE:
|
case FR_MATCHCASE:
|
||||||
found = NOTEPAD_StrRStr(content, content+pos-len, fr->lpstrFindWhat);
|
found = NOTEPAD_StrRStr(content, content+pos-len, fr->lpstrFindWhat);
|
||||||
break;
|
break;
|
||||||
case FR_DOWN|FR_MATCHCASE:
|
case FR_DOWN|FR_MATCHCASE:
|
||||||
found = StrStr(content+pos, fr->lpstrFindWhat);
|
found = StrStrW(content+pos, fr->lpstrFindWhat);
|
||||||
break;
|
break;
|
||||||
default: /* shouldn't happen */
|
default: /* shouldn't happen */
|
||||||
return;
|
return;
|
||||||
|
@ -418,7 +418,7 @@ void NOTEPAD_DoFind(FINDREPLACEW *fr)
|
||||||
static void NOTEPAD_DoReplace(FINDREPLACEW *fr)
|
static void NOTEPAD_DoReplace(FINDREPLACEW *fr)
|
||||||
{
|
{
|
||||||
LPWSTR content;
|
LPWSTR content;
|
||||||
int len = lstrlen(fr->lpstrFindWhat);
|
int len = lstrlenW(fr->lpstrFindWhat);
|
||||||
int fileLen;
|
int fileLen;
|
||||||
DWORD pos;
|
DWORD pos;
|
||||||
DWORD pos_start;
|
DWORD pos_start;
|
||||||
|
@ -432,11 +432,11 @@ static void NOTEPAD_DoReplace(FINDREPLACEW *fr)
|
||||||
switch (fr->Flags & (FR_DOWN|FR_MATCHCASE))
|
switch (fr->Flags & (FR_DOWN|FR_MATCHCASE))
|
||||||
{
|
{
|
||||||
case FR_DOWN:
|
case FR_DOWN:
|
||||||
if ( pos-pos_start == len && StrCmpNI(fr->lpstrFindWhat, content+pos_start, len) == 0)
|
if ( pos-pos_start == len && StrCmpNIW(fr->lpstrFindWhat, content+pos_start, len) == 0)
|
||||||
SendMessageW(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)fr->lpstrReplaceWith);
|
SendMessageW(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)fr->lpstrReplaceWith);
|
||||||
break;
|
break;
|
||||||
case FR_DOWN|FR_MATCHCASE:
|
case FR_DOWN|FR_MATCHCASE:
|
||||||
if ( pos-pos_start == len && StrCmpN(fr->lpstrFindWhat, content+pos_start, len) == 0)
|
if ( pos-pos_start == len && StrCmpNW(fr->lpstrFindWhat, content+pos_start, len) == 0)
|
||||||
SendMessageW(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)fr->lpstrReplaceWith);
|
SendMessageW(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)fr->lpstrReplaceWith);
|
||||||
break;
|
break;
|
||||||
default: /* shouldn't happen */
|
default: /* shouldn't happen */
|
||||||
|
@ -451,7 +451,7 @@ static void NOTEPAD_DoReplaceAll(FINDREPLACEW *fr)
|
||||||
{
|
{
|
||||||
LPWSTR content;
|
LPWSTR content;
|
||||||
LPWSTR found;
|
LPWSTR found;
|
||||||
int len = lstrlen(fr->lpstrFindWhat);
|
int len = lstrlenW(fr->lpstrFindWhat);
|
||||||
int fileLen;
|
int fileLen;
|
||||||
DWORD pos;
|
DWORD pos;
|
||||||
|
|
||||||
|
@ -466,10 +466,10 @@ static void NOTEPAD_DoReplaceAll(FINDREPLACEW *fr)
|
||||||
switch (fr->Flags & (FR_DOWN|FR_MATCHCASE))
|
switch (fr->Flags & (FR_DOWN|FR_MATCHCASE))
|
||||||
{
|
{
|
||||||
case FR_DOWN:
|
case FR_DOWN:
|
||||||
found = StrStrI(content+pos, fr->lpstrFindWhat);
|
found = StrStrIW(content+pos, fr->lpstrFindWhat);
|
||||||
break;
|
break;
|
||||||
case FR_DOWN|FR_MATCHCASE:
|
case FR_DOWN|FR_MATCHCASE:
|
||||||
found = StrStr(content+pos, fr->lpstrFindWhat);
|
found = StrStrW(content+pos, fr->lpstrFindWhat);
|
||||||
break;
|
break;
|
||||||
default: /* shouldn't happen */
|
default: /* shouldn't happen */
|
||||||
return;
|
return;
|
||||||
|
@ -602,7 +602,7 @@ static int AlertFileDoesNotExist(LPCWSTR szFileName)
|
||||||
WCHAR szResource[MAX_STRING_LEN];
|
WCHAR szResource[MAX_STRING_LEN];
|
||||||
|
|
||||||
LoadString(Globals.hInstance, STRING_DOESNOTEXIST, szResource, SIZEOF(szResource));
|
LoadString(Globals.hInstance, STRING_DOESNOTEXIST, szResource, SIZEOF(szResource));
|
||||||
wsprintf(szMessage, szResource, szFileName);
|
wsprintfW(szMessage, szResource, szFileName);
|
||||||
|
|
||||||
LoadString(Globals.hInstance, STRING_ERROR, szResource, SIZEOF(szResource));
|
LoadString(Globals.hInstance, STRING_ERROR, szResource, SIZEOF(szResource));
|
||||||
|
|
||||||
|
@ -683,8 +683,8 @@ static void HandleCommandLine(LPWSTR cmdline)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lstrcpyn(buf, cmdline, MAX_PATH - lstrlen(txtW) - 1);
|
lstrcpynW(buf, cmdline, MAX_PATH - lstrlenW(txtW) - 1);
|
||||||
lstrcat(buf, txtW);
|
lstrcatW(buf, txtW);
|
||||||
file_name = buf;
|
file_name = buf;
|
||||||
file_exists = FileExists(buf);
|
file_exists = FileExists(buf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue