Annotation of /trunk/epdfview/patches/epdfview-0.1.8-cups161.patch
Parent Directory | Revision Log
Revision 2071 -
(hide annotations)
(download)
Fri Feb 8 14:50:44 2013 UTC (11 years, 7 months ago) by niro
File size: 2202 byte(s)
Fri Feb 8 14:50:44 2013 UTC (11 years, 7 months ago) by niro
File size: 2202 byte(s)
-fixed build against newer cups
1 | niro | 2071 | diff -Naur epdfview-0.1.8.orig/src/PrintPter.cxx epdfview-0.1.8/src/PrintPter.cxx |
2 | --- epdfview-0.1.8.orig/src/PrintPter.cxx 2011-05-28 11:25:01.000000000 +0100 | ||
3 | +++ epdfview-0.1.8/src/PrintPter.cxx 2012-08-22 20:11:46.362436859 +0100 | ||
4 | @@ -22,6 +22,40 @@ | ||
5 | #include <locale.h> | ||
6 | #include "epdfview.h" | ||
7 | |||
8 | +#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) | ||
9 | +#define HAVE_CUPS_1_6 1 | ||
10 | +#endif | ||
11 | + | ||
12 | +#ifndef HAVE_CUPS_1_6 | ||
13 | +inline int ippGetInteger (ipp_attribute_t *attr, int element) | ||
14 | +{ | ||
15 | + return (attr->values[element].integer); | ||
16 | +} | ||
17 | + | ||
18 | +inline const char * ippGetString (ipp_attribute_t *attr, | ||
19 | + int element, | ||
20 | + const char **language /*UNUSED*/) | ||
21 | +{ | ||
22 | + return (attr->values[element].string.text); | ||
23 | +} | ||
24 | + | ||
25 | +inline int ippSetOperation (ipp_t *ipp, ipp_op_t op) | ||
26 | +{ | ||
27 | + if (!ipp) | ||
28 | + return (0); | ||
29 | + ipp->request.op.operation_id = op; | ||
30 | + return (1); | ||
31 | +} | ||
32 | + | ||
33 | +inline int ippSetRequestId (ipp_t *ipp, int request_id) | ||
34 | +{ | ||
35 | + if (!ipp) | ||
36 | + return (0); | ||
37 | + ipp->request.any.request_id = request_id; | ||
38 | + return (1); | ||
39 | +} | ||
40 | +#endif | ||
41 | + | ||
42 | using namespace ePDFView; | ||
43 | |||
44 | // Structures | ||
45 | @@ -380,8 +414,8 @@ | ||
46 | |||
47 | ipp_t *request = ippNew (); | ||
48 | |||
49 | - request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; | ||
50 | - request->request.op.request_id = 1; | ||
51 | + ippSetOperation(request, IPP_GET_PRINTER_ATTRIBUTES); | ||
52 | + ippSetRequestId(request, 1); | ||
53 | |||
54 | ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, | ||
55 | "attributes-charset", NULL, "utf-8"); | ||
56 | @@ -403,7 +437,7 @@ | ||
57 | ippFindAttribute (answer, "printer-state", IPP_TAG_ZERO); | ||
58 | if ( NULL != state ) | ||
59 | { | ||
60 | - switch (state->values[0].integer) | ||
61 | + switch (ippGetInteger (state, 0)) | ||
62 | { | ||
63 | case IPP_PRINTER_IDLE: | ||
64 | attributes->state = g_strdup (_("Idle")); | ||
65 | @@ -425,7 +459,7 @@ | ||
66 | ippFindAttribute (answer, "printer-location", IPP_TAG_ZERO); | ||
67 | if ( NULL != location ) | ||
68 | { | ||
69 | - attributes->location = g_strdup (location->values[0].string.text); | ||
70 | + attributes->location = g_strdup (ippGetString (location, 0, NULL)); | ||
71 | } | ||
72 | |||
73 | ippDelete (answer); |