1 |
dilfridge 12/08/24 22:21:00 |
2 |
|
3 |
Added: Net-CUPS-0.610.0-cups16.patch |
4 |
Log: |
5 |
Add patch by Jiří Popelka to fix build against cups-1.6, bug 428740 |
6 |
|
7 |
(Portage version: 2.2.0_alpha122/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 dev-perl/Net-CUPS/files/Net-CUPS-0.610.0-cups16.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-perl/Net-CUPS/files/Net-CUPS-0.610.0-cups16.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-perl/Net-CUPS/files/Net-CUPS-0.610.0-cups16.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: Net-CUPS-0.610.0-cups16.patch |
16 |
=================================================================== |
17 |
diff --git a/CUPS.xs b/CUPS.xs |
18 |
index 2da9558..109f73f 100644 |
19 |
--- a/CUPS.xs |
20 |
+++ b/CUPS.xs |
21 |
@@ -5,9 +5,17 @@ |
22 |
#include "ppport.h" |
23 |
|
24 |
#include <cups/cups.h> |
25 |
+#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) |
26 |
+#define HAVE_CUPS_1_6 1 |
27 |
+#endif |
28 |
+ |
29 |
/*#include <cups/backend.h>*/ |
30 |
#include <cups/http.h> |
31 |
-#include <cups/image.h> |
32 |
+#ifdef HAVE_CUPS_1_6 |
33 |
+ #include <cupsfilters/image.h> |
34 |
+#else |
35 |
+ #include <cups/image.h> |
36 |
+#endif |
37 |
#include <cups/ipp.h> |
38 |
#include <cups/ppd.h> |
39 |
#include <cups/file.h> |
40 |
@@ -19,6 +27,17 @@ |
41 |
#include "const-c.inc" |
42 |
#include "packer.c" |
43 |
|
44 |
+#ifndef HAVE_CUPS_1_6 |
45 |
+#define ippGetGroupTag(attr) attr->group_tag |
46 |
+#define ippGetName(attr) attr->name |
47 |
+#define ippGetValueTag(attr) attr->value_tag |
48 |
+#define ippGetInteger(attr, element) attr->values[element].integer |
49 |
+#define ippGetString(attr, element, language) attr->values[element].string.text |
50 |
+#define ippGetStatusCode(ipp) ipp->request.status.status_code |
51 |
+#define ippFirstAttribute(ipp) ipp->current = ipp->attrs |
52 |
+#define ippNextAttribute(ipp) ipp->current = ipp->current->next |
53 |
+#endif |
54 |
+ |
55 |
static SV *password_cb = (SV*) NULL; |
56 |
|
57 |
const char * |
58 |
@@ -200,7 +219,7 @@ NETCUPS_getPPDMakes() |
59 |
if (response != NULL) { |
60 |
attr = ippFindAttribute(response, "ppd-make", IPP_TAG_TEXT); |
61 |
rv = sv_newmortal(); |
62 |
- sv_setpv(rv, attr->values[0].string.text); |
63 |
+ sv_setpv(rv, ippGetString(attr, 0, NULL)); |
64 |
XPUSHs(rv); |
65 |
count++; |
66 |
|
67 |
@@ -211,7 +230,7 @@ NETCUPS_getPPDMakes() |
68 |
} |
69 |
|
70 |
rv = sv_newmortal(); |
71 |
- sv_setpv(rv, attr->values[0].string.text); |
72 |
+ sv_setpv(rv, ippGetString(attr, 0, NULL)); |
73 |
XPUSHs(rv); |
74 |
count++; |
75 |
} |
76 |
@@ -252,7 +271,7 @@ NETCUPS_getAllPPDs () |
77 |
"ppd-make-and-model", |
78 |
IPP_TAG_TEXT); |
79 |
rv = sv_newmortal(); |
80 |
- sv_setpv(rv, attr->values[0].string.text); |
81 |
+ sv_setpv(rv, ippGetString(attr, 0, NULL)); |
82 |
XPUSHs(rv); |
83 |
count++; |
84 |
while (attr != NULL) { |
85 |
@@ -263,7 +282,7 @@ NETCUPS_getAllPPDs () |
86 |
break; |
87 |
} |
88 |
rv = sv_newmortal(); |
89 |
- sv_setpv(rv, attr->values[0].string.text); |
90 |
+ sv_setpv(rv, ippGetString(attr, 0, NULL)); |
91 |
XPUSHs(rv); |
92 |
count++; |
93 |
} |
94 |
@@ -356,14 +375,14 @@ NETCUPS_getPPDFileName(ppdfilename); |
95 |
if (response != NULL) { |
96 |
attr = ippFindAttribute(response, "ppd-name", IPP_TAG_NAME ); |
97 |
while ((attr != NULL) && (i < 1)) { |
98 |
- tmpppd = attr->values[0].string.text; |
99 |
+ tmpppd = ippGetString(attr, 0, NULL); |
100 |
attr = ippFindNextAttribute(response, |
101 |
"ppd-make", |
102 |
IPP_TAG_TEXT); |
103 |
attr = ippFindNextAttribute(response, |
104 |
"ppd-make-and-model", |
105 |
IPP_TAG_TEXT); |
106 |
- if (strcmp(attr->values[0].string.text, ppdfilename) == 0 ) { |
107 |
+ if (strcmp(ippGetString(attr, 0, NULL), ppdfilename) == 0 ) { |
108 |
/* return tmpppd; */ |
109 |
strcpy(test, tmpppd); |
110 |
break; |
111 |
@@ -410,12 +429,12 @@ NETCUPS_getDeviceAttribute( device, attribute, attribute_type ) |
112 |
attr = ippFindNextAttribute(response, "printer-name", IPP_TAG_NAME); |
113 |
|
114 |
while (attr != NULL) { |
115 |
- if (strcmp(attr->values[0].string.text, device) == 0) { |
116 |
+ if (strcmp(ippGetString(attr, 0, NULL), device) == 0) { |
117 |
attr = ippFindNextAttribute( response, |
118 |
attribute, |
119 |
attribute_type); |
120 |
rv = sv_newmortal(); |
121 |
- sv_setpv( rv, attr->values[0].string.text); |
122 |
+ sv_setpv( rv, ippGetString(attr, 0, NULL)); |
123 |
XPUSHs( rv ); |
124 |
break; |
125 |
} |
126 |
@@ -858,15 +877,15 @@ NETCUPS_getAttributes( ipp ) |
127 |
SV* rv = NULL; |
128 |
int count = 0; |
129 |
ipp_attribute_t* attr = NULL; |
130 |
- for (attr = ipp->attrs; attr != NULL; attr = attr->next) |
131 |
+ for (attr = ippFirstAttribute(ipp); attr != NULL; attr = ippNextAttribute(ipp)) |
132 |
{ |
133 |
- while (attr != NULL && attr->group_tag != IPP_TAG_JOB) |
134 |
- attr = attr->next; |
135 |
+ while (attr != NULL && ippGetGroupTag(attr) != IPP_TAG_JOB) |
136 |
+ attr = ippNextAttribute(ipp); |
137 |
|
138 |
if (attr == NULL) |
139 |
break; |
140 |
rv = sv_newmortal(); |
141 |
- sv_setpv( rv, attr->name ); |
142 |
+ sv_setpv( rv, ippGetName(attr) ); |
143 |
XPUSHs( rv ); |
144 |
count++; |
145 |
} |
146 |
@@ -880,27 +899,27 @@ NETCUPS_getAttributeValue( ipp, name ) |
147 |
SV* rv = NULL; |
148 |
int count = 0; |
149 |
ipp_attribute_t* attr = NULL; |
150 |
- for (attr = ipp->attrs; attr != NULL; attr = attr->next) |
151 |
+ for (attr = ippFirstAttribute(ipp); attr != NULL; attr = ippNextAttribute(ipp)) |
152 |
{ |
153 |
- while (attr != NULL && attr->group_tag != IPP_TAG_JOB) |
154 |
- attr = attr->next; |
155 |
+ while (attr != NULL && ippGetGroupTag(attr) != IPP_TAG_JOB) |
156 |
+ attr = ippNextAttribute(ipp); |
157 |
|
158 |
if (attr == NULL) |
159 |
break; |
160 |
|
161 |
- if( !strcmp( attr->name, name ) ) |
162 |
+ if( !strcmp( ippGetName(attr), name ) ) |
163 |
{ |
164 |
rv = sv_newmortal(); |
165 |
- if( ( attr->value_tag == IPP_TAG_INTEGER ) || |
166 |
- ( attr->value_tag == IPP_TAG_ENUM ) ) |
167 |
+ if( ( ippGetValueTag(attr) == IPP_TAG_INTEGER ) || |
168 |
+ ( ippGetValueTag(attr) == IPP_TAG_ENUM ) ) |
169 |
{ |
170 |
/* We have a number with any luck ... */ |
171 |
- sv_setiv( rv, attr->values[0].integer ); |
172 |
+ sv_setiv( rv, ippGetInteger(attr, 0) ); |
173 |
} |
174 |
else |
175 |
{ |
176 |
/* We have a string ... maybe ... try to set it. */ |
177 |
- sv_setpv( rv, attr->values[0].string.text ); |
178 |
+ sv_setpv( rv, ippGetString(attr, 0, NULL) ); |
179 |
} |
180 |
|
181 |
XPUSHs( rv ); |