1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
$NetBSD: patch-ae,v 1.2 2020/03/05 14:57:59 bouyer Exp $
--- xpp.cxx.orig 2004-12-06 20:00:04.000000000 +0100
+++ xpp.cxx 2020-03-04 15:20:53.406423152 +0100
@@ -168,7 +168,7 @@
{
char *tmp;
- if ((tmp = strchr(dest,'/'))) {
+ if ((tmp = strchr((char*)dest,'/'))) {
tmp[0] = '\0';
instance = tmp + 1;
}
@@ -287,13 +287,14 @@
// Get printer information to show in the menu entry
ipp_t *request = CupsHelper::newIppRequest();
- char buf[1024], *state, *type, *location, *comment;
+ char buf[1024];
+ const char *state, *type, *location, *comment;
sprintf(buf,"ipp://%s:%d/printers/%s",CupsHelper::host(),
CupsHelper::port(),dests[i].name);
ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_URI,"printer-uri",NULL,buf);
- request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
+ ippSetOperation(request, IPP_GET_PRINTER_ATTRIBUTES);
request = CupsHelper::processRequest(request,"/printers/");
- if (!request || request->curtag != IPP_TAG_PRINTER) {
+ if (!request) {
state = "Unknown";
type = "No Information Available";
location = "Location Unknown";
@@ -302,7 +303,7 @@
ipp_attribute_t *attr = ippFindAttribute(request,"printer-state",
IPP_TAG_ENUM);
if (attr)
- switch (attr->values[0].integer) {
+ switch (ippGetInteger(attr, 0)) {
case IPP_PRINTER_IDLE:
state = "Printer idle";
break;
@@ -316,19 +317,19 @@
else state = "Unknown";
attr = ippFindAttribute(request,"printer-info",IPP_TAG_TEXT);
if (attr)
- type = attr->values[0].string.text;
+ type = ippGetString(attr, 0, NULL);
else
type = "No Information Available";
if (strlen(type) == 0) type = "No Information Available";
attr = ippFindAttribute(request,"printer-location",IPP_TAG_TEXT);
if (attr)
- location = attr->values[0].string.text;
+ location = ippGetString(attr, 0, NULL);
else
location = "Location Unknown";
if (strlen(location) == 0) location = "Location Unknown";
attr = ippFindAttribute(request,"printer-make-and-model",IPP_TAG_TEXT);
if (attr)
- comment = attr->values[0].string.text;
+ comment = ippGetString(attr, 0, NULL);
else
comment = "";
}
@@ -714,15 +715,15 @@
// return when the request fails.
ipp_t *request = CupsHelper::newIppRequest();
- char buffer[1024], *t;
- const char *s, *u;
+ char buffer[1024], *t2;
+ const char *s, *t, *u;
sprintf(buffer,"ipp://%s:%d/printers/%s",CupsHelper::host(),
CupsHelper::port(),dests[dest_pos].name);
ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_URI,
"printer-uri",NULL,buffer);
- request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
+ ippSetOperation(request, IPP_GET_PRINTER_ATTRIBUTES);
request = CupsHelper::processRequest(request,"/printers/");
- if (!request || request->curtag != IPP_TAG_PRINTER) return;
+ if (!request) return;
// Check whether the printer supports banner pages and continue only
// if it does so
@@ -732,13 +733,13 @@
// Enable the menus and insert all available banners
before->activate();
after->activate();
- for (i = 0; i < attr->num_values; i ++) {
+ for (i = 0; i < ippGetCount(attr); i ++) {
// Use the replacement method to avoid weird banner file names
// messing up the menues
before->add("x",0,0,0,0);
- before->replace(i,attr->values[i].string.text);
+ before->replace(i,ippGetString(attr, i, NULL));
after->add("x",0,0,0,0);
- after->replace(i,attr->values[i].string.text);
+ after->replace(i,ippGetString(attr, i, NULL));
}
// Determine which banners are currently set
u = before->menu()->label();
@@ -746,18 +747,19 @@
changed_options)) {
strcpy(buffer,s);
s = buffer;
- t = strchr(buffer,',');
- if (t) {
- *t = '\0';
- t ++;
+ t2 = strchr(buffer,',');
+ if (t2) {
+ *t2 = '\0';
+ t2 ++;
} else {
- t = (char *)u;
+ t2 = (char *)u;
}
+ t = t2;
} else if ((attr = ippFindAttribute(request, "job-sheets-default",
IPP_TAG_NAME)) != NULL) {
- if (attr->num_values > 0) s = attr->values[0].string.text;
+ if (ippGetCount(attr) > 0) s = ippGetString(attr, 0, NULL);
else s = u;
- if (attr->num_values > 1) t = attr->values[1].string.text;
+ if (ippGetCount(attr) > 1) t = ippGetString(attr, 1, NULL);
else t = (char *)u;
} else {
s = u;
@@ -795,20 +797,20 @@
CupsHelper::port(),dests[dest_pos].name);
ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_URI,
"printer-uri",NULL,buffer);
- request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
+ ippSetOperation(request, IPP_GET_PRINTER_ATTRIBUTES);
request = CupsHelper::processRequest(request,"/printers/");
// Get the default settings
ipp_attribute_t *attr;
- if ((request) && (request->curtag == IPP_TAG_PRINTER))
+ if (request)
attr = ippFindAttribute(request,"job-sheets-default", IPP_TAG_NAME);
else attr = NULL;
u = before->menu()->label();
if (attr) {
- if (attr->num_values > 0) s = attr->values[0].string.text;
+ if (ippGetCount(attr) > 0) s = ippGetString(attr, 0, NULL);
else s = u;
- if (attr->num_values > 1) t = attr->values[1].string.text;
+ if (ippGetCount(attr) > 1) t = ippGetString(attr, 1, NULL);
else t = u;
} else {
s = u;
@@ -2500,7 +2502,7 @@
// Redraw the destination menu in the main window
printerPack->parent()->redraw();
- printerPack->draw();
+ printerPack->redraw();
}
@@ -2674,7 +2676,7 @@
// Redraw the destination menu in the main window
printerPack->parent()->redraw();
- printerPack->draw();
+ printerPack->redraw();
return(dest_index);
}
|