From 8fede1c92bbb3d11a197ce54d400a9947a8f33e2 Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Wed, 6 Apr 2022 13:18:16 +0200 Subject: [PATCH] libcupsfilters: Rename API functions of colormanager.h to "cf..." Also renamed constants to start with "CF_" and data types to start with "cf_". --- cupsfilters/colormanager.c | 28 +++++++++++----------- cupsfilters/colormanager.h | 39 ++++++++++++++++--------------- cupsfilters/ghostscript.c | 10 ++++---- cupsfilters/imagetoraster.c | 8 +++---- cupsfilters/mupdftopwg.c | 10 ++++---- cupsfilters/pdftoraster.cxx | 24 +++++++++---------- cupsfilters/pwgtoraster.c | 16 ++++++------- cupsfilters/rastertopdf.cpp | 32 ++++++++++++------------- filter/foomatic-rip/foomaticrip.c | 4 ++-- filter/rastertopclx.c | 8 +++---- 10 files changed, 90 insertions(+), 89 deletions(-) diff --git a/cupsfilters/colormanager.c b/cupsfilters/colormanager.c index 49505f0c9..b01eacbae 100644 --- a/cupsfilters/colormanager.c +++ b/cupsfilters/colormanager.c @@ -67,7 +67,7 @@ double blackpoint_default[3] = {0.0, 0.0, 0.0}; /* Get printer color management status from the system's color manager */ int -cmIsPrinterCmDisabled(filter_data_t *data) +cfCmIsPrinterCmDisabled(filter_data_t *data) { filter_logfunc_t log = data->logfunc; void *ld = data->logdata; @@ -88,7 +88,7 @@ cmIsPrinterCmDisabled(filter_data_t *data) /* Get printer ICC profile from the system's color manager */ int -cmGetPrinterIccProfile(filter_data_t *data, +cfCmGetPrinterIccProfile(filter_data_t *data, char **icc_profile, /* ICC Profile Path */ ppd_file_t *ppd) /* Optional PPD file for fallback profile */ { @@ -109,22 +109,22 @@ cmGetPrinterIccProfile(filter_data_t *data, /* Find the "cm-calibration" CUPS option */ -cm_calibration_t -cmGetCupsColorCalibrateMode(filter_data_t *data, +cf_cm_calibration_t +cfCmGetCupsColorCalibrateMode(filter_data_t *data, cups_option_t *options, /* Options from CUPS */ int num_options) /* Options from CUPS */ { filter_logfunc_t log = data->logfunc; void *ld = data->logdata; - cm_calibration_t status; /* color management status */ + cf_cm_calibration_t status; /* color management status */ /* Find the string in CUPS options and */ - if (cupsGetOption(CM_CALIBRATION_STRING, num_options, options) != NULL) - status = CM_CALIBRATION_ENABLED; + if (cupsGetOption(CF_CM_CALIBRATION_STRING, num_options, options) != NULL) + status = CF_CM_CALIBRATION_ENABLED; else - status = CM_CALIBRATION_DISABLED; + status = CF_CM_CALIBRATION_DISABLED; if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "Color Manager: %s", status ? @@ -140,11 +140,11 @@ cmGetCupsColorCalibrateMode(filter_data_t *data, /* Gamma values */ -double *cmGammaAdobeRgb(void) +double *cfCmGammaAdobeRGB(void) { return adobergb_gamma; } -double *cmGammaSGray(void) +double *cfCmGammaSGray(void) { return sgray_gamma; } @@ -152,11 +152,11 @@ double *cmGammaSGray(void) /* Whitepoint values */ -double *cmWhitePointAdobeRgb(void) +double *cfCmWhitePointAdobeRGB(void) { return adobergb_wp; } -double *cmWhitePointSGray(void) +double *cfCmWhitePointSGray(void) { return sgray_wp; } @@ -164,7 +164,7 @@ double *cmWhitePointSGray(void) /* Adapted primaries matrix */ -double *cmMatrixAdobeRgb(void) +double *cfCmMatrixAdobeRGB(void) { return adobergb_matrix; } @@ -172,7 +172,7 @@ double *cmMatrixAdobeRgb(void) /* Blackpoint value */ -double *cmBlackPointDefault(void) +double *cfCmBlackPointDefault(void) { return blackpoint_default; } diff --git a/cupsfilters/colormanager.h b/cupsfilters/colormanager.h index a43a317f8..c8f05812f 100644 --- a/cupsfilters/colormanager.h +++ b/cupsfilters/colormanager.h @@ -42,15 +42,17 @@ extern "C" { #include -#define CM_CALIBRATION_STRING "cm-calibration" /* String for "Color Calibration Mode" */ +#define CF_CM_CALIBRATION_STRING "cm-calibration" /* String for "Color + Calibration Mode" */ /* Enum for status of CUPS color calibration */ -typedef enum cm_calibration_e +typedef enum cf_cm_calibration_e { - CM_CALIBRATION_DISABLED = 0, /* "cm-calibration" option not found */ - CM_CALIBRATION_ENABLED = 1 /* "cm-calibration" found */ -} cm_calibration_t; + CF_CM_CALIBRATION_DISABLED = 0, /* "cm-calibration" option + not found */ + CF_CM_CALIBRATION_ENABLED = 1 /* "cm-calibration" found */ +} cf_cm_calibration_t; @@ -60,25 +62,24 @@ typedef enum cm_calibration_e extern -cm_calibration_t cmGetCupsColorCalibrateMode (filter_data_t *data, - cups_option_t *options, - int num_options); +cf_cm_calibration_t cfCmGetCupsColorCalibrateMode(filter_data_t *data, + cups_option_t *options, + int num_options); -extern int cmGetPrinterIccProfile (filter_data_t *data, - char **icc_profile, - ppd_file_t *ppd); +extern int cfCmGetPrinterIccProfile(filter_data_t *data, + char **icc_profile, + ppd_file_t *ppd); -extern int cmIsPrinterCmDisabled (filter_data_t *data); +extern int cfCmIsPrinterCmDisabled(filter_data_t *data); -extern double* cmGammaAdobeRgb (void); -extern double* cmGammaSGray (void); +extern double* cfCmGammaAdobeRGB(void); +extern double* cfCmGammaSGray(void); -extern double* cmWhitePointAdobeRgb (void); -extern double* cmWhitePointSGray (void); - -extern double* cmMatrixAdobeRgb (void); -extern double* cmBlackPointDefault (void); +extern double* cfCmWhitePointAdobeRGB(void); +extern double* cfCmWhitePointSGray(void); +extern double* cfCmMatrixAdobeRGB(void); +extern double* cfCmBlackPointDefault(void); # ifdef __cplusplus diff --git a/cupsfilters/ghostscript.c b/cupsfilters/ghostscript.c index 4fe19b5a1..973a62501 100644 --- a/cupsfilters/ghostscript.c +++ b/cupsfilters/ghostscript.c @@ -718,7 +718,7 @@ ghostscript(int inputfd, /* I - File descriptor input stream */ ipp_t *printer_attrs = data->printer_attrs; ipp_t *job_attrs = data->job_attrs; struct sigaction sa; - cm_calibration_t cm_calibrate; + cf_cm_calibration_t cm_calibrate; int pxlcolor = 0; /* 1 if printer is color printer otherwise 0. */ ppd_attr_t *attr; ipp_attribute_t *ipp_attr; @@ -982,15 +982,15 @@ ghostscript(int inputfd, /* I - File descriptor input stream */ "Print rendering intent = %s", h.cupsRenderingIntent); /* Check status of color management in CUPS */ - cm_calibrate = cmGetCupsColorCalibrateMode(data, options, num_options); + cm_calibrate = cfCmGetCupsColorCalibrateMode(data, options, num_options); - if (cm_calibrate == CM_CALIBRATION_ENABLED) + if (cm_calibrate == CF_CM_CALIBRATION_ENABLED) cm_disabled = 1; else - cm_disabled = cmIsPrinterCmDisabled(data); + cm_disabled = cfCmIsPrinterCmDisabled(data); if (!cm_disabled) - cmGetPrinterIccProfile(data, &icc_profile, ppd); + cfCmGetPrinterIccProfile(data, &icc_profile, ppd); /* Ghostscript parameters */ gs_args = cupsArrayNew(NULL, NULL); diff --git a/cupsfilters/imagetoraster.c b/cupsfilters/imagetoraster.c index 84fa7d6ac..fb02dd569 100644 --- a/cupsfilters/imagetoraster.c +++ b/cupsfilters/imagetoraster.c @@ -247,7 +247,7 @@ imagetoraster(int inputfd, /* I - File descriptor input stream */ int fd; /* File descriptor for temp file */ char buf[BUFSIZ]; int bytes; - cm_calibration_t cm_calibrate; /* Are we color calibrating the + cf_cm_calibration_t cm_calibrate; /* Are we color calibrating the device? */ int cm_disabled; /* Color management disabled? */ int fillprint = 0; /* print-scaling = fill */ @@ -669,12 +669,12 @@ imagetoraster(int inputfd, /* I - File descriptor input stream */ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "Resolution = %s", resolution); /* support the "cm-calibration" option */ - cm_calibrate = cmGetCupsColorCalibrateMode(data, options, num_options); + cm_calibrate = cfCmGetCupsColorCalibrateMode(data, options, num_options); - if (cm_calibrate == CM_CALIBRATION_ENABLED) + if (cm_calibrate == CF_CM_CALIBRATION_ENABLED) cm_disabled = 1; else - cm_disabled = cmIsPrinterCmDisabled(data); + cm_disabled = cfCmIsPrinterCmDisabled(data); /* * Choose the appropriate colorspace... diff --git a/cupsfilters/mupdftopwg.c b/cupsfilters/mupdftopwg.c index 899a22360..68e75a715 100644 --- a/cupsfilters/mupdftopwg.c +++ b/cupsfilters/mupdftopwg.c @@ -411,7 +411,7 @@ mupdftopwg (int inputfd, /* I - File descriptor input stream */ int status = 1; ppd_file_t *ppd = NULL; struct sigaction sa; - cm_calibration_t cm_calibrate; + cf_cm_calibration_t cm_calibrate; filter_logfunc_t log = data->logfunc; void *ld = data->logdata; filter_iscanceledfunc_t iscanceled = data->iscanceledfunc; @@ -496,15 +496,15 @@ mupdftopwg (int inputfd, /* I - File descriptor input stream */ goto out; /* Check status of color management in CUPS */ - cm_calibrate = cmGetCupsColorCalibrateMode(data, options, num_options); + cm_calibrate = cfCmGetCupsColorCalibrateMode(data, options, num_options); - if (cm_calibrate == CM_CALIBRATION_ENABLED) + if (cm_calibrate == CF_CM_CALIBRATION_ENABLED) cm_disabled = 1; else - cm_disabled = cmIsPrinterCmDisabled(data); + cm_disabled = cfCmIsPrinterCmDisabled(data); if (!cm_disabled) - cmGetPrinterIccProfile(data, &icc_profile, ppd); + cfCmGetPrinterIccProfile(data, &icc_profile, ppd); /* Find print-rendering-intent */ diff --git a/cupsfilters/pdftoraster.cxx b/cupsfilters/pdftoraster.cxx index 9aeef8fad..33c98fd5d 100644 --- a/cupsfilters/pdftoraster.cxx +++ b/cupsfilters/pdftoraster.cxx @@ -107,7 +107,7 @@ typedef struct cms_profile_s cmsCIEXYZ D65WhitePoint; int renderingIntent = INTENT_PERCEPTUAL; int cm_disabled = 0; - cm_calibration_t cm_calibrate; + cf_cm_calibration_t cm_calibrate; } cms_profile_t; typedef struct pdftoraster_doc_s @@ -163,7 +163,7 @@ typedef struct conversion_function_s cmsCIExyY adobergb_wp() { - double * xyY = cmWhitePointAdobeRgb(); + double * xyY = cfCmWhitePointAdobeRGB(); cmsCIExyY wp; wp.x = xyY[0]; @@ -175,7 +175,7 @@ cmsCIExyY adobergb_wp() cmsCIExyY sgray_wp() { - double * xyY = cmWhitePointSGray(); + double * xyY = cfCmWhitePointSGray(); cmsCIExyY wp; wp.x = xyY[0]; @@ -189,7 +189,7 @@ cmsCIExyYTRIPLE adobergb_matrix() { cmsCIExyYTRIPLE m; - double * matrix = cmMatrixAdobeRgb(); + double * matrix = cfCmMatrixAdobeRGB(); m.Red.x = matrix[0]; m.Red.y = matrix[1]; @@ -423,15 +423,15 @@ static int parseOpts(filter_data_t *data, } /* support the CUPS "cm-calibration" option */ - doc->colour_profile.cm_calibrate = cmGetCupsColorCalibrateMode(data, options, num_options); + doc->colour_profile.cm_calibrate = cfCmGetCupsColorCalibrateMode(data, options, num_options); - if (doc->colour_profile.cm_calibrate == CM_CALIBRATION_ENABLED) + if (doc->colour_profile.cm_calibrate == CF_CM_CALIBRATION_ENABLED) doc->colour_profile.cm_disabled = 1; else - doc->colour_profile.cm_disabled = cmIsPrinterCmDisabled(data); + doc->colour_profile.cm_disabled = cfCmIsPrinterCmDisabled(data); if (!doc->colour_profile.cm_disabled) - cmGetPrinterIccProfile(data, &profile, doc->ppd); + cfCmGetPrinterIccProfile(data, &profile, doc->ppd); if (profile != NULL) { doc->colour_profile.colorProfile = cmsOpenProfileFromFile(profile,"r"); @@ -502,15 +502,15 @@ static int parseOpts(filter_data_t *data, } /* support the CUPS "cm-calibration" option */ - doc->colour_profile.cm_calibrate = cmGetCupsColorCalibrateMode(data, options, num_options); + doc->colour_profile.cm_calibrate = cfCmGetCupsColorCalibrateMode(data, options, num_options); - if (doc->colour_profile.cm_calibrate == CM_CALIBRATION_ENABLED) + if (doc->colour_profile.cm_calibrate == CF_CM_CALIBRATION_ENABLED) doc->colour_profile.cm_disabled = 1; else - doc->colour_profile.cm_disabled = cmIsPrinterCmDisabled(data); + doc->colour_profile.cm_disabled = cfCmIsPrinterCmDisabled(data); if (!doc->colour_profile.cm_disabled) - cmGetPrinterIccProfile(data, &profile, doc->ppd); + cfCmGetPrinterIccProfile(data, &profile, doc->ppd); if (profile != NULL) { doc->colour_profile.colorProfile = cmsOpenProfileFromFile(profile,"r"); diff --git a/cupsfilters/pwgtoraster.c b/cupsfilters/pwgtoraster.c index 21c1296ab..833b4f790 100644 --- a/cupsfilters/pwgtoraster.c +++ b/cupsfilters/pwgtoraster.c @@ -99,7 +99,7 @@ typedef struct cms_profile_s cmsCIEXYZ D65WhitePoint; int renderingIntent; int cm_disabled; - cm_calibration_t cm_calibrate; + cf_cm_calibration_t cm_calibrate; } cms_profile_t; typedef struct pwgtoraster_doc_s @@ -153,7 +153,7 @@ typedef struct conversion_function_s cmsCIExyY adobergb_wp_cms() { - double * xyY = cmWhitePointAdobeRgb(); + double * xyY = cfCmWhitePointAdobeRGB(); cmsCIExyY wp; wp.x = xyY[0]; @@ -165,7 +165,7 @@ cmsCIExyY adobergb_wp_cms() cmsCIExyY sgray_wp_cms() { - double * xyY = cmWhitePointSGray(); + double * xyY = cfCmWhitePointSGray(); cmsCIExyY wp; wp.x = xyY[0]; @@ -179,7 +179,7 @@ cmsCIExyYTRIPLE adobergb_matrix_cms() { cmsCIExyYTRIPLE m; - double * matrix = cmMatrixAdobeRgb(); + double * matrix = cfCmMatrixAdobeRGB(); m.Red.x = matrix[0]; m.Red.y = matrix[1]; @@ -382,15 +382,15 @@ static int parseOpts(filter_data_t *data, } /* support the CUPS "cm-calibration" option */ - doc->color_profile.cm_calibrate = cmGetCupsColorCalibrateMode(data, options, num_options); + doc->color_profile.cm_calibrate = cfCmGetCupsColorCalibrateMode(data, options, num_options); - if (doc->color_profile.cm_calibrate == CM_CALIBRATION_ENABLED) + if (doc->color_profile.cm_calibrate == CF_CM_CALIBRATION_ENABLED) doc->color_profile.cm_disabled = 1; else - doc->color_profile.cm_disabled = cmIsPrinterCmDisabled(data); + doc->color_profile.cm_disabled = cfCmIsPrinterCmDisabled(data); if (!doc->color_profile.cm_disabled) - cmGetPrinterIccProfile(data, &profile, doc->ppd); + cfCmGetPrinterIccProfile(data, &profile, doc->ppd); if (profile != NULL) { doc->color_profile.colorProfile = cmsOpenProfileFromFile(profile,"r"); diff --git a/cupsfilters/rastertopdf.cpp b/cupsfilters/rastertopdf.cpp index 230e76bd6..7af7905dd 100644 --- a/cupsfilters/rastertopdf.cpp +++ b/cupsfilters/rastertopdf.cpp @@ -775,12 +775,12 @@ QPDFObjectHandle makeImage(QPDF &pdf, PointerHolder page_data, break; case CUPS_CSPACE_SW: if (use_blackpoint) - dict["/ColorSpace"]=getCalGrayArray(cmWhitePointSGray(), - cmGammaSGray(), - cmBlackPointDefault()); + dict["/ColorSpace"]=getCalGrayArray(cfCmWhitePointSGray(), + cfCmGammaSGray(), + cfCmBlackPointDefault()); else - dict["/ColorSpace"]=getCalGrayArray(cmWhitePointSGray(), - cmGammaSGray(), 0); + dict["/ColorSpace"]=getCalGrayArray(cfCmWhitePointSGray(), + cfCmGammaSGray(), 0); break; case CUPS_CSPACE_CMYK: dict["/ColorSpace"]=QPDFObjectHandle::newName("/DeviceCMYK"); @@ -797,14 +797,14 @@ QPDFObjectHandle makeImage(QPDF &pdf, PointerHolder page_data, break; case CUPS_CSPACE_ADOBERGB: if (use_blackpoint) - dict["/ColorSpace"]=getCalRGBArray(cmWhitePointAdobeRgb(), - cmGammaAdobeRgb(), - cmMatrixAdobeRgb(), - cmBlackPointDefault()); + dict["/ColorSpace"]=getCalRGBArray(cfCmWhitePointAdobeRGB(), + cfCmGammaAdobeRGB(), + cfCmMatrixAdobeRGB(), + cfCmBlackPointDefault()); else - dict["/ColorSpace"]=getCalRGBArray(cmWhitePointAdobeRgb(), - cmGammaAdobeRgb(), - cmMatrixAdobeRgb(), 0); + dict["/ColorSpace"]=getCalRGBArray(cfCmWhitePointAdobeRGB(), + cfCmGammaAdobeRGB(), + cfCmMatrixAdobeRGB(), 0); break; default: if (doc->logfunc) @@ -1386,7 +1386,7 @@ rastertopdf(int inputfd, /* I - File descriptor input stream */ FILE *outputfp; /* Output data stream */ filter_out_format_t outformat; /* Output format */ int Page, empty = 1; - cm_calibration_t cm_calibrate; /* Status of CUPS color management + cf_cm_calibration_t cm_calibrate; /* Status of CUPS color management ("on" or "off") */ struct pdf_info pdf; cups_raster_t *ras; /* Raster stream for printing */ @@ -1442,13 +1442,13 @@ rastertopdf(int inputfd, /* I - File descriptor input stream */ doc.iscanceleddata = icd; /* support the CUPS "cm-calibration" option */ - cm_calibrate = cmGetCupsColorCalibrateMode(data, data->options, data->num_options); + cm_calibrate = cfCmGetCupsColorCalibrateMode(data, data->options, data->num_options); if (outformat == OUTPUT_FORMAT_PCLM || - cm_calibrate == CM_CALIBRATION_ENABLED) + cm_calibrate == CF_CM_CALIBRATION_ENABLED) doc.cm_disabled = 1; else - doc.cm_disabled = cmIsPrinterCmDisabled(data); + doc.cm_disabled = cfCmIsPrinterCmDisabled(data); if (outformat == OUTPUT_FORMAT_PCLM && data->ppd == NULL && printer_attrs == NULL ) diff --git a/filter/foomatic-rip/foomaticrip.c b/filter/foomatic-rip/foomaticrip.c index a03c83726..b1de607cf 100644 --- a/filter/foomatic-rip/foomaticrip.c +++ b/filter/foomatic-rip/foomaticrip.c @@ -916,7 +916,7 @@ int main(int argc, char** argv) /* Check status of printer color management from the color manager */ data->printer = job->printer; - cm_disabled = cmIsPrinterCmDisabled(data); + cm_disabled = cfCmIsPrinterCmDisabled(data); _log("'CM Color Calibration' Mode in SPOOLER-LESS: %s\n", cm_calibrate ? "Activated" : "Off"); @@ -1042,7 +1042,7 @@ int main(int argc, char** argv) _log("INFO: Using qualifer: '%s.%s.%s'\n", qualifier[0], qualifier[1], qualifier[2]); - cmGetPrinterIccProfile(data, (char **)&icc_profile, 0); + cfCmGetPrinterIccProfile(data, (char **)&icc_profile, 0); /* fall back to PPD */ if (icc_profile == NULL) { diff --git a/filter/rastertopclx.c b/filter/rastertopclx.c index 8dbab3ec8..43f41f8dc 100644 --- a/filter/rastertopclx.c +++ b/filter/rastertopclx.c @@ -135,7 +135,7 @@ StartPage(filter_data_t *data, /* I - filter data */ 0.0, 1.0 }; - cm_calibration_t cm_calibrate; /* Color calibration mode */ + cf_cm_calibration_t cm_calibrate; /* Color calibration mode */ /* * Debug info... @@ -347,12 +347,12 @@ StartPage(filter_data_t *data, /* I - filter data */ fprintf(stderr, "DEBUG: Resolution = %s\n", resolution); /* support the "cm-calibration" option */ - cm_calibrate = cmGetCupsColorCalibrateMode(data, options, num_options); + cm_calibrate = cfCmGetCupsColorCalibrateMode(data, options, num_options); - if (cm_calibrate == CM_CALIBRATION_ENABLED) + if (cm_calibrate == CF_CM_CALIBRATION_ENABLED) cm_disabled = 1; else - cm_disabled = cmIsPrinterCmDisabled(data); + cm_disabled = cfCmIsPrinterCmDisabled(data); if (ppd && !cm_disabled) { -- 2.47.3