user32: Use the heap_*() functions in text.c where possible.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b9e082fc07
commit
661528a119
|
@ -41,6 +41,7 @@
|
|||
#include "usp10.h"
|
||||
#include "user_private.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/heap.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(text);
|
||||
|
||||
|
@ -365,7 +366,7 @@ static void TEXT_WordBreak (HDC hdc, WCHAR *str, unsigned int max_str,
|
|||
assert (format & DT_WORDBREAK);
|
||||
assert (chars_fit < *len_str);
|
||||
|
||||
sla = HeapAlloc(GetProcessHeap(), 0, sizeof(SCRIPT_LOGATTR) * *len_str);
|
||||
sla = heap_alloc(sizeof(SCRIPT_LOGATTR) * *len_str);
|
||||
|
||||
memset(&sa, 0, sizeof(SCRIPT_ANALYSIS));
|
||||
sa.eScript = SCRIPT_UNDEFINED;
|
||||
|
@ -445,7 +446,7 @@ static void TEXT_WordBreak (HDC hdc, WCHAR *str, unsigned int max_str,
|
|||
}
|
||||
/* Remeasure the string */
|
||||
GetTextExtentExPointW (hdc, str, *len_str, 0, NULL, NULL, size);
|
||||
HeapFree(GetProcessHeap(),0, sla);
|
||||
heap_free(sla);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
@ -957,7 +958,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
|
|||
if (flags & DT_MODIFYSTRING)
|
||||
{
|
||||
size_retstr = (count + 4) * sizeof (WCHAR);
|
||||
retstr = HeapAlloc(GetProcessHeap(), 0, size_retstr);
|
||||
retstr = heap_alloc(size_retstr);
|
||||
if (!retstr) return 0;
|
||||
memcpy (retstr, str, size_retstr);
|
||||
}
|
||||
|
@ -1003,7 +1004,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
|
|||
len_seg = p - str;
|
||||
if (len_seg != len && !GetTextExtentPointW(hdc, str, len_seg, &size))
|
||||
{
|
||||
HeapFree (GetProcessHeap(), 0, retstr);
|
||||
heap_free(retstr);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -1015,7 +1016,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
|
|||
((flags & DT_RTLREADING) ? ETO_RTLREADING : 0),
|
||||
rect, str, len_seg, NULL ))
|
||||
{
|
||||
HeapFree (GetProcessHeap(), 0, retstr);
|
||||
heap_free(retstr);
|
||||
return 0;
|
||||
}
|
||||
if (prefix_offset != -1 && prefix_offset < len_seg)
|
||||
|
@ -1069,7 +1070,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
|
|||
if (retstr)
|
||||
{
|
||||
memcpy (str, retstr, size_retstr);
|
||||
HeapFree (GetProcessHeap(), 0, retstr);
|
||||
heap_free(retstr);
|
||||
}
|
||||
return y - rect->top;
|
||||
}
|
||||
|
@ -1128,7 +1129,7 @@ INT WINAPI DrawTextExA( HDC hdc, LPSTR str, INT count,
|
|||
wmax += 4;
|
||||
amax += 4;
|
||||
}
|
||||
wstr = HeapAlloc(GetProcessHeap(), 0, wmax * sizeof(WCHAR));
|
||||
wstr = heap_alloc(wmax * sizeof(WCHAR));
|
||||
if (wstr)
|
||||
{
|
||||
MultiByteToWideChar( cp, 0, str, count, wstr, wcount );
|
||||
|
@ -1147,7 +1148,7 @@ INT WINAPI DrawTextExA( HDC hdc, LPSTR str, INT count,
|
|||
for (i=4, p=wstr+wcount; i-- && *p != 0xFFFE; p++) wcount++;
|
||||
WideCharToMultiByte( cp, 0, wstr, wcount, str, amax, NULL, NULL );
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, wstr);
|
||||
heap_free(wstr);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -1417,11 +1418,11 @@ LONG WINAPI TabbedTextOutA( HDC hdc, INT x, INT y, LPCSTR lpstr, INT count,
|
|||
{
|
||||
LONG ret;
|
||||
DWORD len = MultiByteToWideChar( CP_ACP, 0, lpstr, count, NULL, 0 );
|
||||
LPWSTR strW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
|
||||
LPWSTR strW = heap_alloc( len * sizeof(WCHAR) );
|
||||
if (!strW) return 0;
|
||||
MultiByteToWideChar( CP_ACP, 0, lpstr, count, strW, len );
|
||||
ret = TabbedTextOutW( hdc, x, y, strW, len, cTabStops, lpTabPos, nTabOrg );
|
||||
HeapFree( GetProcessHeap(), 0, strW );
|
||||
heap_free( strW );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1470,11 +1471,11 @@ DWORD WINAPI GetTabbedTextExtentA( HDC hdc, LPCSTR lpstr, INT count,
|
|||
{
|
||||
LONG ret;
|
||||
DWORD len = MultiByteToWideChar( CP_ACP, 0, lpstr, count, NULL, 0 );
|
||||
LPWSTR strW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
|
||||
LPWSTR strW = heap_alloc( len * sizeof(WCHAR) );
|
||||
if (!strW) return 0;
|
||||
MultiByteToWideChar( CP_ACP, 0, lpstr, count, strW, len );
|
||||
ret = GetTabbedTextExtentW( hdc, strW, len, cTabStops, lpTabPos );
|
||||
HeapFree( GetProcessHeap(), 0, strW );
|
||||
heap_free( strW );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue