From 225c33fe7047251be4edb33f428cdf118a4832ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Nicolaysen=20S=C3=B8rnes?= Date: Tue, 24 Jul 2007 23:26:53 +0200 Subject: [PATCH] comdlg32: printdlg: Fix number display in PrintDlgW(). --- dlls/comdlg32/printdlg.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c index 5301646f055..714f09cf6c6 100644 --- a/dlls/comdlg32/printdlg.c +++ b/dlls/comdlg32/printdlg.c @@ -2413,21 +2413,19 @@ _c_size2strA(PageSetupDataA *pda,DWORD size,LPSTR strout) { } static void _c_size2strW(PageSetupDataW *pda,DWORD size,LPWSTR strout) { - static const WCHAR UNDEF[] = { '<', 'u', 'n', 'd', 'e', 'f', '>', 0 }; - static const WCHAR mm_fmt[] = { '%', '.', '2', 'f', 'm', 'm', 0 }; - static const WCHAR in_fmt[] = { '%', '.', '2', 'f', 'i', 'n', 0 }; - lstrcpyW(strout, UNDEF); + static const char mm_fmt[] = "%.2f mm"; + static const char in_fmt[] = "%.2f in"; + char buf[20]; if (pda->dlga->Flags & PSD_INHUNDREDTHSOFMILLIMETERS) { - wsprintfW(strout,mm_fmt,(size*1.0)/100.0); - return; + sprintf(buf, mm_fmt, (size * 1.0) / 100.0); + } else if (pda->dlga->Flags & PSD_INTHOUSANDTHSOFINCHES) { + sprintf(buf, in_fmt, (size * 1.0) / 1000.0); + } else { + pda->dlga->Flags |= PSD_INHUNDREDTHSOFMILLIMETERS; + sprintf(buf, mm_fmt, (size * 1.0) / 100.0); } - if (pda->dlga->Flags & PSD_INTHOUSANDTHSOFINCHES) { - wsprintfW(strout,in_fmt,(size*1.0)/1000.0); - return; - } - pda->dlga->Flags |= PSD_INHUNDREDTHSOFMILLIMETERS; - wsprintfW(strout,mm_fmt,(size*1.0)/100.0); - return; + + MultiByteToWideChar(CP_ACP, 0, buf, -1, strout, 20); } static DWORD