summarylogtreecommitdiffstats
path: root/cups-fixes.patch
diff options
context:
space:
mode:
Diffstat (limited to 'cups-fixes.patch')
-rw-r--r--cups-fixes.patch113
1 files changed, 113 insertions, 0 deletions
diff --git a/cups-fixes.patch b/cups-fixes.patch
new file mode 100644
index 000000000000..ae8a0d2c45b1
--- /dev/null
+++ b/cups-fixes.patch
@@ -0,0 +1,113 @@
+diff -Naur a/cngpij/cngpij/bjcups.c b/cngpij/cngpij/bjcups.c
+--- a/cngpij/cngpij/bjcups.c 2019-10-31 15:00:19.000000000 +0200
++++ b/cngpij/cngpij/bjcups.c 2019-10-31 15:14:44.505666529 +0200
+@@ -66,6 +66,48 @@
+ extern int GetIPCData(LPIPCU pipc, char *sname);
+
+
++#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5)
++#define HAVE_CUPS_1_6 1
++#endif
++
++#ifndef HAVE_CUPS_1_6
++#define ippGetCount(attr) attr->num_values
++#define ippGetGroupTag(attr) attr->group_tag
++#define ippGetValueTag(attr) attr->value_tag
++#define ippGetName(attr) attr->name
++#define ippGetBoolean(attr, element) attr->values[element].boolean
++#define ippGetInteger(attr, element) attr->values[element].integer
++#define ippGetStatusCode(ipp) ipp->request.status.status_code
++#define ippGetString(attr, element, language) attr->values[element].string.text
++
++static ipp_attribute_t * ippFirstAttribute( ipp_t *ipp )
++{
++ if (!ipp)
++ return (NULL);
++ return (ipp->current = ipp->attrs);
++}
++
++static ipp_attribute_t * ippNextAttribute( ipp_t *ipp )
++{
++ if (!ipp || !ipp->current)
++ return (NULL);
++ return (ipp->current = ipp->current->next);
++}
++
++static int ippSetOperation( ipp_t *ipp, ipp_op_t op )
++{
++ ipp->request.op.operation_id = op;
++ return (1);
++}
++
++static int ippSetRequestId( ipp_t *ipp, int request_id )
++{
++ ipp->request.any.request_id = request_id;
++ return (1);
++}
++#endif
++
++
+ int get_value_and_param_array(short id, short** value, char*** param)
+ {
+ int count;
+@@ -689,8 +731,8 @@
+ else {
+ pRequest = ippNew();
+
+- pRequest->request.op.operation_id = CUPS_GET_PRINTERS;
+- pRequest->request.op.request_id = 1;
++ ippSetOperation(pRequest, CUPS_GET_PRINTERS);
++ ippSetRequestId(pRequest, 1);
+
+ pLanguage = bjcupsLangDefault(); // cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19
+
+@@ -699,29 +741,29 @@
+ ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, NULL);
+
+ if ((pResponse = cupsDoRequest(pHTTP, pRequest, "/")) != NULL) {
+- if (pResponse->request.status.status_code > IPP_OK_CONFLICT) {
++ if (ippGetStatusCode(pResponse) > IPP_OK_CONFLICT) {
+ fputs("ERROR: IPP ERROR\n", stderr);
+ goto onErr;
+ }
+ else {
+- pAttribute = pResponse->attrs;
++ pAttribute = ippFirstAttribute(pResponse);
+
+ while (pAttribute != NULL) {
+- while (pAttribute != NULL && pAttribute->group_tag != IPP_TAG_PRINTER) {
+- pAttribute = pAttribute->next;
++ while (pAttribute != NULL && ippGetGroupTag(pAttribute) != IPP_TAG_PRINTER) {
++ pAttribute = ippNextAttribute(pAttribute);
+ }
+ if (pAttribute == NULL) {
+ break;
+ }
+
+- while (pAttribute != NULL && pAttribute->group_tag == IPP_TAG_PRINTER) {
+- if (strcmp(pAttribute->name, "printer-name") == 0 && pAttribute->value_tag == IPP_TAG_NAME) {
+- pPrinter = pAttribute->values[0].string.text;
++ while (pAttribute != NULL && ippGetGroupTag(pAttribute) == IPP_TAG_PRINTER) {
++ if (strcmp(ippGetName(pAttribute), "printer-name") == 0 && ippGetValueTag(pAttribute) == IPP_TAG_NAME) {
++ pPrinter = ippGetString(pAttribute, 0, "");
+ }
+- if (strcmp(pAttribute->name, "device-uri") == 0 && pAttribute->value_tag == IPP_TAG_URI) {
+- pDUri = pAttribute->values[0].string.text;
++ if (strcmp(ippGetName(pAttribute), "device-uri") == 0 && ippGetValueTag(pAttribute) == IPP_TAG_URI) {
++ pDUri = ippGetString(pAttribute, 0, "");
+ }
+- pAttribute = pAttribute->next;
++ pAttribute = ippNextAttribute(pAttribute);
+ }
+
+ if (strcasecmp(pDestName, pPrinter) == 0) {
+@@ -730,7 +772,7 @@
+ }
+
+ if (pAttribute != NULL)
+- pAttribute = pAttribute->next;
++ pAttribute = ippNextAttribute(pAttribute);
+ }
+ }
+
+