Gentoo Archives: gentoo-commits

From: "Petteri Raty (betelgeuse)" <betelgeuse@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-libs/xulrunner/files: cups-1.4.4-fixup.patch
Date: Sun, 02 Jan 2011 22:28:47
Message-Id: 20110102222838.08F7E20057@flycatcher.gentoo.org
1 betelgeuse 11/01/02 22:28:37
2
3 Added: cups-1.4.4-fixup.patch
4 Log:
5 Revision to fix printing with latest version of cups. Fixes bug #325469. Committed for Anarchy.
6
7 (Portage version: 2.2.0_alpha10/cvs/Linux i686)
8
9 Revision Changes Path
10 1.1 net-libs/xulrunner/files/cups-1.4.4-fixup.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-libs/xulrunner/files/cups-1.4.4-fixup.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-libs/xulrunner/files/cups-1.4.4-fixup.patch?rev=1.1&content-type=text/plain
14
15 Index: cups-1.4.4-fixup.patch
16 ===================================================================
17 # HG changeset patch
18 # User Matthew Gregan <kinetik@××××.org>
19 # Date 1293624205 -3600
20 # Node ID ffa1ef8ab52b4081e27aa2b24d14a550386f90db
21 # Parent 9e561d402701f46eb56dbadb96b6963f4518cdd0
22 Bug 573039 - Construct nsCUPSShim statically and avoid calling PR_UnloadLibrary on libcups after it has been initialized. r=karlt a=clegnitto
23
24 diff --git a/mozilla/gfx/src/psshared/nsCUPSShim.cpp b/mozilla/gfx/src/psshared/nsCUPSShim.cpp
25 --- a/mozilla/gfx/src/psshared/nsCUPSShim.cpp
26 +++ b/mozilla/gfx/src/psshared/nsCUPSShim.cpp
27 @@ -83,14 +83,8 @@ nsCUPSShim::Init()
28 #endif
29 PR_UnloadLibrary(mCupsLib);
30 mCupsLib = nsnull;
31 return PR_FALSE;
32 }
33 }
34 return PR_TRUE;
35 }
36 -
37 -nsCUPSShim::~nsCUPSShim()
38 -{
39 - if (mCupsLib)
40 - PR_UnloadLibrary(mCupsLib);
41 -}
42 diff --git a/mozilla/gfx/src/psshared/nsCUPSShim.h b/mozilla/gfx/src/psshared/nsCUPSShim.h
43 --- a/mozilla/gfx/src/psshared/nsCUPSShim.h
44 +++ b/mozilla/gfx/src/psshared/nsCUPSShim.h
45 @@ -81,17 +81,16 @@ typedef int (PR_CALLBACK *CupsAddOptionT
46 int num_options,
47 cups_option_t **options);
48
49 struct PRLibrary;
50
51 class NS_PSSHARED nsCUPSShim {
52 public:
53 nsCUPSShim() : mCupsLib(nsnull) { }
54 - ~nsCUPSShim();
55
56 /**
57 * Initialize this object. Attempt to load the CUPS shared
58 * library and find function pointers for the supported
59 * functions (see below).
60 * @return PR_FALSE if the shared library could not be loaded, or if
61 * any of the functions could not be found.
62 * PR_TRUE for successful initialization.
63 diff --git a/mozilla/gfx/src/psshared/nsPSPrinters.cpp b/mozilla/gfx/src/psshared/nsPSPrinters.cpp
64 --- a/mozilla/gfx/src/psshared/nsPSPrinters.cpp
65 +++ b/mozilla/gfx/src/psshared/nsPSPrinters.cpp
66 @@ -51,32 +51,34 @@
67 #include "plstr.h"
68
69 #define NS_CUPS_PRINTER "CUPS/"
70 #define NS_CUPS_PRINTER_LEN (sizeof(NS_CUPS_PRINTER) - 1)
71
72 /* dummy printer name for the gfx/src/ps driver */
73 #define NS_POSTSCRIPT_DRIVER_NAME "PostScript/"
74
75 +nsCUPSShim gCupsShim;
76 +
77 /* Initialize the printer manager object */
78 nsresult
79 nsPSPrinterList::Init()
80 {
81 nsresult rv;
82
83 mPrefSvc = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
84 if (NS_SUCCEEDED(rv))
85 rv = mPrefSvc->GetBranch("print.", getter_AddRefs(mPref));
86 NS_ENSURE_SUCCESS(rv, NS_ERROR_NOT_INITIALIZED);
87
88 // Should we try cups?
89 PRBool useCups = PR_TRUE;
90 rv = mPref->GetBoolPref("postscript.cups.enabled", &useCups);
91 - if (useCups)
92 - mCups.Init();
93 + if (useCups && !gCupsShim.IsInitialized())
94 + gCupsShim.Init();
95 return NS_OK;
96 }
97
98
99 /* Check whether the PostScript module has been disabled at runtime */
100 PRBool
101 nsPSPrinterList::Enabled()
102 {
103 @@ -94,35 +96,35 @@ nsPSPrinterList::Enabled()
104 /* Fetch a list of printers handled by the PostsScript module */
105 void
106 nsPSPrinterList::GetPrinterList(nsTArray<nsCString>& aList)
107 {
108 aList.Clear();
109
110 // Query CUPS for a printer list. The default printer goes to the
111 // head of the output list; others are appended.
112 - if (mCups.IsInitialized()) {
113 + if (gCupsShim.IsInitialized()) {
114 cups_dest_t *dests;
115
116 - int num_dests = (mCups.mCupsGetDests)(&dests);
117 + int num_dests = (gCupsShim.mCupsGetDests)(&dests);
118 if (num_dests) {
119 for (int i = 0; i < num_dests; i++) {
120 nsCAutoString fullName(NS_CUPS_PRINTER);
121 fullName.Append(dests[i].name);
122 if (dests[i].instance != NULL) {
123 fullName.Append("/");
124 fullName.Append(dests[i].instance);
125 }
126 if (dests[i].is_default)
127 aList.InsertElementAt(0, fullName);
128 else
129 aList.AppendElement(fullName);
130 }
131 }
132 - (mCups.mCupsFreeDests)(num_dests, dests);
133 + (gCupsShim.mCupsFreeDests)(num_dests, dests);
134 }
135
136 // Build the "classic" list of printers -- those accessed by running
137 // an opaque command. This list always contains a printer named "default".
138 // In addition, we look for either an environment variable
139 // MOZILLA_POSTSCRIPT_PRINTER_LIST or a preference setting
140 // print.printer_list, which contains a space-separated list of printer
141 // names.
142 diff --git a/mozilla/gfx/src/psshared/nsPSPrinters.h b/mozilla/gfx/src/psshared/nsPSPrinters.h
143 --- a/mozilla/gfx/src/psshared/nsPSPrinters.h
144 +++ b/mozilla/gfx/src/psshared/nsPSPrinters.h
145 @@ -37,17 +37,16 @@
146 * ***** END LICENSE BLOCK ***** */
147
148 #ifndef nsPSPrinters_h___
149 #define nsPSPrinters_h___
150
151 #include "nsString.h"
152 #include "nsTArray.h"
153 #include "prtypes.h"
154 -#include "nsCUPSShim.h"
155 #include "psSharedCore.h"
156
157 class nsIPrefService;
158 class nsIPrefBranch;
159 class nsCUPSShim;
160
161 class NS_PSSHARED nsPSPrinterList {
162 public:
163 @@ -91,12 +90,11 @@ class NS_PSSHARED nsPSPrinterList {
164 * the <type> portion as described for GetPrinterList().
165 * @return The PrinterType value for this name.
166 */
167 static PrinterType GetPrinterType(const nsACString& aName);
168
169 private:
170 nsCOMPtr<nsIPrefService> mPrefSvc;
171 nsCOMPtr<nsIPrefBranch> mPref;
172 - nsCUPSShim mCups;
173 };
174
175 #endif /* nsPSPrinters_h___ */