Skip to content

Commit

Permalink
Re-implement cupsGetDests and cupsCreateJob using cupsEnumDests (Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed May 17, 2017
1 parent d2817c9 commit 7536de1
Show file tree
Hide file tree
Showing 6 changed files with 261 additions and 54 deletions.
4 changes: 3 additions & 1 deletion CHANGES.md
@@ -1,4 +1,4 @@
CHANGES - 2.2.4 - 2017-05-16
CHANGES - 2.2.4 - 2017-05-17
============================

CHANGES IN CUPS V2.2.4
Expand All @@ -11,6 +11,8 @@ CHANGES IN CUPS V2.2.4
- Added a new CUPS Programming Manual to replace the aging API documentation.
- Added the cupsAddIntegerOption and cupsGetIntegerOption functions
(Issue #4992)
- The cupsGetDests and cupsCreateJob functions now support Bonjour printers
(Issue #4993)
- IPP Everywhere improvements (Issue #4998)
- Fixed the "cancel all jobs" function in the web interface for several
languages (Issue #4999)
Expand Down
30 changes: 29 additions & 1 deletion cups/dest-job.c
@@ -1,7 +1,7 @@
/*
* Destination job support for CUPS.
*
* Copyright 2012-2016 by Apple Inc.
* Copyright 2012-2017 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
Expand Down Expand Up @@ -83,6 +83,13 @@ cupsCloseDestJob(

DEBUG_printf(("cupsCloseDestJob(http=%p, dest=%p(%s/%s), info=%p, job_id=%d)", (void *)http, (void *)dest, dest ? dest->name : NULL, dest ? dest->instance : NULL, (void *)info, job_id));

/*
* Get the default connection as needed...
*/

if (!http)
http = _cupsConnect();

/*
* Range check input...
*/
Expand Down Expand Up @@ -171,6 +178,13 @@ cupsCreateDestJob(
DEBUG_printf(("cupsCreateDestJob(http=%p, dest=%p(%s/%s), info=%p, "
"job_id=%p, title=\"%s\", num_options=%d, options=%p)", (void *)http, (void *)dest, dest ? dest->name : NULL, dest ? dest->instance : NULL, (void *)info, (void *)job_id, title, num_options, (void *)options));

/*
* Get the default connection as needed...
*/

if (!http)
http = _cupsConnect();

/*
* Range check input...
*/
Expand Down Expand Up @@ -251,6 +265,13 @@ cupsFinishDestDocument(
{
DEBUG_printf(("cupsFinishDestDocument(http=%p, dest=%p(%s/%s), info=%p)", (void *)http, (void *)dest, dest ? dest->name : NULL, dest ? dest->instance : NULL, (void *)info));

/*
* Get the default connection as needed...
*/

if (!http)
http = _cupsConnect();

/*
* Range check input...
*/
Expand Down Expand Up @@ -306,6 +327,13 @@ cupsStartDestDocument(

DEBUG_printf(("cupsStartDestDocument(http=%p, dest=%p(%s/%s), info=%p, job_id=%d, docname=\"%s\", format=\"%s\", num_options=%d, options=%p, last_document=%d)", (void *)http, (void *)dest, dest ? dest->name : NULL, dest ? dest->instance : NULL, (void *)info, job_id, docname, format, num_options, (void *)options, last_document));

/*
* Get the default connection as needed...
*/

if (!http)
http = _cupsConnect();

/*
* Range check input...
*/
Expand Down
79 changes: 78 additions & 1 deletion cups/dest-options.c
@@ -1,7 +1,7 @@
/*
* Destination option/media support for CUPS.
*
* Copyright 2012-2016 by Apple Inc.
* Copyright 2012-2017 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
Expand Down Expand Up @@ -85,6 +85,13 @@ cupsCheckDestSupported(
_ipp_value_t *attrval; /* Current attribute value */


/*
* Get the default connection as needed...
*/

if (!http)
http = _cupsConnect();

/*
* Range check input...
*/
Expand Down Expand Up @@ -315,6 +322,13 @@ cupsCopyDestConflicts(
if (resolved)
*resolved = NULL;

/*
* Get the default connection as needed...
*/

if (!http)
http = _cupsConnect();

/*
* Range check input...
*/
Expand Down Expand Up @@ -574,6 +588,13 @@ cupsCopyDestInfo(

DEBUG_printf(("cupsCopyDestSupported(http=%p, dest=%p(%s))", (void *)http, (void *)dest, dest ? dest->name : ""));

/*
* Get the default connection as needed...
*/

if (!http)
http = _cupsConnect();

/*
* Range check input...
*/
Expand Down Expand Up @@ -685,6 +706,13 @@ cupsFindDestDefault(
char name[IPP_MAX_NAME]; /* Attribute name */


/*
* Get the default connection as needed...
*/

if (!http)
http = _cupsConnect();

/*
* Range check input...
*/
Expand Down Expand Up @@ -726,6 +754,13 @@ cupsFindDestReady(
char name[IPP_MAX_NAME]; /* Attribute name */


/*
* Get the default connection as needed...
*/

if (!http)
http = _cupsConnect();

/*
* Range check input...
*/
Expand Down Expand Up @@ -769,6 +804,13 @@ cupsFindDestSupported(
char name[IPP_MAX_NAME]; /* Attribute name */


/*
* Get the default connection as needed...
*/

if (!http)
http = _cupsConnect();

/*
* Range check input...
*/
Expand Down Expand Up @@ -851,6 +893,13 @@ cupsGetDestMediaByIndex(
pwg_media_t *pwg; /* PWG media name for size */


/*
* Get the default connection as needed...
*/

if (!http)
http = _cupsConnect();

/*
* Range check input...
*/
Expand Down Expand Up @@ -939,6 +988,13 @@ cupsGetDestMediaByName(
pwg_media_t *pwg; /* PWG media info */


/*
* Get the default connection as needed...
*/

if (!http)
http = _cupsConnect();

/*
* Range check input...
*/
Expand Down Expand Up @@ -1007,6 +1063,13 @@ cupsGetDestMediaBySize(
pwg_media_t *pwg; /* PWG media info */


/*
* Get the default connection as needed...
*/

if (!http)
http = _cupsConnect();

/*
* Range check input...
*/
Expand Down Expand Up @@ -1058,6 +1121,13 @@ cupsGetDestMediaCount(
cups_dinfo_t *dinfo, /* I - Destination information */
unsigned flags) /* I - Media flags */
{
/*
* Get the default connection as needed...
*/

if (!http)
http = _cupsConnect();

/*
* Range check input...
*/
Expand Down Expand Up @@ -1103,6 +1173,13 @@ cupsGetDestMediaDefault(
const char *media; /* Default media size */


/*
* Get the default connection as needed...
*/

if (!http)
http = _cupsConnect();

/*
* Range check input...
*/
Expand Down

0 comments on commit 7536de1

Please sign in to comment.