Fix build with newer cups.

While there switch to fltk13
bump PKGREVISION
This commit is contained in:
bouyer 2020-03-05 14:57:59 +00:00
parent 128abe75d1
commit 3812a39bc1
4 changed files with 209 additions and 13 deletions

View file

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.68 2020/01/18 23:35:05 rillig Exp $
# $NetBSD: Makefile,v 1.69 2020/03/05 14:57:59 bouyer Exp $
DISTNAME= xpp-1.5
PKGREVISION= 27
PKGREVISION= 28
CATEGORIES= print x11
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=cups/}
@ -23,5 +23,5 @@ post-install:
cd ${WRKSRC} && ${INSTALL_DATA} LICENSE README ${DESTDIR}${DOCDIR}
.include "../../print/cups-base/buildlink3.mk"
.include "../../x11/fltk/buildlink3.mk"
.include "../../x11/fltk13/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.11 2015/11/04 01:03:03 agc Exp $
$NetBSD: distinfo,v 1.12 2020/03/05 14:57:59 bouyer Exp $
SHA1 (xpp-1.5.tar.gz) = 7f3c1427979516e47402a0acb708eb83b68daa61
RMD160 (xpp-1.5.tar.gz) = a64ec4c93013d1db08a6c9b6705b43850c36c337
@ -8,5 +8,5 @@ SHA1 (patch-aa) = f8df413715f4f9319f8d52358a99e54d31cd5a6f
SHA1 (patch-ab) = 76d0ca39bef410e580f805ca10a3d953285c58bb
SHA1 (patch-ac) = d94f9359d19de5dff684f61a53af4607bb31f78c
SHA1 (patch-ad) = 5af9e367c1b025ec1d9940101a8b3338d84ae5d6
SHA1 (patch-ae) = a9adc82236847b2749eceacc4b00b2973dd80058
SHA1 (patch-cupshelper.cxx) = beba4e1af0ff8a95d5d6042bd39254aa6e1d1e21
SHA1 (patch-ae) = 28aa8dcfc325f89aed0f0d4a988af713ccdb8740
SHA1 (patch-cupshelper.cxx) = 57d33096de6fdf9805d644eb21364ea8f1df3604

View file

@ -1,8 +1,8 @@
$NetBSD: patch-ae,v 1.1 2010/05/09 04:21:40 sbd Exp $
$NetBSD: patch-ae,v 1.2 2020/03/05 14:57:59 bouyer Exp $
--- xpp.cxx.orig 2004-12-07 08:00:04.000000000 +1300
+++ xpp.cxx
@@ -168,7 +168,7 @@ printFiles::printFiles(int argc, /* I -
--- 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;
@ -11,3 +11,160 @@ $NetBSD: patch-ae,v 1.1 2010/05/09 04:21:40 sbd Exp $
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);
}

View file

@ -1,7 +1,9 @@
$NetBSD: patch-cupshelper.cxx,v 1.1 2011/12/06 19:48:47 joerg Exp $
$NetBSD: patch-cupshelper.cxx,v 1.2 2020/03/05 14:57:59 bouyer Exp $
--- cupshelper.cxx.orig 2011-12-06 14:22:14.000000000 +0000
+++ cupshelper.cxx
update for new cups API
--- cupshelper.cxx.orig 2002-05-28 17:49:45.000000000 +0200
+++ cupshelper.cxx 2020-03-04 15:02:34.300403189 +0100
@@ -34,6 +34,7 @@
#include "cupshelper.h"
#include "passworddialog.h"
@ -10,3 +12,40 @@ $NetBSD: patch-cupshelper.cxx,v 1.1 2011/12/06 19:48:47 joerg Exp $
#include <stdlib.h>
#include <cups/language.h>
@@ -90,7 +91,7 @@
ipp_t* CupsHelper::newIppRequest(){
ipp_t *request = ippNew();
- request->request.op.request_id = 1;
+ ippSetRequestId(request, 1);
cups_lang_t *lang = cupsLangDefault();
ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_CHARSET,"attributes-charset",NULL,cupsLangEncoding(lang));
ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_LANGUAGE,"attributes-natural-language",NULL,lang->language);
@@ -108,7 +109,7 @@
httpClose(HTTP);
if (!answer)
return 0;
- if (answer->state == IPP_ERROR || answer->state == IPP_IDLE)
+ if (ippGetState(answer) == IPP_ERROR || ippGetState(answer) == IPP_IDLE)
{
ippDelete(answer);
return 0;
@@ -151,15 +152,15 @@
char str[256];
int value(-1);
- request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
+ ippSetOperation(request, IPP_GET_PRINTER_ATTRIBUTES);
sprintf(str,"ipp://%s:%d/printers/%s",host(),port(),name);
ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_URI,"printer-uri",NULL,str);
//sprintf(str,"/printers/%s",name);
sprintf(str,"/printers/");
request = processRequest(request,str);
- if (request && request->curtag == IPP_TAG_PRINTER) {
+ if (request) {
ipp_attribute_t *attr = ippFindAttribute(request,"printer-type",IPP_TAG_ENUM);
- if (attr) value = attr->values[0].integer;
+ if (attr) value = ippGetInteger(attr, 0);
}
ippDelete(request);
return value;