From 8cddbdd78592ed9518cf08461323a48019c43948 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 10 Jun 2020 17:21:32 +0300 Subject: [PATCH] dwrite: Fix CreateInMemoryFontFileLoader() prototype. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/dwrite/dwrite_private.h | 2 +- dlls/dwrite/font.c | 4 ++-- dlls/dwrite/main.c | 3 ++- dlls/dwrite/tests/font.c | 20 ++++++++------------ include/dwrite_3.idl | 2 +- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index e53b4dba0bb..38863b85bd6 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -343,7 +343,7 @@ extern HRESULT create_gdiinterop(IDWriteFactory7 *factory, IDWriteGdiInterop1 ** extern void fontface_detach_from_cache(IDWriteFontFace5 *fontface) DECLSPEC_HIDDEN; extern void factory_lock(IDWriteFactory7 *factory) DECLSPEC_HIDDEN; extern void factory_unlock(IDWriteFactory7 *factory) DECLSPEC_HIDDEN; -extern HRESULT create_inmemory_fileloader(IDWriteFontFileLoader**) DECLSPEC_HIDDEN; +extern HRESULT create_inmemory_fileloader(IDWriteInMemoryFontFileLoader **loader) DECLSPEC_HIDDEN; extern HRESULT create_font_resource(IDWriteFactory7 *factory, IDWriteFontFile *file, UINT32 face_index, IDWriteFontResource **resource) DECLSPEC_HIDDEN; diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index d8d892c9ef1..baee8d1e491 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -6832,7 +6832,7 @@ static const IDWriteInMemoryFontFileLoaderVtbl inmemoryfontfileloadervtbl = inmemoryfontfileloader_GetFileCount, }; -HRESULT create_inmemory_fileloader(IDWriteFontFileLoader **ret) +HRESULT create_inmemory_fileloader(IDWriteInMemoryFontFileLoader **ret) { struct dwrite_inmemory_fileloader *loader; @@ -6845,7 +6845,7 @@ HRESULT create_inmemory_fileloader(IDWriteFontFileLoader **ret) loader->IDWriteInMemoryFontFileLoader_iface.lpVtbl = &inmemoryfontfileloadervtbl; loader->ref = 1; - *ret = (IDWriteFontFileLoader *)&loader->IDWriteInMemoryFontFileLoader_iface; + *ret = &loader->IDWriteInMemoryFontFileLoader_iface; return S_OK; } diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c index b940d0d801e..a96874b2c2c 100644 --- a/dlls/dwrite/main.c +++ b/dlls/dwrite/main.c @@ -1627,7 +1627,8 @@ static HRESULT WINAPI dwritefactory5_CreateFontSetBuilder(IDWriteFactory7 *iface return E_NOTIMPL; } -static HRESULT WINAPI dwritefactory5_CreateInMemoryFontFileLoader(IDWriteFactory7 *iface, IDWriteFontFileLoader **loader) +static HRESULT WINAPI dwritefactory5_CreateInMemoryFontFileLoader(IDWriteFactory7 *iface, + IDWriteInMemoryFontFileLoader **loader) { TRACE("%p, %p.\n", iface, loader); diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index f8abbf9e4b4..07baf112eed 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -8696,8 +8696,9 @@ static void testowner_init(struct testowner_object *object) static void test_inmemory_file_loader(void) { IDWriteFontFileStream *stream, *stream2, *stream3; - IDWriteFontFileLoader *loader, *loader2; + IDWriteInMemoryFontFileLoader *loader, *loader2; IDWriteInMemoryFontFileLoader *inmemory; + IDWriteFontFileLoader *fileloader; struct testowner_object ownerobject; const void *key, *data, *frag_start; UINT64 file_size, size, writetime; @@ -8727,12 +8728,9 @@ static void test_inmemory_file_loader(void) hr = IDWriteFactory5_CreateInMemoryFontFileLoader(factory, &loader2); ok(hr == S_OK, "got %#x\n", hr); ok(loader != loader2, "unexpected pointer\n"); - IDWriteFontFileLoader_Release(loader2); + IDWriteInMemoryFontFileLoader_Release(loader2); - hr = IDWriteFontFileLoader_QueryInterface(loader, &IID_IDWriteInMemoryFontFileLoader, (void **)&inmemory); - ok(hr == S_OK, "got %#x\n", hr); - IDWriteFontFileLoader_Release(loader); - EXPECT_REF(inmemory, 1); + inmemory = loader; count = IDWriteInMemoryFontFileLoader_GetFileCount(inmemory); ok(!count, "Unexpected file count %u.\n", count); @@ -8742,15 +8740,15 @@ static void test_inmemory_file_loader(void) hr = IDWriteFontFace_GetFiles(fontface, &count, &file); ok(hr == S_OK, "got %#x\n", hr); - hr = IDWriteFontFile_GetLoader(file, &loader); + hr = IDWriteFontFile_GetLoader(file, &fileloader); ok(hr == S_OK, "got %#x\n", hr); hr = IDWriteFontFile_GetReferenceKey(file, &key, &key_size); ok(hr == S_OK, "got %#x\n", hr); - hr = IDWriteFontFileLoader_CreateStreamFromKey(loader, key, key_size, &stream); + hr = IDWriteFontFileLoader_CreateStreamFromKey(fileloader, key, key_size, &stream); ok(hr == S_OK, "got %#x\n", hr); - IDWriteFontFileLoader_Release(loader); + IDWriteFontFileLoader_Release(fileloader); IDWriteFontFile_Release(file); hr = IDWriteFontFileStream_GetFileSize(stream, &file_size); @@ -8848,9 +8846,7 @@ static void test_inmemory_file_loader(void) hr = IDWriteFactory5_CreateInMemoryFontFileLoader(factory, &loader); ok(hr == S_OK, "Failed to create loader, hr %#x.\n", hr); - hr = IDWriteFontFileLoader_QueryInterface(loader, &IID_IDWriteInMemoryFontFileLoader, (void **)&inmemory); - ok(hr == S_OK, "Failed to get in-memory interface, hr %#x.\n", hr); - IDWriteFontFileLoader_Release(loader); + inmemory = loader; hr = IDWriteFactory5_RegisterFontFileLoader(factory, (IDWriteFontFileLoader *)inmemory); ok(hr == S_OK, "Failed to register loader, hr %#x.\n", hr); diff --git a/include/dwrite_3.idl b/include/dwrite_3.idl index 54d204f39fb..f5ee6157cd7 100644 --- a/include/dwrite_3.idl +++ b/include/dwrite_3.idl @@ -923,7 +923,7 @@ interface IDWriteInMemoryFontFileLoader : IDWriteFontFileLoader interface IDWriteFactory5 : IDWriteFactory4 { HRESULT CreateFontSetBuilder(IDWriteFontSetBuilder1 **fontset_builder); - HRESULT CreateInMemoryFontFileLoader(IDWriteFontFileLoader **loader); + HRESULT CreateInMemoryFontFileLoader(IDWriteInMemoryFontFileLoader **loader); HRESULT CreateHttpFontFileLoader( WCHAR const *referrer_url, WCHAR const *extra_headers,