From 4ff9b7f11a92091c0485504f1a750e9b37844064 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Wed, 11 Apr 2012 12:36:14 +0100 Subject: [PATCH] wineps: Move the installed font list to a standard list. --- dlls/wineps.drv/init.c | 3 ++- dlls/wineps.drv/ppd.c | 32 ++++++++++++-------------------- dlls/wineps.drv/psdrv.h | 7 ++++--- 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/dlls/wineps.drv/init.c b/dlls/wineps.drv/init.c index 0c06ecbf97e..affbcbcf1d7 100644 --- a/dlls/wineps.drv/init.c +++ b/dlls/wineps.drv/init.c @@ -773,7 +773,8 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name) pi->Fonts = NULL; - for(font = pi->ppd->InstalledFonts; font; font = font->next) { + LIST_FOR_EACH_ENTRY( font, &pi->ppd->InstalledFonts, FONTNAME, entry ) + { afm = PSDRV_FindAFMinList(PSDRV_AFMFontList, font->Name); if(!afm) { TRACE( "Couldn't find AFM file for installed printer font '%s' - " diff --git a/dlls/wineps.drv/ppd.c b/dlls/wineps.drv/ppd.c index c2c422d82fc..3f2c4730ab8 100644 --- a/dlls/wineps.drv/ppd.c +++ b/dlls/wineps.drv/ppd.c @@ -631,7 +631,9 @@ PPD *PSDRV_ParsePPD(char *fname) } ppd->ColorDevice = CD_NotSpecified; - list_init(&ppd->PageSizes); + + list_init( &ppd->InstalledFonts ); + list_init( &ppd->PageSizes ); /* * The Windows PostScript drivers create the following "virtual bin" for @@ -678,23 +680,13 @@ PPD *PSDRV_ParsePPD(char *fname) WARN("failed to parse DefaultResolution %s\n", debugstr_a(tuple.value)); } - else if(!strcmp("*Font", tuple.key)) { - FONTNAME *fn; - - for(fn = ppd->InstalledFonts; fn && fn->next; fn = fn->next) - ; - if(!fn) { - ppd->InstalledFonts = HeapAlloc(PSDRV_Heap, - HEAP_ZERO_MEMORY, sizeof(*fn)); - fn = ppd->InstalledFonts; - } else { - fn->next = HeapAlloc(PSDRV_Heap, - HEAP_ZERO_MEMORY, sizeof(*fn)); - fn = fn->next; - } - fn->Name = tuple.option; - tuple.option = NULL; - } + else if(!strcmp("*Font", tuple.key)) + { + FONTNAME *fn = HeapAlloc( PSDRV_Heap, 0, sizeof(*fn) ); + fn->Name = tuple.option; + tuple.option = NULL; + list_add_tail( &ppd->InstalledFonts, &fn->entry ); + } else if(!strcmp("*DefaultFont", tuple.key)) { ppd->DefaultFont = tuple.value; @@ -985,8 +977,8 @@ PPD *PSDRV_ParsePPD(char *fname) OPTION *option; OPTIONENTRY *optionEntry; - for(fn = ppd->InstalledFonts; fn; fn = fn->next) - TRACE("'%s'\n", fn->Name); + LIST_FOR_EACH_ENTRY( fn, &ppd->InstalledFonts, FONTNAME, entry ) + TRACE("'%s'\n", fn->Name); LIST_FOR_EACH_ENTRY(page, &ppd->PageSizes, PAGESIZE, entry) { TRACE("'%s' aka '%s' (%d) invoked by '%s'\n", page->Name, diff --git a/dlls/wineps.drv/psdrv.h b/dlls/wineps.drv/psdrv.h index df86c70f7d0..a4ac759b096 100644 --- a/dlls/wineps.drv/psdrv.h +++ b/dlls/wineps.drv/psdrv.h @@ -118,9 +118,10 @@ typedef struct _tagFONTFAMILY { extern FONTFAMILY *PSDRV_AFMFontList DECLSPEC_HIDDEN; extern const AFM *const PSDRV_BuiltinAFMs[] DECLSPEC_HIDDEN; /* last element is NULL */ -typedef struct _tagFONTNAME { +typedef struct +{ + struct list entry; char *Name; - struct _tagFONTNAME *next; } FONTNAME; typedef struct { @@ -213,7 +214,7 @@ typedef struct { char *JCLToPSInterpreter; char *JCLEnd; char *DefaultFont; - FONTNAME *InstalledFonts; /* ptr to a list of FontNames */ + struct list InstalledFonts; struct list PageSizes; PAGESIZE *DefaultPageSize; OPTION *InstalledOptions; -- 2.11.4.GIT