Commit 31121442 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Use consistent trace format for strings object.

parent 87260918
...@@ -258,9 +258,7 @@ static inline struct localizedstrings *impl_from_IDWriteLocalizedStrings(IDWrite ...@@ -258,9 +258,7 @@ static inline struct localizedstrings *impl_from_IDWriteLocalizedStrings(IDWrite
static HRESULT WINAPI localizedstrings_QueryInterface(IDWriteLocalizedStrings *iface, REFIID riid, void **obj) static HRESULT WINAPI localizedstrings_QueryInterface(IDWriteLocalizedStrings *iface, REFIID riid, void **obj)
{ {
struct localizedstrings *This = impl_from_IDWriteLocalizedStrings(iface); TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDWriteLocalizedStrings)) if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDWriteLocalizedStrings))
{ {
...@@ -358,60 +356,66 @@ static HRESULT WINAPI localizedstrings_GetLocaleNameLength(IDWriteLocalizedStrin ...@@ -358,60 +356,66 @@ static HRESULT WINAPI localizedstrings_GetLocaleNameLength(IDWriteLocalizedStrin
static HRESULT WINAPI localizedstrings_GetLocaleName(IDWriteLocalizedStrings *iface, UINT32 index, WCHAR *buffer, UINT32 size) static HRESULT WINAPI localizedstrings_GetLocaleName(IDWriteLocalizedStrings *iface, UINT32 index, WCHAR *buffer, UINT32 size)
{ {
struct localizedstrings *This = impl_from_IDWriteLocalizedStrings(iface); struct localizedstrings *strings = impl_from_IDWriteLocalizedStrings(iface);
TRACE("(%p)->(%u %p %u)\n", This, index, buffer, size); TRACE("%p, %u, %p, %u.\n", iface, index, buffer, size);
if (index >= This->count) { if (index >= strings->count)
{
if (buffer) *buffer = 0; if (buffer) *buffer = 0;
return E_FAIL; return E_FAIL;
} }
if (size < strlenW(This->data[index].locale)+1) { if (size < strlenW(strings->data[index].locale) + 1)
{
if (buffer) *buffer = 0; if (buffer) *buffer = 0;
return E_NOT_SUFFICIENT_BUFFER; return E_NOT_SUFFICIENT_BUFFER;
} }
strcpyW(buffer, This->data[index].locale); strcpyW(buffer, strings->data[index].locale);
return S_OK; return S_OK;
} }
static HRESULT WINAPI localizedstrings_GetStringLength(IDWriteLocalizedStrings *iface, UINT32 index, UINT32 *length) static HRESULT WINAPI localizedstrings_GetStringLength(IDWriteLocalizedStrings *iface, UINT32 index, UINT32 *length)
{ {
struct localizedstrings *This = impl_from_IDWriteLocalizedStrings(iface); struct localizedstrings *strings = impl_from_IDWriteLocalizedStrings(iface);
TRACE("(%p)->(%u %p)\n", This, index, length); TRACE("%p, %u, %p.\n", iface, index, length);
if (index >= This->count) { if (index >= strings->count)
*length = (UINT32)-1; {
*length = ~0u;
return E_FAIL; return E_FAIL;
} }
*length = strlenW(This->data[index].string); *length = strlenW(strings->data[index].string);
return S_OK; return S_OK;
} }
static HRESULT WINAPI localizedstrings_GetString(IDWriteLocalizedStrings *iface, UINT32 index, WCHAR *buffer, UINT32 size) static HRESULT WINAPI localizedstrings_GetString(IDWriteLocalizedStrings *iface, UINT32 index, WCHAR *buffer, UINT32 size)
{ {
struct localizedstrings *This = impl_from_IDWriteLocalizedStrings(iface); struct localizedstrings *strings = impl_from_IDWriteLocalizedStrings(iface);
TRACE("(%p)->(%u %p %u)\n", This, index, buffer, size); TRACE("%p, %u, %p, %u.\n", iface, index, buffer, size);
if (index >= This->count) { if (index >= strings->count)
{
if (buffer) *buffer = 0; if (buffer) *buffer = 0;
return E_FAIL; return E_FAIL;
} }
if (size < strlenW(This->data[index].string)+1) { if (size < strlenW(strings->data[index].string) + 1)
{
if (buffer) *buffer = 0; if (buffer) *buffer = 0;
return E_NOT_SUFFICIENT_BUFFER; return E_NOT_SUFFICIENT_BUFFER;
} }
strcpyW(buffer, This->data[index].string); strcpyW(buffer, strings->data[index].string);
return S_OK; return S_OK;
} }
static const IDWriteLocalizedStringsVtbl localizedstringsvtbl = { static const IDWriteLocalizedStringsVtbl localizedstringsvtbl =
{
localizedstrings_QueryInterface, localizedstrings_QueryInterface,
localizedstrings_AddRef, localizedstrings_AddRef,
localizedstrings_Release, localizedstrings_Release,
...@@ -511,13 +515,15 @@ HRESULT clone_localizedstrings(IDWriteLocalizedStrings *iface, IDWriteLocalizedS ...@@ -511,13 +515,15 @@ HRESULT clone_localizedstrings(IDWriteLocalizedStrings *iface, IDWriteLocalizedS
void set_en_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *string) void set_en_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *string)
{ {
static const WCHAR enusW[] = {'e','n','-','U','S',0}; static const WCHAR enusW[] = {'e','n','-','U','S',0};
struct localizedstrings *This = impl_from_IDWriteLocalizedStrings(iface); struct localizedstrings *strings = impl_from_IDWriteLocalizedStrings(iface);
UINT32 i; UINT32 i;
for (i = 0; i < This->count; i++) { for (i = 0; i < strings->count; i++)
if (!strcmpiW(This->data[i].locale, enusW)) { {
heap_free(This->data[i].string); if (!strcmpiW(strings->data[i].locale, enusW))
This->data[i].string = heap_strdupW(string); {
heap_free(strings->data[i].string);
strings->data[i].string = heap_strdupW(string);
break; break;
} }
} }
......
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