Commit c53b7723 authored by Andrey Turkin's avatar Andrey Turkin Committed by Alexandre Julliard

wordpad: Convert some ANSI calls to Unicode.

parent 566dcd78
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <math.h> #include <math.h>
#include <errno.h> #include <errno.h>
#include "wine/unicode.h"
#include "wordpad.h" #include "wordpad.h"
#ifdef NONAMELESSUNION #ifdef NONAMELESSUNION
...@@ -1284,21 +1285,18 @@ static void append_current_units(LPWSTR buffer) ...@@ -1284,21 +1285,18 @@ static void append_current_units(LPWSTR buffer)
static void number_with_units(LPWSTR buffer, int number) static void number_with_units(LPWSTR buffer, int number)
{ {
float converted = (float)number / TWIPS_PER_CM; float converted = (float)number / TWIPS_PER_CM;
char string[MAX_STRING_LEN]; static const WCHAR fmt[] = {'%','.','2','f',' ','%','s','\0'};
sprintf(string, "%.2f ", converted); sprintfW(buffer, fmt, converted, units_cmW);
lstrcatA(string, units_cmA);
MultiByteToWideChar(CP_ACP, 0, string, -1, buffer, MAX_STRING_LEN);
} }
static BOOL get_comboexlist_selection(HWND hComboEx, LPWSTR wszBuffer, UINT bufferLength) static BOOL get_comboexlist_selection(HWND hComboEx, LPWSTR wszBuffer, UINT bufferLength)
{ {
HANDLE hHeap; COMBOBOXEXITEMW cbItem;
COMBOBOXEXITEM cbItem;
COMBOBOXINFO cbInfo; COMBOBOXINFO cbInfo;
HWND hCombo, hList; HWND hCombo, hList;
int idx, result; int idx, result;
char *szBuffer;
hCombo = (HWND)SendMessage(hComboEx, CBEM_GETCOMBOCONTROL, 0, 0); hCombo = (HWND)SendMessage(hComboEx, CBEM_GETCOMBOCONTROL, 0, 0);
if (!hCombo) if (!hCombo)
return FALSE; return FALSE;
...@@ -1311,22 +1309,13 @@ static BOOL get_comboexlist_selection(HWND hComboEx, LPWSTR wszBuffer, UINT buff ...@@ -1311,22 +1309,13 @@ static BOOL get_comboexlist_selection(HWND hComboEx, LPWSTR wszBuffer, UINT buff
if (idx < 0) if (idx < 0)
return FALSE; return FALSE;
hHeap = GetProcessHeap();
szBuffer = HeapAlloc(hHeap, HEAP_ZERO_MEMORY, bufferLength);
ZeroMemory(&cbItem, sizeof(cbItem)); ZeroMemory(&cbItem, sizeof(cbItem));
cbItem.mask = CBEIF_TEXT; cbItem.mask = CBEIF_TEXT;
cbItem.iItem = idx; cbItem.iItem = idx;
cbItem.pszText = szBuffer; cbItem.pszText = wszBuffer;
cbItem.cchTextMax = bufferLength-1; cbItem.cchTextMax = bufferLength-1;
result = SendMessage(hComboEx, CBEM_GETITEM, 0, (LPARAM)&cbItem); result = SendMessageW(hComboEx, CBEM_GETITEM, 0, (LPARAM)&cbItem);
if (!result)
{
HeapFree(hHeap, 0, szBuffer);
return FALSE;
}
result = MultiByteToWideChar(CP_ACP, 0, szBuffer, -1, wszBuffer, bufferLength);
HeapFree(hHeap, 0, szBuffer);
return result != 0; return result != 0;
} }
......
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