Huw Davies : wineps.drv: Remove paper sizes that lack either a PageSize or a PaperDimension entry in the PPD .

Alexandre Julliard julliard at wine.codeweavers.com
Thu Mar 8 15:35:55 CST 2007


Module: wine
Branch: master
Commit: 6316429c805a01dde1005baed417ec21964d56c1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6316429c805a01dde1005baed417ec21964d56c1

Author: Huw Davies <huw at codeweavers.com>
Date:   Thu Mar  8 14:44:26 2007 +0000

wineps.drv: Remove paper sizes that lack either a PageSize or a PaperDimension entry in the PPD.

---

 dlls/wineps.drv/ppd.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/dlls/wineps.drv/ppd.c b/dlls/wineps.drv/ppd.c
index 0c893e7..130613a 100644
--- a/dlls/wineps.drv/ppd.c
+++ b/dlls/wineps.drv/ppd.c
@@ -551,6 +551,7 @@ PPD *PSDRV_ParsePPD(char *fname)
     PPD *ppd;
     PPDTuple tuple;
     char *default_pagesize = NULL, *default_duplex = NULL;
+    PAGESIZE *page, *page_cursor2;
 
     TRACE("file '%s'\n", fname);
 
@@ -647,7 +648,6 @@ PPD *PSDRV_ParsePPD(char *fname)
 	}
 
 	else if(!strcmp("*PageSize", tuple.key)) {
-	    PAGESIZE *page;
 	    page = PSDRV_PPDGetPageSizeInfo(ppd, tuple.option);
 
 	    if(!page->Name) {
@@ -694,7 +694,6 @@ PPD *PSDRV_ParsePPD(char *fname)
         }
 
         else if(!strcmp("*ImageableArea", tuple.key)) {
-	    PAGESIZE *page;
 	    page = PSDRV_PPDGetPageSizeInfo(ppd, tuple.option);
 
 	    if(!page->Name) {
@@ -719,7 +718,6 @@ PPD *PSDRV_ParsePPD(char *fname)
 
 
 	else if(!strcmp("*PaperDimension", tuple.key)) {
-	    PAGESIZE *page;
 	    page = PSDRV_PPDGetPageSizeInfo(ppd, tuple.option);
 
 	    if(!page->Name) {
@@ -859,10 +857,25 @@ PPD *PSDRV_ParsePPD(char *fname)
 
     }
 
+    /* Remove any partial page size entries, that is any without a PageSize or a PaperDimension (we can
+       cope with a missing ImageableArea). */
+    LIST_FOR_EACH_ENTRY_SAFE(page, page_cursor2, &ppd->PageSizes, PAGESIZE, entry)
+    {
+        if(!page->InvocationString || !page->PaperDimension)
+        {
+            WARN("Removing page %s since it has a missing %s entry\n", debugstr_a(page->FullName),
+                 page->InvocationString ? "PaperDimension" : "InvocationString");
+            HeapFree(PSDRV_Heap, 0, page->Name);
+            HeapFree(PSDRV_Heap, 0, page->FullName);
+            HeapFree(PSDRV_Heap, 0, page->InvocationString);
+            HeapFree(PSDRV_Heap, 0, page->ImageableArea);
+            HeapFree(PSDRV_Heap, 0, page->PaperDimension);
+            list_remove(&page->entry);
+        }
+    }
 
     ppd->DefaultPageSize = NULL;
     if(default_pagesize) {
-	PAGESIZE *page;
 	LIST_FOR_EACH_ENTRY(page, &ppd->PageSizes, PAGESIZE, entry) {
             if(!strcmp(page->Name, default_pagesize)) {
                 ppd->DefaultPageSize = page;




More information about the wine-cvs mailing list