const char *resolution, /* I - Resolution */
char *spec, /* O - Final selection string */
int specsize, /* I - Size of string buffer */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Log function data */
{
ppd_attr_t *attr; /* Attribute */
*/
snprintf(spec, specsize, "%s.%s.%s", colormodel, media, resolution);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"Looking for \"*%s %s\"...", name, spec);
if ((attr = ppdFindAttr(ppd, name, spec)) != NULL && attr->value != NULL)
return (attr);
snprintf(spec, specsize, "%s.%s", colormodel, resolution);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"Looking for \"*%s %s\"...", name, spec);
if ((attr = ppdFindAttr(ppd, name, spec)) != NULL && attr->value != NULL)
return (attr);
snprintf(spec, specsize, "%s", colormodel);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"Looking for \"*%s %s\"...", name, spec);
if ((attr = ppdFindAttr(ppd, name, spec)) != NULL && attr->value != NULL)
return (attr);
snprintf(spec, specsize, "%s.%s", media, resolution);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"Looking for \"*%s %s\"...", name, spec);
if ((attr = ppdFindAttr(ppd, name, spec)) != NULL && attr->value != NULL)
return (attr);
snprintf(spec, specsize, "%s", media);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"Looking for \"*%s %s\"...", name, spec);
if ((attr = ppdFindAttr(ppd, name, spec)) != NULL && attr->value != NULL)
return (attr);
snprintf(spec, specsize, "%s", resolution);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"Looking for \"*%s %s\"...", name, spec);
if ((attr = ppdFindAttr(ppd, name, spec)) != NULL && attr->value != NULL)
return (attr);
spec[0] = '\0';
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"Looking for \"*%s\"...", name);
if ((attr = ppdFindAttr(ppd, name, spec)) != NULL && attr->value != NULL)
return (attr);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"No instance of \"*%s\" found...", name);
return (NULL);
return 1;
}
-static unsigned parse_show(char *s, filter_logfunc_t log, void *ld)
+static unsigned parse_show(char *s, cf_logfunc_t log, void *ld)
{
unsigned info = 0;
char *tok;
else if (!strcasecmp(tok, "time-at-processing"))
info |= INFO_TIME_AT_PROCESSING;
else if (log)
- log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterBannerToPDF: error: unknown value for 'Show': %s\n", tok);
+ log(ld, CF_LOGLEVEL_ERROR, "cfFilterBannerToPDF: error: unknown value for 'Show': %s\n", tok);
}
return info;
}
banner_t *banner_new_from_file(const char *filename, int *num_options,
cups_option_t **options, const char *datadir,
- filter_logfunc_t log, void *ld)
+ cf_logfunc_t log, void *ld)
{
FILE *f;
char *line = NULL;
if (!(f = fopen(filename, "r")))
{
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterBannerToPDF: Error opening temporary file with input stream");
goto out;
}
if (bytes_read == -1)
{
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterBannerToPDF: No banner instructions found in input stream");
goto out;
}
if (ispdf)
break;
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterBannerToPDF: Line %d is missing a value", linenr);
continue;
}
!strcasecmp(key, "notice"))
{
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterBannerToPDF: Note: %d: bannertopdf does not support '%s'",
linenr, key);
}
if (ispdf)
break;
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterBannerToPDF: Error: %d: unknown keyword '%s'",
linenr, key);
}
const char *jobtitle,
int noptions,
cups_option_t *options,
- filter_logfunc_t log,
+ cf_logfunc_t log,
void *ld,
FILE *outputfp)
{
if (!(doc = pdf_load_template(banner->template_file)))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"PDF template must exist and contain exactly 1 page: %s",
banner->template_file);
return (1);
if (pdf_resize_page(doc, 1, page_width, page_length, &page_scale) != 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Unable to resize requested PDF page");
pdf_free(doc);
return (1);
if (pdf_add_type1_font(doc, 1, "Courier") != 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Unable to add type1 font to requested PDF page");
pdf_free(doc);
return (1);
if ((s = tmpfile()) == NULL)
{
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterBannerToPDF: Cannot create temp file: %s\n", strerror(errno));
+ log(ld, CF_LOGLEVEL_ERROR, "cfFilterBannerToPDF: Cannot create temp file: %s\n", strerror(errno));
pdf_free(doc);
return 1;
}
if (fstat(fileno(s), &st) < 0)
{
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterBannerToPDF: Cannot fstat(): %s\n", , strerror(errno));
+ log(ld, CF_LOGLEVEL_ERROR, "cfFilterBannerToPDF: Cannot fstat(): %s\n", , strerror(errno));
return 1;
}
fseek(s, 0L, SEEK_SET);
if ((buf = malloc(st.st_size + 1)) == NULL)
{
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterBannerToPDF: Cannot malloc(): %s\n", , strerror(errno));
+ log(ld, CF_LOGLEVEL_ERROR, "cfFilterBannerToPDF: Cannot malloc(): %s\n", , strerror(errno));
return 1;
}
size_t nbytes = fread(buf, 1, st.st_size, s);
if (pdf_prepend_stream(doc, 1, buf, len) != 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Unable to prepend stream to requested PDF page");
}
}
{
if (pdf_duplicate_page(doc, 1, copies - 1) != 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Unable to duplicate requested PDF page");
}
}
size_t bytes;
const char *datadir = (const char *)parameters;
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
if (!iscanceled || !iscanceled(icd))
{
if (log)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterBannerToPDF: Unable to open input data stream.");
}
return (1);
if ((tempfd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterBannerToPDF: Unable to copy input file: %s",
strerror(errno));
return (1);
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterBannerToPDF: Copying input to temp file \"%s\"",
tempfile);
if (!iscanceled || !iscanceled(icd))
{
if (log)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterBannerToPDF: Unable to open output data stream.");
}
if (!ppd)
{
if (log)
- log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterBannerToPDF: Could not open PPD file '%s'", ppd);
+ log(ld, CF_LOGLEVEL_DEBUG, "cfFilterBannerToPDF: Could not open PPD file '%s'", ppd);
}
/*
if (!banner)
{
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterBannerToPDF: Could not read banner file");
+ log(ld, CF_LOGLEVEL_ERROR, "cfFilterBannerToPDF: Could not read banner file");
return 1;
}
const char *colormodel, /* I - ColorModel value */
const char *media, /* I - MediaType value */
const char *resolution, /* I - Resolution value */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Log function data */
{
cf_cmyk_t *cmyk; /* CMYK color separation */
break;
}
else
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Bad cupsBlackLtDk value \"%s\"!",
attr->value);
}
else
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"No light black attribute found for %s!",
spec);
}
if (sscanf(attr->value, "%f%f", &light, &dark) == 2)
cfCMYKSetLtDk(cmyk, 0, light, dark, log, ld);
else
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Bad cupsCyanLtDk value \"%s\"!",
attr->value);
}
else
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"No light cyan attribute found for %s!",
spec);
if (sscanf(attr->value, "%f%f", &light, &dark) == 2)
cfCMYKSetLtDk(cmyk, 2, light, dark, log, ld);
else
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Bad cupsMagentaLtDk value \"%s\"!",
attr->value);
}
else
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"No light magenta attribute found for %s!",
spec);
}
cfCMYKSetBlack(cf_cmyk_t *cmyk, /* I - CMYK color separation */
float lower, /* I - No black ink */
float upper, /* I - Only black ink */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Log function data */
{
int i, /* Looping var */
cmyk->color_lut[i] = 0;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfCMYKSetBlack(cmyk, lower=%.3f, upper=%.3f)",
lower, upper);
if (log)
for (i = 0; i < 256; i += 17)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
" %3d = %3dk + %3dc", i,
cmyk->black_lut[i], cmyk->color_lut[i]);
}
int num_xypoints,
/* I - Number of X,Y points */
const float *xypoints, /* I - X,Y points */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Log function data */
{
int i; /* Looping var */
for (i = xend; i < 256; i ++)
cmyk->channels[channel][i] = yend;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cupsCMYKSetXY(cmyk, channel=%d, num_xypoints=%d, "
"xypoints=[%.3f %.3f %.3f %.3f ...])", channel,
num_xypoints, xypoints[0], xypoints[1], xypoints[2],
if (log)
for (i = 0; i < 256; i += 17)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
" %3d = %4d", i,
cmyk->channels[channel + 0][i]);
}
int channel, /* I - Ink channel */
float gamval, /* I - Gamma correction */
float density, /* I - Maximum density */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Log function data */
{
int i; /* Looping var */
cmyk->channels[channel][i] = (int)(density * CF_MAX_LUT *
pow((float)i / 255.0, gamval) + 0.5);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfCMYKSetGamma(cmyk, channel=%d, gamval=%.3f, "
"density=%.3f)", channel, gamval, density);
if (log)
for (i = 0; i < 256; i += 17)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
" %3d = %4d", i,
cmyk->channels[channel + 0][i]);
}
int channel, /* I - Dark ink channel (+1 for light) */
float light, /* I - Light ink only level */
float dark, /* I - Dark ink only level */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Log function data */
{
int i, /* Looping var */
cmyk->channels[channel + 1][i] = 0;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfCMYKSetLtDk(cmyk, channel=%d, light=%.3f, "
"dark=%.3f)", channel, light, dark);
if (log)
for (i = 0; i < 256; i += 17)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
" %3d = %4dlt + %4ddk", i,
cmyk->channels[channel + 0][i], cmyk->channels[channel + 1][i]);
}
DBusConnection *con,
const char *object_path)
{
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
char *filename = NULL;
const char *interface = "org.freedesktop.ColorManager.Profile";
/* send syncronous */
dbus_error_init(&error);
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "Calling %s.Get(%s)", interface, property);
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "Calling %s.Get(%s)", interface, property);
reply = dbus_connection_send_with_reply_and_block(con,
message,
-1,
&error);
if (reply == NULL) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"DEBUG: Failed to send: %s:%s",
error.name, error.message);
dbus_error_free(&error);
/* get reply data */
dbus_message_iter_init(reply, &args);
if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_VARIANT) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"Incorrect reply type");
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,"Incorrect reply type");
goto out;
}
const char *object_path,
const char **split)
{
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
char **key = NULL;
char *profile = NULL;
/* send syncronous */
dbus_error_init(&error);
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "Calling GetProfileForQualifiers(%s...)", key[0]);
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "Calling GetProfileForQualifiers(%s...)", key[0]);
reply = dbus_connection_send_with_reply_and_block(con,
message,
-1,
&error);
if (reply == NULL) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "Failed to send: %s:%s",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "Failed to send: %s:%s",
error.name, error.message);
dbus_error_free(&error);
goto out;
/* get reply data */
dbus_message_iter_init(reply, &args);
if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "Incorrect reply type");
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "Incorrect reply type");
goto out;
}
dbus_message_iter_get_basic(&args, &tmp);
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "Found profile %s", tmp);
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "Found profile %s", tmp);
/* get filename */
profile = get_filename_for_profile_path(data, con, tmp);
DBusConnection *con,
const char *device_id)
{
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
char *device_path = NULL;
const char *device_path_tmp;
/* send syncronous */
dbus_error_init(&error);
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "Calling FindDeviceById(%s)", device_id);
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "Calling FindDeviceById(%s)", device_id);
reply = dbus_connection_send_with_reply_and_block(con,
message,
-1,
&error);
if (reply == NULL) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "Failed to send: %s:%s",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "Failed to send: %s:%s",
error.name, error.message);
dbus_error_free(&error);
goto out;
/* get reply data */
dbus_message_iter_init(reply, &args);
if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Incorrect reply type");
goto out;
}
dbus_message_iter_get_basic(&args, &device_path_tmp);
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Found device %s", device_path_tmp);
device_path = strdup(device_path_tmp);
out:
const char *device_id,
const char **qualifier_tuple)
{
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
DBusConnection *con = NULL;
char *device_path = NULL;
char *filename = NULL;
if (device_id == NULL) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"No colord device ID available");
goto out;
}
con = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
if (con == NULL) {
// If D-Bus is not reachable, gracefully leave and ignore error
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Failed to connect to system bus");
goto out;
}
/* find the device */
device_path = get_device_path_for_device_id (data, con, device_id);
if (device_path == NULL) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Failed to get device %s", device_id);
goto out;
}
/* get the best profile for the device */
filename = get_profile_for_device_path(data, con, device_path, qualifier_tuple);
if (filename == NULL || !filename[0]) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Failed to get profile filename for %s", device_id);
goto out;
}
- if(log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if(log) log(ld, CF_LOGLEVEL_ERROR,
"Use profile filename: '%s'", filename);
out:
free(device_path);
get_profile_inhibitors ( cf_filter_data_t *data,
DBusConnection *con, const char *object_path)
{
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
char *tmp;
const char *interface = "org.freedesktop.ColorManager.Device";
/* send syncronous */
dbus_error_init(&error);
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Calling %s.Get(%s)", interface, property);
reply = dbus_connection_send_with_reply_and_block(con,
message,
-1,
&error);
if (reply == NULL) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Failed to send: %s:%s",
error.name, error.message);
dbus_error_free(&error);
/* get reply data */
dbus_message_iter_init(reply, &args);
if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_VARIANT) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Incorrect reply type");
goto out;
}
dbus_message_iter_recurse(&sub2, &sub);
while (dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_INVALID) {
dbus_message_iter_get_basic(&sub, &tmp);
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Inhibitor %s exists", tmp);
dbus_message_iter_next(&sub);
inhibitors++;
cfColordGetInhibitForDeviceID (cf_filter_data_t *data,
const char *device_id)
{
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void* ld = data->logdata;
DBusConnection *con;
char *device_path = NULL;
con = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
if (con == NULL) {
// If D-Bus is not reachable, gracefully leave and ignore error
- if(log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if(log) log(ld, CF_LOGLEVEL_ERROR,
"Failed to connect to system bus");
goto out;
}
/* find the device */
device_path = get_device_path_for_device_id (data, con, device_id);
if (device_path == NULL) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Failed to get find device %s", device_id);
goto out;
}
const char *device_id,
const char **qualifier_tuple)
{
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- if(log) log(ld, FILTER_LOGLEVEL_WARN,
+ if(log) log(ld, CF_LOGLEVEL_WARN,
"not compiled with DBus support");
return NULL;
}
cfColordGetInhibitForDeviceID (cf_filter_data_t *data,
const char *device_id)
{
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- if(log) log(ld, FILTER_LOGLEVEL_WARN,
+ if(log) log(ld, CF_LOGLEVEL_WARN,
"not compiled with DBus support");
return 0;
int
cfCmIsPrinterCmDisabled(cf_filter_data_t *data)
{
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
int is_cm_off = 0; /* color management status flag */
is_cm_off = _get_colord_printer_cm_status(data);
if (is_cm_off)
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Color Manager: Color management disabled by OS.");
return is_cm_off;
char **icc_profile, /* ICC Profile Path */
ppd_file_t *ppd) /* Optional PPD file for fallback profile */
{
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
int profile_set = 0; /* 'is profile found' flag */
/* Request a profile from colord */
profile_set = _get_colord_profile(data, icc_profile, ppd);
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Color Manager: ICC Profile: %s", *icc_profile ?
*icc_profile : "None");
int num_options) /* Options from CUPS */
{
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
cf_cm_calibration_t status; /* color management status */
else
status = CF_CM_CALIBRATION_DISABLED;
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Color Manager: %s", status ?
"Calibration Mode/Enabled" : "Calibration Mode/Off");
_get_colord_printer_id( cf_filter_data_t *data)
{
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
if (data->printer == NULL) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Color Manager: Invalid printer name.");
return 0;
}
_get_colord_printer_cm_status( cf_filter_data_t *data)
{
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
/* If invalid input, we leave color management alone */
if (data->printer == NULL) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Color Manager: Invalid printer name.");
return 0;
} else if (!strcmp(data->printer, "(null)"))
ppd_file_t *ppd) /* PPD file */
{
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
if (data->printer == NULL || profile == 0) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Color Manager: Invalid input - Unable to find profile.");
return -1;
}
_get_ppd_icc_fallback (cf_filter_data_t *data, ppd_file_t *ppd, char **qualifier)
{
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
char full_path[1024];
char *icc_profile = NULL;
/* neither */
if (attr == NULL) {
- if(log) log(ld, FILTER_LOGLEVEL_INFO,
+ if(log) log(ld, CF_LOGLEVEL_INFO,
"Color Manager: no profiles specified in PPD");
goto out;
/* try to find a profile that matches the qualifier exactly */
for (;attr != NULL; attr = ppdFindNextAttr(ppd, profile_key, NULL)) {
- if(log) log(ld, FILTER_LOGLEVEL_INFO,
+ if(log) log(ld, CF_LOGLEVEL_INFO,
"Color Manager: found profile %s in PPD with qualifier '%s'",
attr->value, attr->spec);
/* check the file exists */
if (access(full_path, 0)) {
- if(log) log(ld, FILTER_LOGLEVEL_INFO,
+ if(log) log(ld, CF_LOGLEVEL_INFO,
"Color Manager: found profile %s in PPD that does not exist",
full_path);
continue;
/* no match */
if (attr == NULL) {
- if(log) log(ld, FILTER_LOGLEVEL_INFO,
+ if(log) log(ld, CF_LOGLEVEL_INFO,
"Color Manager: no profiles in PPD for qualifier '%s'",
qualifer_tmp);
goto out;
const char *media,
const char *resolution,
char *spec, int specsize,
- filter_logfunc_t log,
+ cf_logfunc_t log,
void *ld);
/*
*/
extern cf_lut_t *cfLutNew(int num_vals, const float *vals,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
extern void cfLutDelete(cf_lut_t *lut);
extern cf_lut_t *cfLutLoad(ppd_file_t *ppd,
const char *colormodel,
const char *media,
const char *resolution,
const char *ink,
- filter_logfunc_t log,
+ cf_logfunc_t log,
void *ld);
const char *colormodel,
const char *media,
const char *resolution,
- filter_logfunc_t log,
+ cf_logfunc_t log,
void *ld);
extern cf_rgb_t *cfRGBNew(int num_samples, cf_sample_t *samples,
int cube_size, int num_channels);
const char *colormodel,
const char *media,
const char *resolution,
- filter_logfunc_t log,
+ cf_logfunc_t log,
void *ld);
extern void cfCMYKSetBlack(cf_cmyk_t *cmyk,
float lower, float upper,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
extern void cfCMYKSetCurve(cf_cmyk_t *cmyk, int channel,
int num_xypoints,
const float *xypoints,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
extern void cfCMYKSetGamma(cf_cmyk_t *cmyk, int channel,
float gamval, float density,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
extern void cfCMYKSetInkLimit(cf_cmyk_t *cmyk, float limit);
extern void cfCMYKSetLtDk(cf_cmyk_t *cmyk, int channel,
float light, float dark,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
/*
void
cfCUPSLogFunc(void *data,
- filter_loglevel_t level,
+ cf_loglevel_t level,
const char *message,
...)
{
switch(level)
{
- case FILTER_LOGLEVEL_UNSPEC:
- case FILTER_LOGLEVEL_DEBUG:
+ case CF_LOGLEVEL_UNSPEC:
+ case CF_LOGLEVEL_DEBUG:
default:
fprintf(stderr, "DEBUG: ");
break;
- case FILTER_LOGLEVEL_INFO:
+ case CF_LOGLEVEL_INFO:
fprintf(stderr, "INFO: ");
break;
- case FILTER_LOGLEVEL_WARN:
+ case CF_LOGLEVEL_WARN:
fprintf(stderr, "WARN: ");
break;
- case FILTER_LOGLEVEL_ERROR:
- case FILTER_LOGLEVEL_FATAL:
+ case CF_LOGLEVEL_ERROR:
+ case CF_LOGLEVEL_FATAL:
fprintf(stderr, "ERROR: ");
break;
- case FILTER_LOGLEVEL_CONTROL:
+ case CF_LOGLEVEL_CONTROL:
break;
}
va_start(arglist, message);
const char *filename = (const char *)parameters;
ssize_t bytes, total = 0; /* Bytes read/written */
char buffer[65536]; /* Read/write buffer */
- filter_logfunc_t log = data->logfunc; /* Log function */
+ cf_logfunc_t log = data->logfunc; /* Log function */
void *ld = data->logdata; /* log function data */
int teefd = -1; /* File descriptor for "tee"ed
copy */
{
total += bytes;
if (log)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterTee (%s): Passing on%s %d bytes, total %d bytes.",
filename, teefd >= 0 ? " and copying" : "", bytes, total);
if (write(teefd, buffer, (size_t)bytes) != bytes)
{
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTee (%s): Unable to write %d bytes to the copy, stopping copy, continuing job output.",
filename, (int)bytes);
close(teefd);
if (write(outputfd, buffer, (size_t)bytes) != bytes)
{
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTee (%s): Unable to pass on %d bytes.",
filename, (int)bytes);
if (teefd >= 0)
pid, /* Process ID of filter */
ret,
infd, outfd; /* Temporary file descriptors */
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
if (inputfd < 0 && outputfd < 0)
{
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPOpen: Either inputfd or outputfd must be < 0, not both");
return (-1);
}
if (inputfd > 0 && outputfd > 0)
{
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPOpen: One of inputfd or outputfd must be < 0");
return (-1);
}
*/
if (pipe(pipefds) < 0) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPOpen: Could not create pipe for %s: %s",
inputfd < 0 ? "input" : "output",
strerror(errno));
close(infd);
close(outfd);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPOpen: Filter function completed with status %d.",
ret);
exit(ret);
} else if (pid > 0) {
- if (log) log(ld, FILTER_LOGLEVEL_INFO,
+ if (log) log(ld, CF_LOGLEVEL_INFO,
"cfFilterPOpen: Filter function (PID %d) started.", pid);
/*
* fork() error
*/
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPOpen: Could not fork to start filter function: %s",
strerror(errno));
return (-1);
{
int status, /* Exit status */
retval; /* Return value */
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
if (errno == EINTR)
goto retry_wait;
if (log)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPClose: Filter function (PID %d) stopped with an error: %s!",
filter_pid, strerror(errno));
goto out;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPClose: Filter function (PID %d) exited with no errors.",
filter_pid);
cups_array_t *pids; /* Executed filters array */
filter_function_pid_t *pid_entry, /* Entry in executed filters array */
key; /* Search key for filters */
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
filter;
filter = (cf_filter_filter_in_chain_t *)cupsArrayNext(filter_chain)) {
if (!filter->function) {
- if (log) log(ld, FILTER_LOGLEVEL_INFO,
+ if (log) log(ld, CF_LOGLEVEL_INFO,
"cfFilterChain: Invalid filter: %s - Removing...",
filter->name ? filter->name : "Unspecified");
cupsArrayRemove(filter_chain, filter);
} else
- if (log) log(ld, FILTER_LOGLEVEL_INFO,
+ if (log) log(ld, CF_LOGLEVEL_INFO,
"cfFilterChain: Running filter: %s",
filter->name ? filter->name : "Unspecified");
}
if (cupsArrayCount(filter_chain) == 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_INFO,
+ if (log) log(ld, CF_LOGLEVEL_INFO,
"cfFilterChain: No filter at all in chain, passing through the data.");
retval = 0;
while ((bytes = read(inputfd, buf, sizeof(buf))) > 0)
if (write(outputfd, buf, bytes) < bytes)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterChain: Data write error: %s", strerror(errno));
retval = 1;
break;
}
if (bytes < 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterChain: Data read error: %s", strerror(errno));
retval = 1;
}
if (next) {
if (pipe(filterfds[1 - current]) < 0) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterChain: Could not create pipe for output of %s: %s",
filter->name ? filter->name : "Unspecified filter",
strerror(errno));
close(infd);
close(outfd);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterChain: %s completed with status %d.",
filter->name ? filter->name : "Unspecified filter", ret);
exit(ret);
} else if (pid > 0) {
- if (log) log(ld, FILTER_LOGLEVEL_INFO,
+ if (log) log(ld, CF_LOGLEVEL_INFO,
"cfFilterChain: %s (PID %d) started.",
filter->name ? filter->name : "Unspecified filter", pid);
pid_entry->name = filter->name ? filter->name : "Unspecified filter";
cupsArrayAdd(pids, pid_entry);
} else {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterChain: Could not fork to start %s: %s",
filter->name ? filter->name : "Unspecified filter",
strerror(errno));
while (cupsArrayCount(pids) > 0) {
if ((pid = wait(&status)) < 0) {
if (errno == EINTR && iscanceled && iscanceled(icd)) {
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterChain: Job canceled, killing filters ...");
for (pid_entry = (filter_function_pid_t *)cupsArrayFirst(pids);
pid_entry;
if (status) {
if (WIFEXITED(status)) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterChain: %s (PID %d) stopped with status %d",
pid_entry->name, pid, WEXITSTATUS(status));
} else {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterChain: %s (PID %d) crashed on signal %d",
pid_entry->name, pid, WTERMSIG(status));
}
retval = 1;
} else {
- if (log) log(ld, FILTER_LOGLEVEL_INFO,
+ if (log) log(ld, CF_LOGLEVEL_INFO,
"cfFilterChain: %s (PID %d) exited with no errors.",
pid_entry->name, pid);
}
int stderrpipe[2]; /* Pipe to log stderr */
cups_file_t *fp; /* File pointer to read log lines */
char buf[2048]; /* Log line buffer */
- filter_loglevel_t log_level; /* Log level of filter's log message */
+ cf_loglevel_t log_level; /* Log level of filter's log message */
char *ptr1, *ptr2,
*msg, /* Filter log message */
*filter_name; /* Filter name for logging */
cups_option_t *opt;
int status = 65536;
int wstatus;
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
if (!params->filter || !params->filter[0]) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterExternalCUPS: Filter executable path/command not specified");
return (1);
}
{
for (i = 0; envp[i]; i ++)
if (!strncmp(envp[i], "AUTH_", 5))
- log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterExternalCUPS (%s): envp[%d]: AUTH_%c****",
+ log(ld, CF_LOGLEVEL_DEBUG, "cfFilterExternalCUPS (%s): envp[%d]: AUTH_%c****",
filter_name, i, envp[i][5]);
else if (!strncmp(envp[i], "DEVICE_URI=", 11))
- log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterExternalCUPS (%s): envp[%d]: DEVICE_URI=%s",
+ log(ld, CF_LOGLEVEL_DEBUG, "cfFilterExternalCUPS (%s): envp[%d]: DEVICE_URI=%s",
filter_name, i, sanitize_device_uri(envp[i] + 11,
buf, sizeof(buf)));
else
- log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterExternalCUPS (%s): envp[%d]: %s",
+ log(ld, CF_LOGLEVEL_DEBUG, "cfFilterExternalCUPS (%s): envp[%d]: %s",
filter_name, i, envp[i]);
}
/* Log the arguments */
if (log)
for (i = 0; argv[i]; i ++)
- log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterExternalCUPS (%s): argv[%d]: %s",
+ log(ld, CF_LOGLEVEL_DEBUG, "cfFilterExternalCUPS (%s): argv[%d]: %s",
filter_name, i, argv[i]);
} else {
/*
*/
if (pipe(stderrpipe) < 0) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterExternalCUPS (%s): Could not create pipe for stderr: %s",
filter_name, strerror(errno));
return (1);
if (inputfd != 0) {
if (inputfd < 0) {
inputfd = open("/dev/null", O_RDONLY);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterExternalCUPS (%s): No input file descriptor supplied for CUPS filter - %s",
filter_name, strerror(errno));
}
if (inputfd > 0) {
fcntl_add_cloexec(inputfd);
if (dup2(inputfd, 0) < 0) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterExternalCUPS (%s): Failed to connect input file descriptor with CUPS filter's stdin - %s",
filter_name, strerror(errno));
goto fd_error;
} else
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterExternalCUPS (%s): Connected input file descriptor %d to CUPS filter's stdin.",
filter_name, inputfd);
close(inputfd);
}
} else
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterExternalCUPS (%s): Input comes from stdin, letting the filter grab stdin directly",
filter_name);
execve(filter_path, argv, envp);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterExternalCUPS (%s): Execution of %s %s failed - %s",
filter_name, params->is_backend ? "backend" : "filter",
filter_path, strerror(errno));
fd_error:
exit(errno);
} else if (pid > 0) {
- if (log) log(ld, FILTER_LOGLEVEL_INFO,
+ if (log) log(ld, CF_LOGLEVEL_INFO,
"cfFilterExternalCUPS (%s): %s (PID %d) started.",
filter_name, filter_path, pid);
} else {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterExternalCUPS (%s): Unable to fork process for %s %s",
filter_name, params->is_backend ? "backend" : "filter",
filter_path);
while (cupsFileGets(fp, buf, sizeof(buf)))
if (log) {
if (strncmp(buf, "DEBUG: ", 7) == 0) {
- log_level = FILTER_LOGLEVEL_DEBUG;
+ log_level = CF_LOGLEVEL_DEBUG;
msg = buf + 7;
} else if (strncmp(buf, "DEBUG2: ", 8) == 0) {
- log_level = FILTER_LOGLEVEL_DEBUG;
+ log_level = CF_LOGLEVEL_DEBUG;
msg = buf + 8;
} else if (strncmp(buf, "INFO: ", 6) == 0) {
- log_level = FILTER_LOGLEVEL_INFO;
+ log_level = CF_LOGLEVEL_INFO;
msg = buf + 6;
} else if (strncmp(buf, "WARNING: ", 9) == 0) {
- log_level = FILTER_LOGLEVEL_WARN;
+ log_level = CF_LOGLEVEL_WARN;
msg = buf + 9;
} else if (strncmp(buf, "ERROR: ", 7) == 0) {
- log_level = FILTER_LOGLEVEL_ERROR;
+ log_level = CF_LOGLEVEL_ERROR;
msg = buf + 7;
} else if (strncmp(buf, "PAGE: ", 6) == 0 ||
strncmp(buf, "ATTR: ", 6) == 0 ||
strncmp(buf, "STATE: ", 6) == 0 ||
strncmp(buf, "PPD: ", 6) == 0) {
- log_level = FILTER_LOGLEVEL_CONTROL;
+ log_level = CF_LOGLEVEL_CONTROL;
msg = buf;
} else {
- log_level = FILTER_LOGLEVEL_DEBUG;
+ log_level = CF_LOGLEVEL_DEBUG;
msg = buf;
}
- if (log_level == FILTER_LOGLEVEL_CONTROL)
+ if (log_level == CF_LOGLEVEL_CONTROL)
log(ld, log_level, msg);
else
log(ld, log_level, "cfFilterExternalCUPS (%s): %s", filter_name, msg);
/* Ignore errors of the logging process */
exit(0);
} else if (stderrpid > 0) {
- if (log) log(ld, FILTER_LOGLEVEL_INFO,
+ if (log) log(ld, CF_LOGLEVEL_INFO,
"cfFilterExternalCUPS (%s): Logging (PID %d) started.",
filter_name, stderrpid);
} else {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterExternalCUPS (%s): Unable to fork process for logging",
filter_name);
close(stderrpipe[0]);
while (pid > 0 || stderrpid > 0) {
if ((wpid = wait(&wstatus)) < 0) {
if (errno == EINTR && iscanceled && iscanceled(icd)) {
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterExternalCUPS (%s): Job canceled, killing %s ...",
filter_name, params->is_backend ? "backend" : "filter");
kill(pid, SIGTERM);
if (wstatus) {
if (WIFEXITED(wstatus)) {
/* Via exit() anywhere or return() in the main() function */
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterExternalCUPS (%s): %s (PID %d) stopped with status %d",
filter_name,
(wpid == pid ?
wpid, WEXITSTATUS(wstatus));
} else {
/* Via signal */
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterExternalCUPS (%s): %s (PID %d) crashed on signal %d",
filter_name,
(wpid == pid ?
}
status = 1;
} else {
- if (log) log(ld, FILTER_LOGLEVEL_INFO,
+ if (log) log(ld, CF_LOGLEVEL_INFO,
"cfFilterExternalCUPS (%s): %s (PID %d) exited with no errors.",
filter_name,
(wpid == pid ?
cfFilterOpenBackAndSidePipes(
cf_filter_data_t *data) /* O - FDs in filter_data record */
{
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
if (fcntl_add_cloexec(data->side_pipe[1]))
goto out;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"Pipes for back and side channels opened");
/*
* Clean up after failure...
*/
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Unable to open pipes for back and side channels");
cfFilterCloseBackAndSidePipes(data);
cfFilterCloseBackAndSidePipes(
cf_filter_data_t *data) /* O - FDs in filter_data record */
{
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
data->side_pipe[0] = -1;
data->side_pipe[1] = -1;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"Closed the pipes for back and side channels");
}
float *PageBottom,
float *PageWidth,
float *PageLength,
- filter_logfunc_t log, /* I - Logging function,
+ cf_logfunc_t log, /* I - Logging function,
NULL for no logging */
void *ld) /* I - User data for logging function,
can be NULL */
*PageWidth = pagesize->width;
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Invalid value for page width: %.0f",
pagesize->width);
corrected = 1;
*PageLength = pagesize->length;
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Invalid value for page length: %.0f",
pagesize->length);
corrected = 1;
*PageTop = pagesize->top;
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Invalid value for page top margin: %.0f",
pagesize->top);
if (*PageLength >= *PageBottom)
*PageBottom = pagesize->bottom;
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Invalid value for page bottom margin: %.0f",
pagesize->bottom);
if (*PageLength <= *PageBottom)
}
if (*PageBottom == *PageTop)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Invalid values for page margins: Bottom: %.0f; Top: %.0f",
*PageBottom, *PageTop);
*PageTop = *PageLength - *PageBottom;
}
if (*PageBottom > *PageTop)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Invalid values for page margins: Bottom: %.0f; Top: %.0f",
*PageBottom, *PageTop);
float swap = *PageBottom;
*PageLeft = pagesize->left;
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Invalid value for page left margin: %.0f",
pagesize->left);
if (*PageWidth <= *PageLeft)
*PageRight = pagesize->right;
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Invalid value for page right margin: %.0f",
pagesize->right);
if (*PageWidth >= *PageLeft)
}
if (*PageLeft == *PageRight)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Invalid values for page margins: Left: %.0f; Right: %.0f",
*PageLeft, *PageRight);
*PageRight = *PageWidth - *PageLeft;
}
if (*PageLeft > *PageRight)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Invalid values for page margins: Left: %.0f; Right: %.0f",
*PageLeft, *PageRight);
float swap = *PageLeft;
if (corrected)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"PPD Page = %.0fx%.0f; %.0f,%.0f to %.0f,%.0f",
pagesize->width, pagesize->length, pagesize->left,
pagesize->bottom, pagesize->right, pagesize->top);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Corrected Page = %.0fx%.0f; %.0f,%.0f to %.0f,%.0f",
*PageWidth, *PageLength, *PageLeft,
*PageBottom, *PageRight, *PageTop);
}
else
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"Page = %.0fx%.0f; %.0f,%.0f to %.0f,%.0f",
pagesize->width, pagesize->length, pagesize->left,
pagesize->bottom, pagesize->right, pagesize->top);
ppd_file_t *ppd; /* PPD file data */
int back_pipe[2]; /* File descriptors of backchannel pipe */
int side_pipe[2]; /* File descriptors of sidechannel pipe */
- filter_logfunc_t logfunc; /* Logging function, NULL for no logging */
+ cf_logfunc_t logfunc; /* Logging function, NULL for no logging */
void *logdata; /* User data for logging function, can be NULL */
cf_filter_iscanceledfunc_t iscanceledfunc; /* Function returning 1 when
job is canceled, NULL for not
*/
extern void cfCUPSLogFunc(void *data,
- filter_loglevel_t level,
+ cf_loglevel_t level,
const char *message,
...);
float *PageBottom,
float *PageWidth,
float *PageLength,
- filter_logfunc_t log,
+ cf_logfunc_t log,
void *ld);
char **envp,
FILE *fp,
int outputfd,
- filter_logfunc_t log,
+ cf_logfunc_t log,
void *ld,
cf_filter_iscanceledfunc_t iscanceled,
void *icd)
int numargs;
int pid, gspid, errpid;
cups_file_t *logfp;
- filter_loglevel_t log_level;
+ cf_loglevel_t log_level;
char *msg;
int status = 65536;
int wstatus;
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
" %s%s%s", apos, gsargv[i], apos);
}
- log(ld, FILTER_LOGLEVEL_DEBUG, "%s", buf);
+ log(ld, CF_LOGLEVEL_DEBUG, "%s", buf);
for (i = 0; envp[i]; i ++)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterGhostscript: envp[%d]=\"%s\"", i, envp[i]);
}
{
infds[0] = -1;
infds[1] = -1;
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: Unable to establish stdin pipe for Ghostscript call");
goto out;
}
{
errfds[0] = -1;
errfds[1] = -1;
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: Unable to establish stderr pipe for Ghostscript call");
goto out;
}
close(infds[1]);
infds[0] = -1;
infds[1] = -1;
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: Unable to set \"close on exec\" flag on read end of the stdin pipe for Ghostscript call");
goto out;
}
{
close(infds[0]);
close(infds[1]);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: Unable to set \"close on exec\" flag on write end of the stdin pipe for Ghostscript call");
goto out;
}
close(errfds[1]);
errfds[0] = -1;
errfds[1] = -1;
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: Unable to set \"close on exec\" flag on read end of the stderr pipe for Ghostscript call");
goto out;
}
{
close(errfds[0]);
close(errfds[1]);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: Unable to set \"close on exec\" flag on write end of the stderr pipe for Ghostscript call");
goto out;
}
if (infds[0] >= 0) {
if (infds[0] != 0) {
if (dup2(infds[0], 0) < 0) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: Unable to couple pipe with stdin of Ghostscript process");
exit(1);
}
}
close(infds[1]);
} else {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: invalid pipe file descriptor to couple with stdin of Ghostscript process");
exit(1);
}
if (errfds[1] >= 2) {
if (errfds[1] != 2) {
if (dup2(errfds[1], 2) < 0) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: Unable to couple pipe with stderr of Ghostscript process");
exit(1);
}
}
close(errfds[0]);
} else {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: invalid pipe file descriptor to couple with stderr of Ghostscript process");
exit(1);
}
if (outputfd >= 1) {
if (outputfd != 1) {
if (dup2(outputfd, 1) < 0) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: Unable to couple stdout of Ghostscript process");
exit(1);
}
close(outputfd);
}
} else {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: Invalid file descriptor to couple with stdout of Ghostscript process");
exit(1);
}
/* Execute Ghostscript command line ... */
execvpe(filename, gsargv, envp);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: Unable to launch Ghostscript: %s: %s",
filename, strerror(errno));
exit(1);
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterGhostscript: Started Ghostscript (PID %d)", gspid);
close(infds[0]);
while (cupsFileGets(logfp, buf, sizeof(buf)))
if (log) {
if (strncmp(buf, "DEBUG: ", 7) == 0) {
- log_level = FILTER_LOGLEVEL_DEBUG;
+ log_level = CF_LOGLEVEL_DEBUG;
msg = buf + 7;
} else if (strncmp(buf, "DEBUG2: ", 8) == 0) {
- log_level = FILTER_LOGLEVEL_DEBUG;
+ log_level = CF_LOGLEVEL_DEBUG;
msg = buf + 8;
} else if (strncmp(buf, "INFO: ", 6) == 0) {
- log_level = FILTER_LOGLEVEL_INFO;
+ log_level = CF_LOGLEVEL_INFO;
msg = buf + 6;
} else if (strncmp(buf, "WARNING: ", 9) == 0) {
- log_level = FILTER_LOGLEVEL_WARN;
+ log_level = CF_LOGLEVEL_WARN;
msg = buf + 9;
} else if (strncmp(buf, "ERROR: ", 7) == 0) {
- log_level = FILTER_LOGLEVEL_ERROR;
+ log_level = CF_LOGLEVEL_ERROR;
msg = buf + 7;
} else {
- log_level = FILTER_LOGLEVEL_DEBUG;
+ log_level = CF_LOGLEVEL_DEBUG;
msg = buf;
}
log(ld, log_level, "cfFilterGhostscript: %s", msg);
/* Ignore errors of the logging process */
exit(0);
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterGhostscript: Started logging (PID %d)", errpid);
close(errfds[0]);
if (count == -1) {
if (errno == EINTR)
goto retry_write;
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: write failed: %s", strerror(errno));
}
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: Can't feed job data into Ghostscript");
goto out;
}
}
close (infds[1]);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterGhostscript: Input data feed completed");
while (gspid > 0 || errpid > 0) {
if ((pid = wait(&wstatus)) < 0) {
if (errno == EINTR && iscanceled && iscanceled(icd)) {
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterGhostscript: Job canceled, killing Ghostscript ...");
kill(gspid, SIGTERM);
gspid = -1;
if (wstatus) {
if (WIFEXITED(wstatus)) {
/* Via exit() anywhere or return() in the main() function */
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: %s (PID %d) stopped with status %d",
(pid == gspid ? "Ghostscript" : "Logging"), pid,
WEXITSTATUS(wstatus));
status = WEXITSTATUS(wstatus);
} else {
/* Via signal */
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: %s (PID %d) crashed on signal %d",
(pid == gspid ? "Ghostscript" : "Logging"), pid,
WTERMSIG(wstatus));
status = 256 * WTERMSIG(wstatus);
}
} else {
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterGhostscript: %s (PID %d) exited with no errors.",
(pid == gspid ? "Ghostscript" : "Logging"), pid);
status = 0;
int pxlcolor = 0; /* 1 if printer is color printer otherwise 0. */
ppd_attr_t *attr;
ipp_attribute_t *ipp_attr;
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
} else
outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterGhostscript: Output format: %s",
(outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ? "CUPS Raster" :
(outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ? "PWG Raster" :
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterGhostscript: Unable to open input data stream.");
}
if (!inputseekable || doc_type == GS_DOC_TYPE_PS) {
if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: Unable to copy PDF file: %s", strerror(errno));
fclose(fp);
return (1);
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterGhostscript: Copying input to temp file \"%s\"",
tempfile);
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterGhostscript: Unable to open temporary file.");
}
doc_type = parse_doc_type(fp);
if (doc_type == GS_DOC_TYPE_EMPTY) {
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterGhostscript: Input is empty, outputting empty file.");
status = 0;
if (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ||
if (write(outputfd, "RaS2", 4)) {};
goto out;
} if (doc_type == GS_DOC_TYPE_UNKNOWN) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: Can't detect file type");
goto out;
}
int pages = pdf_pages_fp(fp);
if (pages == 0) {
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterGhostscript: No pages left, outputting empty file.");
status = 0;
if (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ||
goto out;
}
if (pages < 0) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: Unexpected page count");
goto out;
}
FILE *pd = popen(gscommand, "r");
if (!pd) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: Failed to execute ghostscript to determine "
"number of input pages!");
goto out;
pagecount = -1;
if (pagecount == 0) {
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterGhostscript: No pages left, outputting empty file.");
status = 0;
if (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ||
goto out;
}
if (pagecount < 0) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: Unexpected page count");
goto out;
}
filename = NULL;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterGhostscript: Input format: %s",
(doc_type == GS_DOC_TYPE_PDF ? "PDF" :
(doc_type == GS_DOC_TYPE_PS ? "PostScript" :
else
{
doc_type = GS_DOC_TYPE_UNKNOWN;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterGhostscript: Input format: Not determined");
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterGhostscript: Streaming mode, no checks for input format, zero-page input, instructions from previous filter");
}
/* Find print-rendering-intent */
getPrintRenderIntent(data, &h);
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Print rendering intent = %s", h.cupsRenderingIntent);
/* Check status of color management in CUPS */
/* Ghostscript parameters */
gs_args = cupsArrayNew(NULL, NULL);
if (!gs_args) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterGhostscript: Unable to allocate memory for Ghostscript arguments array");
goto out;
}
!strcasecmp(attr->value, "yes"))) ||
(t && (!strcasecmp(t, "true") || !strcasecmp(t, "on") ||
!strcasecmp(t, "yes")))) {
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterGhostscript: Ghostscript using Center-of-Pixel method to "
"fill paths.");
cupsArrayAdd(gs_args, strdup("0 0 .setfilladjust2"));
} else
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterGhostscript: Ghostscript using Any-Part-of-Pixel method to "
"fill paths.");
int pl, pr;
int fillprint = 0; /* print-scaling = fill */
int cropfit = 0; /* -o crop-to-fit = true */
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterImageToPDF: Unable to open input data stream.");
}
if (!inputseekable) {
if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterImageToPDF: Unable to copy input: %s",
strerror(errno));
fclose(fp);
return (1);
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Copying input to temp file \"%s\"",
tempfile);
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterImageToPDF: Unable to open temporary file.");
}
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterImageToPDF: Unable to open output data stream.");
}
if (doc.img == NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterImageToPDF: Unable to open image file for printing!");
fclose(doc.outputfp);
close(outputfd);
if (yppi == 0)
yppi = xppi;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Before scaling: xppi=%d, yppi=%d, zoom=%.2f",
xppi, yppi, zoom);
doc.yprint = (doc.PageTop - doc.PageBottom) / 72.0;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Before scaling: xprint=%.1f, yprint=%.1f",
doc.xprint, doc.yprint);
doc.xinches = (float)cfImageGetWidth(doc.img) / (float)xppi;
doc.yinches = (float)cfImageGetHeight(doc.img) / (float)yppi;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Image size is %.1f x %.1f inches...",
doc.xinches, doc.yinches);
* Rotate the image if it will fit landscape but not portrait...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Auto orientation...");
if ((doc.xinches > doc.xprint || doc.yinches > doc.yprint) &&
* Rotate the image as needed...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Using landscape orientation...");
doc.Orientation = (doc.Orientation + 1) & 3;
doc.aspect = (float)cfImageGetYPPI(doc.img) /
(float)cfImageGetXPPI(doc.img);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Before scaling: xprint=%.1f, yprint=%.1f",
doc.xprint, doc.yprint);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: cfImageGetXPPI(img) = %d, "
"cfImageGetYPPI(img) = %d, aspect = %f",
cfImageGetXPPI(doc.img), cfImageGetYPPI(doc.img),
doc.aspect / cfImageGetHeight(doc.img);
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Portrait size is %.2f x %.2f inches",
doc.xsize, doc.ysize);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Landscape size is %.2f x %.2f inches",
doc.xsize2, doc.ysize2);
* portrait if they are equal...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Auto orientation...");
if ((doc.xsize * doc.ysize) < (doc.xsize2 * doc.xsize2))
* Do landscape orientation...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Using landscape orientation...");
doc.Orientation = 1;
* Do portrait orientation...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Using portrait orientation...");
doc.Orientation = 0;
}
else if (doc.Orientation & 1)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Using landscape orientation...");
doc.xinches = doc.xsize2;
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Using portrait orientation...");
doc.xinches = doc.xsize;
doc.xprint = doc.xinches / doc.xpages;
doc.yprint = doc.yinches / doc.ypages;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: xpages = %dx%.2fin, ypages = %dx%.2fin",
doc.xpages, doc.xprint, doc.ypages, doc.yprint);
length = min_length;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Updated custom page size to %.2f x %.2f "
"inches...",
width / 72.0, length / 72.0);
doc.row = malloc(cfImageGetWidth(doc.img) * abs(doc.colorspace) + 3);
if (log) {
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: XPosition=%d, YPosition=%d, Orientation=%d",
doc.XPosition, doc.YPosition, doc.Orientation);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: xprint=%.2f, yprint=%.2f", doc.xprint, doc.yprint);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: PageLeft=%.0f, PageRight=%.0f, PageWidth=%.0f",
doc.PageLeft, doc.PageRight, doc.PageWidth);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: PageBottom=%.0f, PageTop=%.0f, PageLength=%.0f",
doc.PageBottom, doc.PageTop, doc.PageLength);
}
break;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: left=%.2f, top=%.2f", doc.left, doc.top);
if (doc.Collate)
if ((contentsObjs = malloc(sizeof(int)*doc.xpages*doc.ypages)) == NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterImageToPDF: Can't allocate contentsObjs");
goto out_of_memory;
}
if ((imgObjs = malloc(sizeof(int)*doc.xpages*doc.ypages)) == NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterImageToPDF: Can't allocate imgObjs");
goto out_of_memory;
}
if (iscanceled && iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Job canceled");
goto canceled;
}
{
if (iscanceled && iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Job canceled");
goto canceled;
}
imgObjs[doc.ypages * doc.xpage + doc.ypage]) < 0)
goto out_of_memory;
if (pdf_printer && log)
- log(ld, FILTER_LOGLEVEL_CONTROL,
+ log(ld, CF_LOGLEVEL_CONTROL,
"PAGE: %d %d\n", doc.page+1, 1);
}
if (doc.EvenDuplex) {
if (outPageObject(&doc, doc.pageObjects[doc.page], -1, -1) < 0)
goto out_of_memory;
if (pdf_printer && log)
- log(ld, FILTER_LOGLEVEL_CONTROL,
+ log(ld, CF_LOGLEVEL_CONTROL,
"PAGE: %d %d\n", doc.page+1, 1);
}
}
if (iscanceled && iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Job canceled");
goto canceled;
}
{
if (iscanceled && iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Job canceled");
goto canceled;
}
imgObj) < 0)
goto out_of_memory;
if (pdf_printer && log)
- log(ld, FILTER_LOGLEVEL_CONTROL,
+ log(ld, CF_LOGLEVEL_CONTROL,
"PAGE: %d %d\n", doc.page+1, 1);
}
}
{
if (iscanceled && iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPDF: Job canceled");
goto canceled;
}
if (outPageObject(&doc, doc.pageObjects[doc.page], -1, -1) < 0)
goto out_of_memory;
if (pdf_printer && log)
- log(ld, FILTER_LOGLEVEL_CONTROL,
+ log(ld, CF_LOGLEVEL_CONTROL,
"PAGE: %d %d\n", doc.page+1, 1);
}
}
out_of_memory:
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterImageToPDF: Cannot allocate any more memory.");
freeAllObj(&doc);
cfImageClose(doc.img);
int fd; /* File descriptor for temp file */
char buf[BUFSIZ];
int bytes;
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterImageToPS: Unable to open input data stream.");
}
if (!inputseekable) {
if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterImageToPS: Unable to copy input: %s",
strerror(errno));
return (1);
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: Copying input to temp file \"%s\"",
tempfile);
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterImageToPS: Unable to open temporary file.");
}
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterImageToPS: Unable to open output data stream.");
}
if (img == NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterImageToPS: The print file could not be opened - %s",
strerror(errno));
return (1);
if (yppi == 0)
yppi = xppi;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: Before scaling: xppi=%d, yppi=%d, zoom=%.2f",
xppi, yppi, zoom);
yprint = (doc.PageTop - doc.PageBottom) / 72.0;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: Before scaling: xprint=%.1f, yprint=%.1f",
xprint, yprint);
xinches = (float)cfImageGetWidth(img) / (float)xppi;
yinches = (float)cfImageGetHeight(img) / (float)yppi;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: Image size is %.1f x %.1f inches...",
xinches, yinches);
* Rotate the image if it will fit landscape but not portrait...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: Auto orientation...");
if ((xinches > xprint || yinches > yprint) &&
* Rotate the image as needed...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: Using landscape orientation...");
doc.Orientation = (doc.Orientation + 1) & 3;
yprint = (doc.PageTop - doc.PageBottom) / 72.0;
aspect = (float)cfImageGetYPPI(img) / (float)cfImageGetXPPI(img);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: Before scaling: xprint=%.1f, yprint=%.1f",
xprint, yprint);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: cfImageGetXPPI(img) = %d, "
"cfImageGetYPPI(img) = %d, aspect = %f",
cfImageGetXPPI(img), cfImageGetYPPI(img), aspect);
cfImageGetHeight(img);
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: Portrait size is %.2f x %.2f inches",
xsize, ysize);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: Landscape size is %.2f x %.2f inches",
xsize2, ysize2);
* portrait if they are equal...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: Auto orientation...");
if ((xsize * ysize) < (xsize2 * xsize2))
* Do landscape orientation...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: Using landscape orientation...");
doc.Orientation = 1;
* Do portrait orientation...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: Using portrait orientation...");
doc.Orientation = 0;
}
else if (doc.Orientation & 1)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: Using landscape orientation...");
xinches = xsize2;
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: Using portrait orientation...");
xinches = xsize;
xprint = xinches / xpages;
yprint = yinches / ypages;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: xpages = %dx%.2fin, ypages = %dx%.2fin",
xpages, xprint, ypages, yprint);
if (length < ppd->custom_min[1])
length = ppd->custom_min[1];
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: Updated custom page size to %.2f x %.2f inches...",
width / 72.0, length / 72.0);
row = malloc(cfImageGetWidth(img) * abs(colorspace) + 3);
if (row == NULL)
{
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterImageToPS: Could not allocate memory.");
cfImageClose(img);
return (2);
if (log)
{
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: XPosition=%d, YPosition=%d, Orientation=%d",
XPosition, YPosition, doc.Orientation);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: xprint=%.1f, yprint=%.1f", xprint, yprint);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: PageLeft=%.0f, PageRight=%.0f, PageWidth=%.0f",
doc.PageLeft, doc.PageRight, doc.PageWidth);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: PageBottom=%.0f, PageTop=%.0f, PageLength=%.0f",
doc.PageBottom, doc.PageTop, doc.PageLength);
}
break;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: left=%.2f, top=%.2f", left, top);
for (page = 1; Copies > 0; Copies --)
{
if (iscanceled && iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: Job canceled");
goto canceled;
}
if (log && ppd && ppd->num_filters == 0)
- log(ld, FILTER_LOGLEVEL_CONTROL,
+ log(ld, CF_LOGLEVEL_CONTROL,
"PAGE: %d %d", page, realcopies);
- if (log) log(ld, FILTER_LOGLEVEL_INFO,
+ if (log) log(ld, CF_LOGLEVEL_INFO,
"cfFilterImageToPS: Printing page %d.", page);
fprintf(doc.outputfp, "%%%%Page: %d %d\n", page, page);
fputc(0x04, doc.outputfp);
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToPS: Printing completed.", page);
/*
PageLength; /* Total page length */
cf_ib_t OnPixels[256], /* On-pixel LUT */
OffPixels[256]; /* Off-pixel LUT */
- filter_logfunc_t logfunc; /* Logging function, NULL for no
+ cf_logfunc_t logfunc; /* Logging function, NULL for no
logging */
void *logdata; /* User data for logging function, can
be NULL */
int cm_disabled; /* Color management disabled? */
int fillprint = 0; /* print-scaling = fill */
int cropfit = 0; /* -o crop-to-fit */
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
} else
outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Final output format: %s",
(outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ? "CUPS Raster" :
(outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ? "PWG Raster" :
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Unable to open input data stream.");
}
if (!inputseekable) {
if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterImageToRaster: Unable to copy input: %s",
strerror(errno));
fclose(fp);
return (1);
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Copying input to temp file \"%s\"",
tempfile);
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Unable to open temporary file.");
}
if (log)
{
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: doc.color = %d", doc.Color);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: doc.Orientation = %d", doc.Orientation);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: doc.Duplex = %d", doc.Duplex);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: doc.PageWidth = %.1f", doc.PageWidth);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: doc.PageLength = %.1f", doc.PageLength);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: doc.PageLeft = %.1f", doc.PageLeft);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: doc.PageRight = %.1f", doc.PageRight);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: doc.PageTop = %.1f", doc.PageTop);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: doc.PageBottom = %.1f", doc.PageBottom);
}
/* Find print-rendering-intent */
getPrintRenderIntent(data, &header);
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Print rendering intent = %s",
header.cupsRenderingIntent);
}
else
resolution = strdup("300dpi");
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "Resolution = %s", resolution);
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "Resolution = %s", resolution);
/* support the "cm-calibration" option */
cm_calibrate = cfCmGetCupsColorCalibrateMode(data, options, num_options);
case CUPS_CSPACE_DEVICED :
case CUPS_CSPACE_DEVICEE :
case CUPS_CSPACE_DEVICEF :
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Colorspace %d not supported.",
header.cupsColorSpace);
if (!inputseekable)
}
else if (ppd != NULL && !cm_disabled)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Searching for profile \"%s/%s\"...",
resolution, media_type);
for (i = 0, profile = ppd->profiles; i < ppd->num_profiles;
i ++, profile ++)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: \"%s/%s\" = ", profile->resolution,
profile->media_type);
(strcmp(profile->media_type, media_type) == 0 ||
profile->media_type[0] == '-'))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: MATCH");
break;
}
else
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: no.");
}
* Open the input image to print...
*/
- if (log) log(ld, FILTER_LOGLEVEL_INFO,
+ if (log) log(ld, CF_LOGLEVEL_INFO,
"cfFilterImageToRaster: Loading print file.");
if (header.cupsColorSpace == CUPS_CSPACE_CIEXYZ ||
if (img == NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterImageToRaster: The print file could not be opened.");
return (1);
}
if (yppi == 0)
yppi = xppi;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Before scaling: xppi=%d, yppi=%d, zoom=%.2f",
xppi, yppi, zoom);
yprint = (doc.PageTop - doc.PageBottom) / 72.0;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Before scaling: xprint=%.1f, yprint=%.1f",
xprint, yprint);
xinches = (float)img->xsize / (float)xppi;
yinches = (float)img->ysize / (float)yppi;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Image size is %.1f x %.1f inches...",
xinches, yinches);
* Rotate the image if it will fit landscape but not portrait...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Auto orientation...");
if ((xinches > xprint || yinches > yprint) &&
* Rotate the image as needed...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Using landscape orientation...");
doc.Orientation = (doc.Orientation + 1) & 3;
yprint = (doc.PageTop - doc.PageBottom) / 72.0;
aspect = (float)img->yppi / (float)img->xppi;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Before scaling: xprint=%.1f, yprint=%.1f",
xprint, yprint);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: img->xppi = %d, img->yppi = %d, aspect = %f",
img->xppi, img->yppi, aspect);
xsize2 = ysize2 * img->xsize * aspect / img->ysize;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Portrait size is %.2f x %.2f inches",
xsize, ysize);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Landscape size is %.2f x %.2f inches",
xsize2, ysize2);
* portrait if they are equal...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Auto orientation...");
if ((xsize * ysize) < (xsize2 * ysize2))
* Do landscape orientation...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Using landscape orientation...");
doc.Orientation = 1;
* Do portrait orientation...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Using portrait orientation...");
doc.Orientation = 0;
}
else if (doc.Orientation & 1)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Using landscape orientation...");
xinches = xsize2;
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Using portrait orientation...");
xinches = xsize;
xprint = xinches / xpages;
yprint = yinches / ypages;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: xpages = %dx%.2fin, ypages = %dx%.2fin",
xpages, xprint, ypages, yprint);
length = min_length;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Updated custom page size to %.2f x %.2f "
"inches...",
width / 72.0, length / 72.0);
header.Margins[0] = doc.PageLeft;
header.Margins[1] = doc.PageBottom;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: PageSize = [%d %d]", header.PageSize[0],
header.PageSize[1]);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: PageLeft = %f, PageRight = %f, "
"PageBottom = %f, PageTop = %f",
doc.PageLeft, doc.PageRight, doc.PageBottom, doc.PageTop);
header.ImagingBoundingBox[2] = header.cupsImagingBBox[2];
header.ImagingBoundingBox[3] = header.cupsImagingBBox[3];
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Orientation: %d, XPosition: %d, YPosition: %d, "
"ImagingBoundingBox = [%d %d %d %d]",
doc.Orientation, doc.XPosition, doc.YPosition,
*/
if (log) {
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: cupsWidth = %d", header.cupsWidth);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: cupsHeight = %d", header.cupsHeight);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: cupsBitsPerColor = %d", header.cupsBitsPerColor);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: cupsBitsPerPixel = %d", header.cupsBitsPerPixel);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: cupsBytesPerLine = %d", header.cupsBytesPerLine);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: cupsColorOrder = %d", header.cupsColorOrder);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: cupsColorSpace = %d", header.cupsColorSpace);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: img->colorspace = %d", img->colorspace);
}
{
if (iscanceled && iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Job canceled");
goto canceled;
}
- if (log) log(ld, FILTER_LOGLEVEL_INFO,
+ if (log) log(ld, CF_LOGLEVEL_INFO,
"cfFilterImageToRaster: Formatting page %d.", page);
if (doc.Orientation & 1)
if (doc.YPosition == 0)
y /= 2;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Writing %d leading blank lines...",
y);
if (cupsRasterWritePixels(ras, row, header.cupsBytesPerLine) <
header.cupsBytesPerLine)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterImageToRaster: Unable to send raster data.");
cfImageClose(img);
return (1);
if (cupsRasterWritePixels(ras, row, header.cupsBytesPerLine) <
header.cupsBytesPerLine)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Unable to send raster data.");
cfImageClose(img);
return (1);
if (doc.YPosition == 0)
y = y - y / 2;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterImageToRaster: Writing %d trailing blank lines...",
y);
if (cupsRasterWritePixels(ras, row, header.cupsBytesPerLine) <
header.cupsBytesPerLine)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterImageToRaster: Unable to send raster data.");
cfImageClose(img);
return (1);
* Types...
*/
-typedef enum filter_loglevel_e { /* Log levels, same as PAPPL, similar
- to CUPS */
- FILTER_LOGLEVEL_UNSPEC = -1, /* Not specified */
- FILTER_LOGLEVEL_DEBUG, /* Debug message */
- FILTER_LOGLEVEL_INFO, /* Informational message */
- FILTER_LOGLEVEL_WARN, /* Warning message */
- FILTER_LOGLEVEL_ERROR, /* Error message */
- FILTER_LOGLEVEL_FATAL, /* Fatal message */
- FILTER_LOGLEVEL_CONTROL /* Control message */
-} filter_loglevel_t;
-
-typedef void (*filter_logfunc_t)(void *data, filter_loglevel_t level,
- const char *message, ...);
+typedef enum cf_loglevel_e { /* Log levels, same as PAPPL, similar
+ to CUPS */
+ CF_LOGLEVEL_UNSPEC = -1, /* Not specified */
+ CF_LOGLEVEL_DEBUG, /* Debug message */
+ CF_LOGLEVEL_INFO, /* Informational message */
+ CF_LOGLEVEL_WARN, /* Warning message */
+ CF_LOGLEVEL_ERROR, /* Error message */
+ CF_LOGLEVEL_FATAL, /* Fatal message */
+ CF_LOGLEVEL_CONTROL /* Control message */
+} cf_loglevel_t;
+
+typedef void (*cf_logfunc_t)(void *data, cf_loglevel_t level,
+ const char *message, ...);
# ifdef __cplusplus
}
const char *media, /* I - Media type */
const char *resolution, /* I - Resolution */
const char *ink, /* I - Ink name */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Log function data */
{
char name[PPD_MAX_NAME], /* Attribute name */
vals[3] = 0.0;
nvals = sscanf(attr->value, "%f%f%f", vals + 1, vals + 2, vals + 3) + 1;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"Loaded LUT %s from PPD with values [%.3f %.3f %.3f %.3f]",
name, vals[0], vals[1], vals[2], vals[3]);
cf_lut_t * /* O - New lookup table */
cfLutNew(int num_values, /* I - Number of values */
const float *values, /* I - Lookup table values */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Log function data */
{
int pixel; /* Pixel value */
if (log)
for (start = 0; start <= CF_MAX_LUT; start += CF_MAX_LUT / 15)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"%d = %d/%d/%d", start, lut[start].intensity,
lut[start].pixel, lut[start].error);
int
-parse_doc_type(FILE *fp, filter_logfunc_t log, void *ld)
+parse_doc_type(FILE *fp, cf_logfunc_t log, void *ld)
{
char buf[5];
char *rc;
if (strncmp(buf,"%PDF",4) == 0)
return 0;
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterMuPDFToPWG: input file cannot be identified");
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterMuPDFToPWG: input file cannot be identified");
return -1;
}
mutool_spawn (const char *filename,
cups_array_t *mutool_args,
int outputfd,
- filter_logfunc_t log,
+ cf_logfunc_t log,
void *ld,
cf_filter_iscanceledfunc_t iscanceled,
void *icd)
int numargs;
int pid, mutoolpid, errpid;
cups_file_t *logfp;
- filter_loglevel_t log_level;
+ cf_loglevel_t log_level;
char *msg;
int status = 65536;
int wstatus;
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
" %s%s%s", apos, mutoolargv[i], apos);
}
- log(ld, FILTER_LOGLEVEL_DEBUG, "%s", buf);
+ log(ld, CF_LOGLEVEL_DEBUG, "%s", buf);
}
/* Create a pipe for stderr output of mutool */
{
errfds[0] = -1;
errfds[1] = -1;
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterMuPDFToPWG: Unable to establish stderr pipe for mutool "
"call");
goto out;
close(errfds[1]);
errfds[0] = -1;
errfds[1] = -1;
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterMuPDFToPWG: Unable to set \"close on exec\" flag on read "
"end of the stderr pipe for mutool call");
goto out;
{
close(errfds[0]);
close(errfds[1]);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterMuPDFToPWG: Unable to set \"close on exec\" flag on write "
"end of the stderr pipe for mutool call");
goto out;
if (errfds[1] >= 2) {
if (errfds[1] != 2) {
if (dup2(errfds[1], 2) < 0) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterMuPDFToPWG: Unable to couple pipe with stderr of "
"mutool process");
exit(1);
}
close(errfds[0]);
} else {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterMuPDFToPWG: invalid pipe file descriptor to couple with "
"stderr of mutool process");
exit(1);
if (outputfd >= 1) {
if (outputfd != 1) {
if (dup2(outputfd, 1) < 0) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterMuPDFToPWG: Unable to couple stdout of mutool "
"process");
exit(1);
close(outputfd);
}
} else {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterMuPDFToPWG: Invalid file descriptor to couple with "
"stdout of mutool process");
exit(1);
/* Execute mutool command line ... */
execvp(filename, mutoolargv);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterMuPDFToPWG: Unable to launch mutool: %s: %s", filename,
strerror(errno));
exit(1);
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterMuPDFToPWG: Started mutool (PID %d)", mutoolpid);
close(errfds[1]);
while (cupsFileGets(logfp, buf, sizeof(buf)))
if (log) {
if (strncmp(buf, "DEBUG: ", 7) == 0) {
- log_level = FILTER_LOGLEVEL_DEBUG;
+ log_level = CF_LOGLEVEL_DEBUG;
msg = buf + 7;
} else if (strncmp(buf, "DEBUG2: ", 8) == 0) {
- log_level = FILTER_LOGLEVEL_DEBUG;
+ log_level = CF_LOGLEVEL_DEBUG;
msg = buf + 8;
} else if (strncmp(buf, "INFO: ", 6) == 0) {
- log_level = FILTER_LOGLEVEL_INFO;
+ log_level = CF_LOGLEVEL_INFO;
msg = buf + 6;
} else if (strncmp(buf, "WARNING: ", 9) == 0) {
- log_level = FILTER_LOGLEVEL_WARN;
+ log_level = CF_LOGLEVEL_WARN;
msg = buf + 9;
} else if (strncmp(buf, "ERROR: ", 7) == 0) {
- log_level = FILTER_LOGLEVEL_ERROR;
+ log_level = CF_LOGLEVEL_ERROR;
msg = buf + 7;
} else {
- log_level = FILTER_LOGLEVEL_DEBUG;
+ log_level = CF_LOGLEVEL_DEBUG;
msg = buf;
}
log(ld, log_level, "cfFilterMuPDFToPWG: %s", msg);
/* Ignore errors of the logging process */
exit(0);
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterMuPDFToPWG: Started logging (PID %d)", errpid);
close(errfds[0]);
while (mutoolpid > 0 || errpid > 0) {
if ((pid = wait(&wstatus)) < 0) {
if (errno == EINTR && iscanceled && iscanceled(icd)) {
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterMuPDFToPWG: Job canceled, killing mutool ...");
kill(mutoolpid, SIGTERM);
mutoolpid = -1;
if (wstatus) {
if (WIFEXITED(wstatus)) {
/* Via exit() anywhere or return() in the main() function */
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterMuPDFToPWG: %s (PID %d) stopped with status %d",
(pid == mutoolpid ? "mutool" : "Logging"), pid,
WEXITSTATUS(wstatus));
status = WEXITSTATUS(wstatus);
} else {
/* Via signal */
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterMuPDFToPWG: %s (PID %d) crashed on signal %d",
(pid == mutoolpid ? "mutool" : "Logging"), pid,
WTERMSIG(wstatus));
status = 256 * WTERMSIG(wstatus);
}
} else {
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterMuPDFToPWG: %s (PID %d) exited with no errors.",
(pid == mutoolpid ? "mutool" : "Logging"), pid);
status = 0;
ppd_file_t *ppd = NULL;
struct sigaction sa;
cf_cm_calibration_t cm_calibrate;
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
} else
outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterMuPDFToPWG: Output format: %s",
(outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ? "CUPS Raster" :
(outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ? "PWG Raster" :
fd = cupsTempFd(infilename, 1024);
if (fd < 0) {
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Can't create temporary file");
+ if(log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Can't create temporary file");
goto out;
}
/* copy input file to the tmp file */
while ((n = read(inputfd, buf, BUFSIZ)) > 0) {
if (write(fd,buf,n) != n) {
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Can't copy input to temporary file");
+ if(log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Can't copy input to temporary file");
close(fd);
goto out;
}
if (!inputfd) {
if (lseek(fd,0,SEEK_SET) < 0) {
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Can't rewind temporary file");
+ if(log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Can't rewind temporary file");
close(fd);
goto out;
}
if ((fp = fdopen(fd,"rb")) == 0) {
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Can't open temporary file");
+ if(log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Can't open temporary file");
close(fd);
goto out;
}
/* filename is specified */
if ((fp = fdopen(fd,"rb")) == 0) {
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Can't open temporary file");
+ if(log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Can't open temporary file");
goto out;
}
}
/* Find print-rendering-intent */
getPrintRenderIntent(data, &h);
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Print rendering intent = %s", h.cupsRenderingIntent);
/* mutool parameters */
mupdf_args = cupsArrayNew(NULL, NULL);
if (!mupdf_args) {
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Unable to allocate memory for mutool arguments array");
+ if(log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Unable to allocate memory for mutool arguments array");
goto out;
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterMuPDFToPWG: command: %s",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterMuPDFToPWG: command: %s",
CUPS_MUTOOL);
snprintf(tmpstr, sizeof(tmpstr), "%s", CUPS_MUTOOL);
cupsArrayAdd(mupdf_args, strdup(tmpstr));
if(empty)
{
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Input is empty, outputting empty file.");
+ if(log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Input is empty, outputting empty file.");
status = 0;
}
out:
const char* t = NULL;
ppd_attr_t* attr;
const char *val;
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
ppd_file_t *ppd = pclmtoraster_data->ppd;
cups_page_header2_t *header = &(pclmtoraster_data->header);
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPCLmToRaster: PPD file is not specified.");
t = cupsGetOption("media-class", num_options, options);
pclmtoraster_data->bi_level = 1;
strncpy(pclmtoraster_data->pageSizeRequested, header->cupsPageSizeName, 64);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPCLmToRaster: Page size requested: %s.",
header->cupsPageSizeName);
return(0);
unsigned int width, /* I - Width of raster image in pixels */
int rowsize, /* I - Length of one row of pixels */
std::string colorspace,/* I - Colorspace of input bitmap */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Aux. data for log function */
{
unsigned char *bp = src;
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPCLmToRaster: Incorrect Rotate Value %d, not rotating",
rotate);
return (src);
static void /* O - Exit status */
selectConvertFunc(int pgno, /* I - Page number */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld, /* I - Aux. data for log
function */
pclmtoraster_data_t *data, /* I - pclmtoraster filter
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPCLmToRaster: Colorspace %s not supported, "
"defaulting to /deviceRGB",
colorspace.c_str());
outPage(cups_raster_t* raster, /* I - Raster stream */
QPDFObjectHandle page, /* I - QPDF Page Object */
int pgno, /* I - Page number */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void* ld, /* I - Aux. data for log function */
pclmtoraster_data_t *data, /* I - pclmtoraster filter data */
cf_filter_data_t *filter_data, /* I - filter data */
// Get pagesize by the mediabox key of the page.
if (!mediaboxlookup(page, mediaBox))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPCLmToRaster: PDF page %d doesn't contain a valid mediaBox",
pgno + 1);
return (1);
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPCLmToRaster: mediaBox = [%f %f %f %f]: ",
mediaBox[0], mediaBox[1], mediaBox[2], mediaBox[3]);
l = mediaBox[2] - mediaBox[0];
if (!cupsRasterWriteHeader2(raster,&(data->header)))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPCLmToRaster: Can't write page %d header", pgno + 1);
return (1);
}
cups_raster_t *raster;
pclmtoraster_data_t pclmtoraster_data;
conversion_function_t convert;
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
} else
outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPCLmToRaster: Output format: %s",
(outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ? "CUPS Raster" :
(outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ? "PWG Raster" :
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPCLmToRaster: Unable to open input data stream.");
}
if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPCLmToRaster: Unable to copy PDF file: %s",
strerror(errno));
fclose(inputfp);
return (1);
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPCLmToRaster: Copying input to temp file \"%s\"",
tempfile);
&& pclmtoraster_data.header.cupsBitsPerColor != 8
&& pclmtoraster_data.header.cupsBitsPerColor != 16)
{
- if(log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if(log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPCLmToRaster: Specified color format is not supported: %s",
strerror(errno));
delete(pdf);
CUPS_RASTER_WRITE_PWG :
CUPS_RASTER_WRITE_APPLE)))) == 0)
{
- if(log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if(log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPCLmToRaster: Can't open raster stream: %s",
strerror(errno));
delete(pdf);
{
if (iscanceled && iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPCLmToRaster: Job canceled");
break;
}
- if (log) log(ld, FILTER_LOGLEVEL_INFO,
+ if (log) log(ld, CF_LOGLEVEL_INFO,
"cfFilterPCLmToRaster: Starting page %d.", i+1);
if (outPage(raster, pages[i], i, log, ld, &pclmtoraster_data,data,
&convert) != 0)
{
int len=data.size();
if (len==0) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: (empty)");
return;
}
len--;
for (int iA=0;iA<len;iA++) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: [%d,%d)",
data[iA].first, data[iA].second);
}
if (data[len].second==npos) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: [%d,inf)",
data[len].first);
} else {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: [%d,%d)",
data[len].first, data[len].second);
}
void NupParameters::dump(pdftopdf_doc_t *doc) const // {{{
{
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: NupX: %d, NupY: %d, "
"width: %f, height: %f",
nupX,nupY,
spos=1;
}
if (first==Axis::X) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: First Axis: X");
opos=0;
} else if (first==Axis::Y) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: First Axis: Y");
opos=2;
std::swap(fpos,spos);
}
if ( (opos==-1)||(fpos==-1)||(spos==-1) ) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Bad Spec: %d; start: %d, %d",
first,xstart,ystart);
} else {
static const char *order[4]={"lr","rl","bt","tb"};
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Order: %s%s",
order[opos+fpos],order[(opos+2)%4+spos]);
}
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Alignment:");
Position_dump(xalign,Axis::X,doc);
Position_dump(yalign,Axis::Y,doc);
void NupPageEdit::dump(pdftopdf_doc_t *doc) const // {{{
{
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: xpos: %f, ypos: %f, scale: %f",
xpos,ypos,scale);
sub.dump(doc);
return true;
}
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: Unsupported output-order "
"value %s, using 'normal'!",
val);
*/
if ((ipprot<3)||(ipprot>6)) {
if (ipprot && doc->logfunc)
- doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: Bad value (%d) for "
"orientation-requested, using 0 degrees",
ipprot);
(val = cupsGetOption("page-size", num_options, options)) != NULL ||
(val = cupsGetOption("PageSize", num_options, options)) != NULL) {
pwg_media_t *size_found = NULL;
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Page size from command "
"line: %s", val);
if ((size_found = pwgMediaForPWG(val)) == NULL)
param.page.right=param.page.left=18.0;
param.page.right=param.page.width-param.page.right;
param.page.top=param.page.height-param.page.top;
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Width: %f, Length: %f",
param.page.width, param.page.height);
}
else
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Unsupported page size %s.",
val);
}
param.duplex=true;
param.setDuplex=true;
} else if (strcasecmp(val,"one-sided")!=0) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: Unsupported sides value %s, "
"using sides=one-sided!", val);
}
int nup=1;
if (optGetInt("number-up",num_options,options,&nup)) {
if (!NupParameters::possible(nup)) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: Unsupported number-up value "
"%d, using number-up=1!", nup);
nup=1;
if ((val=cupsGetOption("number-up-layout",num_options,options)) != NULL) {
if (!parseNupLayout(val,param.nup)) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: Unsupported number-up-layout "
"%s, using number-up-layout=lrtb!" ,val);
param.nup.first=Axis::X;
if ((val=cupsGetOption("page-border",num_options,options)) != NULL) {
if (!parseBorder(val,param.border)) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: Unsupported page-border value "
"%s, using page-border=none!", val);
param.border=BorderType::NONE;
} else if (strcasecmp(val,"odd")==0) {
param.evenPages=false;
} else if (strcasecmp(val,"all")!=0) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: Unsupported page-set value %s, "
"using page-set=all!", val);
}
} else if (is_true(val)) {
param.booklet=BookletMode::BOOKLET_ON;
} else if (!is_false(val)) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: Unsupported booklet value %s, "
"using booklet=off!", val);
}
param.bookSignature=-1;
if (optGetInt("booklet-signature",num_options,options,¶m.bookSignature)) {
if (param.bookSignature==0) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: Unsupported booklet-signature "
"value, using booklet-signature=-1 "
"(all)!", val);
if ((val=cupsGetOption("position",num_options,options)) != NULL) {
if (!parsePosition(val,param.xpos,param.ypos)) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: Unrecognized position value "
"%s, using position=center!", val);
param.xpos=Position::CENTER;
if ((val=cupsGetOption("page-logging",num_options,options)) != NULL) {
if (strcasecmp(val,"auto") == 0) {
param.page_logging = -1;
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Automatic page logging "
"selected by command line.");
} else if (is_true(val)) {
param.page_logging = 1;
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Forced page logging selected "
"by command line.");
} else if (is_false(val)) {
param.page_logging = 0;
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Suppressed page logging "
"selected by command line.");
} else {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: Unsupported page-logging "
"value %s, using page-logging=auto!",val);
param.page_logging = -1;
final_content_type[0]=='\0'){
param.page_logging = -1;
}
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: No PPD file specified, "
"determined whether to log pages or "
"not using final_content_type env variable.");
- doc->logfunc(doc->logdata,FILTER_LOGLEVEL_DEBUG,"final_content_type = %s page_logging=%d",final_content_type?final_content_type:"NULL",param.page_logging);
+ doc->logfunc(doc->logdata,CF_LOGLEVEL_DEBUG,"final_content_type = %s page_logging=%d",final_content_type?final_content_type:"NULL",param.page_logging);
} else {
char *lastfilter = NULL;
if (final_content_type == NULL) {
// No FINAL_CONTENT_TYPE env variable set, we cannot determine
// whether we have to log pages, so do not log.
param.page_logging = 0;
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: No FINAL_CONTENT_TYPE "
"environment variable, could not "
"determine whether to log pages or "
param.page_logging = 0;
}
} else {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: Last filter could not "
"get determined, page logging turned "
"off.");
param.page_logging = 0;
}
}
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Last filter determined by the "
"PPD: %s; FINAL_CONTENT_TYPE: "
"%s => pdftopdf will %slog pages in "
// FIXME: what does >buf mean here?
int outfd=cupsTempFd(buf,sizeof(buf));
if (outfd<0) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: Can't create temporary file");
return NULL;
}
// copy stdin to the tmp file
while ((n=read(infd,buf,BUFSIZ)) > 0) {
if (write(outfd,buf,n) != n) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: Can't copy stdin to temporary "
"file");
close(outfd);
}
}
if (lseek(outfd,0,SEEK_SET) < 0) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: Can't rewind temporary file");
close(outfd);
return NULL;
FILE *f;
if ((f=fdopen(outfd,"rb")) == 0) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: Can't fdopen temporary file");
close(outfd);
return NULL;
int streaming = 0;
size_t bytes;
char buf[BUFSIZ];
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
(strcasecmp(t, "false") && strcasecmp(t, "off") &
strcasecmp(t, "no"))) {
streaming = 1;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Streaming mode: No PDF processing, only adding of JCL");
}
if (!streaming) {
if (is_empty(inputfp)) {
fclose(inputfp);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Input is empty, outputting empty file.");
return 0;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Processing PDF input with QPDF: Page-ranges, page-set, number-up, booklet, size adjustment, ...");
// Load the PDF input data into QPDF
// proc->emitFilename(NULL);
} else {
// Pass through the input data
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Passing on unchanged PDF data from input");
while ((bytes = fread(buf, 1, sizeof(buf), inputfp)) > 0)
if (fwrite(buf, 1, bytes, outputfp) != bytes)
fclose(outputfp);
} catch (std::exception &e) {
// TODO? exception type
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: Exception: %s",e.what());
return 5;
} catch (...) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: Unknown exception caught. Exiting.");
return 6;
}
typedef struct /***** Document information *****/
{
- filter_logfunc_t logfunc; /* Log function */
+ cf_logfunc_t logfunc; /* Log function */
void *logdata; /* Log data */
cf_filter_iscanceledfunc_t iscanceledfunc; /* Function returning 1 when
job is canceled, NULL for not
{
static const char *bstr[3]={"Off","On","Shuffle-Only"};
if ((bkm<BOOKLET_OFF) || (bkm>BOOKLET_JUSTSHUFFLE)) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: bookletMode: (bad booklet mode: "
"%d)", bkm);
} else {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: bookletMode: %s", bstr[bkm]);
}
}
void ProcessingParameters::dump(pdftopdf_doc_t *doc) const // {{{
{
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: jobId: %d, numCopies: %d",
jobId,numCopies);
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: user: %s, title: %s",
(user)?user:"(null)",(title)?title:"(null)");
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: fitplot: %s",
(fitplot)?"true":"false");
Rotation_dump(orientation,doc);
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: paper_is_landscape: %s",
(paper_is_landscape)?"true":"false");
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: duplex: %s",
(duplex)?"true":"false");
nup.dump(doc);
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: reverse: %s",
(reverse)?"true":"false");
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: evenPages: %s, oddPages: %s",
(evenPages)?"true":"false",
(oddPages)?"true":"false");
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: input page range:");
inputPageRange.dump(doc);
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: page range:");
pageRange.dump(doc);
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: mirror: %s",
(mirror)?"true":"false");
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Position:");
Position_dump(xpos,Axis::X,doc);
Position_dump(ypos,Axis::Y,doc);
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: collate: %s",
(collate)?"true":"false");
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: evenDuplex: %s",
(evenDuplex)?"true":"false");
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: pageLabel: %s",
pageLabel.empty () ? "(none)" :
pageLabel.c_str());
BookletMode_dump(booklet,doc);
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: booklet signature: %d",
bookSignature);
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: autoRotate: %s",
(autoRotate)?"true":"false");
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: emitJCL: %s",
(emitJCL)?"true":"false");
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: deviceCopies: %d",
deviceCopies);
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: deviceCollate: %s",
(deviceCollate)?"true":"false");
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: setDuplex: %s",
(setDuplex)?"true":"false");
}
bool processPDFTOPDF(PDFTOPDF_Processor &proc,ProcessingParameters ¶m,pdftopdf_doc_t *doc) // {{{
{
if (!proc.check_print_permissions(doc)) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Not allowed to print");
return false;
}
}
const int numPages=std::max(shuffle.size(),input_page_range_list.size());
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: \"print-scaling\" IPP attribute: %s",
(param.autoprint ? "auto" :
(param.autofit ? "auto-fit" :
(h > param.page.width || w > param.page.height))
{
if (doc->logfunc)
- doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Page %d too large for output page size, scaling pages to fit.",
i + 1);
document_large = true;
}
}
if (param.fidelity && doc->logfunc)
- doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: \"ipp-attribute-fidelity\" IPP attribute is set, scaling pages to fit.");
if (param.autoprint)
}
}
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Print scaling mode: %s",
(param.fitplot ?
"Scale to fit printable area" :
outputno ++;
if (param.page_logging == 1)
if (doc->logfunc) doc->logfunc(doc->logdata,
- FILTER_LOGLEVEL_CONTROL,
+ CF_LOGLEVEL_CONTROL,
"PAGE: %d %d", outputno,
param.copies_to_be_logged);
}
// Log page in /var/log/cups/page_log
outputno ++;
if (param.page_logging == 1)
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_CONTROL,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_CONTROL,
"PAGE: %d %d", outputno,
param.copies_to_be_logged);
}
proc.add_page(proc.new_page(param.page.width,param.page.height,doc),param.reverse);
// Log page in /var/log/cups/page_log
if (param.page_logging == 1)
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_CONTROL,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_CONTROL,
"PAGE: %d %d", outputno + 1,
param.copies_to_be_logged);
}
{
static const char *pstr[3]={"Left/Bottom","Center","Right/Top"};
if ((pos < LEFT) || (pos > RIGHT)) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: (bad position: %d)",pos);
} else {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: %s",pstr[pos+1]);
}
}
{
assert((axis == Axis::X) || (axis == Axis::Y));
if ((pos < LEFT) || (pos > RIGHT)) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Position %s: (bad position: %d)",
(axis == Axis::X) ? "X" : "Y", pos);
return;
}
if (axis==Axis::X) {
static const char *pxstr[3]={"Left","Center","Right"};
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Position X: %s", pxstr[pos+1]);
} else {
static const char *pystr[3]={"Bottom","Center","Top"};
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Position Y: %s",pystr[pos+1]);
}
}
{
static const char *rstr[4]={"0 deg","90 deg","180 deg","270 deg"}; // CCW
if ((rot < ROT_0) || (rot > ROT_270)) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Rotation(CCW): (bad rotation: %d)",rot);
} else {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Rotation(CCW): %s",rstr[rot]);
}
}
void BorderType_dump(BorderType border,pdftopdf_doc_t *doc) // {{{
{
if ((border < NONE) || (border == 1) || (border > TWO_THICK)) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Border: (bad border: %d)",border);
} else {
static const char *bstr[6]={"None",NULL,"one thin","one thick","two thin","two thick"};
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: Border: %s",bstr[border]);
}
}
void PageRect::dump(pdftopdf_doc_t *doc) const // {{{
{
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: top: %f, left: %f, right: %f, bottom: %f, "
"width: %f, height: %f",
top,left,right,bottom,
final_w = pageWidth;
final_h = pageHeight;
}
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: After Cropping: %lf %lf %lf %lf",
width,height,final_w,final_h);
double posw = (width-final_w)/2,
try {
pdf->processFile("temp file",f,false);
} catch (const std::exception &e) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: loadFile failed: %s", e.what());
return false;
}
try {
pdf->processFile("temp file",f,true);
} catch (const std::exception &e) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: loadFile failed: %s", e.what());
return false;
}
break;
case MustDuplicate:
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: loadFile with MustDuplicate is not supported");
return false;
}
pdf.reset(new QPDF);
pdf->processFile(name);
} catch (const std::exception &e) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: loadFilename failed: %s",e.what());
return false;
}
bool QPDF_PDFTOPDF_Processor::check_print_permissions(pdftopdf_doc_t *doc) // {{{
{
if (!pdf) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: No PDF loaded");
return false;
}
{
std::vector<std::shared_ptr<PDFTOPDF_PageHandle>> ret;
if (!pdf) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: No PDF loaded");
assert(0);
return ret;
std::shared_ptr<PDFTOPDF_PageHandle> QPDF_PDFTOPDF_Processor::new_page(float width,float height,pdftopdf_doc_t *doc) // {{{
{
if (!pdf) {
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: No PDF loaded");
assert(0);
return std::shared_ptr<PDFTOPDF_PageHandle>();
out.setOutputFile("temp file",f,true);
break;
case MustDuplicate:
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPDF: emitFile with MustDuplicate is not supported");
return;
}
if (len)
out.write();
else
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPDF: No pages left, outputting empty file.");
}
// }}}
char *deviceCopies, /* O - Number of copies
(hardware) */
int *deviceCollate, /* O - Hardware collate*/
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Aux. data for
log function */
{
FILE *fp;
if ((fp = fopen(filename,"rb")) == NULL) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: Cannot open input file \"%s\"",
filename);
return;
int /* O - Result: 1: Empty; 0: Contains pages */
is_empty(char *filename, /* I - Input file */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Auxiliary data for log function */
{
FILE *fp = NULL;
fp = fopen(filename, "rb");
if (fp == NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: Cannot open input file \"%s\"",
filename);
return 1;
rewind(fp);
if (fread(buf, 1, 1, fp) == 0) {
fclose(fp);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Input is empty, outputting empty file.");
return 1;
}
fclose(fp);
int pages = pdf_pages(filename);
if (pages == 0) {
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: No pages left, outputting empty file.");
return 1;
}
void
log_command_line(const char* file, /* I - Program to be executed */
char *const argv[], /* I - Argument list */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Auxiliary data for log function */
{
int i;
}
buf[sizeof(buf) - 1] = '\0';
- log(ld, FILTER_LOGLEVEL_DEBUG, "%s", buf);
+ log(ld, CF_LOGLEVEL_DEBUG, "%s", buf);
}
*ptr; /* Pointer into value */
int duplex, tumble; /* Duplex settings for PPD-less
printing */
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Unable to open input data stream.");
}
if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: Unable to copy PDF file: %s", strerror(errno));
return (1);
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Copying input to temp file \"%s\"",
tempfile);
ppd->product + 1);
make_model[strlen(make_model) - 1] = '\0';
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Printer make and model: %s", make_model);
/*
else if (strcasecmp(val, "hybrid") == 0)
renderer = HYBRID;
else
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"cfFilterPDFToPS: Invalid value for \"pdftops-renderer\": \"%s\"",
val);
}
(!strncasecmp(make_model, "Apple", 5) &&
(ptr = strcasestr(make_model, "LaserWriter")))))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Switching to Poppler's pdftops instead of "
"Ghostscript for Brother, Minolta, Konica Minolta, Dell, "
"and Apple LaserWriter printers to work around bugs in the "
while (*ptr && isalnum(*ptr)) ptr ++;
if (!*ptr) /* End of string, no further word */
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Switching to Poppler's pdftops instead of "
"Ghostscript for old HP LaserJet (\"LaserJet "
"<number>\", no letters before <number>, no "
pdf_argv[pdf_argc++] = (char *)"-dLanguageLevel=1";
else if (renderer == PDFTOCAIRO)
{
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"cfFilterPDFToPS: Level 1 PostScript not supported by "
"pdftocairo.");
}
else if (renderer == ACROREAD)
{
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"cfFilterPDFToPS: Level 1 PostScript not supported by acroread.");
}
else if (renderer == MUPDF)
{
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"cfFilterPDFToPS: Level 1 PostScript not supported by mutool.");
}
}
}
else if (renderer == MUPDF)
{
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"cfFilterPDFToPS: Level 3 PostScript not supported by mutool.");
}
else /* PDFTOCAIRO || ACROREAD */
resolution[sizeof(resolution)-1] = '\0';
if ((xres == 0) && (yres == 0) &&
((numvalues = sscanf(resolution, "%dx%d", &xres, &yres)) <= 0))
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: No resolution information found in the PPD file.");
}
else{
strcasecmp(ptr, "dpc") &&
strcasecmp(ptr, "dpcm")))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Bad resolution value \"%s\".", val);
}
else
if ((numvalues = sscanf(val, "%d", &mres)) > 0)
maxres = mres;
else
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"cfFilterPDFToPS: Invalid value for "
"\"pdftops-max-image-resolution\": \"%s\"",
val);
pdf_argv[pdf_argc++] = (char *)"-r";
snprintf(resolution, sizeof(resolution), "%d", res);
pdf_argv[pdf_argc++] = resolution;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Using image rendering resolution %d dpi", res);
#endif /* HAVE_POPPLER_PDFTOPS_WITH_RESOLUTION */
if (gray_output == 1) /* Checking for monochrome/grayscale PostScript
/* pdf_argv[1] = (char *)"-level1";
pdf_argv[pdf_argc++] = (char *)"-optimizecolorspace"; */
/* Issue a warning message when printing a grayscale job with Poppler */
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"cfFilterPDFToPS: Grayscale/monochrome printing requested for this "
"job but Poppler is not able to convert to "
"grayscale/monochrome PostScript.");
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"cfFilterPDFToPS: Use \"pdftops-renderer\" option (see "
"cups-filters README file) to use Ghostscript or MuPDF for "
"the PDF -> PostScript conversion.");
*/
snprintf(resolution, 127, "-r%d", res);
pdf_argv[pdf_argc++] = resolution;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Using image rendering resolution %d dpi", res);
/*
* PostScript debug mode: If you send a job with "lpr -o psdebug" Ghostscript
(!strncasecmp(make_model, "Kyocera", 7) ||
!strncasecmp(make_model, "Utax", 4))))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Deactivated compression of pages in "
"Ghostscript's PostScript output (\"psdebug\" debug mode "
"or Kyocera/Utax printer)");
if (make_model[0] &&
!strncasecmp(make_model, "Brother", 7))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Deactivation of Ghostscript's image compression "
"for Brother printers to workarounmd PS interpreter bug");
pdf_argv[pdf_argc++] = (char *)"-dEncodeMonoImages=false";
if (make_model[0] &&
!strncasecmp(make_model, "Toshiba", 7))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: To work around a bug in Toshiba's PS "
"interpreters turn TTF font glyphs into bitmaps, usually "
"Type 3 PS fonts, or images for large characters");
{
if (pipe(pstops_pipe))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: Unable to create pipe for cfFilterPSToPS: %s",
strerror(errno));
{
if (pipe(post_proc_pipe))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: Unable to create pipe for post-processing: %s",
strerror(errno));
if (renderer == PDFTOPS)
{
execvp(CUPS_POPPLER_PDFTOPS, pdf_argv);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: Unable to execute pdftops program: %s",
strerror(errno));
}
else if (renderer == GS)
{
execvp(CUPS_GHOSTSCRIPT, pdf_argv);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: Unable to execute gs program: %s",
strerror(errno));
}
else if (renderer == PDFTOCAIRO)
{
execvp(CUPS_POPPLER_PDFTOCAIRO, pdf_argv);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: Unable to execute pdftocairo program: %s",
strerror(errno));
}
}
execvp(CUPS_ACROREAD, pdf_argv);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: Unable to execute acroread program: %s",
strerror(errno));
}
else if (renderer == MUPDF)
{
execvp(CUPS_MUTOOL, pdf_argv);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: Unable to execute mutool program: %s",
strerror(errno));
}
if (log)
{
if (renderer == PDFTOPS)
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: Unable to execute pdftops program: %s",
strerror(errno));
else if (renderer == GS)
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: Unable to execute gs program: %s",
strerror(errno));
else if (renderer == PDFTOCAIRO)
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: Unable to execute pdftocairo program: %s",
strerror(errno));
else if (renderer == ACROREAD)
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: Unable to execute acroread program: %s",
strerror(errno));
else if (renderer == MUPDF)
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: Unable to execute mutool program: %s",
strerror(errno));
}
goto error;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Started filter %s (PID %d)", pdf_argv[0], pdf_pid);
if (need_post_proc)
if (strncmp(buffer, "%%BeginProlog", 13))
{
/* No Prolog section, create one */
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Adding Prolog section for workaround "
"PostScript code");
puts("%%BeginProlog");
if (!strncasecmp(make_model, "Kyocera", 7) ||
!strncasecmp(make_model, "Utax", 4))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Inserted workaround PostScript code for "
"Kyocera and Utax printers");
puts("% ===== Workaround insertion by pdftops CUPS filter =====");
else if (!strncasecmp(make_model, "Brother", 7))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Inserted workaround PostScript code for "
"Brother printers");
puts("% ===== Workaround insertion by pdftops CUPS filter =====");
if (strncmp(buffer, "%%BeginSetup", 12))
{
/* No Setup section, create one */
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Adding Setup section for option "
"PostScript code");
puts("%%BeginSetup");
* Unable to fork!
*/
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: Unable to execute post-processing process: %s",
strerror(errno));
goto error;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Started post-processing (PID %d)", post_proc_pid);
}
ret = cfFilterPSToPS(pstops_pipe[0], outputfd, 0, &pstops_filter_data, NULL);
close(pstops_pipe[0]);
- if (ret && log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (ret && log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: pstops filter function failed.");
close(outputfd);
* Unable to fork!
*/
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: Unable to execute pstops program: %s",
strerror(errno));
goto error;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Started filter pstops (PID %d)", pstops_pid);
close(pstops_pipe[0]);
{
exit_status = WEXITSTATUS(wait_status);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: PID %d (%s) stopped with status %d!",
wait_pid,
wait_pid == pdf_pid ?
}
else if (WTERMSIG(wait_status) == SIGTERM)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: PID %d (%s) was terminated normally with "
"signal %d!",
wait_pid,
{
exit_status = WTERMSIG(wait_status);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToPS: PID %d (%s) crashed on signal %d!",
wait_pid,
wait_pid == pdf_pid ?
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: PID %d (%s) exited with no errors.",
wait_pid,
wait_pid == pdf_pid ?
error:
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToPS: Closing files ...");
close(outputfd);
ppd_file_t *ppd = 0;
poppler::document *poppler_doc;
cups_page_header2_t header;
- filter_logfunc_t logfunc; /* Logging function, NULL for no
+ cf_logfunc_t logfunc; /* Logging function, NULL for no
logging */
void *logdata; /* User data for logging function, can
be NULL */
const char *t = NULL;
ppd_attr_t *attr;
const char *val;
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data ->logdata;
ipp_t *printer_attrs = data->printer_attrs;
cups_cspace_t cspace = (cups_cspace_t)(-1);
} else
outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToRaster: Output format: %s",
(outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ? "CUPS Raster" :
"PWG Raster"));
ppdMarkOptions(doc->ppd,num_options,options);
handleRqeuiresPageRegion(doc);
} else
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToRaster: PPD file is not specified.");
cupsRasterPrepareHeader(&(doc->header), data, outformat,
} else if (strcasecmp(doc->header.cupsRenderingIntent,"ABSOLUTE") == 0) {
doc->colour_profile.renderingIntent = INTENT_ABSOLUTE_COLORIMETRIC;
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Print rendering intent = %s", doc->header.cupsRenderingIntent);
int backside = getBackSideAndHeaderDuplex(printer_attrs, &(doc->header));
if ((val = cupsGetOption("print-color-mode", num_options, options)) != NULL
&& !strncasecmp(val, "bi-level", 8))
doc->bi_level = 1;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToRaster: Page size requested: %s", doc->header.cupsPageSizeName);
if (num_options)
}
/* select convertLine function */
-static int selectConvertFunc(cups_raster_t *raster, pdftoraster_doc_t* doc, conversion_function_t *convert, filter_logfunc_t log, void* ld)
+static int selectConvertFunc(cups_raster_t *raster, pdftoraster_doc_t* doc, conversion_function_t *convert, cf_logfunc_t log, void* ld)
{
doc->bitspercolor = doc->header.cupsBitsPerColor;
if ((doc->colour_profile.colorProfile == NULL || doc->colour_profile.popplerColorProfile == doc->colour_profile.colorProfile)
CHANNELS_SH(doc->header.cupsNumColors) |
BYTES_SH(bytes),
doc->colour_profile.renderingIntent,0)) == 0) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToRaster: Can't create color transform.");
return (1);
}
convert->convertCSpace = W8toK8;
break;
default:
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToRaster: Specified ColorSpace is not supported");
return (1);
}
}
static int outPage(pdftoraster_doc_t *doc, int pageNo, cf_filter_data_t *data,
- cups_raster_t *raster, conversion_function_t *convert, filter_logfunc_t log, void* ld, cf_filter_iscanceledfunc_t iscanceled, void *icd)
+ cups_raster_t *raster, conversion_function_t *convert, cf_logfunc_t log, void* ld, cf_filter_iscanceledfunc_t iscanceled, void *icd)
{
int rotate = 0;
double paperdimensions[2], /* Physical size of the paper */
break;
default:rotate=0;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToRaster: mediabox = [ %f %f %f %f ]; rotate = %d",
mediaBox.left(), mediaBox.top(), mediaBox.right(),
mediaBox.bottom(), rotate);
doc->header.cupsBytesPerLine *= doc->header.cupsNumColors;
}
if (!cupsRasterWriteHeader2(raster,&(doc->header))) {
- if (log) log(ld,FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld,CF_LOGLEVEL_ERROR,
"cfFilterPDFToRaster: Cannot write page %d header", pageNo);
return (1);
}
return (0);
}
-static int setPopplerColorProfile(pdftoraster_doc_t *doc, filter_logfunc_t log, void *ld)
+static int setPopplerColorProfile(pdftoraster_doc_t *doc, cf_logfunc_t log, void *ld)
{
if (doc->header.cupsBitsPerColor != 8 && doc->header.cupsBitsPerColor != 16) {
/* color Profile is not supported */
doc->colour_profile.popplerColorProfile = NULL;
break;
default:
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToRaster: Specified ColorSpace is not supported");
return (1);
break;
int npages = 0;
cups_raster_t *raster = NULL;
cups_file_t *inputfp; /* Print file */
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
int deviceCopies = 1;
bool deviceCollate = false;
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToRaster: Unable to open input data stream.");
}
fd = cupsTempFd(name,sizeof(name));
if (fd < 0) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToRaster: Can't create temporary file.");
return (1);
}
/* copy input data to the tmp file */
while ((n = read(inputfd, buf, BUFSIZ)) > 0) {
if (write(fd, buf, n) != n) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToRaster: Can't copy input data to temporary file.");
close(fd);
unlink(name);
FILE *fp;
if ((fp = fdopen(inputfd,"rb")) == 0) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToRaster: Can't open input file.");
ret = 1;
goto out;
&& doc.header.cupsBitsPerColor != 4
&& doc.header.cupsBitsPerColor != 8
&& doc.header.cupsBitsPerColor != 16) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToRaster: Specified color format is not supported.");
ret = 1;
goto out;
if (doc.header.cupsColorOrder != CUPS_ORDER_CHUNKED
|| (doc.header.cupsBitsPerColor != 8
&& doc.header.cupsBitsPerColor != 16)) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToRaster: Specified color format is not supported.");
ret = 1;
goto out;
doc.popplerNumColors = 1;
break;
default:
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToRaster: Specified ColorSpace is not supported.");
ret = 1;
goto out;
}
if (!(doc.colour_profile.cm_disabled)) {
if (setPopplerColorProfile(&doc, log, ld) != 0) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToRaster: Cannot set color profile.");
ret = 1;
goto out;
if ((raster = cupsRasterOpen(outputfd, doc.pwgraster ? CUPS_RASTER_WRITE_PWG :
CUPS_RASTER_WRITE)) == 0) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToRaster: Cannot open raster stream.");
ret = 1;
goto out;
memset(&convert, 0, sizeof(conversion_function_t));
if (selectConvertFunc(raster, &doc, &convert, log, ld) == 1)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPDFToRaster: Unable to select color conversion function.");
ret = 1;
goto out;
for (i = 1;i <= npages;i++) {
if (outPage(&doc,i,data,raster, &convert, log, ld, iscanceled, icd) == 1)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToRaster: Unable to output page %d.", i);
ret = 1;
goto out;
}
}
} else
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPDFToRaster: Input is empty outputting empty file.");
out:
PageLength; /* Total page length */
cups_file_t *inputfp; /* Temporary file, if any */
FILE *outputfp; /* Temporary file, if any */
- filter_logfunc_t logfunc; /* Logging function, NULL for no
+ cf_logfunc_t logfunc; /* Logging function, NULL for no
logging */
void *logdata; /* User data for logging function, can
be NULL */
char *job_title, int copies,
int num_options,
cups_option_t *options,
- filter_logfunc_t logfunc,
+ cf_logfunc_t logfunc,
void *logdata,
cf_filter_iscanceledfunc_t
iscanceledfunc,
buffer[8192]; /* Line buffers */
ssize_t len,bytes; /* Length of line buffers */
pstops_page_t *pageinfo;
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
{
if(pipe(proc_pipe))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPSToPS: Unable to create pipe for input-page-ranges");
return (1);
}
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: Unable to open input data stream.");
}
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: Unable to open input data stream.");
}
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: Unable to open output data stream.");
}
if ((len = (ssize_t)cupsFileGetLine(inputfp, line, sizeof(line))) == 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: The print file is empty.");
/* Do not treat this an error, if a previous filter eliminated all
pages the job should get dequeued without anything printed. */
* with "ENTER LANGUAGE"...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: Skipping PJL header...");
while (strstr(line, "ENTER LANGUAGE") == NULL && strncmp(line, "%!", 2))
if (waitpid (pstops_pid, &childStatus, 0) == -1) {
if (errno == EINTR)
goto retry_wait;
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPSToPS: Error while waiting for input_page_ranges to finish - %s.",
strerror(errno));
}
if (childStatus) {
if (WIFEXITED(childStatus)) {
/* Via exit() anywhere or return() in the main() function */
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPSToPS: input-page-ranges filter (PID %d) stopped with status %d",
pstops_pid, WEXITSTATUS(childStatus));
} else {
/* Via signal */
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPSToPS: imput-page-ranges filter (PID %d) crashed on signal %d",
pstops_pid, WTERMSIG(childStatus));
}
status=1;
} else {
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: input-page-ranges-filter (PID %d) exited with no errors.",
pstops_pid);
}
const char *label) /* I - Page label */
{
pstops_page_t *pageinfo; /* New page info object */
- filter_logfunc_t log = doc->logfunc;
+ cf_logfunc_t log = doc->logfunc;
void *ld = doc->logdata;
if (!doc->pages)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPSToPS: Unable to allocate memory for pages array");
return (NULL);
}
if ((pageinfo = calloc(1, sizeof(pstops_page_t))) == NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPSToPS: Unable to allocate memory for page info");
return (NULL);
}
char buffer[8192]; /* Data buffer */
ssize_t nbytes; /* Number of bytes read */
size_t nleft; /* Number of bytes left/remaining */
- filter_logfunc_t log = doc->logfunc;
+ cf_logfunc_t log = doc->logfunc;
void *ld = doc->logdata;
if (cupsFileSeek(doc->temp, offset) < 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Unable to seek in file");
return;
}
saw_for, /* Saw %%For: comment? */
saw_pages, /* Saw %%Pages: comment? */
saw_title; /* Saw %%Title: comment? */
- filter_logfunc_t log = doc->logfunc;
+ cf_logfunc_t log = doc->logfunc;
void *ld = doc->logdata;
* Log the header...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: %s", line);
/*
int pages; /* Number of pages */
if (saw_pages && log)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: A duplicate %%Pages: comment was seen.");
saw_pages = 1;
{
if (saw_bounding_box)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: A duplicate %%BoundingBox: comment was seen.");
}
else if (strstr(line + 14, "(atend)"))
doc->bounding_box + 1, doc->bounding_box + 2,
doc->bounding_box + 3) != 4)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: A bad %%BoundingBox: comment was seen.");
doc->bounding_box[0] = (int)(doc->PageLeft);
}
if (!saw_bounding_box && log)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: There wasn't a %%BoundingBox: comment in the header.");
if (!saw_pages && log)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: There wasn't a %%Pages: comment in the header.");
if (!saw_for)
{
int number; /* Page number */
pstops_page_t *pageinfo; /* Page information */
- filter_logfunc_t log = doc->logfunc;
+ cf_logfunc_t log = doc->logfunc;
void *ld = doc->logdata;
cf_filter_iscanceledfunc_t iscanceled = doc->iscanceledfunc;
void *icd = doc->iscanceleddata;
* Start sending the document with any commands needed...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: Before copy_comments - %s", line);
linelen = copy_comments(doc, ppd, line, linelen, linesize);
* Now find the prolog section, if any...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: Before copy_prolog - %s", line);
linelen = copy_prolog(doc, ppd, line, linelen, linesize);
* Then the document setup section...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: Before copy_setup - %s", line);
linelen = copy_setup(doc, ppd, line, linelen, linesize);
number = 0;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: Before page loop - %s", line);
while (!strncmp(line, "%%Page:", 7))
{
if (iscanceled && iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: Job canceled");
break;
}
if (check_range((number - 1) / doc->number_up + 1,doc->page_ranges,doc->page_set))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: Copying page %d...", number);
linelen = copy_page(doc, ppd, number, line, linelen, linesize);
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: Skipping page %d...", number);
linelen = skip_page(doc, line, linelen, linesize);
}
if (!doc->slow_order)
{
if ((!ppd || !ppd->num_filters) && log)
- log(ld, FILTER_LOGLEVEL_CONTROL,
+ log(ld, CF_LOGLEVEL_CONTROL,
"PAGE: %d %d", doc->page,
doc->slow_collate ? 1 : doc->copies);
{
if (iscanceled && iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: Job canceled");
break;
}
if (iscanceled && iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: Job canceled");
break;
}
number ++;
if ((!ppd || !ppd->num_filters) && log)
- log(ld, FILTER_LOGLEVEL_CONTROL,
+ log(ld, CF_LOGLEVEL_CONTROL,
"PAGE: %d %d", number,
doc->slow_collate ? 1 : doc->copies);
int copy; /* Current copy */
char buffer[8192]; /* Copy buffer */
ssize_t bytes; /* Number of bytes copied */
- filter_logfunc_t log = doc->logfunc;
+ cf_logfunc_t log = doc->logfunc;
void *ld = doc->logdata;
cf_filter_iscanceledfunc_t iscanceled = doc->iscanceledfunc;
void *icd = doc->iscanceleddata;
* that may not print correctly...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: This document does not conform to the Adobe Document "
"Structuring Conventions and may not print correctly.");
*/
if ((!ppd || !ppd->num_filters) && log)
- log(ld, FILTER_LOGLEVEL_CONTROL,
+ log(ld, CF_LOGLEVEL_CONTROL,
"PAGE: 1 %d", doc->temp ? 1 : doc->copies);
fputs("%%Page: 1 1\n", doc->outputfp);
{
if (iscanceled && iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: Job canceled");
break;
}
if ((!ppd || !ppd->num_filters) && log)
- log(ld, FILTER_LOGLEVEL_CONTROL,
+ log(ld, CF_LOGLEVEL_CONTROL,
"PAGE: 1 1");
fprintf(doc->outputfp, "%%%%Page: %d %d\n", copy + 1, copy + 1);
int has_page_setup = 0; /* Does the page have
%%Begin/EndPageSetup? */
int bounding_box[4]; /* PageBoundingBox */
- filter_logfunc_t log = doc->logfunc;
+ cf_logfunc_t log = doc->logfunc;
void *ld = doc->logdata;
if (!parse_text(line + 7, &ptr, label, sizeof(label)))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: There was a bad %%Page: comment in the file.");
label[0] = '\0';
number = doc->page;
}
else if (strtol(ptr, &ptr, 10) == LONG_MAX || !isspace(*ptr & 255))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: There was a bad %%Page: comment in the file.");
number = doc->page;
}
bounding_box + 3) != 4)
{
if (log)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: There was a bad %%PageBoundingBox: comment in the "
"file.");
memcpy(bounding_box, doc->bounding_box,
if (log)
{
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: Orientation = %d", doc->Orientation);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: original bounding_box = [ %d %d %d %d ]",
bounding_box[0], bounding_box[1],
bounding_box[2], bounding_box[3]);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: PageWidth = %.1f, PageLength = %.1f",
doc->PageWidth, doc->PageLength);
}
break;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: updated bounding_box = [ %d %d %d %d ]",
bounding_box[0], bounding_box[1],
bounding_box[2], bounding_box[3]);
if (!doc->slow_order && first_page)
{
if ((!ppd || !ppd->num_filters) && log)
- log(ld, FILTER_LOGLEVEL_CONTROL,
+ log(ld, CF_LOGLEVEL_CONTROL,
"PAGE: %d %d", doc->page,
doc->slow_collate ? 1 : doc->copies);
{
line[0] = '\0';
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPSToPS: Early end-of-file while reading binary data: %s",
strerror(errno));
return (0);
ssize_t linelen, /* I - Length of initial line */
size_t linesize) /* I - Size of line buffer */
{
- filter_logfunc_t log = doc->logfunc;
+ cf_logfunc_t log = doc->logfunc;
void *ld = doc->logdata;
if (!strncmp(line, "%%EndProlog", 11))
linelen = (ssize_t)cupsFileGetLine(doc->inputfp, line, linesize);
else
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: The %%EndProlog comment is missing.");
}
{
int num_options; /* Number of options */
cups_option_t *options; /* Options */
- filter_logfunc_t log = doc->logfunc;
+ cf_logfunc_t log = doc->logfunc;
void *ld = doc->logdata;
if (!strncmp(line, "%%EndSetup", 10))
linelen = (ssize_t)cupsFileGetLine(doc->inputfp, line, linesize);
else
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: The %%EndSetup comment is missing.");
}
ssize_t linelen, /* I - Length of initial line */
size_t linesize) /* I - Size of line buffer */
{
- filter_logfunc_t log = doc->logfunc;
+ cf_logfunc_t log = doc->logfunc;
void *ld = doc->logdata;
linelen = (ssize_t)cupsFileGetLine(doc->inputfp, line, linesize);
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: Wrote %d pages...", number);
fprintf(doc->outputfp, "%%%%Pages: %d\n", number);
va_list ap; /* Pointer to arguments */
char buffer[1024]; /* Output buffer */
ssize_t bytes; /* Number of bytes to write */
- filter_logfunc_t log = doc->logfunc;
+ cf_logfunc_t log = doc->logfunc;
void *ld = doc->logdata;
if ((size_t)bytes > sizeof(buffer))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPSToPS: Buffer overflow detected, truncating.");
bytes = sizeof(buffer);
}
char name[255], /* Option name */
value[255]; /* Option value */
ppd_option_t *option; /* Option in file */
- filter_logfunc_t log = doc->logfunc;
+ cf_logfunc_t log = doc->logfunc;
void *ld = doc->logdata;
if (sscanf(line + 17, "%254s%254s", name, value) != 2)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: The %%IncludeFeature: comment is not valid.");
return (num_options);
}
if ((option = ppdFindOption(ppd, name + 1)) == NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"cfFilterPSToPS: Unknown option \"%s\".", name + 1);
return (num_options);
}
if (option->section == PPD_ORDER_EXIT ||
option->section == PPD_ORDER_JCL)
{
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"cfFilterPSToPS: Option \"%s\" cannot be included via "
"%%%%IncludeFeature.", name + 1);
return (num_options);
if (!ppdFindChoice(option, value))
{
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"cfFilterPSToPS: Unknown choice \"%s\" for option \"%s\".",
value, name + 1);
return (num_options);
int copies, /* I - Number of copies */
int num_options, /* I - Number of options */
cups_option_t *options, /* I - Options */
- filter_logfunc_t logfunc, /* I - Logging function,
+ cf_logfunc_t logfunc, /* I - Logging function,
NULL for no logging */
void *logdata, /* I - User data for logging function,
can be NULL */
ppd_choice_t *choice; /* PPD choice */
const char *content_type; /* Original content type */
int max_copies; /* Maximum number of copies supported */
- filter_logfunc_t log = logfunc;
+ cf_logfunc_t log = logfunc;
void *ld = logdata;
cf_filter_iscanceledfunc_t iscanceled = iscanceledfunc;
void *icd = iscanceleddata;
doc->number_up = intval;
break;
default :
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPSToPS: Unsupported number-up value %d, using "
"number-up=1.", intval);
doc->number_up = 1;
doc->number_up_layout = PSTOPS_LAYOUT_BTRL;
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPSToPS: Unsupported number-up-layout value %s, using "
"number-up-layout=lrtb.", val);
doc->number_up_layout = PSTOPS_LAYOUT_LRTB;
doc->page_border = PSTOPS_BORDERDOUBLE2;
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPSToPS: Unsupported page-border value %s, using "
"page-border=none.", val);
doc->page_border = PSTOPS_BORDERNONE;
if ((doc->temp = cupsTempFile2(doc->tempfile,
sizeof(doc->tempfile))) == NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPSToPS: Unable to create temporary file: %s",
strerror(errno));
return (1);
doc->use_ESPshowpage = 1;
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: slow_collate=%d, slow_duplex=%d, slow_order=%d",
doc->slow_collate, doc->slow_duplex, doc->slow_order);
size_t linesize) /* I - Size of line buffer */
{
int level; /* Embedded document level */
- filter_logfunc_t log = doc->logfunc;
+ cf_logfunc_t log = doc->logfunc;
void *ld = doc->logdata;
{
line[0] = '\0';
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPSToPS: Early end-of-file while reading binary data: %s",
strerror(errno));
return (0);
bboxw, /* BoundingBox width */
bboxl; /* BoundingBox height */
double margin = 0; /* Current margin for border */
- filter_logfunc_t log = doc->logfunc;
+ cf_logfunc_t log = doc->logfunc;
void *ld = doc->logdata;
if (log)
{
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: pagew = %.1f, pagel = %.1f", pagew, pagel);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: bboxx = %d, bboxy = %d, bboxw = %d, bboxl = %d",
bboxx, bboxy, bboxw, bboxl);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: PageLeft = %.1f, PageRight = %.1f",
doc->PageLeft, doc->PageRight);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: PageTop = %.1f, PageBottom = %.1f",
doc->PageTop, doc->PageBottom);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPSToPS: PageWidth = %.1f, PageLength = %.1f",
doc->PageWidth, doc->PageLength);
}
ppd_file_t *ppd;
cups_page_header2_t inheader;
cups_page_header2_t outheader;
- filter_logfunc_t logfunc; /* Logging function, NULL for no
+ cf_logfunc_t logfunc; /* Logging function, NULL for no
logging */
void *logdata; /* User data for logging function, can
be NULL */
char *profile = NULL;
ppd_attr_t *attr;
const char *val;
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data ->logdata;
cups_cspace_t cspace = (cups_cspace_t)(-1);
CF_FILTER_OUT_FORMAT_CUPS_RASTER : outformat, 0, &cspace);
if (doc->ppd) {
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Using PPD file: %s", doc->ppd->nickname);
ppdMarkOptions(doc->ppd,num_options,options);
handleRequiresPageRegion(doc);
free(profile);
}
} else {
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: No PPD file is specified.");
if (strcasecmp(doc->outheader.cupsRenderingIntent, "Perceptual") == 0) {
doc->color_profile.renderingIntent = INTENT_PERCEPTUAL;
&& !strncasecmp(val, "bi-level", 8))
doc->bi_level = 1;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Page size %s: %s",
doc->page_size_requested ? "requested" : "default",
doc->outheader.cupsPageSizeName);
static int selectConvertFunc(cups_raster_t *raster,
pwgtoraster_doc_t* doc,
conversion_function_t *convert,
- filter_logfunc_t log,
+ cf_logfunc_t log,
void* ld)
{
doc->bitspercolor = doc->outheader.cupsBitsPerColor;
CHANNELS_SH(doc->outheader.cupsNumColors) |
BYTES_SH(bytes),
doc->color_profile.renderingIntent,0)) == 0) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPWGToRaster: Can't create color transform.");
return (1);
}
convert->convertCSpace = W8toK8;
break;
default:
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPWGToRaster: Specified ColorSpace is not supported");
return (1);
break;
cups_raster_t *inras,
cups_raster_t *outras,
conversion_function_t *convert,
- filter_logfunc_t log,
+ cf_logfunc_t log,
void *ld,
cf_filter_iscanceledfunc_t iscanceled,
void *icd)
if (iscanceled && iscanceled(icd))
{
// Canceled
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Job canceled on input page %d", pageNo);
return (false);
}
if (!cupsRasterReadHeader2(inras, &(doc->inheader)))
{
// Done
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Job completed");
return (false);
}
// Raster and Apple Raster (the input formats supported by this
// filter function) these values are all zero. With at least one not
// zero we consider the input not supported.
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPWGToRaster: Input page %d is not PWG or Apple Raster", pageNo);
return (false);
}
if (log) {
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Input page %d", pageNo);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: HWResolution = [ %d %d ]",
doc->inheader.HWResolution[0], doc->inheader.HWResolution[1]);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: PageSize = [ %d %d ]",
doc->inheader.PageSize[0], doc->inheader.PageSize[1]);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsWidth = %d", doc->inheader.cupsWidth);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsHeight = %d", doc->inheader.cupsHeight);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsBitsPerColor = %d", doc->inheader.cupsBitsPerColor);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsBitsPerPixel = %d", doc->inheader.cupsBitsPerPixel);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsBytesPerLine = %d", doc->inheader.cupsBytesPerLine);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsColorOrder = %d", doc->inheader.cupsColorOrder);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsColorSpace = %d", doc->inheader.cupsColorSpace);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsCompression = %d", doc->inheader.cupsCompression);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsPageSizeName = %s", doc->inheader.cupsPageSizeName);
}
doc->outheader.cupsBytesPerLine *= doc->outheader.cupsNumColors;
if (!cupsRasterWriteHeader2(outras, &(doc->outheader))) {
- if (log) log(ld,FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld,CF_LOGLEVEL_ERROR,
"cfFilterPWGToRaster: Can't write page %d header", pageNo);
return (false);
}
if (log) {
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Output page %d", pageNo);
if (doc->outheader.ImagingBoundingBox[3] > 0)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Duplex = %d", doc->outheader.Duplex);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: HWResolution = [ %d %d ]",
doc->outheader.HWResolution[0], doc->outheader.HWResolution[1]);
if (doc->outheader.ImagingBoundingBox[3] > 0)
{
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: ImagingBoundingBox = [ %d %d %d %d ]",
doc->outheader.ImagingBoundingBox[0],
doc->outheader.ImagingBoundingBox[1],
doc->outheader.ImagingBoundingBox[2],
doc->outheader.ImagingBoundingBox[3]);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Margins = [ %d %d ]",
doc->outheader.Margins[0], doc->outheader.Margins[1]);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: ManualFeed = %d", doc->outheader.ManualFeed);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: MediaPosition = %d", doc->outheader.MediaPosition);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: NumCopies = %d", doc->outheader.NumCopies);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Orientation = %d", doc->outheader.Orientation);
}
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: PageSize = [ %d %d ]",
doc->outheader.PageSize[0], doc->outheader.PageSize[1]);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsWidth = %d", doc->outheader.cupsWidth);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsHeight = %d", doc->outheader.cupsHeight);
if (doc->outheader.ImagingBoundingBox[3] > 0)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsMediaType = %d", doc->outheader.cupsMediaType);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsBitsPerColor = %d",
doc->outheader.cupsBitsPerColor);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsBitsPerPixel = %d",
doc->outheader.cupsBitsPerPixel);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsBytesPerLine = %d",
doc->outheader.cupsBytesPerLine);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsColorOrder = %d", doc->outheader.cupsColorOrder);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsColorSpace = %d", doc->outheader.cupsColorSpace);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsCompression = %d", doc->outheader.cupsCompression);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsPageSizeName = %s", doc->outheader.cupsPageSizeName);
}
if (doc->outheader.HWResolution[i] == doc->inheader.HWResolution[i])
{
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: %s resolution: %d dpi",
i == 0 ? "Horizontal" : "Vertical", doc->inheader.HWResolution[i]);
continue;
{
if (doc->outheader.HWResolution[i] % doc->inheader.HWResolution[i])
{
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPWGToRaster: %s output resolution %d dpi is not an integer multiple of %s input resolution %d dpi",
i == 0 ? "Horizontal" : "Vertical", doc->outheader.HWResolution[i],
i == 0 ? "horizontal" : "vertical", doc->inheader.HWResolution[i]);
{
res_up_factor[i] =
doc->outheader.HWResolution[i] / doc->inheader.HWResolution[i];
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: %s input resolution: %d dpi; %s output resolution: %d dpi -> Raising by factor %d",
i == 0 ? "Horizontal" : "Vertical", doc->inheader.HWResolution[i],
i == 0 ? "Horizontal" : "Vertical", doc->outheader.HWResolution[i],
{
if (doc->inheader.HWResolution[i] % doc->outheader.HWResolution[i])
{
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPWGToRaster: %s input resolution %d dpi is not an integer multiple of %s output resolution %d dpi",
i == 0 ? "Horizontal" : "Vertical", doc->inheader.HWResolution[i],
i == 0 ? "horizontal" : "vertical", doc->outheader.HWResolution[i]);
{
res_down_factor[i] =
doc->inheader.HWResolution[i] / doc->outheader.HWResolution[i];
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: %s input resolution: %d dpi; %s output resolution: %d dpi -> Reducing by factor %d",
i == 0 ? "Horizontal" : "Vertical", doc->inheader.HWResolution[i],
i == 0 ? "Horizontal" : "Vertical", doc->outheader.HWResolution[i],
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPWGToRaster: Unsupported input color space: Number of colors: %d; Bits per color: %d.",
doc->inheader.cupsNumColors, doc->inheader.cupsBitsPerColor);
return false;
if (input_color_mode != color_mode_needed)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Need to pre-convert input from %s to %s",
(input_color_mode == 0 ? "1-bit mono" :
(input_color_mode == 1 ? "8-bit gray" :
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Input color mode: %s",
(input_color_mode == 0 ? "1-bit mono" :
(input_color_mode == 1 ? "8-bit gray" :
if (doc->outheader.PageSize[0] >= 2 * doc->inheader.PageSize[0] ||
doc->outheader.PageSize[1] >= 2 * doc->inheader.PageSize[1])
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPWGToRaster: Difference between input and output page dimensions too large, probably the input has a wrong page size");
goto out;
}
if (abs(doc->outheader.PageSize[0] - doc->inheader.PageSize[0]) > 2 ||
abs(doc->outheader.PageSize[1] - doc->inheader.PageSize[1]) > 2)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Output page dimensions are larger for borderless printing with overspray, inserting one extra pixel after each %d pixels",
overspray_duplicate_after_pixels);
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Output page dimensions are larger than input page dimensions due to rounding error, inserting one extra pixel after each %d pixels",
overspray_duplicate_after_pixels);
}
doc->inheader.cupsBytesPerLine) !=
doc->inheader.cupsBytesPerLine)
{
- if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld,CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Unable to read line %d for page %d.",
yin + 1, pageNo);
ret = false;
doc->inheader.cupsBytesPerLine) !=
doc->inheader.cupsBytesPerLine)
{
- if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld,CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Unable to read line %d for page %d.",
yin + 1, pageNo);
ret = false;
doc->inheader.cupsBytesPerLine) !=
doc->inheader.cupsBytesPerLine)
{
- if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld,CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Unable to read line %d for page %d.",
yin + 1, pageNo);
ret = false;
return (ret);
}
-static int setColorProfile(pwgtoraster_doc_t *doc, filter_logfunc_t log, void *ld)
+static int setColorProfile(pwgtoraster_doc_t *doc, cf_logfunc_t log, void *ld)
{
if (doc->outheader.cupsBitsPerColor != 8 && doc->outheader.cupsBitsPerColor != 16) {
/* color Profile is not supported */
doc->color_profile.outputColorProfile = NULL;
break;
default:
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPWGToRaster: Specified ColorSpace is not supported");
return (1);
}
int i;
cups_raster_t *inras = NULL,
*outras = NULL;
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
conversion_function_t convert;
cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
} else
outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Output format: %s",
(outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ? "CUPS Raster" :
(outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ? "PWG Raster" :
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPWGToRaster: Unable to open input data stream.");
}
&& doc.outheader.cupsBitsPerColor != 4
&& doc.outheader.cupsBitsPerColor != 8
&& doc.outheader.cupsBitsPerColor != 16) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPWGToRaster: Specified color format is not supported.");
ret = 1;
goto out;
if (doc.outheader.cupsColorOrder != CUPS_ORDER_CHUNKED
|| (doc.outheader.cupsBitsPerColor != 8
&& doc.outheader.cupsBitsPerColor != 16)) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPWGToRaster: Specified color format is not supported.");
ret = 1;
goto out;
doc.outputNumColors = 1;
break;
default:
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPWGToRaster: Specified ColorSpace is not supported.");
ret = 1;
goto out;
}
if (!(doc.color_profile.cm_disabled)) {
if (setColorProfile(&doc, log, ld) == 1) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPWGToRaster: Cannot set color profile.");
ret = 1;
goto out;
CUPS_RASTER_WRITE_APPLE :
CUPS_RASTER_WRITE))))) == 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPWGToRaster: Can't open output raster stream.");
ret = 1;
goto out;
memset(&convert, 0, sizeof(conversion_function_t));
if (selectConvertFunc(outras, &doc, &convert, log, ld) == 1)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterPWGToRaster: Unable to select color conversion function.");
ret = 1;
goto out;
}
if (log) {
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Output page header");
if (doc.outheader.ImagingBoundingBox[3] > 0)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Duplex = %d", doc.outheader.Duplex);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: HWResolution = [ %d %d ]",
doc.outheader.HWResolution[0], doc.outheader.HWResolution[1]);
if (doc.outheader.ImagingBoundingBox[3] > 0)
{
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: ImagingBoundingBox = [ %d %d %d %d ]",
doc.outheader.ImagingBoundingBox[0],
doc.outheader.ImagingBoundingBox[1],
doc.outheader.ImagingBoundingBox[2],
doc.outheader.ImagingBoundingBox[3]);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Margins = [ %d %d ]",
doc.outheader.Margins[0], doc.outheader.Margins[1]);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: ManualFeed = %d", doc.outheader.ManualFeed);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: MediaPosition = %d", doc.outheader.MediaPosition);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: NumCopies = %d", doc.outheader.NumCopies);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: Orientation = %d", doc.outheader.Orientation);
}
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: PageSize = [ %d %d ]",
doc.outheader.PageSize[0], doc.outheader.PageSize[1]);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsWidth = %d", doc.outheader.cupsWidth);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsHeight = %d", doc.outheader.cupsHeight);
if (doc.outheader.ImagingBoundingBox[3] > 0)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsMediaType = %d", doc.outheader.cupsMediaType);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsBitsPerColor = %d",
doc.outheader.cupsBitsPerColor);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsBitsPerPixel = %d",
doc.outheader.cupsBitsPerPixel);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsBytesPerLine = %d",
doc.outheader.cupsBytesPerLine);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsColorOrder = %d", doc.outheader.cupsColorOrder);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsColorSpace = %d", doc.outheader.cupsColorSpace);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsCompression = %d", doc.outheader.cupsCompression);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: cupsPageSizeName = %s", doc.outheader.cupsPageSizeName);
}
icd))
i ++;
if (i == 0)
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterPWGToRaster: No page printed, outputting empty file.");
out:
cups_size_t *size, /* Current media size */
*size_matched = NULL;
/* Matched size */
- filter_logfunc_t log = data->logfunc; /* logging function for debugging */
+ cf_logfunc_t log = data->logfunc; /* logging function for debugging */
void *ld = data->logdata;
ipp_attribute_t *defattr; /* default value of attr */
int i, /* looping var */
if (!header)
{
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "Page header cannot be NULL!\n");
+ if(log) log(ld, CF_LOGLEVEL_ERROR, "Page header cannot be NULL!\n");
return (-1);
}
if (!printer_attrs)
{
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "Printer-attributes info not supplied!\n");
+ if(log) log(ld, CF_LOGLEVEL_ERROR, "Printer-attributes info not supplied!\n");
return (-1);
}
if(fabs(header->PageSize[1] - temptop + tempbottom) / templength < 0.01 &&
fabs(header->PageSize[0] - tempright + templeft) / tempwidth < 0.01 &&
(size_matched==NULL || !strcasecmp(pageSizeRequested, ippsizename))){
- if(log)log(ld,FILTER_LOGLEVEL_DEBUG,"Imageable area fit\n");
+ if(log)log(ld,CF_LOGLEVEL_DEBUG,"Imageable area fit\n");
size_matched = size;
if (landscape) *landscape = 0;
if (image_fit) *image_fit = 1;
/*
* Standard size...
*/
- if(log)log(ld,FILTER_LOGLEVEL_DEBUG,"IPP matched size = %s\n", size_matched->media);
+ if(log)log(ld,CF_LOGLEVEL_DEBUG,"IPP matched size = %s\n", size_matched->media);
size = size_matched;
dimensions[0] = size->width * 72.0 / 2540.0;
dimensions[1] = size->length * 72.0 / 2540.0;
if(fabs(header->PageSize[0] - temptop + tempbottom) / templength < 0.01 &&
fabs(header->PageSize[1] - tempright + templeft) / tempwidth < 0.01 &&
(size_matched==NULL || !strcasecmp(pageSizeRequested, ippsizename))){
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "Imageable area fit\n");
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "Imageable area fit\n");
size_matched = size;
if (landscape) *landscape = 1;
if (image_fit) *image_fit = 1;
* Standard size in landscape orientation...
*/
size = size_matched;
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "landscape size = %s\n", size->media);
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "landscape size = %s\n", size->media);
dimensions[0] = size->width * 72.0 / 2540.0;
dimensions[1] = size->length * 72.0 / 2540.0;
margins[0] = size->left * 72.0 / 2540.0;
/*
* Custom size...
*/
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "size = custom\n");
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "size = custom\n");
for (i = 0; i < 2; i ++)
dimensions[i] = header->PageSize[i];
margins[0] = left * 72.0 / 2540.0;
cups_option_t *options = NULL;
ipp_t *printer_attrs = data->printer_attrs;
ipp_attribute_t *ipp_attr;
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
int i;
num_options = joinJobOptionsAndAttrs(data, num_options, &options);
}
}
if(i==count){
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"User specified print-rendering-intent not supported by printer,"
"using default print rendering intent.");
header->cupsRenderingIntent[0] = '\0';
ipp_t *printer_attrs, *job_attrs;
int num_options = 0;
cups_option_t *options = NULL;
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
int pwgraster = 0,
appleraster = 0,
if (log) {
if (*cspace == -1)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"Color space requested: Default");
else
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"Color space requested: #%d", *cspace);
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"Final output format: %s",
appleraster ? "Apple Raster" :
(pwgraster ? "PWG Raster" :
if (ppd)
{
if (log)
- log(ld, FILTER_LOGLEVEL_DEBUG, "PPD file present");
+ log(ld, CF_LOGLEVEL_DEBUG, "PPD file present");
ppdRasterInterpretPPD(h, ppd, num_options, options, NULL);
if ((ppd_attr = ppdFindAttr(ppd,"PWGRaster",0)) != 0 &&
(!strcasecmp(ppd_attr->value, "true") ||
appleraster = 0;
pclm = 0;
if (log)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"PWG Raster output requested (via \"PWGRaster\" PPD attribute)");
}
(!strcasecmp(quality, "High") || !strcmp(quality, "5"))) ?
1 : 0;
if (log) {
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"Color mode requested: %s; color depth requested: %s",
color_mode, hi_depth ? "High" : "Standard");
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"Determining best color space/depth ...");
}
res = cupsRasterSetColorSpace(h, cspaces_available, color_mode,
}
hi_depth = 0;
if (log)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"For PCLm color mode is always SRGB/SGray 8-bit.");
res = cupsRasterSetColorSpace(h, cspaces_available, color_mode,
cspace, &hi_depth);
else
{
if (log)
- log(ld, FILTER_LOGLEVEL_DEBUG, "No PPD file present");
+ log(ld, CF_LOGLEVEL_DEBUG, "No PPD file present");
if (cupsraster)
{
pwgraster = 0;
pwgraster = 1;
cupsraster = 0;
if (log)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"PWG Raster output requested (via \"MediaClass\"/\"media-class\" option)");
} else
pwgraster = 0;
(!strcasecmp(quality, "high") || !strcmp(quality, "5"))) ?
1 : 0;
if (log) {
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"Color mode requested: %s; color depth requested: %s",
color_mode, hi_depth ? "High" : "Standard");
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"Determining best color space/depth ...");
}
res = cupsRasterSetColorSpace(h, cspaces_available, color_mode,
"print-color-mode");
hi_depth = 0;
if (log)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"For PCLm color mode is always SRGB/SGray 8-bit.");
res = cupsRasterSetColorSpace(h, cspaces_available, color_mode,
cspace, &hi_depth);
if (res < 0) {
/* failed */
if (log) {
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"Unable to set color space/depth for Raster output!");
if (*cspace < 0)
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"Did not find a valid color space!");
else
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"Requested color space #%d not a valid PWG/Apple Raster color space!",
*cspace);
}
} else
/* succeeded */
if (log)
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"Using color space #%d with %s color depth",
*cspace, hi_depth ? "high" : "standard");
}
function */
bitFunction bit_function; /* Raster bit function */
FILE *outputfp; /* Temporary file, if any */
- filter_logfunc_t logfunc; /* Logging function, NULL for no
+ cf_logfunc_t logfunc; /* Logging function, NULL for no
logging */
void *logdata; /* User data for logging
function, can be NULL */
alternate_cs = "/DeviceCMYK";
break;
default:
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Failed to embed ICC Profile.");
return QPDFObjectHandle::newNull();
}
ret = pdf.makeIndirectObject(array);
free(buff);
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: ICC Profile embedded in PDF.");
return ret;
components = 3;
break;
default:
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Color space not supported.");
return std::vector<QPDFObjectHandle>(num_strips, QPDFObjectHandle());
}
break;
default:
if (doc->logfunc)
- doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Color space not supported.");
return QPDFObjectHandle();
}
break;
default:
if (doc->logfunc)
- doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Color space not supported.");
return QPDFObjectHandle();
}
if(!image.isInitialized())
{
if (doc->logfunc)
- doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Unable to load image data");
return 1;
}
if(!strips[i].isInitialized())
{
if (doc->logfunc)
- doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Unable to load strip data");
return 1;
}
break;
default:
if (doc->logfunc)
- doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Unable to convert PDF from profile.");
doc->colorProfile = NULL;
error = 1;
break;
default:
if (doc->logfunc)
- doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Color space not supported.");
error = 1;
break;
if (info->height > (std::numeric_limits<unsigned>::max() /
info->line_bytes)) {
if (doc->logfunc)
- doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Page too big");
return 1;
}
info->pdf.addPage(info->page, false);
} catch (std::bad_alloc &ex) {
if (doc->logfunc)
- doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Unable to allocate page data");
return 1;
} catch (...) {
if(line_n > info->height)
{
if (doc->logfunc)
- doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Bad line %d", line_n);
return;
}
if (doc->colorProfile != NULL) {
if (doc->logfunc)
- doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Load profile successful.");
return 0;
}
else {
if (doc->logfunc)
- doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
+ doc->logfunc(doc->logdata, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Unable to load profile.");
return 1;
}
ipp_t *printer_attrs = data->printer_attrs; /* Printer attributes from printer data*/
ipp_attribute_t *ipp_attr; /* Printer attribute*/
const char* profile_name = NULL; /* IPP Profile Name */
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
}
else
outformat = CF_FILTER_OUT_FORMAT_PDF;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: OUTFORMAT=\"%s\"",
outformat == CF_FILTER_OUT_FORMAT_PDF ? "PDF" : "PCLM");
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Unable to open output data stream.");
}
if (outformat == CF_FILTER_OUT_FORMAT_PCLM && data->ppd == NULL
&& printer_attrs == NULL )
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPDF: PCLm output: Neither a PPD file nor printer IPP attributes are supplied, PCLm output not possible.");
return 1;
}
char *attr_name = (char *)"cupsPclmStripHeightPreferred";
if ((attr = ppdFindAttr(data->ppd, attr_name, NULL)) != NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: PPD PCLm attribute \"%s\" with value \"%s\"",
attr_name, attr->value);
pdf.pclm_strip_height_preferred = atoi(attr->value);
attr_name = (char *)"cupsPclmStripHeightSupported";
if ((attr = ppdFindAttr(data->ppd, attr_name, NULL)) != NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: PPD PCLm attribute \"%s\" with value \"%s\"",
attr_name, attr->value);
pdf.pclm_strip_height_supported.clear(); // remove default value = 16
attr_name = (char *)"cupsPclmRasterBackSide";
if ((attr = ppdFindAttr(data->ppd, attr_name, NULL)) != NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: PPD PCLm attribute \"%s\" with value \"%s\"",
attr_name, attr->value);
pdf.pclm_raster_back_side = attr->value;
attr_name = (char *)"cupsPclmSourceResolutionSupported";
if ((attr = ppdFindAttr(data->ppd, attr_name, NULL)) != NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: PPD PCLm attribute \"%s\" with value \"%s\"",
attr_name, attr->value);
pdf.pclm_source_resolution_supported = split_strings(attr->value, ",");
attr_name = (char *)"cupsPclmSourceResolutionDefault";
if ((attr = ppdFindAttr(data->ppd, attr_name, NULL)) != NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: PPD PCLm attribute \"%s\" with value \"%s\"",
attr_name, attr->value);
pdf.pclm_source_resolution_default = attr->value;
{
pdf.pclm_source_resolution_default =
pdf.pclm_source_resolution_supported[0];
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: PPD PCLm attribute \"%s\" missing, taking first item of \"cupsPclmSourceResolutionSupported\" as default resolution",
attr_name);
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPDF: PCLm output: PPD file does not contain printer resolution information for PCLm.");
return 1;
}
attr_name = (char *)"cupsPclmCompressionMethodPreferred";
if ((attr = ppdFindAttr(data->ppd, attr_name, NULL)) != NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: PPD PCLm attribute \"%s\" with value \"%s\"",
attr_name, attr->value);
std::vector<std::string> vec = split_strings(attr->value, ",");
// use FLATE as compression method and show a warning.
if (pdf.pclm_compression_method_preferred.empty())
{
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"(rastertopclm) Unable parse PPD attribute \"%s\". "
"Using FLATE for encoding image streams.", attr_name);
pdf.pclm_compression_method_preferred.push_back(FLATE_DECODE);
{
if (log)
{
- log(ld, FILTER_LOGLEVEL_DEBUG, "PCLm-related printer IPP attributes:");
+ log(ld, CF_LOGLEVEL_DEBUG, "PCLm-related printer IPP attributes:");
total_attrs = 0;
ipp_attr = ippFirstAttribute(printer_attrs);
while (ipp_attr)
{
total_attrs ++;
ippAttributeString(ipp_attr, buf, sizeof(buf));
- log(ld, FILTER_LOGLEVEL_DEBUG, " Attr: %s",ippGetName(ipp_attr));
- log(ld, FILTER_LOGLEVEL_DEBUG, " Value: %s", buf);
+ log(ld, CF_LOGLEVEL_DEBUG, " Attr: %s",ippGetName(ipp_attr));
+ log(ld, CF_LOGLEVEL_DEBUG, " Value: %s", buf);
for (i = 0; i < ippGetCount(ipp_attr); i ++)
if ((kw = ippGetString(ipp_attr, i, NULL)) != NULL)
- log(ld, FILTER_LOGLEVEL_DEBUG, " Keyword: %s", kw);
+ log(ld, CF_LOGLEVEL_DEBUG, " Keyword: %s", kw);
}
ipp_attr = ippNextAttribute(printer_attrs);
}
- log(ld, FILTER_LOGLEVEL_DEBUG, " %d attributes", total_attrs);
+ log(ld, CF_LOGLEVEL_DEBUG, " %d attributes", total_attrs);
}
char *attr_name = (char *)"pclm-strip-height-preferred";
if ((ipp_attr = ippFindAttribute(printer_attrs, attr_name, IPP_TAG_ZERO)) != NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Printer PCLm attribute \"%s\" with value %d",
attr_name, ippGetInteger(ipp_attr, 0));
pdf.pclm_strip_height_preferred = ippGetInteger(ipp_attr, 0);
attr_name = (char *)"pclm-strip-height-supported";
if ((ipp_attr = ippFindAttribute(printer_attrs, attr_name, IPP_TAG_ZERO)) != NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Printer PCLm attribute \"%s\"",
attr_name);
pdf.pclm_strip_height_supported.clear(); // remove default value = 16
attr_name = (char *)"pclm-raster-back-side";
if ((ipp_attr = ippFindAttribute(printer_attrs, attr_name, IPP_TAG_ZERO)) != NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Printer PCLm attribute \"%s\" with value \"%s\"",
attr_name, ippGetString(ipp_attr, 0, NULL));
pdf.pclm_raster_back_side = ippGetString(ipp_attr, 0, NULL);
if ((ipp_attr = ippFindAttribute(printer_attrs, attr_name, IPP_TAG_ZERO)) != NULL)
{
ippAttributeString(ipp_attr, buf, sizeof(buf));
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Printer PCLm attribute \"%s\" with value \"%s\"",
attr_name, buf);
pdf.pclm_source_resolution_supported = split_strings(buf, ",");
if ((ipp_attr = ippFindAttribute(printer_attrs, attr_name, IPP_TAG_ZERO)) != NULL)
{
ippAttributeString(ipp_attr, buf, sizeof(buf));
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Printer PCLm attribute \"%s\" with value \"%s\"",
attr_name, buf);
pdf.pclm_source_resolution_default = buf;
{
pdf.pclm_source_resolution_default =
pdf.pclm_source_resolution_supported[0];
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Printer PCLm attribute \"%s\" missing, taking first item of \"pclm-source-resolution-supported\" as default resolution",
attr_name);
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPDF: PCLm output: Printer IPP attributes do not contain printer resolution information for PCLm.");
return 1;
}
if ((ipp_attr = ippFindAttribute(printer_attrs, attr_name, IPP_TAG_ZERO)) != NULL)
{
ippAttributeString(ipp_attr, buf, sizeof(buf));
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Printer PCLm attribute \"%s\" with value \"%s\"",
attr_name, buf);
std::vector<std::string> vec = split_strings(buf, ",");
// use FLATE as compression method and show a warning.
if (pdf.pclm_compression_method_preferred.empty())
{
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"(rastertopclm) Unable parse Printer attribute \"%s\". "
"Using FLATE for encoding image streams.", attr_name);
pdf.pclm_compression_method_preferred.push_back(FLATE_DECODE);
{
if (iscanceled && iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Job canceled");
break;
}
// We have a valid input page, so create PDF file
if (create_pdf_file(&pdf, outformat) != 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPDF: Unable to create PDF file");
return 1;
}
// Write a status message with the page number
Page ++;
- if (log) log(ld, FILTER_LOGLEVEL_INFO,
+ if (log) log(ld, CF_LOGLEVEL_INFO,
"cfFilterRasterToPDF: Starting page %d.", Page);
// Use "profile=profile_name.icc" to embed 'profile_name.icc' into the PDF
doc.cm_disabled = 0;
}
if (doc.colorProfile != NULL)
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: TEST ICC Profile specified (color "
"management forced ON): \n[%s]", profile_name);
header.cupsColorSpace, header.HWResolution[0],
header.HWResolution[1], &doc) != 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPDF: Unable to start new PDF page");
return 1;
}
header.cupsBitsPerPixel, header.cupsBytesPerLine,
&pdf, &doc) != 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPDF: Failed to convert page bitmap");
return 1;
}
if (empty)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPDF: Input is empty, outputting empty file.");
cupsRasterClose(ras);
return 0;
typedef struct { /**** Document information ****/
cups_file_t *inputfp; /* Temporary file, if any */
FILE *outputfp; /* Temporary file, if any */
- filter_logfunc_t logfunc; /* Logging function, NULL for no
+ cf_logfunc_t logfunc; /* Logging function, NULL for no
logging */
void *logdata; /* User data for logging function, can
be NULL */
int length, /* I - Page length in points */
rastertops_doc_t *doc) /* I - Document information */
{
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_CONTROL,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_CONTROL,
"PAGE: %d %d", page, 1);
fprintf(doc->outputfp, "%%%%Page: %d %d\n", page, page);
fprintf(doc->outputfp, "%%%%BeginPageSetup\n");
{
switch (ret) {
case Z_ERRNO:
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPS: zpipe - error in source data or output file");
break;
case Z_STREAM_ERROR:
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPS: zpipe - invalid compression level");
break;
case Z_DATA_ERROR:
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPS: zpipe - invalid or incomplete deflate data");
break;
case Z_MEM_ERROR:
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPS: zpipe - out of memory");
break;
case Z_VERSION_ERROR:
- if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
+ if (doc->logfunc) doc->logfunc(doc->logdata, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPS: zpipe - zlib version mismatch!");
}
}
int empty, /* Is the input empty? */
Page = 0, /* variable for counting the pages */
ret; /* Return value of deflate compression */
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPS: Unable to open input data stream.");
}
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPS: Unable to open output data stream.");
}
{
if (iscanceled && iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPS: Job canceled");
break;
}
Page ++;
- if (log) log(ld, FILTER_LOGLEVEL_INFO,
+ if (log) log(ld, CF_LOGLEVEL_INFO,
"cfFilterRasterToPS: Starting page %d.", Page);
/*
if (empty)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPS: Input is empty, outputting empty file.");
cupsRasterClose(ras);
return 0;
const char *val; /* Option value */
cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
cf_filter_out_format_t output_format;
outras = cupsRasterOpen(outputfd, CUPS_RASTER_WRITE_APPLE);
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPWG: Invalid output format specified. Only PWG Raster and Apple Raster/URF are supported.");
return (1);
}
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPWG: Output format not specified.");
return (1);
}
if (!data->ppd)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: PPD file is not specified.");
}
if (iscanceled && iscanceled(icd))
{
/* Canceled */
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: Job canceled on input page %d", page + 1);
}
/*
* Show page device dictionary...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: Duplex = %d", inheader.Duplex);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: HWResolution = [ %d %d ]",
inheader.HWResolution[0], inheader.HWResolution[1]);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: ImagingBoundingBox = [ %d %d %d %d ]",
inheader.ImagingBoundingBox[0],
inheader.ImagingBoundingBox[1],
inheader.ImagingBoundingBox[2],
inheader.ImagingBoundingBox[3]);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: Margins = [ %d %d ]",
inheader.Margins[0], inheader.Margins[1]);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: ManualFeed = %d", inheader.ManualFeed);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: MediaPosition = %d", inheader.MediaPosition);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: NumCopies = %d", inheader.NumCopies);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: Orientation = %d", inheader.Orientation);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: PageSize = [ %d %d ]",
inheader.PageSize[0], inheader.PageSize[1]);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: cupsWidth = %d", inheader.cupsWidth);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: cupsHeight = %d", inheader.cupsHeight);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: cupsMediaType = %d", inheader.cupsMediaType);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: cupsBitsPerColor = %d",
inheader.cupsBitsPerColor);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: cupsBitsPerPixel = %d",
inheader.cupsBitsPerPixel);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: cupsBytesPerLine = %d",
inheader.cupsBytesPerLine);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: cupsColorOrder = %d", inheader.cupsColorOrder);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: cupsColorSpace = %d", inheader.cupsColorSpace);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: cupsCompression = %d", inheader.cupsCompression);
/*
page ++;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: %d %d\n", page, inheader.NumCopies);
page_width = (unsigned)(inheader.cupsPageSize[0] *
linesize = (page_width * inheader.cupsBitsPerPixel + 7) / 8;
lineoffset = page_left * inheader.cupsBitsPerPixel / 8; /* Round down */
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: In pixels: Width: %u Height: %u Left: %u Right: %u Top: %u Bottom: %u",
page_width, page_height,
page_left, page_right, page_top, page_bottom);
if (page_left > page_width || page_top > page_height ||
page_bottom > page_height || page_right > page_width)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPWG: Unsupported raster data.");
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: Bad bottom/left/top margin on page %d.", page);
return (1);
}
break;
default :
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPWG: Unsupported raster data.");
- if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld,CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: Unsupported cupsColorSpace %d on page %d.",
inheader.cupsColorSpace, page);
return (1);
if (inheader.cupsColorOrder != CUPS_ORDER_CHUNKED)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPWG: Unsupported raster data.");
- if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld,CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: Unsupported cupsColorOrder %d on page %d.",
inheader.cupsColorOrder, page);
return (1);
if (inheader.cupsBitsPerPixel != 1 &&
inheader.cupsBitsPerColor != 8 && inheader.cupsBitsPerColor != 16)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPWG: Unsupported raster data.");
- if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld,CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: Unsupported cupsBitsPerColor %d on page %d.",
inheader.cupsBitsPerColor, page);
return (1);
sizeof(outheader.OutputType));
else
{
- if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld,CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: Unsupported print-content-optimize value.");
outheader.OutputType[0] = '\0';
}
outheader.cupsInteger[8] = quality;
else
{
- if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld,CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: Unsupported print-quality %d.", quality);
outheader.cupsInteger[8] = 0;
}
sizeof(outheader.cupsRenderingIntent));
else
{
- if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld,CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: Unsupported print-rendering-intent value.");
outheader.cupsRenderingIntent[0] = '\0';
}
sizeof(outheader.cupsPageSizeName) - 1);
else
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: Unsupported PageSize %.2fx%.2f.",
inheader.cupsPageSize[0], inheader.cupsPageSize[1]);
outheader.cupsPageSizeName[0] = '\0';
* Unsupported value...
*/
- if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld,CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: Unsupported cupsBackSide value.");
outheader.cupsInteger[1] = 1; /* CrossFeedTransform */
if (!cupsRasterWriteHeader2(outras, &outheader))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPWG: Error sending raster data.");
- if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld,CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: Unable to write header for page %d.", page);
return (1);
}
for (y = page_top; y > 0; y --)
if (!cupsRasterWritePixels(outras, line, outheader.cupsBytesPerLine))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPWG: Error sending raster data.");
- if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld,CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: Unable to write line %d for page %d.",
page_top - y + 1, page);
return (1);
inheader.cupsBytesPerLine) !=
inheader.cupsBytesPerLine)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPWG: Error sending raster data.");
- if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld,CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: Unable to read line %d for page %d.",
inheader.cupsHeight - y + page_top + 1, page);
return (1);
if (!cupsRasterWritePixels(outras, line, outheader.cupsBytesPerLine))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPWG: Error sending raster data.");
- if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld,CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: Unable to write line %d for page %d.",
inheader.cupsHeight - y + page_top + 1, page);
return (1);
for (y = page_bottom; y > 0; y --)
if (!cupsRasterWritePixels(outras, line, outheader.cupsBytesPerLine))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterRasterToPWG: Error sending raster data.");
- if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld,CF_LOGLEVEL_DEBUG,
"cfFilterRasterToPWG: Unable to write line %d for page %d.",
page_bottom - y + page_top + inheader.cupsHeight + 1,
page);
const char *colormodel, /* I - Color model */
const char *media, /* I - Media type */
const char *resolution, /* I - Resolution */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Log function data */
{
int i, /* Looping var */
if ((attr = cfFindAttr(ppd, "cupsRGBProfile", colormodel, media,
resolution, spec, sizeof(spec), log, ld)) == NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"No cupsRGBProfile attribute found for the current settings!");
return (NULL);
}
if (!attr->value || sscanf(attr->value, "%d%d%d", &cube_size, &num_channels,
&num_samples) != 3)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Bad cupsRGBProfile attribute \'%s\'!",
attr->value ? attr->value : "(null)");
return (NULL);
num_channels < 1 || num_channels > CF_MAX_RGB ||
num_samples != (cube_size * cube_size * cube_size))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Bad cupsRGBProfile attribute \'%s\'!",
attr->value);
return (NULL);
if ((samples = calloc(num_samples, sizeof(cf_sample_t))) == NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Unable to allocate memory for RGB profile!");
return (NULL);
}
break;
else if (!attr->value)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Bad cupsRGBSample value!");
break;
}
values + 1, values + 2, values + 3, values + 4, values + 5,
values + 6) != (3 + num_channels))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"Bad cupsRGBSample value!");
break;
}
#include "driver.h"
#include <sys/stat.h>
-filter_logfunc_t logfunc = cfCUPSLogFunc; /* Log function */
+cf_logfunc_t logfunc = cfCUPSLogFunc; /* Log function */
void *ld = NULL; /* Log function data */
void test_gray(int num_comps, const char *basename);
#include <string.h>
#include <ctype.h>
-filter_logfunc_t logfunc = cfCUPSLogFunc; /* Log function */
+cf_logfunc_t logfunc = cfCUPSLogFunc; /* Log function */
void *ld = NULL; /* Log function data */
} texttopdf_doc_t;
-EMB_PARAMS *font_load(const char *font, int fontwidth, filter_logfunc_t log,
+EMB_PARAMS *font_load(const char *font, int fontwidth, cf_logfunc_t log,
void *ld)
{
OTF_FILE *otf;
if (!fontname)
{
// TODO: try /usr/share/fonts/*/*/%s.ttf
- if(log) log(ld, FILTER_LOGLEVEL_ERROR,"cfFilterTextToPDF: No viable font found.");
+ if(log) log(ld, CF_LOGLEVEL_ERROR,"cfFilterTextToPDF: No viable font found.");
return NULL;
}
int WriteProlog(const char *title, const char *user,
const char *classification, const char *label,
ppd_file_t *ppd, texttopdf_doc_t *doc,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
void WritePage(texttopdf_doc_t *doc);
void WriteEpilogue(texttopdf_doc_t *doc);
enum {StrBeg=-1, NoStr, StrEnd}
strState; /* Inside a dbl-quoted string */
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"textopdf: Unable to open input data stream.");
}
return (1);
if (doc.PageColumns < 1)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTextToPDF: Bad columns value %d", doc.PageColumns);
ret = 1;
goto out;
if (doc.CharsPerInch <= 0.0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTextToPDF: Bad cpi value %f", doc.CharsPerInch);
ret = 1;
goto out;
if (doc.LinesPerInch <= 0.0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTextToPDF: Bad lpi value %f", doc.LinesPerInch);
ret = 1;
goto out;
if (doc.SizeLines >= INT_MAX / doc.SizeColumns / sizeof(lchar_t))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterTextToPDF: Bad page size");
+ if (log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterTextToPDF: Bad page size");
ret = 1;
goto out;
}
doc.Page = calloc(sizeof(lchar_t *), doc.SizeLines);
if (!doc.Page)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTextToPDF: cannot allocate memory for page");
ret = 1;
goto out;
if (!doc.Page[0])
{
free(doc.Page);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTextToPDF: cannot allocate memory for page");
ret = 1;
goto out;
/* Do not write anything if the input file is empty */
if (empty)
{
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,
"Input is empty, outputting empty file");
goto out;
}
const char *label, /* I - Page label */
ppd_file_t *ppd, /* I - PPD file info */
texttopdf_doc_t *doc,
- filter_logfunc_t log,
+ cf_logfunc_t log,
void *ld)
{
int i, j, k; /* Looping vars */
* Can't open charset file!
*/
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTextToPDF: Unable to open %s: %s",
filename, strerror(errno));
return (1);
*/
fclose(fp);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTextToPDF: Bad charset file %s", filename);
return (1);
}
*/
fclose(fp);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTextToPDF: Bad charset file %s", filename);
return (1);
}
* Can't have a font without all required values...
*/
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTextToPDF: Bad font description line: %s", valptr);
return (1);
}
doc->Directions[doc->NumFonts] = -1;
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTextToPDF: Bad text direction %s", valptr);
return (1);
}
* Can't have a font without all required values...
*/
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTextToPDF: Bad font description line: %s", valptr);
return (1);
}
doc->Widths[doc->NumFonts] = 2;
else
{
- if(log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if(log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTextToPDF: Bad text width %s", valptr);
return (1);
}
font_load(valptr, doc->Widths[doc->NumFonts], log, ld);
if (!fonts[num_fonts]) // font missing/corrupt, replace by first
{
- if(log) log(ld, FILTER_LOGLEVEL_WARN,
+ if(log) log(ld, CF_LOGLEVEL_WARN,
"cfFilterTextToPDF: Ignored bad font \"%s\"",valptr);
break;
}
/*
* Can't have a font without all required values...
*/
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTextToPDF: Bad font description line: %s", valptr);
return (1);
}
doc->Directions[doc->NumFonts] = -1;
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTextToPDF: Bad text direction %s", valptr);
return (1);
}
/*
* Can't have a font without all required values...
*/
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTextToPDF: Bad font description line: %s", valptr);
return (1);
}
doc->Widths[doc->NumFonts] = 2;
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTextToPDF: Bad text width %s", valptr);
return (1);
}
font_load(valptr, doc->Widths[doc->NumFonts], log, ld);
if (!fonts[num_fonts]) // font missing/corrupt, replace by first
{
- if(log) log(ld, FILTER_LOGLEVEL_WARN,
+ if(log) log(ld, CF_LOGLEVEL_WARN,
"cfFilterTextToPDF: Ignored bad font \"%s\"",valptr);
break;
}
} // }}}
else // {{{
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTextToPDF: Bad charset type %s", lineptr);
return (1);
} // }}}
// }}}
if (doc->NumFonts == 0) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterTextToPDF:No usable font available");
return (1);
}
ipp_t *defsize;
char buf[2048];
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
{
if (!iscanceled || !iscanceled(icd))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterBannerToPDF: Unable to open output data stream.");
}
return (1);
}
num_chars_per_inch = atoi(val);
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"cfFilterTextToText: num of lines per inch = %d",num_lines_per_inch);
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"cfFilterTextToText: num of chars per inch = %d",num_chars_per_inch);
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,"cfFilterTextToText: num of lines per inch = %d",num_lines_per_inch);
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,"cfFilterTextToText: num of chars per inch = %d",num_chars_per_inch);
/* With the "PageSize"/"PageRegion" options we only determine the number
of lines and columns of a page, we do not use the geometry defined by
if(val==NULL)
val = ppd_attr->value;
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"cfFilterTextToText: PageSize: %s", val);
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,"cfFilterTextToText: PageSize: %s", val);
snprintf(buffer, sizeof(buffer), "Default%sNumLines", val);
if ((val2 = cupsGetOption(buffer + 7, num_options, options)) != NULL ||
(ipp = ippFindAttribute(job_attrs, buffer+7, IPP_TAG_ZERO))!= NULL ||
num_columns = atoi(val2);
}
if (num_lines <= 0) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"cfFilterTextToText: Invalid number of lines %d, using default: 66",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,"cfFilterTextToText: Invalid number of lines %d, using default: 66",
num_lines);
num_lines = 66;
}
if (num_columns <= 0) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"cfFilterTextToText: Invalid number of columns %d, using default: 80",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,"cfFilterTextToText: Invalid number of columns %d, using default: 80",
num_columns);
num_columns = 80;
}
num_columns = (int)((x_dim/72.0)*(num_chars_per_inch));
}
if (num_lines <= 0) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"cfFilterTextToText: Invalid number of lines %d, using default: 66",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,"cfFilterTextToText: Invalid number of lines %d, using default: 66",
num_lines);
num_lines = 66;
}
if (num_columns <= 0) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"cfFilterTextToText: Invalid number of columns %d, using default: 80",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG,"cfFilterTextToText: Invalid number of columns %d, using default: 80",
num_columns);
num_columns = 80;
}
if (i > 0)
num_lines = i;
else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid number of lines %d, using default value: %d",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid number of lines %d, using default value: %d",
i, num_lines);
}
if ((val = cupsGetOption("page-width", num_options, options)) != NULL ||
if (i > 0)
num_columns = i;
else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid number of columns %d, using default value: %d",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid number of columns %d, using default value: %d",
i, num_columns);
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Lines per page: %d; Characters per line: %d",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Lines per page: %d; Characters per line: %d",
num_lines, num_columns);
if ((val = cupsGetOption("page-left", num_options, options)) != NULL ||
val += 7;
page_left = atoi(val);
if (page_left < 0 || page_left > num_columns - 1) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid left margin %d, setting to 0",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid left margin %d, setting to 0",
page_left);
page_left = 0;
}
val += 7;
page_right = atoi(val);
if (page_right < 0 || page_right > num_columns - page_left - 1) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid right margin %d, setting to 0",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid right margin %d, setting to 0",
page_right);
page_right = 0;
}
val += 7;
page_top = atoi(val);
if (page_top < 0 || page_top > num_lines - 1) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid top margin %d, setting to 0",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid top margin %d, setting to 0",
page_top);
page_top = 0;
}
val += 7;
page_bottom = atoi(val);
if (page_bottom < 0 || page_bottom > num_lines - page_top - 1) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid bottom margin %d, setting to 0",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid bottom margin %d, setting to 0",
page_bottom);
page_bottom = 0;
}
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Margins: Left (Columns): %d; Right (Columns): %d; Top (Lines): %d; Bottom (Lines): %d",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Margins: Left (Columns): %d; Right (Columns): %d; Top (Lines): %d; Bottom (Lines): %d",
page_left, page_right, page_top, page_bottom);
text_width = num_columns - page_left - page_right;
text_height = num_lines - page_top - page_bottom;
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Text area: Lines per page: %d; Characters per line: %d",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Text area: Lines per page: %d; Characters per line: %d",
text_height, text_width);
strcpy(encoding, "ASCII//IGNORE");
*p = toupper(*p);
}
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Output encoding: %s", encoding);
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Output encoding: %s", encoding);
if ((val = cupsGetOption("OverlongLines", num_options, options)) != NULL ||
(ipp = ippFindAttribute(job_attrs, "overlong-lines", IPP_TAG_ENUM))!=NULL ||
else if (!strcasecmp(val, "WrapAtWidth"))
overlong_lines = WRAPATWIDTH;
else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for OverlongLines: %s, using default value",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for OverlongLines: %s, using default value",
val);
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Handling of overlong lines: %s",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Handling of overlong lines: %s",
(overlong_lines == TRUNCATE ? "Truncate at maximum width" :
(overlong_lines == WORDWRAP ? "Word-wrap" :
"Wrap exactly at maximum width")));
if (i > 0)
tab_width = i;
else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid tab width %d, using default value: %d",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid tab width %d, using default value: %d",
i, tab_width);
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Tab width: %d", tab_width);
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Tab width: %d", tab_width);
if ((val = cupsGetOption("Pagination", num_options, options)) != NULL ||
(ipp = ippFindAttribute(job_attrs, "pagination", IPP_TAG_BOOLEAN))!=NULL ||
else if (is_false(val))
pagination = 0;
else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for Pagination: %s, using default value",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for Pagination: %s, using default value",
val);
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Pagination (Print in defined pages): %s",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Pagination (Print in defined pages): %s",
(pagination ? "Yes" : "No"));
if ((val = cupsGetOption("SendFF", num_options, options)) != NULL ||
else if (is_false(val))
send_ff = 0;
else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for SendFF: %s, using default value",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for SendFF: %s, using default value",
val);
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Send Form Feed character at end of page: %s",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Send Form Feed character at end of page: %s",
(send_ff ? "Yes" : "No"));
if ((val = cupsGetOption("NewlineCharacters", num_options, options)) !=
else if (!strcasecmp(val, "CRLF"))
newline_char = CRLF;
else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for NewlineCharacters: %s, using default value",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for NewlineCharacters: %s, using default value",
val);
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Characters sent to make printer start a new line: %s",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Characters sent to make printer start a new line: %s",
(newline_char == LF ? "Line Feed (LF)" :
(newline_char == CR ? "Carriage Return (CR)" :
"Carriage Return (CR) and Line Feed (LF)")));
page_ranges = strdup(val);
}
if (page_ranges)
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Page selection: %s", page_ranges);
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Page selection: %s", page_ranges);
if ((val = cupsGetOption("page-set", num_options, options)) !=
NULL ||
even_pages = 1;
odd_pages = 1;
} else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for page-set: %s, using default value",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for page-set: %s, using default value",
val);
}
if (!even_pages || !odd_pages)
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Print %s",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Print %s",
(even_pages ? "only the even pages" :
(odd_pages ? "only the odd pages" :
"no pages")));
if (!strcasecmp(val, "reverse"))
reverse_order = 1;
else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for OutputOrder: %s, using default value",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for OutputOrder: %s, using default value",
val);
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Print pages in reverse order: %s",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Print pages in reverse order: %s",
(reverse_order ? "Yes" : "No"));
if ((val = cupsGetOption("Collate", num_options, options)) != NULL ||
else if (is_false(val))
collate = 0;
else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for Collate: %s, using default value",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for Collate: %s, using default value",
val);
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Collate copies: %s",
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Collate copies: %s",
(collate ? "Yes" : "No"));
/* Create a string to insert as the newline mark */
/* Something went wrong. */
if (errno == EINVAL)
{
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterTextToText: Conversion from UTF-8 to %s not available",
+ if(log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterTextToText: Conversion from UTF-8 to %s not available",
encoding);
}else
{
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterTextToText: Error setting up conversion from UTF-8 to %s",
+ if(log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterTextToText: Error setting up conversion from UTF-8 to %s",
encoding);
}
goto error;
/* Open the input file */
fd = inputfd;
if (fd < 0) {
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterTextToText: Unable to open input text file");
+ if(log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterTextToText: Unable to open input text file");
goto error;
}
ends with an incomplete UTF-8 character. Log
this fact. */
if (insize > 0 && incomplete_char){
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Input text file ends with incomplete UTF-8 character sequence, file possibly incomplete, but printing the successfully read part anyway");
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Input text file ends with incomplete UTF-8 character sequence, file possibly incomplete, but printing the successfully read part anyway");
}
/* Now write out the byte sequence to get into the
} else {
/* We found an illegal UTF-8 byte sequence here,
so error out at this point. */
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterTextToText: Illegal UTF-8 sequence found. Input file perhaps not UTF-8-encoded");
+ if(log) log(ld, CF_LOGLEVEL_ERROR, "cfFilterTextToText: Illegal UTF-8 sequence found. Input file perhaps not UTF-8-encoded");
result = -1;
break;
}
load) */
if (num_pages == 1)
{
- if(log) log(ld, FILTER_LOGLEVEL_INFO, "cfFilterTextToText: 1 1");
+ if(log) log(ld, CF_LOGLEVEL_INFO, "cfFilterTextToText: 1 1");
}
} else if ((num_copies == 1 || !collate) && !reverse_order) {
/* Log the page output */
- if(log) log(ld, FILTER_LOGLEVEL_INFO, "cfFilterTextToText: %d %d", num_pages, num_copies);
+ if(log) log(ld, CF_LOGLEVEL_INFO, "cfFilterTextToText: %d %d", num_pages, num_copies);
} else {
/* Save the page in the page array */
cupsArrayAdd(page_array, strdup(out_page));
close(fd);
if (iconv_close (cd) != 0)
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Error closing iconv encoding conversion session");
+ if(log) log(ld, CF_LOGLEVEL_DEBUG, "cfFilterTextToText: Error closing iconv encoding conversion session");
/* Error out on an illegal UTF-8 sequence in the input file */
if (result < 0)
(reverse_order ? (page >= 1) : (page <= num_pages));
page += (reverse_order ? -1 : 1)) {
p = (char *)cupsArrayIndex(page_array, page - 1);
- if(log) log(ld, FILTER_LOGLEVEL_INFO, "cfFilterTextToText: %d %d", page, (collate ? 1 : num_copies));
+ if(log) log(ld, CF_LOGLEVEL_INFO, "cfFilterTextToText: %d %d", page, (collate ? 1 : num_copies));
}
/* Clean up */
for (page = 0; page < num_pages; page ++) {
cf_filter_universal_parameter_t universal_parameters;
ppd_file_t *ppd;
ppd_cache_t *cache;
- filter_logfunc_t log = data->logfunc;
+ cf_logfunc_t log = data->logfunc;
void *ld = data->logdata;
int ret = 0;
input = universal_parameters.input_format;
if (input == NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterUniversal: No input data format supplied.");
return (1);
}
final_output = universal_parameters.output_format;
if (final_output == NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterUniversal: No output data format supplied.");
return (1);
}
int lowest_cost = INT_MAX;
char *filter;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: \"*cupsFilter(2): ...\" lines in the PPD file:");
for (filter = (char *)cupsArrayFirst(cache->filters);
*coststr = NULL;
int cost;
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: %s", filter);
/* String of the "*cupsfilter:" or "*cupsfilter2:" line */
strcasecmp(in, "application/PCLm") == 0 ||
strcasecmp(in, "application/postscript") == 0))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: --> Selecting this line");
/* Take the input format of the line as output format for us */
strncpy(output, in, sizeof(output));
/* We cannot find a "better" solution ... */
if (lowest_cost == 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Cost value is down to zero, stopping reading further lines");
break;
}
error:
if (lowest_cost == INT_MAX && coststr)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: PPD uses \"*cupsFilter: ...\" lines, so we always convert to format given by FINAL_CONTENT_TYPE");
break;
}
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterUniversal: Invalid \"*cupsFilter2: ...\" line in PPD: %s",
filter);
}
if (strcasecmp(output, final_output) != 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Converting from %s to %s, final output will be %s",
input, output, final_output);
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Converting from %s to %s", input, output);
}
filter->parameters = outformat;
filter->name = "imagetoraster";
cupsArrayAdd(filter_chain, filter);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Adding %s to chain", filter->name);
if (!strcmp(output, "image/pwg-raster"))
filter->parameters = outformat;
filter->name = "rastertopwg";
cupsArrayAdd(filter_chain, filter);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Adding %s to chain", filter->name);
}
else if (!strcmp(output, "application/PCLm"))
filter->parameters = outformat;
filter->name = "rastertopclm";
cupsArrayAdd(filter_chain, filter);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Adding %s to chain", filter->name);
}
else if (!strcmp(output, "image/urf"))
filter->parameters = outformat;
filter->name = "rastertopwg";
cupsArrayAdd(filter_chain, filter);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Adding %s to chain", filter->name);
}
}
filter->parameters = NULL;
filter->name = "imagetopdf";
cupsArrayAdd(filter_chain, filter);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Adding %s to chain", filter->name);
}
}
filter->parameters = outformat;
filter->name = "ghostscript";
cupsArrayAdd(filter_chain, filter);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Adding %s to chain", filter->name);
}
else if (!strcmp(input_super, "text") ||
filter->parameters = parameters;
filter->name = "texttopdf";
cupsArrayAdd(filter_chain, filter);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Adding %s to chain",
filter->name);
}
filter->parameters = outformat;
filter->name = "rastertopdf";
cupsArrayAdd(filter_chain, filter);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Adding %s to chain", filter->name);
}
else if (!strcmp(input_type, "vnd.adobe-reader-postscript"))
filter->parameters = outformat;
filter->name = "ghostscript";
cupsArrayAdd(filter_chain, filter);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Adding %s to chain", filter->name);
if (!strcmp(output, "image/urf"))
filter->parameters = outformat;
filter->name = "rastertopwg";
cupsArrayAdd(filter_chain, filter);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Adding %s to chain",
filter->name);
}
filter->parameters = outformat;
filter->name = "rastertopdf";
cupsArrayAdd(filter_chain, filter);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Adding %s to chain", filter->name);
}
}
filter->parameters = NULL;
filter->name = "bannertopdf";
cupsArrayAdd(filter_chain, filter);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Adding %s to chain", filter->name);
}
else if (!strstr(input_type, "pdf"))
filter->parameters = strdup(output);
filter->name = "pdftopdf";
cupsArrayAdd(filter_chain, filter);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Adding %s to chain", filter->name);
}
filter->parameters = outformat;
filter->name = "ghostscript";
cupsArrayAdd(filter_chain, filter);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Adding %s to chain",
filter->name);
filter->parameters = outformat;
filter->name = "rastertopwg";
cupsArrayAdd(filter_chain, filter);
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Adding %s to chain",
filter->name);
}
filter->function = cfFilterPDFToPS;
filter->parameters = NULL;
filter->name = "pdftops";
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"cfFilterUniversal: Adding %s to chain", filter->name);
cupsArrayAdd(filter_chain, filter);
}
out:
if (ret) {
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"cfFilterUniversal: Unsupported combination of input and output formats: %s -> %s",
input, output);
}
cf_dither_t *DitherStates[7]; /* Dither state tables */
int OutputFeed; /* Number of lines to skip */
int Canceled; /* Is the job canceled? */
-filter_logfunc_t logfunc; /* Log function */
+cf_logfunc_t logfunc; /* Log function */
void *ld; /* Log function data */
{ 5, 0, 1, 2, 3, 4, 6 } /* KCMYcmk */
};
int Canceled; /* Is the job canceled? */
-filter_logfunc_t logfunc; /* Log function */
+cf_logfunc_t logfunc; /* Log function */
void *ld; /* Log function data */
extern _ppd_fc_result_t _ppdFileCheck(const char *filename,
_ppd_fc_filetype_t filetype,
int dorootchecks,
- filter_logfunc_t log,
+ cf_logfunc_t log,
void *ld);
# ifdef __cplusplus
const char *filename, /* I - Filename to check */
_ppd_fc_filetype_t filetype, /* I - Type of file checks? */
int dorootchecks, /* I - Check for root permissions? */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Data pointer for log function */
{
struct stat fileinfo; /* File information */
{
cups_lang_t *lang = cupsLangDefault();
/* Localization information */
- filter_loglevel_t loglevel;
+ cf_loglevel_t loglevel;
switch (result)
{
case _PPD_FILE_CHECK_OK :
- loglevel = FILTER_LOGLEVEL_DEBUG;
+ loglevel = CF_LOGLEVEL_DEBUG;
if (filetype == _PPD_FILE_CHECK_DIRECTORY)
snprintf(message, sizeof(message),
_ppdLangString(lang, _("Directory \"%s\" permissions OK "
break;
case _PPD_FILE_CHECK_MISSING :
- loglevel = FILTER_LOGLEVEL_ERROR;
+ loglevel = CF_LOGLEVEL_ERROR;
if (filetype == _PPD_FILE_CHECK_DIRECTORY)
snprintf(message, sizeof(message),
_ppdLangString(lang, _("Directory \"%s\" not available: "
break;
case _PPD_FILE_CHECK_PERMISSIONS :
- loglevel = FILTER_LOGLEVEL_ERROR;
+ loglevel = CF_LOGLEVEL_ERROR;
if (filetype == _PPD_FILE_CHECK_DIRECTORY)
snprintf(message, sizeof(message),
_ppdLangString(lang, _("Directory \"%s\" has insecure "
break;
case _PPD_FILE_CHECK_WRONG_TYPE :
- loglevel = FILTER_LOGLEVEL_ERROR;
+ loglevel = CF_LOGLEVEL_ERROR;
if (filetype == _PPD_FILE_CHECK_DIRECTORY)
snprintf(message, sizeof(message),
_ppdLangString(lang, _("Directory \"%s\" is a file.")),
break;
case _PPD_FILE_CHECK_RELATIVE_PATH :
- loglevel = FILTER_LOGLEVEL_ERROR;
+ loglevel = CF_LOGLEVEL_ERROR;
if (filetype == _PPD_FILE_CHECK_DIRECTORY)
snprintf(message, sizeof(message),
_ppdLangString(lang, _("Directory \"%s\" contains a "
const char *psversion, time_t mtime,
size_t size, int model_number, int type,
const char *scheme, ppd_list_t *ppdlist,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
static cups_file_t *cat_drv(const char *name, char *ppdname,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
static cups_file_t *cat_static(const char *name,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
static cups_file_t *cat_tar(const char *name, char *ppdname,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
static int compare_inodes(struct stat *a, struct stat *b);
static int compare_matches(const ppd_info_t *p0,
const ppd_info_t *p1);
static int load_driver(const char *filename,
const char *name,
ppd_list_t *ppdlist,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
static int load_drv(const char *filename, const char *name,
cups_file_t *fp, time_t mtime, off_t size,
ppd_list_t *ppdlist,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
static void load_ppd(const char *filename, const char *name,
const char *scheme, struct stat *fileinfo,
ppd_info_t *ppd, cups_file_t *fp, off_t end,
ppd_list_t *ppdlist,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
static int load_ppds(const char *d, const char *p, int descend,
ppd_list_t *ppdlist,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
static int load_ppds_dat(const char *filename, int verbose,
ppd_list_t *ppdlist,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
static int load_tar(const char *filename, const char *name,
cups_file_t *fp, time_t mtime, off_t size,
ppd_list_t *ppdlist,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
static int read_tar(cups_file_t *fp, char *name, size_t namesize,
struct stat *info,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
static regex_t *regex_device_id(const char *device_id,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
static regex_t *regex_string(const char *s,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
static int CompareNames(const char *s, const char *t);
static cups_array_t *CreateStringsArray(const char *s);
static int ExecCommand(const char *command, char **argv);
static cups_file_t *PipeCommand(int *cpid, int *epid, const char *command,
char **argv, uid_t user,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
static int ClosePipeCommand(cups_file_t *fp, int cpid, int epid,
- filter_logfunc_t log, void *ld);
+ cf_logfunc_t log, void *ld);
/*
int limit, /* I - Limit */
int num_options, /* I - Number of options */
cups_option_t *options, /* I - Options */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Aux. data for log function */
{
int i; /* Looping var */
* Write the new ppds.dat file...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] ChangedPPD=%d",
ppdlist.ChangedPPD);
if (rename(newname, cachename))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to rename \"%s\" - %s",
newname, strerror(errno));
}
else
- if (log) log(ld, FILTER_LOGLEVEL_INFO,
+ if (log) log(ld, CF_LOGLEVEL_INFO,
"libppd: [PPD Collections] Wrote \"%s\", %d PPDs...",
cachename, cupsArrayCount(ppdlist.PPDsByName));
}
else
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to write \"%s\" - %s",
cachename, strerror(errno));
}
else
- if (log) log(ld, FILTER_LOGLEVEL_INFO,
+ if (log) log(ld, CF_LOGLEVEL_INFO,
"libppd: [PPD Collections] No new or changed PPDs...");
}
if (type >= (int)(sizeof(PPDTypes) / sizeof(PPDTypes[0])))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Bad ppd-type=\"%s\" ignored!",
type_str);
type_str = NULL;
type = 0;
for (i = 0; i < num_options; i ++)
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] %s=\"%s\"", options[i].name,
options[i].value);
if (ppd->matches)
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] %s matches with score %d!",
ppd->record.name, ppd->matches);
cupsArrayAdd(matches, ppd);
* Output this PPD...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] Sending %s (%s)...",
ppd->record.name, ppd->record.make_and_model);
const char *name, /* I - PPD URI of the desired PPD */
cups_array_t *ppd_collections, /* I - Directories to search for PPDs
in */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Aux. data for log function */
{
ppd_collection_t *col; /* Pointer to PPD collection */
if (strstr(name, "../"))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Invalid PPD name.");
return(NULL);
}
}
if (col == NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Requested PPD %s is in none of "
"the collections",
name);
}
if (access(realname, R_OK))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Cannot access file %s - %s",
realname, strerror(errno));
return(NULL);
* File does not exist or is not executable...
*/
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to access \"%s\" - %s",
realname, strerror(errno));
/*
* Yes, let it cat the PPD file...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] Grabbing PPD via command: \"%s cat %s\"",
realname, ptr);
{
if ((fd = cupsTempFd(tempname, sizeof(tempname))) < 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to copy PPD to temp "
"file: %s",
strerror(errno));
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"libppd: [PPD Collections] Unable to execute \"%s\": %s",
tempname, strerror(errno));
return(NULL);
int
ppdCollectionDumpCache(const char *filename, /* I - Filename */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Aux. data for log
function */
{
int type, /* I - Driver type */
const char *scheme, /* I - PPD scheme */
ppd_list_t *ppdlist,
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Aux. data for log function */
{
ppd_info_t *ppd; /* PPD */
if ((ppd = (ppd_info_t *)calloc(1, sizeof(ppd_info_t))) == NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Ran out of memory for %d PPD "
"files!",
cupsArrayCount(ppdlist->PPDsByName));
static cups_file_t * /* O - Pointer to PPD file */
cat_drv(const char *filename, /* I - *.drv file name */
char *ppdname, /* I - PPD name in the *.drv file */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Aux. data for log function */
{
cups_file_t *fp; // File pointer
if ((fp = cupsFileOpen(filename, "r")) == NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to open \"%s\" - %s\n",
filename, strerror(errno));
if ((fd = cupsTempFd(tempname, sizeof(tempname))) < 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to copy PPD to temp "
"file: %s",
strerror(errno));
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] %u locales defined in \"%s\"...\n",
(unsigned)src->po_files->count, filename);
catalog;
catalog = (ppdcCatalog *)src->po_files->next())
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] Adding locale \"%s\"...\n",
catalog->locale->value);
catalog->locale->retain();
}
}
else
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] PPD \"%s\" not found.\n", ppdname);
src->release();
static cups_file_t * /* O - Pointer to PPD file */
cat_static(const char *name, /* I - PPD name */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Aux. data for log function */
{
cups_file_t *fp;
if ((fp = cupsFileOpen(name, "r")) == NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to open \"%s\" - %s",
name, strerror(errno));
static cups_file_t * /* O - Pointer to PPD file */
cat_tar(const char *filename, /* I - Archive name */
char *ppdname, /* I - PPD name in the archive */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Aux. data for log function */
{
cups_file_t *fp; /* Archive file pointer */
if ((fp = cupsFileOpen(filename, "r")) == NULL)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to open \"%s\" - %s",
filename, strerror(errno));
{
if ((fd = cupsTempFd(tempname, sizeof(tempname))) < 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to copy PPD to temp "
"file: %s",
strerror(errno));
}
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Read error - %s",
strerror(errno));
cupsFileClose(fp);
}
else if (bytes > 0 && write(fd, buffer, bytes) != bytes)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Write error - %s",
strerror(errno));
cupsFileClose(fp);
cupsFileClose(fp);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] PPD \"%s\" not found.", ppdname);
return (NULL);
load_driver(const char *filename, /* I - Driver excutable file name */
const char *name, /* I - Name to the rest of the world */
ppd_list_t *ppdlist,
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Aux. data for log function */
{
int i; /* Looping var */
if (line[strlen(line) - 1] == '\n')
line[strlen(line) - 1] = '\0';
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Bad line from \"%s\": %s",
filename, line);
break;
if (type >= (int)(sizeof(PPDTypes) / sizeof(PPDTypes[0])))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Bad ppd-type \"%s\" ignored!",
type_str);
type = PPD_TYPE_UNKNOWN;
}
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] Adding PPD \"%s\"...",
ppd_name);
}
ClosePipeCommand(fp, cpid, epid, log, ld);
}
else
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"libppd: [PPD Collections] Unable to execute \"%s\": %s",
filename, strerror(errno));
time_t mtime, /* I - Mod time of driver info file */
off_t size, /* I - Size of driver info file */
ppd_list_t *ppdlist,
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Aux. data for log function */
{
ppdcSource *src; // Driver information file
if (src->drivers->count == 0)
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Bad driver information file \"%s\"!\n",
filename);
src->release();
cups_file_t *fp, /* I - File to read from */
off_t end, /* I - End of file position or 0 */
ppd_list_t *ppdlist,
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Aux. data for log function */
{
int i; /* Looping var */
*/
if (!make_model[0])
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"libppd: [PPD Collections] Missing NickName and ModelName "
"in %s!",
filename);
if (cupsArrayCount(products) == 0)
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"libppd: [PPD Collections] Missing Product in %s!",
filename);
if (cupsArrayCount(psversions) == 0)
- if (log) log(ld, FILTER_LOGLEVEL_WARN,
+ if (log) log(ld, CF_LOGLEVEL_WARN,
"libppd: [PPD Collections] Missing PSVersion in %s!",
filename);
* Add new PPD file...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] Adding PPD \"%s\"...", name);
ppd = add_ppd(filename, name, lang_version, manufacturer, make_model,
* Update existing record...
*/
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] Updating ppd \"%s\"...", name);
memset(ppd, 0, sizeof(ppd_info_t));
const char *p, /* I - Virtual path in name */
int descend, /* I - Descend into directories? */
ppd_list_t *ppdlist,
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Aux. data for log function */
{
struct stat dinfo, /* Directory information */
if (stat(d, &dinfo))
{
if (errno != ENOENT)
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to stat \"%s\": %s", d,
strerror(errno));
}
else if (cupsArrayFind(ppdlist->Inodes, &dinfo))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Skipping \"%s\": loop detected!",
d);
return (1);
if ((dir = cupsDirOpen(d)) == NULL)
{
if (errno != ENOENT)
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to open PPD directory "
"\"%s\": %s\n",
d, strerror(errno));
return (0);
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] Loading \"%s\"...", d);
while ((dent = cupsDirRead(dir)) != NULL)
load_ppds_dat(const char *filename, /* I - Filename */
int verbose, /* I - Be verbose? */
ppd_list_t *ppdlist,
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Aux. data for log function */
{
ppd_info_t *ppd; /* Current PPD file */
if ((ppd = (ppd_info_t *)calloc(1, sizeof(ppd_info_t))) == NULL)
{
if (verbose)
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to allocate memory "
"for PPD!");
return(1);
}
if (verbose)
- if (log) log(ld, FILTER_LOGLEVEL_INFO,
+ if (log) log(ld, CF_LOGLEVEL_INFO,
"libppd: [PPD Collections] Read \"%s\", %d PPDs...",
filename, cupsArrayCount(ppdlist->PPDsByName));
}
time_t mtime, /* I - Mod time of driver info file */
off_t size, /* I - Size of driver info file */
ppd_list_t *ppdlist,
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Aux. data for log function */
{
char curname[256], /* Current archive file name */
char *name, /* I - Filename buffer */
size_t namesize, /* I - Size of filename buffer */
struct stat *info, /* O - File information */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Aux. data for log function */
{
tar_rec_t record; /* Record from file */
{
if (record.header.magic[0] ||
memcmp(record.header.magic, record.header.magic + 1, 5))
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Bad tar magic/version.");
break;
}
static regex_t * /* O - Regular expression */
regex_device_id(const char *device_id, /* I - IEEE-1284 device ID */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Aux. data for log function */
{
char res[2048], /* Regular expression string */
int cmd; /* Command set string? */
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] regex_device_id(\"%s\")",
device_id);
*ptr = '\0';
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] regex_device_id: \"%s\"", res);
/*
{
if (!regcomp(re, res, REG_EXTENDED | REG_ICASE))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] regex_device_id: OK");
return (re);
}
static regex_t * /* O - Regular expression */
regex_string(const char *s, /* I - String to compare */
- filter_logfunc_t log, /* I - Log function */
+ cf_logfunc_t log, /* I - Log function */
void *ld) /* I - Aux. data for log function */
{
char res[2048], /* Regular expression string */
regex_t *re; /* Regular expression */
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] regex_string(\"%s\")", s);
/*
*ptr = '\0';
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] regex_string: \"%s\"", res);
/*
{
if (!regcomp(re, res, REG_ICASE))
{
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] regex_string: OK");
return (re);
}
const char *command, /* I - Command to run */
char **argv, /* I - Arguments to pass to command */
uid_t user, /* I - User to run as or 0 for current*/
- filter_logfunc_t log,
+ cf_logfunc_t log,
void *ld)
{
int fd, /* Temporary file descriptor */
efds[2]; /* Error/Log Pipe file descriptors */
cups_file_t *outfp, *logfp;
char buf[BUFSIZ];
- filter_loglevel_t log_level;
+ cf_loglevel_t log_level;
char *msg;
if (pipe(cfds))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to establish output pipe for %s call: %s",
argv[0], strerror(errno));
return (NULL);
if (log)
if (pipe(efds))
{
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to establish error/logging pipe for %s call: %s",
argv[0], strerror(errno));
return (NULL);
{
close(cfds[0]);
close(cfds[1]);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to set \"close on exec\" flag on read end of the output pipe for %s call: %s",
argv[0], strerror(errno));
return (NULL);
{
close(cfds[0]);
close(cfds[1]);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to set \"close on exec\" flag on write end of the output pipe for %s call: %s",
argv[0], strerror(errno));
return (NULL);
close(cfds[1]);
close(efds[0]);
close(efds[1]);
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to set \"close on exec\" flag on read end of the error/logging pipe for %s call: %s",
argv[0], strerror(errno));
return (NULL);
close(cfds[1]);
close(efds[0]);
close(efds[1]);
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to set \"close on exec\" flag on write end of the error/logging pipe for %s call: %s",
argv[0], strerror(errno));
return (NULL);
close(efds[1]);
}
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to fork for %s: %s", argv[0],
strerror(errno));
}
ExecCommand(command, argv);
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to launch %s: %s", argv[0],
strerror(errno));
exit(errno);
}
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] Started %s (PID %d)", argv[0], cpid);
/*
kill(*cpid, SIGTERM);
ClosePipeCommand(outfp, *cpid, 0, log, ld);
- log(ld, FILTER_LOGLEVEL_ERROR,
+ log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Unable to fork for logging for %s: %s",
argv[0], strerror(errno));
while (cupsFileGets(logfp, buf, sizeof(buf)))
if (log) {
if (strncmp(buf, "DEBUG: ", 7) == 0) {
- log_level = FILTER_LOGLEVEL_DEBUG;
+ log_level = CF_LOGLEVEL_DEBUG;
msg = buf + 7;
} else if (strncmp(buf, "DEBUG2: ", 8) == 0) {
- log_level = FILTER_LOGLEVEL_DEBUG;
+ log_level = CF_LOGLEVEL_DEBUG;
msg = buf + 8;
} else if (strncmp(buf, "INFO: ", 6) == 0) {
- log_level = FILTER_LOGLEVEL_INFO;
+ log_level = CF_LOGLEVEL_INFO;
msg = buf + 6;
} else if (strncmp(buf, "WARNING: ", 9) == 0) {
- log_level = FILTER_LOGLEVEL_WARN;
+ log_level = CF_LOGLEVEL_WARN;
msg = buf + 9;
} else if (strncmp(buf, "ERROR: ", 7) == 0) {
- log_level = FILTER_LOGLEVEL_ERROR;
+ log_level = CF_LOGLEVEL_ERROR;
msg = buf + 7;
} else {
- log_level = FILTER_LOGLEVEL_DEBUG;
+ log_level = CF_LOGLEVEL_DEBUG;
msg = buf;
}
log(ld, log_level, "libppd: [PPD Collections] %s: %s", argv[0], msg);
exit(0);
}
- log(ld, FILTER_LOGLEVEL_DEBUG,
+ log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] Started logging for %s (PID %d)",
argv[0], cpid);
ClosePipeCommand(cups_file_t *fp,
int cpid,
int epid,
- filter_logfunc_t log,
+ cf_logfunc_t log,
void *ld)
{
int pid;
continue;
else
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] Error closing sub-processes: %s - killing processes",
strerror(errno));
kill(cpid, SIGTERM);
if (wstatus) {
if (WIFEXITED(wstatus)) {
/* Via exit() anywhere or return() in the main() function */
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] %s (PID %d) stopped with status %d",
(pid == cpid ? "Command" : "Logging"), pid,
WEXITSTATUS(wstatus));
status = WEXITSTATUS(wstatus);
} else {
/* Via signal */
- if (log) log(ld, FILTER_LOGLEVEL_ERROR,
+ if (log) log(ld, CF_LOGLEVEL_ERROR,
"libppd: [PPD Collections] %s (PID %d) crashed on signal %d",
(pid == cpid ? "Command" : "Logging"), pid,
WTERMSIG(wstatus));
status = 256 * WTERMSIG(wstatus);
}
} else {
- if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ if (log) log(ld, CF_LOGLEVEL_DEBUG,
"libppd: [PPD Collections] %s (PID %d) exited with no errors.",
(pid == cpid ? "Command" : "Logging"), pid);
status = 0;
int limit,
int num_options,
cups_option_t *options,
- filter_logfunc_t log,
+ cf_logfunc_t log,
void *ld);
extern cups_file_t *ppdCollectionGetPPD(const char *name,
cups_array_t *ppd_collections,
- filter_logfunc_t log,
+ cf_logfunc_t log,
void *ld);
extern int ppdCollectionDumpCache(const char *filename,
- filter_logfunc_t log,
+ cf_logfunc_t log,
void *ld);
/**** New in cups-filters 2.0.0: For PPD retro-fit Printer Applications ****/
void
_log(void *data,
- filter_loglevel_t level,
+ cf_loglevel_t level,
const char *message,
...)
{
{
default:
break;
- case FILTER_LOGLEVEL_ERROR:
+ case CF_LOGLEVEL_ERROR:
printf("ERROR: ");
break;
- case FILTER_LOGLEVEL_FATAL:
+ case CF_LOGLEVEL_FATAL:
printf("FATAL: ");
break;
}