[PATCH 4/5] gdi32: Only request registry font path when necessary.
Rémi Bernon
rbernon at codeweavers.com
Tue Dec 1 04:01:45 CST 2020
On 12/1/20 10:33 AM, Huw Davies wrote:
> On Fri, Nov 27, 2020 at 03:38:04PM +0100, Rémi Bernon wrote:
>> Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
>> ---
>> dlls/gdi32/font.c | 9 ++++++++-
>> 1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
>> index d3202d83a15..4cc072bd785 100644
>> --- a/dlls/gdi32/font.c
>> +++ b/dlls/gdi32/font.c
>> @@ -7910,7 +7910,7 @@ static void load_registry_fonts(void)
>>
>> vlen = ARRAY_SIZE(value);
>> dlen = sizeof(data);
>> - while (!RegEnumValueW( hkey, i++, value, &vlen, NULL, &type, (LPBYTE)data, &dlen ))
>> + while (!RegEnumValueW( hkey, i++, value, &vlen, NULL, &type, NULL, NULL ))
>> {
>> if (type != REG_SZ) goto next;
>> dlen /= sizeof(WCHAR);
>> @@ -7918,6 +7918,13 @@ static void load_registry_fonts(void)
>> if (find_face_from_full_name( value )) goto next;
>> if (tmp && !*tmp) *tmp = ' ';
>>
>> + if (RegQueryValueExW( hkey, value, NULL, NULL, (LPBYTE)data, &dlen ))
>> + {
>> + WARN( "Unable to get face path %s\n", debugstr_w(value) );
>> + goto next;
>> + }
>> +
>> + dlen /= sizeof(WCHAR);
>> if (data[0] && data[1] == ':')
>> add_font_resource( data, ADDFONT_ALLOW_BITMAP | ADDFONT_ADD_TO_CACHE );
>> else if (dlen >= 6 && !wcsicmp( data + dlen - 5, L".fon" ))
>
> Just so I understand, this is essentially saving the memcpy() in
> RegEnumValueW() for the (many) external fonts at the expense of a
> second server round-trip for the (few) "internal" fonts?
>
> Huw.
>
The memcpy and the write/read from/to wineserver, yes.
--
Rémi Bernon <rbernon at codeweavers.com>
More information about the wine-devel
mailing list