From 974ab2c02850c1bbd3b1c11b9291e9dca2e18b1f Mon Sep 17 00:00:00 2001 From: Biswadeep Purkayastha <98874428+metabiswadeep@users.noreply.github.com> Date: Tue, 10 Oct 2023 04:19:09 +0530 Subject: [PATCH 1/7] Update cups array api --- cupsfilters/filter.c | 16 ++++++++-------- cupsfilters/ghostscript.c | 12 ++++++------ cupsfilters/image.c | 2 +- cupsfilters/imagetopdf.c | 2 +- cupsfilters/imagetoraster.c | 2 +- cupsfilters/ipp.c | 28 ++++++++++++++-------------- cupsfilters/mupdftopwg.c | 4 ++-- cupsfilters/universal.c | 4 ++-- 8 files changed, 35 insertions(+), 35 deletions(-) diff --git a/cupsfilters/filter.c b/cupsfilters/filter.c index ed5bdbbf4..cb5d5d785 100644 --- a/cupsfilters/filter.c +++ b/cupsfilters/filter.c @@ -128,9 +128,9 @@ get_filter_data_ext_entry(cups_array_t *ext_array, if (!ext_array || !name) return (NULL); - for (entry = (cf_filter_data_ext_t *)cupsArrayFirst(ext_array); + for (entry = (cf_filter_data_ext_t *)cupsArrayGetFirst(ext_array); entry; - entry = (cf_filter_data_ext_t *)cupsArrayNext(ext_array)) + entry = (cf_filter_data_ext_t *)cupsArrayGetNext(ext_array)) if (strcmp(entry->name, name) == 0) break; @@ -649,9 +649,9 @@ cfFilterChain(int inputfd, // I - File descriptor input stream // Remove NULL filters... // - for (filter = (cf_filter_filter_in_chain_t *)cupsArrayFirst(filter_chain); + for (filter = (cf_filter_filter_in_chain_t *)cupsArrayGetFirst(filter_chain); filter; - filter = (cf_filter_filter_in_chain_t *)cupsArrayNext(filter_chain)) + filter = (cf_filter_filter_in_chain_t *)cupsArrayGetNext(filter_chain)) { if (!filter->function) { @@ -705,11 +705,11 @@ cfFilterChain(int inputfd, // I - File descriptor input stream filterfds[1][0] = -1; filterfds[1][1] = -1; - for (filter = (cf_filter_filter_in_chain_t *)cupsArrayFirst(filter_chain); + for (filter = (cf_filter_filter_in_chain_t *)cupsArrayGetFirst(filter_chain); filter; filter = next, current = 1 - current) { - next = (cf_filter_filter_in_chain_t *)cupsArrayNext(filter_chain); + next = (cf_filter_filter_in_chain_t *)cupsArrayGetNext(filter_chain); if (filterfds[1 - current][0] > 1) { @@ -824,9 +824,9 @@ cfFilterChain(int inputfd, // I - File descriptor input stream { if (log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterChain: Job canceled, killing filters ..."); - for (pid_entry = (filter_function_pid_t *)cupsArrayFirst(pids); + for (pid_entry = (filter_function_pid_t *)cupsArrayGetFirst(pids); pid_entry; - pid_entry = (filter_function_pid_t *)cupsArrayNext(pids)) + pid_entry = (filter_function_pid_t *)cupsArrayGetNext(pids)) { kill(pid_entry->pid, SIGTERM); free(pid_entry); diff --git a/cupsfilters/ghostscript.c b/cupsfilters/ghostscript.c index 9f16290a1..ca97e4d26 100644 --- a/cupsfilters/ghostscript.c +++ b/cupsfilters/ghostscript.c @@ -459,10 +459,10 @@ gs_spawn (const char *filename, // Put Ghostscript command line argument into an array for the "exec()" // call - numargs = cupsArrayCount(gs_args); + numargs = cupsArrayGetCount(gs_args); gsargv = calloc(numargs + 1, sizeof(char *)); - for (argument = (char *)cupsArrayFirst(gs_args), i = 0; argument; - argument = (char *)cupsArrayNext(gs_args), i++) + for (argument = (char *)cupsArrayGetFirst(gs_args), i = 0; argument; + argument = (char *)cupsArrayGetNext(gs_args), i++) gsargv[i] = argument; gsargv[i] = NULL; @@ -938,7 +938,7 @@ cfFilterGhostscript(int inputfd, // I - File descriptor input if (!inputseekable || doc_type == GS_DOC_TYPE_PS) { - if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0) + if ((fd = cupsCreateTempFd(tempfile, sizeof(tempfile))) < 0) { if (log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterGhostscript: Unable to copy PDF file: %s", @@ -1090,7 +1090,7 @@ cfFilterGhostscript(int inputfd, // I - File descriptor input } // Ghostscript parameters - gs_args = cupsArrayNew(NULL, NULL); + gs_args = cupsArrayNew3(NULL, NULL); if (!gs_args) { if (log) log(ld, CF_LOGLEVEL_ERROR, @@ -1685,7 +1685,7 @@ cfFilterGhostscript(int inputfd, // I - File descriptor input unlink(filename); if (gs_args) { - while ((tmp = cupsArrayFirst(gs_args)) != NULL) + while ((tmp = cupsArrayGetFirst(gs_args)) != NULL) { cupsArrayRemove(gs_args, tmp); free(tmp); diff --git a/cupsfilters/image.c b/cupsfilters/image.c index 6337f00b7..2063c0195 100644 --- a/cupsfilters/image.c +++ b/cupsfilters/image.c @@ -685,7 +685,7 @@ flush_tile(cf_image_t *img) // I - Image if (img->cachefile < 0) { - if ((img->cachefile = cupsTempFd(img->cachename, + if ((img->cachefile = cupsCreateTempFd(img->cachename, sizeof(img->cachename))) < 0) { tile->ic = NULL; diff --git a/cupsfilters/imagetopdf.c b/cupsfilters/imagetopdf.c index 7871d8daf..111def899 100644 --- a/cupsfilters/imagetopdf.c +++ b/cupsfilters/imagetopdf.c @@ -677,7 +677,7 @@ cfFilterImageToPDF(int inputfd, // I - File descriptor input stream if (!inputseekable) { - if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0) + if ((fd = cupsCreateTempFd(tempfile, sizeof(tempfile))) < 0) { if (log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterImageToPDF: Unable to copy input: %s", diff --git a/cupsfilters/imagetoraster.c b/cupsfilters/imagetoraster.c index fb7f57e42..ecdca73b8 100644 --- a/cupsfilters/imagetoraster.c +++ b/cupsfilters/imagetoraster.c @@ -360,7 +360,7 @@ cfFilterImageToRaster(int inputfd, // I - File descriptor input stream if (!inputseekable) { - if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0) + if ((fd = cupsCreateTempFd(tempfile, sizeof(tempfile))) < 0) { if (log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterImageToRaster: Unable to copy input: %s", diff --git a/cupsfilters/ipp.c b/cupsfilters/ipp.c index a0814ae5b..6607f44cb 100644 --- a/cupsfilters/ipp.c +++ b/cupsfilters/ipp.c @@ -359,7 +359,7 @@ cfGetPrinterAttributes5(http_t *http_printer, NULL, pattrs); response = cupsDoRequest(http_printer, request, resource); - ipp_status = cupsLastError(); + ipp_status = cupsGetError(); if (response) { @@ -370,7 +370,7 @@ cfGetPrinterAttributes5(http_t *http_printer, if (debug) log_printf(cf_get_printer_attributes_log, "Full list of all IPP attributes:\n"); - attr = ippFirstAttribute(response); + attr = ippGetFirstAttribute(response); while (attr) { total_attrs ++; @@ -385,7 +385,7 @@ cfGetPrinterAttributes5(http_t *http_printer, if ((kw = ippGetString(attr, i, NULL)) != NULL) log_printf(cf_get_printer_attributes_log, " Keyword: %s\n", kw); } - attr = ippNextAttribute(response); + attr = ippGetNextAttribute(response); } // Check whether the IPP response contains the required attributes @@ -437,7 +437,7 @@ cfGetPrinterAttributes5(http_t *http_printer, ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", NULL, "media-col-database"); response2 = cupsDoRequest(http_printer, request, resource); - ipp_status = cupsLastError(); + ipp_status = cupsGetError(); if (response2) { if ((attr = ippFindAttribute(response2, "media-col-database", @@ -461,7 +461,7 @@ cfGetPrinterAttributes5(http_t *http_printer, { log_printf(cf_get_printer_attributes_log, "Request for IPP attributes (get-printer-attributes) for printer with URI %s failed: %s\n", - uri, cupsLastErrorString()); + uri, cupsGetErrorString()); log_printf(cf_get_printer_attributes_log, "get-printer-attributes IPP request failed:\n"); log_printf(cf_get_printer_attributes_log, " - No response\n"); } @@ -1276,8 +1276,8 @@ cfJoinJobOptionsAndAttrs(cf_filter_data_t* data, // I - Filter data for (i = 0, opt = data->options; i < data->num_options; i ++, opt ++) num_options = cupsAddOption(opt->name, opt->value, num_options, options); - for (ipp_attr = ippFirstAttribute(job_attrs); ipp_attr; - ipp_attr = ippNextAttribute(job_attrs)) + for (ipp_attr = ippGetFirstAttribute(job_attrs); ipp_attr; + ipp_attr = ippGetNextAttribute(job_attrs)) { ippAttributeString(ipp_attr, buf, sizeof(buf)); num_options = cupsAddOption(ippGetName(ipp_attr), buf, @@ -1532,7 +1532,7 @@ cfIPPAttrToResolutionArray(ipp_attribute_t *attr) cfFreeResolution(res, NULL); } } - if (cupsArrayCount(res_array) == 0) + if (cupsArrayGetCount(res_array) == 0) { cupsArrayDelete(res_array); res_array = NULL; @@ -1569,7 +1569,7 @@ cfJoinResolutionArrays(cups_array_t **current, int retval; if (current == NULL || new_arr == NULL || *new_arr == NULL || - cupsArrayCount(*new_arr) == 0) + cupsArrayGetCount(*new_arr) == 0) { retval = 0; goto finish; @@ -1588,7 +1588,7 @@ cfJoinResolutionArrays(cups_array_t **current, } return 1; } - else if (cupsArrayCount(*current) == 0) + else if (cupsArrayGetCount(*current) == 0) { retval = 1; goto finish; @@ -1596,8 +1596,8 @@ cfJoinResolutionArrays(cups_array_t **current, // Dry run: Check whether the two arrays have at least one resolution // in common, if not, do not touch the original array - for (res = cupsArrayFirst(*current); - res; res = cupsArrayNext(*current)) + for (res = cupsArrayGetFirst(*current); + res; res = cupsArrayGetNext(*current)) if (cupsArrayFind(*new_arr, res)) break; @@ -1606,8 +1606,8 @@ cfJoinResolutionArrays(cups_array_t **current, // Reduce the original array to the resolutions which are in both // the original and the new array, at least one resolution will // remain. - for (res = cupsArrayFirst(*current); - res; res = cupsArrayNext(*current)) + for (res = cupsArrayGetFirst(*current); + res; res = cupsArrayGetNext(*current)) if (!cupsArrayFind(*new_arr, res)) cupsArrayRemove(*current, res); if (current_default) diff --git a/cupsfilters/mupdftopwg.c b/cupsfilters/mupdftopwg.c index d7dd59e4c..83b169468 100644 --- a/cupsfilters/mupdftopwg.c +++ b/cupsfilters/mupdftopwg.c @@ -191,8 +191,8 @@ mutool_spawn(const char *filename, // call numargs = cupsArrayCount(mutool_args); mutoolargv = calloc(numargs + 1, sizeof(char *)); - for (argument = (char *)cupsArrayFirst(mutool_args), i = 0; argument; - argument = (char *)cupsArrayNext(mutool_args), i++) + for (argument = (char *)cupsArrayGetFirst(mutool_args), i = 0; argument; + argument = (char *)cupsArrayGetNext(mutool_args), i++) mutoolargv[i] = argument; mutoolargv[i] = NULL; diff --git a/cupsfilters/universal.c b/cupsfilters/universal.c index 7218af622..dbc20d615 100644 --- a/cupsfilters/universal.c +++ b/cupsfilters/universal.c @@ -340,10 +340,10 @@ cfFilterUniversal(int inputfd, // I - File descriptor input stream // Do the dirty work ... ret = cfFilterChain(inputfd, outputfd, inputseekable, data, filter_chain); - for (filter = (cf_filter_filter_in_chain_t *)cupsArrayFirst(filter_chain); + for (filter = (cf_filter_filter_in_chain_t *)cupsArrayGetFirst(filter_chain); filter; filter = next) { - next = (cf_filter_filter_in_chain_t *)cupsArrayNext(filter_chain); + next = (cf_filter_filter_in_chain_t *)cupsArrayGetNext(filter_chain); free(filter->parameters); free(filter); } From 4ae85d79297b67b84365b71277251ee0ca877f7d Mon Sep 17 00:00:00 2001 From: Biswadeep Purkayastha <98874428+metabiswadeep@users.noreply.github.com> Date: Tue, 10 Oct 2023 04:41:27 +0530 Subject: [PATCH 2/7] Some more updates --- cupsfilters/ghostscript.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cupsfilters/ghostscript.c b/cupsfilters/ghostscript.c index ca97e4d26..e2d24e242 100644 --- a/cupsfilters/ghostscript.c +++ b/cupsfilters/ghostscript.c @@ -938,7 +938,7 @@ cfFilterGhostscript(int inputfd, // I - File descriptor input if (!inputseekable || doc_type == GS_DOC_TYPE_PS) { - if ((fd = cupsCreateTempFd(tempfile, sizeof(tempfile))) < 0) + if ((fd = cupsCreateTempFd(NULL, NULL, tempfile, sizeof(tempfile))) < 0) { if (log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterGhostscript: Unable to copy PDF file: %s", @@ -1090,7 +1090,8 @@ cfFilterGhostscript(int inputfd, // I - File descriptor input } // Ghostscript parameters - gs_args = cupsArrayNew3(NULL, NULL); + gs_args = cupsArrayNew3(NULL, NULL, 0, 0, + 0, 0); if (!gs_args) { if (log) log(ld, CF_LOGLEVEL_ERROR, From 3d9dab9a975769427e34507522ecec28179a23c1 Mon Sep 17 00:00:00 2001 From: Biswadeep Purkayastha <98874428+metabiswadeep@users.noreply.github.com> Date: Tue, 10 Oct 2023 05:05:48 +0530 Subject: [PATCH 3/7] Update image.c --- cupsfilters/image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cupsfilters/image.c b/cupsfilters/image.c index 2063c0195..1ba0d5e67 100644 --- a/cupsfilters/image.c +++ b/cupsfilters/image.c @@ -685,7 +685,7 @@ flush_tile(cf_image_t *img) // I - Image if (img->cachefile < 0) { - if ((img->cachefile = cupsCreateTempFd(img->cachename, + if ((img->cachefile = cupsCreateTempFd(NULL, NULL, img->cachename, sizeof(img->cachename))) < 0) { tile->ic = NULL; From 6f44b44f6c05dc8fa2a070404828129d900e0ecc Mon Sep 17 00:00:00 2001 From: Biswadeep Purkayastha <98874428+metabiswadeep@users.noreply.github.com> Date: Tue, 10 Oct 2023 05:33:59 +0530 Subject: [PATCH 4/7] Few more updates --- cupsfilters/imagetopdf.c | 2 +- cupsfilters/imagetoraster.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cupsfilters/imagetopdf.c b/cupsfilters/imagetopdf.c index 111def899..612b9629f 100644 --- a/cupsfilters/imagetopdf.c +++ b/cupsfilters/imagetopdf.c @@ -677,7 +677,7 @@ cfFilterImageToPDF(int inputfd, // I - File descriptor input stream if (!inputseekable) { - if ((fd = cupsCreateTempFd(tempfile, sizeof(tempfile))) < 0) + if ((fd = cupsCreateTempFd(NULL, NULL, tempfile, sizeof(tempfile))) < 0) { if (log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterImageToPDF: Unable to copy input: %s", diff --git a/cupsfilters/imagetoraster.c b/cupsfilters/imagetoraster.c index ecdca73b8..ad5a9f2ee 100644 --- a/cupsfilters/imagetoraster.c +++ b/cupsfilters/imagetoraster.c @@ -360,7 +360,7 @@ cfFilterImageToRaster(int inputfd, // I - File descriptor input stream if (!inputseekable) { - if ((fd = cupsCreateTempFd(tempfile, sizeof(tempfile))) < 0) + if ((fd = cupsCreateTempFd(NULL, NULL, tempfile, sizeof(tempfile))) < 0) { if (log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterImageToRaster: Unable to copy input: %s", From 6ac075f8a6d548cf513cdfd999cbf5981a5e77cf Mon Sep 17 00:00:00 2001 From: Biswadeep Purkayastha <98874428+metabiswadeep@users.noreply.github.com> Date: Tue, 10 Oct 2023 20:10:02 +0530 Subject: [PATCH 5/7] Update ipp.h --- cupsfilters/ipp.h | 1 + 1 file changed, 1 insertion(+) diff --git a/cupsfilters/ipp.h b/cupsfilters/ipp.h index 20beeec33..7faea2fe6 100644 --- a/cupsfilters/ipp.h +++ b/cupsfilters/ipp.h @@ -7,6 +7,7 @@ #ifndef _CUPS_FILTERS_IPP_H_ # define _CUPS_FILTERS_IPP_H_ +#define HTTP_URI_OK HTTP_URI_STATUS_OK # ifdef __cplusplus extern "C" { From 63449617d6a86321d391f0b36a202f96bb62bb1b Mon Sep 17 00:00:00 2001 From: Biswadeep Purkayastha <98874428+metabiswadeep@users.noreply.github.com> Date: Wed, 11 Oct 2023 01:49:17 +0530 Subject: [PATCH 6/7] More changes --- cupsfilters/ipp.c | 4 ++-- cupsfilters/ipp.h | 1 - cupsfilters/mupdftopwg.c | 4 ++-- cupsfilters/texttotext.c | 2 +- cupsfilters/universal.c | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cupsfilters/ipp.c b/cupsfilters/ipp.c index 6607f44cb..da461430b 100644 --- a/cupsfilters/ipp.c +++ b/cupsfilters/ipp.c @@ -288,7 +288,7 @@ cfGetPrinterAttributes5(http_t *http_printer, host_name, sizeof(host_name), &(host_port), resource, sizeof(resource)); - if (uri_status != HTTP_URI_OK) + if (uri_status != HTTP_URI_STATUS_OK) { // Invalid URI log_printf(cf_get_printer_attributes_log, @@ -527,7 +527,7 @@ cfResolveURI2 (const char *uri, int is_fax) userpass, sizeof(userpass), hostname, sizeof(hostname), &port, resource, sizeof(resource)); - if (status < HTTP_URI_OK) + if (status < HTTP_URI_STATUS_OK) // Invalid URI goto error; diff --git a/cupsfilters/ipp.h b/cupsfilters/ipp.h index 7faea2fe6..20beeec33 100644 --- a/cupsfilters/ipp.h +++ b/cupsfilters/ipp.h @@ -7,7 +7,6 @@ #ifndef _CUPS_FILTERS_IPP_H_ # define _CUPS_FILTERS_IPP_H_ -#define HTTP_URI_OK HTTP_URI_STATUS_OK # ifdef __cplusplus extern "C" { diff --git a/cupsfilters/mupdftopwg.c b/cupsfilters/mupdftopwg.c index 83b169468..fc7e79208 100644 --- a/cupsfilters/mupdftopwg.c +++ b/cupsfilters/mupdftopwg.c @@ -189,7 +189,7 @@ mutool_spawn(const char *filename, // Put mutool command line argument into an array for the "exec()" // call - numargs = cupsArrayCount(mutool_args); + numargs = cupsArrayGetCount(mutool_args); mutoolargv = calloc(numargs + 1, sizeof(char *)); for (argument = (char *)cupsArrayGetFirst(mutool_args), i = 0; argument; argument = (char *)cupsArrayGetNext(mutool_args), i++) @@ -525,7 +525,7 @@ cfFilterMuPDFToPWG(int inputfd, // I - File descriptor input stream goto out; // mutool parameters - mupdf_args = cupsArrayNew(NULL, NULL); + mupdf_args = cupsArrayNew3(NULL, NULL, 0, 0, 0, 0); if (!mupdf_args) { if (log) log(ld, CF_LOGLEVEL_ERROR, diff --git a/cupsfilters/texttotext.c b/cupsfilters/texttotext.c index 022a277f5..a10974b60 100644 --- a/cupsfilters/texttotext.c +++ b/cupsfilters/texttotext.c @@ -809,7 +809,7 @@ cfFilterTextToText(int inputfd, // I - File descriptor input stream if (pagination && ((num_copies != 1 && collate) || reverse_order)) // Create page array - page_array = cupsArrayNew(NULL, NULL); + page_array = cupsArrayNew3(NULL, NULL, 0, 0, 0, 0); // Main loop for reading the input file, converting the encoding, formatting // the output, and printing the pages diff --git a/cupsfilters/universal.c b/cupsfilters/universal.c index dbc20d615..1b664efbe 100644 --- a/cupsfilters/universal.c +++ b/cupsfilters/universal.c @@ -85,7 +85,7 @@ cfFilterUniversal(int inputfd, // I - File descriptor input stream sscanf(output, "%15[^/]/%255s", output_super, output_type); cups_array_t *filter_chain; - filter_chain = cupsArrayNew(NULL, NULL); + filter_chain = cupsArrayNew3(NULL, NULL, 0, 0, 0, 0); if (!strcasecmp(input_super, "image") && strcasecmp(input_type, "urf") && strcasecmp(input_type, "pwg-raster")) From 464a8266d81734914e970175c5563152af62708e Mon Sep 17 00:00:00 2001 From: Biswadeep Purkayastha <98874428+metabiswadeep@users.noreply.github.com> Date: Wed, 18 Oct 2023 22:28:36 +0530 Subject: [PATCH 7/7] Revert warning changes --- cupsfilters/filter.c | 16 ++++++++-------- cupsfilters/ghostscript.c | 13 ++++++------- cupsfilters/image.c | 2 +- cupsfilters/imagetopdf.c | 2 +- cupsfilters/imagetoraster.c | 2 +- cupsfilters/ipp.c | 28 ++++++++++++++-------------- cupsfilters/mupdftopwg.c | 8 ++++---- cupsfilters/texttotext.c | 2 +- cupsfilters/universal.c | 6 +++--- 9 files changed, 39 insertions(+), 40 deletions(-) diff --git a/cupsfilters/filter.c b/cupsfilters/filter.c index cb5d5d785..ed5bdbbf4 100644 --- a/cupsfilters/filter.c +++ b/cupsfilters/filter.c @@ -128,9 +128,9 @@ get_filter_data_ext_entry(cups_array_t *ext_array, if (!ext_array || !name) return (NULL); - for (entry = (cf_filter_data_ext_t *)cupsArrayGetFirst(ext_array); + for (entry = (cf_filter_data_ext_t *)cupsArrayFirst(ext_array); entry; - entry = (cf_filter_data_ext_t *)cupsArrayGetNext(ext_array)) + entry = (cf_filter_data_ext_t *)cupsArrayNext(ext_array)) if (strcmp(entry->name, name) == 0) break; @@ -649,9 +649,9 @@ cfFilterChain(int inputfd, // I - File descriptor input stream // Remove NULL filters... // - for (filter = (cf_filter_filter_in_chain_t *)cupsArrayGetFirst(filter_chain); + for (filter = (cf_filter_filter_in_chain_t *)cupsArrayFirst(filter_chain); filter; - filter = (cf_filter_filter_in_chain_t *)cupsArrayGetNext(filter_chain)) + filter = (cf_filter_filter_in_chain_t *)cupsArrayNext(filter_chain)) { if (!filter->function) { @@ -705,11 +705,11 @@ cfFilterChain(int inputfd, // I - File descriptor input stream filterfds[1][0] = -1; filterfds[1][1] = -1; - for (filter = (cf_filter_filter_in_chain_t *)cupsArrayGetFirst(filter_chain); + for (filter = (cf_filter_filter_in_chain_t *)cupsArrayFirst(filter_chain); filter; filter = next, current = 1 - current) { - next = (cf_filter_filter_in_chain_t *)cupsArrayGetNext(filter_chain); + next = (cf_filter_filter_in_chain_t *)cupsArrayNext(filter_chain); if (filterfds[1 - current][0] > 1) { @@ -824,9 +824,9 @@ cfFilterChain(int inputfd, // I - File descriptor input stream { if (log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterChain: Job canceled, killing filters ..."); - for (pid_entry = (filter_function_pid_t *)cupsArrayGetFirst(pids); + for (pid_entry = (filter_function_pid_t *)cupsArrayFirst(pids); pid_entry; - pid_entry = (filter_function_pid_t *)cupsArrayGetNext(pids)) + pid_entry = (filter_function_pid_t *)cupsArrayNext(pids)) { kill(pid_entry->pid, SIGTERM); free(pid_entry); diff --git a/cupsfilters/ghostscript.c b/cupsfilters/ghostscript.c index e2d24e242..9f16290a1 100644 --- a/cupsfilters/ghostscript.c +++ b/cupsfilters/ghostscript.c @@ -459,10 +459,10 @@ gs_spawn (const char *filename, // Put Ghostscript command line argument into an array for the "exec()" // call - numargs = cupsArrayGetCount(gs_args); + numargs = cupsArrayCount(gs_args); gsargv = calloc(numargs + 1, sizeof(char *)); - for (argument = (char *)cupsArrayGetFirst(gs_args), i = 0; argument; - argument = (char *)cupsArrayGetNext(gs_args), i++) + for (argument = (char *)cupsArrayFirst(gs_args), i = 0; argument; + argument = (char *)cupsArrayNext(gs_args), i++) gsargv[i] = argument; gsargv[i] = NULL; @@ -938,7 +938,7 @@ cfFilterGhostscript(int inputfd, // I - File descriptor input if (!inputseekable || doc_type == GS_DOC_TYPE_PS) { - if ((fd = cupsCreateTempFd(NULL, NULL, tempfile, sizeof(tempfile))) < 0) + if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0) { if (log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterGhostscript: Unable to copy PDF file: %s", @@ -1090,8 +1090,7 @@ cfFilterGhostscript(int inputfd, // I - File descriptor input } // Ghostscript parameters - gs_args = cupsArrayNew3(NULL, NULL, 0, 0, - 0, 0); + gs_args = cupsArrayNew(NULL, NULL); if (!gs_args) { if (log) log(ld, CF_LOGLEVEL_ERROR, @@ -1686,7 +1685,7 @@ cfFilterGhostscript(int inputfd, // I - File descriptor input unlink(filename); if (gs_args) { - while ((tmp = cupsArrayGetFirst(gs_args)) != NULL) + while ((tmp = cupsArrayFirst(gs_args)) != NULL) { cupsArrayRemove(gs_args, tmp); free(tmp); diff --git a/cupsfilters/image.c b/cupsfilters/image.c index 1ba0d5e67..6337f00b7 100644 --- a/cupsfilters/image.c +++ b/cupsfilters/image.c @@ -685,7 +685,7 @@ flush_tile(cf_image_t *img) // I - Image if (img->cachefile < 0) { - if ((img->cachefile = cupsCreateTempFd(NULL, NULL, img->cachename, + if ((img->cachefile = cupsTempFd(img->cachename, sizeof(img->cachename))) < 0) { tile->ic = NULL; diff --git a/cupsfilters/imagetopdf.c b/cupsfilters/imagetopdf.c index 612b9629f..7871d8daf 100644 --- a/cupsfilters/imagetopdf.c +++ b/cupsfilters/imagetopdf.c @@ -677,7 +677,7 @@ cfFilterImageToPDF(int inputfd, // I - File descriptor input stream if (!inputseekable) { - if ((fd = cupsCreateTempFd(NULL, NULL, tempfile, sizeof(tempfile))) < 0) + if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0) { if (log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterImageToPDF: Unable to copy input: %s", diff --git a/cupsfilters/imagetoraster.c b/cupsfilters/imagetoraster.c index ad5a9f2ee..fb7f57e42 100644 --- a/cupsfilters/imagetoraster.c +++ b/cupsfilters/imagetoraster.c @@ -360,7 +360,7 @@ cfFilterImageToRaster(int inputfd, // I - File descriptor input stream if (!inputseekable) { - if ((fd = cupsCreateTempFd(NULL, NULL, tempfile, sizeof(tempfile))) < 0) + if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0) { if (log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterImageToRaster: Unable to copy input: %s", diff --git a/cupsfilters/ipp.c b/cupsfilters/ipp.c index da461430b..34c763a77 100644 --- a/cupsfilters/ipp.c +++ b/cupsfilters/ipp.c @@ -359,7 +359,7 @@ cfGetPrinterAttributes5(http_t *http_printer, NULL, pattrs); response = cupsDoRequest(http_printer, request, resource); - ipp_status = cupsGetError(); + ipp_status = cupsLastError(); if (response) { @@ -370,7 +370,7 @@ cfGetPrinterAttributes5(http_t *http_printer, if (debug) log_printf(cf_get_printer_attributes_log, "Full list of all IPP attributes:\n"); - attr = ippGetFirstAttribute(response); + attr = ippFirstAttribute(response); while (attr) { total_attrs ++; @@ -385,7 +385,7 @@ cfGetPrinterAttributes5(http_t *http_printer, if ((kw = ippGetString(attr, i, NULL)) != NULL) log_printf(cf_get_printer_attributes_log, " Keyword: %s\n", kw); } - attr = ippGetNextAttribute(response); + attr = ippNextAttribute(response); } // Check whether the IPP response contains the required attributes @@ -437,7 +437,7 @@ cfGetPrinterAttributes5(http_t *http_printer, ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", NULL, "media-col-database"); response2 = cupsDoRequest(http_printer, request, resource); - ipp_status = cupsGetError(); + ipp_status = cupsLastError(); if (response2) { if ((attr = ippFindAttribute(response2, "media-col-database", @@ -461,7 +461,7 @@ cfGetPrinterAttributes5(http_t *http_printer, { log_printf(cf_get_printer_attributes_log, "Request for IPP attributes (get-printer-attributes) for printer with URI %s failed: %s\n", - uri, cupsGetErrorString()); + uri, cupsLastErrorString()); log_printf(cf_get_printer_attributes_log, "get-printer-attributes IPP request failed:\n"); log_printf(cf_get_printer_attributes_log, " - No response\n"); } @@ -1276,8 +1276,8 @@ cfJoinJobOptionsAndAttrs(cf_filter_data_t* data, // I - Filter data for (i = 0, opt = data->options; i < data->num_options; i ++, opt ++) num_options = cupsAddOption(opt->name, opt->value, num_options, options); - for (ipp_attr = ippGetFirstAttribute(job_attrs); ipp_attr; - ipp_attr = ippGetNextAttribute(job_attrs)) + for (ipp_attr = ippFirstAttribute(job_attrs); ipp_attr; + ipp_attr = ippNextAttribute(job_attrs)) { ippAttributeString(ipp_attr, buf, sizeof(buf)); num_options = cupsAddOption(ippGetName(ipp_attr), buf, @@ -1532,7 +1532,7 @@ cfIPPAttrToResolutionArray(ipp_attribute_t *attr) cfFreeResolution(res, NULL); } } - if (cupsArrayGetCount(res_array) == 0) + if (cupsArrayCount(res_array) == 0) { cupsArrayDelete(res_array); res_array = NULL; @@ -1569,7 +1569,7 @@ cfJoinResolutionArrays(cups_array_t **current, int retval; if (current == NULL || new_arr == NULL || *new_arr == NULL || - cupsArrayGetCount(*new_arr) == 0) + cupsArrayCount(*new_arr) == 0) { retval = 0; goto finish; @@ -1588,7 +1588,7 @@ cfJoinResolutionArrays(cups_array_t **current, } return 1; } - else if (cupsArrayGetCount(*current) == 0) + else if (cupsArrayCount(*current) == 0) { retval = 1; goto finish; @@ -1596,8 +1596,8 @@ cfJoinResolutionArrays(cups_array_t **current, // Dry run: Check whether the two arrays have at least one resolution // in common, if not, do not touch the original array - for (res = cupsArrayGetFirst(*current); - res; res = cupsArrayGetNext(*current)) + for (res = cupsArrayFirst(*current); + res; res = cupsArrayNext(*current)) if (cupsArrayFind(*new_arr, res)) break; @@ -1606,8 +1606,8 @@ cfJoinResolutionArrays(cups_array_t **current, // Reduce the original array to the resolutions which are in both // the original and the new array, at least one resolution will // remain. - for (res = cupsArrayGetFirst(*current); - res; res = cupsArrayGetNext(*current)) + for (res = cupsArrayFirst(*current); + res; res = cupsArrayNext(*current)) if (!cupsArrayFind(*new_arr, res)) cupsArrayRemove(*current, res); if (current_default) diff --git a/cupsfilters/mupdftopwg.c b/cupsfilters/mupdftopwg.c index fc7e79208..d7dd59e4c 100644 --- a/cupsfilters/mupdftopwg.c +++ b/cupsfilters/mupdftopwg.c @@ -189,10 +189,10 @@ mutool_spawn(const char *filename, // Put mutool command line argument into an array for the "exec()" // call - numargs = cupsArrayGetCount(mutool_args); + numargs = cupsArrayCount(mutool_args); mutoolargv = calloc(numargs + 1, sizeof(char *)); - for (argument = (char *)cupsArrayGetFirst(mutool_args), i = 0; argument; - argument = (char *)cupsArrayGetNext(mutool_args), i++) + for (argument = (char *)cupsArrayFirst(mutool_args), i = 0; argument; + argument = (char *)cupsArrayNext(mutool_args), i++) mutoolargv[i] = argument; mutoolargv[i] = NULL; @@ -525,7 +525,7 @@ cfFilterMuPDFToPWG(int inputfd, // I - File descriptor input stream goto out; // mutool parameters - mupdf_args = cupsArrayNew3(NULL, NULL, 0, 0, 0, 0); + mupdf_args = cupsArrayNew(NULL, NULL); if (!mupdf_args) { if (log) log(ld, CF_LOGLEVEL_ERROR, diff --git a/cupsfilters/texttotext.c b/cupsfilters/texttotext.c index a10974b60..022a277f5 100644 --- a/cupsfilters/texttotext.c +++ b/cupsfilters/texttotext.c @@ -809,7 +809,7 @@ cfFilterTextToText(int inputfd, // I - File descriptor input stream if (pagination && ((num_copies != 1 && collate) || reverse_order)) // Create page array - page_array = cupsArrayNew3(NULL, NULL, 0, 0, 0, 0); + page_array = cupsArrayNew(NULL, NULL); // Main loop for reading the input file, converting the encoding, formatting // the output, and printing the pages diff --git a/cupsfilters/universal.c b/cupsfilters/universal.c index 1b664efbe..7218af622 100644 --- a/cupsfilters/universal.c +++ b/cupsfilters/universal.c @@ -85,7 +85,7 @@ cfFilterUniversal(int inputfd, // I - File descriptor input stream sscanf(output, "%15[^/]/%255s", output_super, output_type); cups_array_t *filter_chain; - filter_chain = cupsArrayNew3(NULL, NULL, 0, 0, 0, 0); + filter_chain = cupsArrayNew(NULL, NULL); if (!strcasecmp(input_super, "image") && strcasecmp(input_type, "urf") && strcasecmp(input_type, "pwg-raster")) @@ -340,10 +340,10 @@ cfFilterUniversal(int inputfd, // I - File descriptor input stream // Do the dirty work ... ret = cfFilterChain(inputfd, outputfd, inputseekable, data, filter_chain); - for (filter = (cf_filter_filter_in_chain_t *)cupsArrayGetFirst(filter_chain); + for (filter = (cf_filter_filter_in_chain_t *)cupsArrayFirst(filter_chain); filter; filter = next) { - next = (cf_filter_filter_in_chain_t *)cupsArrayGetNext(filter_chain); + next = (cf_filter_filter_in_chain_t *)cupsArrayNext(filter_chain); free(filter->parameters); free(filter); }