Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
Just a small change while I'm at it to not store the full path twice, we now have unix_name and we are only comparing the file basename here.
dlls/gdi32/freetype.c | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index d0b076ce6fd..c613171e237 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -274,7 +274,7 @@ typedef struct tagFace { DWORD flags; WCHAR *style_name; WCHAR *full_name; - WCHAR *file; + WCHAR *file_name; FONTSIGNATURE fs; DWORD ntmFlags; FT_Fixed font_version; @@ -1043,7 +1043,6 @@ static Face *find_face_from_filename(const WCHAR *file_name, const WCHAR *face_n { Family *family; Face *face; - const WCHAR *file;
TRACE("looking for file %s name %s\n", debugstr_w(file_name), debugstr_w(face_name));
@@ -1055,12 +1054,7 @@ static Face *find_face_from_filename(const WCHAR *file_name, const WCHAR *face_n LIST_FOR_EACH_ENTRY(face, face_list, Face, entry) { if (face->flags & ADDFONT_ADD_MEMRESOURCE) continue; - file = strrchrW(face->file, '/'); - if(!file) - file = face->file; - else - file++; - if(strcmpiW(file, file_name)) continue; + if (strcmpiW( face->file_name, file_name )) continue; face_addref( face ); return face; } @@ -1571,6 +1565,7 @@ static ULONG family_release( Family *family )
static Face *face_create( const char *unix_name, DWORD face_index, DWORD flags ) { + const char *file_name; Face *face;
if (!(face = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*face) + strlen( unix_name ) + 1 ))) @@ -1586,7 +1581,9 @@ static Face *face_create( const char *unix_name, DWORD face_index, DWORD flags ) face->flags = flags; strcpy( (char *)face->unix_name, unix_name );
- face->file = towstr( CP_UNIXCP, face->unix_name ); + if ((file_name = strrchr( face->unix_name, '/' ))) file_name++; + else file_name = face->unix_name; + face->file_name = towstr( CP_UNIXCP, file_name ); if (!HIWORD( face->flags )) face->flags |= ADDFONT_AA_FLAGS( default_aa_flags );
return face; @@ -1612,7 +1609,7 @@ static ULONG face_release( Face *face ) family_release( face->family ); }
- HeapFree( GetProcessHeap(), 0, face->file ); + HeapFree( GetProcessHeap(), 0, face->file_name ); HeapFree( GetProcessHeap(), 0, face->style_name ); HeapFree( GetProcessHeap(), 0, face->full_name ); HeapFree( GetProcessHeap(), 0, face->cached_enum_data ); @@ -2583,11 +2580,7 @@ static void populate_system_links(const WCHAR *name, const WCHAR *const *values) LIST_FOR_EACH_ENTRY(face, face_list, Face, entry) { if (face->flags & ADDFONT_ADD_MEMRESOURCE) continue; - file = strrchrW(face->file, '/'); - if (!file) - file = face->file; - else - file++; + file = face->file_name; break; } if (!file) @@ -3213,14 +3206,7 @@ static void update_reg_entries(void) } file = path; } - else if ((file = strrchrW(face->file, '/'))) - { - file++; - } - else - { - file = face->file; - } + else file = face->file_name;
len = strlenW(file) + 1; RegSetValueExW(winnt_key, valueW, 0, REG_SZ, (BYTE*)file, len * sizeof(WCHAR));