diff options
author | John Ralls <jralls@ceridwen.us> | 2012-02-19 15:11:24 -0800 |
---|---|---|
committer | John Ralls <jralls@ceridwen.us> | 2012-04-23 12:44:06 -0700 |
commit | 2c000c8e61e7b7f802116cc48f6b78102efbd612 (patch) | |
tree | 22204c5c4b352523a787aa453798a53ead6c0e82 /modules | |
parent | 02f57f96427bc91a72a40ba39b6a806402b64d21 (diff) | |
download | gtk+-2c000c8e61e7b7f802116cc48f6b78102efbd612.tar.gz |
Bug 670373: modules/printing/cups/gtkprintbackendcups.c won't build with CUPS 1.6
Fix up accesses of ipp structures in gtkcupsutils.c
Diffstat (limited to 'modules')
-rw-r--r-- | modules/printbackends/cups/gtkcupsutils.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/modules/printbackends/cups/gtkcupsutils.c b/modules/printbackends/cups/gtkcupsutils.c index e9cc9b6487..15132a8265 100644 --- a/modules/printbackends/cups/gtkcupsutils.c +++ b/modules/printbackends/cups/gtkcupsutils.c @@ -81,6 +81,14 @@ static GtkCupsRequestStateFunc get_states[] = { _get_read_data }; +#ifndef HAVE_CUPS_API_1_6 +#define ippSetOperation(ipp_request, ipp_op_id) ipp_request->request.op.operation_id = ipp_op_id +#define ippSetRequestId(ipp_request, ipp_rq_id) ipp_request->request.op.request_id = ipp_rq_id +#define ippSetState(ipp_request, ipp_state) ipp_request->state = ipp_state +#define ippGetString(attr, index, foo) attr->values[index].string.text +#define ippGetCount(attr) attr->num_values +#endif + static void gtk_cups_result_set_error (GtkCupsResult *result, GtkCupsErrorType error_type, @@ -163,8 +171,8 @@ gtk_cups_request_new_with_username (http_t *connection, request->data_io = data_io; request->ipp_request = ippNew (); - request->ipp_request->request.op.operation_id = operation_id; - request->ipp_request->request.op.request_id = 1; + ippSetOperation (request->ipp_request, operation_id); + ippSetRequestId (request->ipp_request, 1); language = cupsLangDefault (); @@ -353,8 +361,8 @@ gtk_cups_request_ipp_get_string (GtkCupsRequest *request, name, tag); - if (attribute != NULL && attribute->values != NULL) - return attribute->values[0].string.text; + if (attribute != NULL && ippGetCount (attribute) > 0) + return ippGetString (attribute, 0, NULL); else return NULL; } @@ -732,7 +740,7 @@ _post_send (GtkCupsRequest *request) request->attempts = 0; request->state = GTK_CUPS_POST_WRITE_REQUEST; - request->ipp_request->state = IPP_IDLE; + ippSetState (request->ipp_request, IPP_IDLE); } static void @@ -1221,7 +1229,7 @@ _get_send (GtkCupsRequest *request) request->state = GTK_CUPS_GET_CHECK; request->poll_state = GTK_CUPS_HTTP_READ; - request->ipp_request->state = IPP_IDLE; + ippSetState (request->ipp_request, IPP_IDLE); } static void |