wineconsole: Fix a string resource so its format placeholders can be reordered.

Francois Gouget fgouget at free.fr
Thu Oct 20 07:48:14 CDT 2011


Also the arguments to IDS_FNT_DISPLAY are regular unsigned ints, not longs.
---
 programs/wineconsole/dialog.c       |    6 +++++-
 programs/wineconsole/wineconsole.rc |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/programs/wineconsole/dialog.c b/programs/wineconsole/dialog.c
index cb3ff50..da7487a 100644
--- a/programs/wineconsole/dialog.c
+++ b/programs/wineconsole/dialog.c
@@ -415,6 +415,7 @@ static BOOL  select_font(struct dialog_info* di)
     int		font_idx, size_idx;
     WCHAR	buf[256];
     WCHAR	fmt[128];
+    DWORD_PTR   args[2];
     LOGFONTW    lf;
     HFONT       hFont, hOldFont;
     struct config_data config;
@@ -439,7 +440,10 @@ static BOOL  select_font(struct dialog_info* di)
     if (hOldFont) DeleteObject(hOldFont);
 
     LoadStringW(GetModuleHandleW(NULL), IDS_FNT_DISPLAY, fmt, sizeof(fmt) / sizeof(fmt[0]));
-    wsprintfW(buf, fmt, config.cell_width, config.cell_height);
+    args[0] = config.cell_width;
+    args[1] = config.cell_height;
+    FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
+                   fmt, 0, 0, buf, sizeof(buf)/sizeof(*buf), (va_list*)args);
 
     SendDlgItemMessageW(di->hDlg, IDC_FNT_FONT_INFO, WM_SETTEXT, 0, (LPARAM)buf);
 
diff --git a/programs/wineconsole/wineconsole.rc b/programs/wineconsole/wineconsole.rc
index 6eaabef..1ea9f3e 100644
--- a/programs/wineconsole/wineconsole.rc
+++ b/programs/wineconsole/wineconsole.rc
@@ -31,7 +31,7 @@ IDS_PASTE,		"&Paste"
 IDS_SELECTALL,		"&Select all"
 IDS_SCROLL,		"Sc&roll"
 IDS_SEARCH,		"S&earch"
-IDS_FNT_DISPLAY,	"Each character is %ld pixels wide on %ld pixels high"
+IDS_FNT_DISPLAY,	"Each character is %1!u! pixels wide on %2!u! pixels high"
 IDS_FNT_PREVIEW,	"This is a test"
 IDS_DLG_TIT_DEFAULT,    "Setup - Default settings"
 IDS_DLG_TIT_CURRENT,    "Setup - Current settings"
-- 
1.7.6.3



More information about the wine-patches mailing list