Alexandre Julliard : Replace some instances of LoadStringA by LoadStringW.
Alexandre Julliard
julliard at winehq.org
Mon Mar 3 14:03:32 CST 2008
Module: wine
Branch: master
Commit: 4fd668d01088e82b4639ee2f4f088e0b718e6a88
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4fd668d01088e82b4639ee2f4f088e0b718e6a88
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Mar 3 20:07:37 2008 +0100
Replace some instances of LoadStringA by LoadStringW.
---
dlls/comdlg32/printdlg.c | 21 +++++++++------------
dlls/oledlg/insobjdlg.c | 34 +++++++++++++++++-----------------
dlls/sane.ds/ui.c | 22 +++++++++++-----------
3 files changed, 37 insertions(+), 40 deletions(-)
diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c
index 73588b5..f2d67b5 100644
--- a/dlls/comdlg32/printdlg.c
+++ b/dlls/comdlg32/printdlg.c
@@ -308,15 +308,12 @@ static BOOL PRINTDLG_UpdatePrintDlgA(HWND hDlg,
nToPage = GetDlgItemInt(hDlg, edt2, NULL, FALSE);
if (nFromPage < lppd->nMinPage || nFromPage > lppd->nMaxPage ||
nToPage < lppd->nMinPage || nToPage > lppd->nMaxPage) {
- char resourcestr[256];
- char resultstr[256];
- LoadStringA(COMDLG32_hInstance, PD32_INVALID_PAGE_RANGE,
- resourcestr, 255);
- sprintf(resultstr,resourcestr, lppd->nMinPage, lppd->nMaxPage);
- LoadStringA(COMDLG32_hInstance, PD32_PRINT_TITLE,
- resourcestr, 255);
- MessageBoxA(hDlg, resultstr, resourcestr,
- MB_OK | MB_ICONWARNING);
+ WCHAR resourcestr[256];
+ WCHAR resultstr[256];
+ LoadStringW(COMDLG32_hInstance, PD32_INVALID_PAGE_RANGE, resourcestr, 255);
+ wsprintfW(resultstr,resourcestr, lppd->nMinPage, lppd->nMaxPage);
+ LoadStringW(COMDLG32_hInstance, PD32_PRINT_TITLE, resourcestr, 255);
+ MessageBoxW(hDlg, resultstr, resourcestr, MB_OK | MB_ICONWARNING);
return FALSE;
}
lppd->nFromPage = nFromPage;
@@ -3569,9 +3566,9 @@ BOOL WINAPI PageSetupDlgA(LPPAGESETUPDLGA setupdlg) {
bRet = PrintDlgA(&pdlg);
if (!bRet){
if (!(setupdlg->Flags & PSD_NOWARNING)) {
- char errstr[256];
- LoadStringA(COMDLG32_hInstance, PD32_NO_DEFAULT_PRINTER, errstr, 255);
- MessageBoxA(setupdlg->hwndOwner, errstr, 0, MB_OK | MB_ICONERROR);
+ WCHAR errstr[256];
+ LoadStringW(COMDLG32_hInstance, PD32_NO_DEFAULT_PRINTER, errstr, 255);
+ MessageBoxW(setupdlg->hwndOwner, errstr, 0, MB_OK | MB_ICONERROR);
}
return FALSE;
}
diff --git a/dlls/oledlg/insobjdlg.c b/dlls/oledlg/insobjdlg.c
index 159b002..4578bbe 100644
--- a/dlls/oledlg/insobjdlg.c
+++ b/dlls/oledlg/insobjdlg.c
@@ -305,7 +305,7 @@ static void UIINSERTOBJECTDLG_SelectCreateNew(InsertObjectDlgInfo* pdlgInfo)
*/
static void UIINSERTOBJECTDLG_SelectCreateFromFile(InsertObjectDlgInfo* pdlgInfo)
{
- char resstr[MAX_PATH];
+ WCHAR resstr[MAX_PATH];
ShowWindow(pdlgInfo->hwndAddCtrlBTN, SW_HIDE);
ShowWindow(pdlgInfo->hwndObjTypeLBL, SW_HIDE);
@@ -318,10 +318,10 @@ static void UIINSERTOBJECTDLG_SelectCreateFromFile(InsertObjectDlgInfo* pdlgInfo
ShowWindow(pdlgInfo->hwndFileTB, SW_SHOW);
ShowWindow(pdlgInfo->hwndBrowseBTN, SW_SHOW);
- SendMessageA(pdlgInfo->hwndCreateFromFileCB, BM_SETCHECK, BST_CHECKED, 0);
+ SendMessageW(pdlgInfo->hwndCreateFromFileCB, BM_SETCHECK, BST_CHECKED, 0);
- if (LoadStringA(OLEDLG_hInstance, IDS_RESULTFILEOBJDESC, resstr, MAX_PATH))
- SendMessageA(pdlgInfo->hwndResultDesc, WM_SETTEXT, 0, (LPARAM)resstr);
+ if (LoadStringW(OLEDLG_hInstance, IDS_RESULTFILEOBJDESC, resstr, MAX_PATH))
+ SendMessageW(pdlgInfo->hwndResultDesc, WM_SETTEXT, 0, (LPARAM)resstr);
}
@@ -418,20 +418,20 @@ static void UIINSERTOBJECTDLG_FreeObjectTypes(InsertObjectDlgInfo* pdlgInfo)
static void UIINSERTOBJECTDLG_SelChange(InsertObjectDlgInfo* pdlgInfo)
{
INT index;
- CHAR objname[MAX_PATH];
- CHAR objdesc[MAX_PATH];
- CHAR resstr[MAX_PATH];
+ WCHAR objname[MAX_PATH];
+ WCHAR objdesc[MAX_PATH];
+ WCHAR resstr[MAX_PATH];
TRACE("\n");
- if (LoadStringA(OLEDLG_hInstance, IDS_RESULTOBJDESC, resstr, MAX_PATH) &&
- ((index = SendMessageA(pdlgInfo->hwndObjTypeLB, LB_GETCURSEL, 0, 0)) >= 0) &&
- SendMessageA(pdlgInfo->hwndObjTypeLB, LB_GETTEXT, (WPARAM)index, (LPARAM)objname))
- sprintf(objdesc, resstr, objname);
+ if (LoadStringW(OLEDLG_hInstance, IDS_RESULTOBJDESC, resstr, MAX_PATH) &&
+ ((index = SendMessageW(pdlgInfo->hwndObjTypeLB, LB_GETCURSEL, 0, 0)) >= 0) &&
+ SendMessageW(pdlgInfo->hwndObjTypeLB, LB_GETTEXT, (WPARAM)index, (LPARAM)objname))
+ wsprintfW(objdesc, resstr, objname);
else
objdesc[0] = 0;
- SendMessageA(pdlgInfo->hwndResultDesc, WM_SETTEXT, 0, (LPARAM)objdesc);
+ SendMessageW(pdlgInfo->hwndResultDesc, WM_SETTEXT, 0, (LPARAM)objdesc);
}
@@ -615,13 +615,13 @@ static void UIINSERTOBJECTDLG_AddControl(InsertObjectDlgInfo* pdlgInfo)
if (!bValid)
{
- char title[32];
- char msg[256];
+ WCHAR title[32];
+ WCHAR msg[256];
- LoadStringA(OLEDLG_hInstance, IDS_NOTOLEMODCAPTION, title, 32);
- LoadStringA(OLEDLG_hInstance, IDS_NOTOLEMOD, msg, 256);
+ LoadStringW(OLEDLG_hInstance, IDS_NOTOLEMODCAPTION, title, 32);
+ LoadStringW(OLEDLG_hInstance, IDS_NOTOLEMOD, msg, 256);
- MessageBoxA(pdlgInfo->hwndSelf, msg, title, MB_ICONEXCLAMATION);
+ MessageBoxW(pdlgInfo->hwndSelf, msg, title, MB_ICONEXCLAMATION);
}
}
}
diff --git a/dlls/sane.ds/ui.c b/dlls/sane.ds/ui.c
index 6763240..83006c5 100644
--- a/dlls/sane.ds/ui.c
+++ b/dlls/sane.ds/ui.c
@@ -608,14 +608,13 @@ BOOL DoScannerUI(void)
static void UpdateRelevantEdit(HWND hwnd, const SANE_Option_Descriptor *opt,
int index, int position)
{
- CHAR buffer[244];
+ WCHAR buffer[244];
HWND edit_w;
- CHAR unit[20];
-
- LoadStringA(SANE_instance, opt->unit, unit,20);
+ int len;
if (opt->type == SANE_TYPE_INT)
{
+ static const WCHAR formatW[] = {'%','i',0};
INT si;
if (opt->constraint.range->quant)
@@ -623,11 +622,11 @@ static void UpdateRelevantEdit(HWND hwnd, const SANE_Option_Descriptor *opt,
else
si = position;
- sprintf(buffer,"%i %s",si,unit);
-
+ len = wsprintfW( buffer, formatW, si );
}
else if (opt->type == SANE_TYPE_FIXED)
{
+ static const WCHAR formatW[] = {'%','f',0};
double s_quant, dd;
s_quant = SANE_UNFIX(opt->constraint.range->quant);
@@ -637,14 +636,15 @@ static void UpdateRelevantEdit(HWND hwnd, const SANE_Option_Descriptor *opt,
else
dd = position * 0.01;
- sprintf(buffer,"%f %s",dd,unit);
+ len = wsprintfW( buffer, formatW, dd );
}
- else
- buffer[0] = 0;
+ else return;
+
+ buffer[len++] = ' ';
+ LoadStringW( SANE_instance, opt->unit, buffer + len, sizeof(buffer)/sizeof(WCHAR) - len );
edit_w = GetDlgItem(hwnd,index+ID_BASE+ID_EDIT_BASE);
- if (edit_w && buffer[0])
- SetWindowTextA(edit_w,buffer);
+ if (edit_w) SetWindowTextW(edit_w,buffer);
}
More information about the wine-cvs
mailing list