---
dlls/winspool.drv/info.c |    8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)

Detlef Riekenberg wrote:

Sorry, I misinterpreted the Patch because of the subject.

I'm fine with your Patch, when you fix your typo:

> +    if (hadprinter & !haddefault)
> +        WINSPOOL_SetDefaultPrinter(dests[0].name, dests[i].name, TRUE);

With greetings from Copy and Paste: [i]  =>  [0]


For the subject, I suggest to include "Fallback":
winspool.drv: Fallback to the first found printer as default printer


Thank you for your comments, and sorry for the typo and the ambiguous
subject…

- Pedro.
# [PATCH] winspool.drv: Fallback to the first found printer as default printer

---
 dlls/winspool.drv/info.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index 822fde4..7ec5830 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -419,7 +419,7 @@ static void *cupshandle;
 static BOOL CUPS_LoadPrinters(void)
 {
     int	                  i, nrofdests;
-    BOOL                  hadprinter = FALSE;
+    BOOL                  hadprinter = FALSE, haddefault = FALSE;
     cups_dest_t          *dests;
     PRINTER_INFO_2A       pinfo2a;
     char   *port,*devline;
@@ -497,9 +497,13 @@ static BOOL CUPS_LoadPrinters(void)
 	HeapFree(GetProcessHeap(),0,port);
 
         hadprinter = TRUE;
-        if (dests[i].is_default)
+        if (dests[i].is_default) {
             WINSPOOL_SetDefaultPrinter(dests[i].name, dests[i].name, TRUE);
+            haddefault = TRUE;
+        }
     }
+    if (hadprinter & !haddefault)
+        WINSPOOL_SetDefaultPrinter(dests[0].name, dests[0].name, TRUE);
     RegCloseKey(hkeyPrinters);
     return hadprinter;
 }
-- 
1.4.4.2



Reply via email to