Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:11.4
ghostscript-library
hpdj-2.6-gs9.00.dif
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File hpdj-2.6-gs9.00.dif of Package ghostscript-library
--- hpdj/gdevhpdj.c +++ hpdj/gdevhpdj.c 2007-09-04 10:32:23.000000000 +0000 @@ -223,6 +223,7 @@ static dev_proc_map_cmyk_color(hpdj_map_ static dev_proc_map_cmyk_color(hpdj_map_cmyk_color_flex); static dev_proc_map_rgb_color(hpdj_map_rgb_color); static dev_proc_map_rgb_color(hpdj_map_rgb_color_flex); +static dev_proc_map_color_rgb(hpdj_map_color_rgb); static dev_proc_open_device(hpdj_open_device); /*****************************************************************************/ @@ -243,7 +244,7 @@ static gx_device_procs hpdj_procs = { gdev_prn_output_page, /* output_page */ gdev_prn_close, /* close_device */ hpdj_map_rgb_color, /* map_rgb_color */ - NULL, /* map_color_rgb + hpdj_map_color_rgb, /* map_color_rgb drivers.txt states that a printer driver must provide this function, but this is apparently not true. It seems rather to be intended for devices supporting colour maps. */ @@ -368,7 +369,7 @@ static void hpdj_get_initial_matrix(gx_d { hpdj_device *dev = (hpdj_device *)device; #ifdef HPDJ_TRACE - fputs("! hpdj_get_initial_matrix()...\n", stderr); + errprintf(dev->memory"! hpdj_get_initial_matrix()...\n"); #endif if (dev->landscape) { @@ -444,15 +445,14 @@ static void hpdj_get_initial_matrix(gx_d ******************************************************************************/ -static gx_color_index hpdj_map_cmyk_color(gx_device *device, - gx_color_value cyan, gx_color_value magenta, gx_color_value yellow, - gx_color_value black) +static gx_color_index hpdj_map_cmyk_color(gx_device *device, const gx_color_value cv[]) { + gx_color_value cyan = cv[0], magenta = cv[1], yellow = cv[2], black = cv[3]; gx_color_index value = 0; gx_color_value threshold = gx_max_color_value/2; #ifdef HPDJ_TRACE - fprintf(stderr, + errprintf( "! hpdj_map_cmyk_color() called for CMYK = (%hu, %hu, %hu, %hu).\n", cyan, magenta, yellow, black); #endif @@ -480,17 +480,16 @@ static gx_color_index hpdj_map_cmyk_colo ******************************************************************************/ -static gx_color_index hpdj_map_cmyk_color_flex(gx_device *device, - gx_color_value cyan, gx_color_value magenta, gx_color_value yellow, - gx_color_value black) +static gx_color_index hpdj_map_cmyk_color_flex(gx_device *device, const gx_color_value cv[]) { + gx_color_value cyan = cv[0], magenta = cv[1], yellow = cv[2], black = cv[3]; gx_color_index value = 0; gx_color_value step; int level; hpdj_device *dev = (hpdj_device *)device; #ifdef HPDJ_TRACE - fprintf(stderr, + errprintf(dev->memory, "! hpdj_map_cmyk_color_flex() called for CMYK = (%hu, %hu, %hu, %hu).\n", cyan, magenta, yellow, black); #endif @@ -546,7 +545,7 @@ static gx_color_index hpdj_map_cmyk_colo } #ifdef HPDJ_TRACE - fprintf(stderr, " returning colour index %lX.\n", (unsigned long)value); + errprintf(dev->memory," returning colour index %lX.\n", (unsigned long)value); #endif return value; } @@ -559,23 +558,32 @@ static gx_color_index hpdj_map_cmyk_colo ******************************************************************************/ -static gx_color_index hpdj_map_rgb_color_flex(gx_device *device, - gx_color_value red, gx_color_value green, gx_color_value blue) +static gx_color_index hpdj_map_rgb_color_flex(gx_device *device, const gx_color_value cv[]) { + gx_color_value red = cv[0], green = cv[1], blue = cv[2]; + gx_color_value rv[4]; hpdj_device *dev = (hpdj_device *)device; #ifdef HPDJ_TRACE - fprintf(stderr, + errprintf(dev->memory, "! hpdj_map_rgb_color_flex() called for RGB = (%hu, %hu, %hu).\n", red, green, blue); #endif /* Treat pure grey levels differently */ - if (dev->colour_mode != cmy && red == green && green == blue) - return hpdj_map_cmyk_color_flex(device, 0, 0, 0, gx_max_color_value - red); + if (dev->colour_mode != cmy && red == green && green == blue) { + rv[0] = 0; + rv[1] = 0; + rv[2] = 0; + rv[3] = gx_max_color_value - red; + return hpdj_map_cmyk_color_flex(device, rv); + } - return hpdj_map_cmyk_color_flex(device, gx_max_color_value - red, - gx_max_color_value - green, gx_max_color_value - blue, 0); + rv[0] = gx_max_color_value - red; + rv[1] = gx_max_color_value - green; + rv[2] = gx_max_color_value - blue; + rv[3] = 0; + return hpdj_map_cmyk_color_flex(device, rv); /* This implies that for CMY+K only "true" grey shades will be printed with black ink, all others will be mixed from CMY. */ } @@ -592,18 +600,21 @@ static gx_color_index hpdj_map_rgb_color ******************************************************************************/ -static gx_color_index hpdj_map_rgb_color(gx_device *device, gx_color_value red, - gx_color_value green, gx_color_value blue) +static gx_color_index hpdj_map_rgb_color(gx_device *device, const gx_color_value cv[]) { + gx_color_value red = cv[0], green = cv[1], blue = cv[2]; gx_color_value half = gx_max_color_value/2; gx_color_index value = (CYAN_MASK | MAGENTA_MASK | YELLOW_MASK); hpdj_device *dev = (hpdj_device *)device; #ifdef HPDJ_TRACE - fprintf(stderr, "! hpdj_map_rgb_color() called for RGB = (%hu, %hu, %hu).\n", + errprintf(dev->memory,"! hpdj_map_rgb_color() called for RGB = (%hu, %hu, %hu).\n", red, green, blue); #endif + if (dev->colour_mode == cmyk) + return hpdj_map_cmyk_color(device, cv); + assert(dev->colour_mode == mono && red == green && green == blue && (blue == 0 || blue == gx_max_color_value) || dev->colour_mode == cmy || dev->colour_mode == cmy_plus_k); @@ -621,6 +632,17 @@ static gx_color_index hpdj_map_rgb_color return value; } +static int hpdj_map_color_rgb(gx_device *device, gx_color_index color, gx_color_value rgb[]) +{ + hpdj_device *dev = (hpdj_device *)device; + /* Just to be safe we return defined values (white) */ + if (dev->colour_mode != mono) + rgb[0] = rgb[1] = rgb[2] = gx_max_color_value; + else + rgb[0] = rgb[1] = rgb[2] = 0; + return -1; +} + /****************************************************************************** Function: hpdj_set_page_layout @@ -717,7 +739,7 @@ int hpdj_set_page_layout(hpdj_device *de pcl_page_size size_requested; #ifdef HPDJ_TRACE - fputs("! hpdj_set_page_layout()...\n", stderr); + errprintf(dev->memory,"! hpdj_set_page_layout()...\n"); #endif /* Initialization */ @@ -794,7 +816,7 @@ int hpdj_set_page_layout(hpdj_device *de (width < cp->width_min || cp->width_max < width || height < cp->height_min || cp->height_max < height)) cp++; if (cp->width_max <= 0) { - fprintf(stderr, ERRPREF + errprintf(dev->memory,ERRPREF "This document requests a sheet size of %d x %d bp.\n" /* Note: Not "page size" because we might have rotated already. */ " This exceeds the custom page size limits for the DeskJet %s.\n", @@ -809,7 +831,7 @@ int hpdj_set_page_layout(hpdj_device *de margin_desc *mp = dev->margin_overrides; while (mp->code != pcl_ps_none && mp->code != pcl_ps_custom) mp++; if (mp->code != pcl_ps_custom) { - fprintf(stderr, ERRPREF + errprintf(dev->memory,ERRPREF "This document requests a sheet size of %d x %d bp\n" " but there is no entry for this size in the margin file\n" " %s.\n" @@ -834,14 +856,13 @@ int hpdj_set_page_layout(hpdj_device *de if (dev->ps_code == pcl_ps_none) { /* Requested size is unsupported */ - fprintf(stderr, ERRPREF + errprintf(dev->memory,ERRPREF "This document requests a sheet size of %d x %d bp.\n", (int)(width + 0.5), (int)(height + 0.5)); if (dev->margin_overrides != NULL) - fputs(" The margin file does not contain an entry for this size.\n", - stderr); + errprintf(dev->memory," The margin file does not contain an entry for this size.\n"); else - fprintf(stderr, " This size is not supported by the DeskJet %s.\n", + errprintf(dev->memory," This size is not supported by the DeskJet %s.\n", hpdj_model[dev->model].name); return -1; } @@ -859,7 +880,7 @@ int hpdj_set_page_layout(hpdj_device *de See hpdj_get_params(). */ #ifdef HPDJ_TRACE - fputs("! hpdj_set_page_layout(): Rotation is necessary.\n", stderr); + errprintf(dev->memory,"! hpdj_set_page_layout(): Rotation is necessary.\n"); #endif /* Remember that the initial matrix must be rotated */ @@ -898,14 +919,14 @@ int hpdj_set_page_layout(hpdj_device *de int rc; #ifdef HPDJ_TRACE - fputs("! hpdj_set_page_layout(): Device is open on rotation.\n", stderr); + errprintf(dev->memory,"! hpdj_set_page_layout(): Device is open on rotation.\n"); #endif /* Unfortunately, gdev_prn_free() and gdev_prn_alloc() are static. */ gdev_prn_close((gx_device *)dev); /* ignore the result */ rc = gdev_prn_open((gx_device *)dev); if (rc < 0) { - fprintf(stderr, ERRPREF "Failure of gdev_prn_open(), code is %d.\n", + errprintf(dev->memory,ERRPREF "Failure of gdev_prn_open(), code is %d.\n", rc); return rc; } @@ -984,23 +1005,21 @@ static int final_checks(hpdj_device *dev /* First check for model "none" */ if (dev->model == hpdj_none) { - fputs(ERRPREF, stderr); + errprintf(dev->memory,ERRPREF); if (HPDJ_DEFAULT_MODEL == hpdj_none) - fputs("This instance of hpdj has been compiled without\n" + errprintf(dev->memory,"This instance of hpdj has been compiled without\n" " choosing a default printer model. You must therefore explicitly\n" " select a model by means of the 'Model' option. Consult the manual\n" - " page gs-hpdj(1) for permissible values.\n", - stderr); + " page gs-hpdj(1) for permissible values.\n"); else - fputs("Setting the printer model to \"none\" is not\n" - " particularly profitable. Please choose another model.\n", - stderr); + errprintf(dev->memory,"Setting the printer model to \"none\" is not\n" + " particularly profitable. Please choose another model.\n"); return_error(gs_error_rangecheck); } /* Colour capability */ if (hpdj_model[dev->model].colour_capability < dev->colour_mode) { - fprintf(stderr, ERRPREF "The DeskJet %s does not support colour mode %s.\n", + errprintf(dev->memory,ERRPREF "The DeskJet %s does not support colour mode %s.\n", hpdj_model[dev->model].name, hpdj_colour_mode_list[dev->colour_mode].name); return_error(gs_error_rangecheck); @@ -1011,18 +1030,18 @@ static int final_checks(hpdj_device *dev /* Find the resolution entry */ while (rp->h != 0 && (rp->h != rh || rp->v != rv)) rp++; if (rp->h == 0) { - fprintf(stderr, ERRPREF "A resolution of %d", rh); - if (rh != rv) fprintf(stderr, "x%d", rv); - fprintf(stderr, " ppi is not supported\n by the DeskJet %s.\n", + errprintf(dev->memory,ERRPREF "A resolution of %d", rh); + if (rh != rv) errprintf(dev->memory,"x%d", rv); + errprintf(dev->memory," ppi is not supported\n by the DeskJet %s.\n", hpdj_model[dev->model].name); return_error(gs_error_rangecheck); } /* Check for values illegal in coloured modes */ if (dev->colour_mode != mono && !rp->for_colour) { - fprintf(stderr, ERRPREF "A resolution of %d", rh); - if (rh != rv) fprintf(stderr, "x%d", rv); - fprintf(stderr, + errprintf(dev->memory,ERRPREF "A resolution of %d", rh); + if (rh != rv) errprintf(dev->memory,"x%d", rv); + errprintf(dev->memory, " ppi is not supported\n by the DeskJet %s when printing in colour.\n", hpdj_model[dev->model].name); return_error(gs_error_rangecheck); @@ -1032,7 +1051,7 @@ static int final_checks(hpdj_device *dev /* Checks concerned with intensity levels */ if ((dev->colour_mode == mono) != (dev->cmy_levels == 0) || dev->colour_mode == cmy && dev->black_levels != 0) { - fprintf(stderr, ERRPREF "Colour mode (%s) and intensity levels (%d, %d) " + errprintf(dev->memory,ERRPREF "Colour mode (%s) and intensity levels (%d, %d) " "are inconsistent.\n", hpdj_colour_mode_list[dev->colour_mode].name, dev->black_levels, dev->cmy_levels); @@ -1041,7 +1060,7 @@ static int final_checks(hpdj_device *dev if (dev->black_levels > 2 || dev->cmy_levels > 2) { if (dev->model != hpdj850c && dev->model != hpdj855c && dev->model != hpdj_unspec) { - fprintf(stderr, ERRPREF + errprintf(dev->memory,ERRPREF "More than 2 intensity levels are not supported\n" " for the DeskJet %s.\n", hpdj_model[dev->model].name); return_error(gs_error_rangecheck); @@ -1053,7 +1072,7 @@ static int final_checks(hpdj_device *dev /* This is an experimentally determined constraint. I've not been able to achieve more than two intensities on a DJ 850C except at 300 ppi. */ - fprintf(stderr, ERRPREF + errprintf(dev->memory,ERRPREF "For the DeskJet %s, more than 2 intensity levels are only\n" " supported at 300 ppi.\n", hpdj_model[dev->model].name); @@ -1064,7 +1083,7 @@ static int final_checks(hpdj_device *dev print with colour mode CMY on a DJ 850C lead to the colour changing instead of the intensity. */ - fprintf(stderr, ERRPREF + errprintf(dev->memory,ERRPREF "For the DeskJet %s, more than 2 intensity levels are not\n" " supported for the colour mode CMY.\n", hpdj_model[dev->model].name); @@ -1072,7 +1091,7 @@ static int final_checks(hpdj_device *dev } if (dev->black_levels > 4 || dev->cmy_levels > 4) { /* See BPD02652 for the justification */ - fprintf(stderr, ERRPREF + errprintf(dev->memory,ERRPREF "The DeskJet %s permits at most 4 intensity levels.\n", hpdj_model[dev->model].name); return_error(gs_error_rangecheck); @@ -1082,7 +1101,7 @@ static int final_checks(hpdj_device *dev setting the black levels to 2 or 3 lead to the colours being ignored or scrambled. (Note that we can't have CMY here.) */ - fprintf(stderr, ERRPREF "With more than 2 CMY intensity levels,\n" + errprintf(dev->memory,ERRPREF "With more than 2 CMY intensity levels,\n" " you must set BlackLevels to 4 for the DeskJet %s.\n", hpdj_model[dev->model].name); return_error(gs_error_rangecheck); @@ -1093,7 +1112,7 @@ static int final_checks(hpdj_device *dev being ignored or scrambled. (Note that at least one of the levels is larger than 2.) */ - fprintf(stderr, ERRPREF "If you want to increase BlackLevels with\n" + errprintf(dev->memory,ERRPREF "If you want to increase BlackLevels with\n" " colour mode CMYK, you must set it to 4 for the DeskJet %s.\n", hpdj_model[dev->model].name); return_error(gs_error_rangecheck); @@ -1102,7 +1121,7 @@ static int final_checks(hpdj_device *dev /* This is an experimentally determined constraint. On a DJ 850C and in draft quality, the low intensity bit was ignored. */ - fprintf(stderr, ERRPREF + errprintf(dev->memory,ERRPREF "Printing with more than 2 intensity levels is\n" " useless in draft quality on the DeskJet %s.\n", hpdj_model[dev->model].name); @@ -1113,14 +1132,13 @@ static int final_checks(hpdj_device *dev /* Compression methods */ if (dev->model == hpdj500 && dev->compression_method == pcl_cm_crdr) { - fputs(ERRPREF "The DeskJet 500 does not support compression method 9.\n", - stderr); + errprintf(dev->memory,ERRPREF "The DeskJet 500 does not support compression method 9.\n"); return_error(gs_error_rangecheck); } /* Dry time */ if (dev->dry_time >= 0 && (dev->model == hpdj500 || dev->model == hpdj500c)) { - fprintf(stderr, ERRPREF + errprintf(dev->memory,ERRPREF "The DeskJet %s does not support setting a dry time.\n", hpdj_model[dev->model].name); return_error(gs_error_rangecheck); @@ -1128,7 +1146,7 @@ static int final_checks(hpdj_device *dev /* Media types */ if (dev->media_type == 5 && dev->model != hpdj_unspec) - fprintf(stderr, WARNPREF + errprintf(dev->memory,WARNPREF "The DeskJet %s has no knowledge of photo paper.\n", hpdj_model[dev->model].name); @@ -1157,28 +1175,27 @@ static int hpdj_open_device(gx_device *d int rc; #ifdef HPDJ_TRACE - fputs("! hpdj_open_device()...\n", stderr); + errprintf(dev->memory,"! hpdj_open_device()...\n"); #endif #ifdef HPDJ_MARGIN_FILE /* Change default margin descriptions for 'unspec' */ if (dev->model == hpdj_unspec && dev->margin_file == NULL) { /* Copy the name into the device structure */ - dev->margin_file = (char *) gs_malloc(strlen(HPDJ_MARGIN_FILE) + 1, + dev->margin_file = (char *) gs_malloc(dev->memory, strlen(HPDJ_MARGIN_FILE) + 1, /* At present, one could also use sizeof() instead of strlen() here. I find this safer, though, concerning possible changes. */ sizeof(char), "hpdj_open_device"); if (dev->margin_file == NULL) { - fputs(ERRPREF - "Memory allocation failure from gs_malloc() in hpdj_open_device().\n", - stderr); + errprintf(dev->memory,ERRPREF + "Memory allocation failure from gs_malloc() in hpdj_open_device().\n"); return_error(gs_error_VMerror); } strcpy(dev->margin_file, HPDJ_MARGIN_FILE); /* Read the margin file */ if ((rc = hpdj_read_margins(dev)) != 0) { - gs_free(dev->margin_file, strlen(dev->margin_file) + 1, sizeof(char), + gs_free(dev->memory, dev->margin_file, strlen(dev->margin_file) + 1, sizeof(char), "hpdj_open_device"); dev->margin_file = NULL; return rc; @@ -1201,10 +1218,9 @@ static int hpdj_open_device(gx_device *d unsigned long count = 0; if (pcf_getcount(dev->pagecount_file, &count) != 0) { /* pcf_getcount() has issued an error message. */ - fputs( - " No further attempts will be made to access the page count file.\n", - stderr); - gs_free(dev->pagecount_file, strlen(dev->pagecount_file) + 1, + errprintf(dev->memory, + " No further attempts will be made to access the page count file.\n"); + gs_free(dev->memory, dev->pagecount_file, strlen(dev->pagecount_file) + 1, sizeof(char), "hpdj_open_device"); dev->pagecount_file = NULL; } --- hpdj/hpdjparm.c +++ hpdj/hpdjparm.c 2007-09-04 10:27:51.000000000 +0000 @@ -197,7 +197,7 @@ static int get_option_value(const gs_par /* First we construct a properly NUL-terminated string */ s = (char *) malloc(in_value->size + 1); if (s == NULL) { - fprintf(stderr, ERRPREF + errprintf_nomem(ERRPREF "Memory allocation failure in get_option_value(), errno is %d.\n", errno); return_error(gs_error_VMerror); @@ -247,7 +247,7 @@ int hpdj_get_params(gx_device *device, g rc; #ifdef HPDJ_TRACE - fputs("! hpdj_get_params()...\n", stderr); + errprintf(dev->memory,"! hpdj_get_params()...\n"); #endif #ifndef NDEBUG @@ -548,7 +548,7 @@ int hpdj_read_margins(hpdj_device *dev) if ((f = fopen(dev->margin_file, "r")) == NULL) { const char *s; if ((s = strerror(errno)) == NULL) s = "unknown reason"; - fprintf(stderr, ERRPREF "Error opening the margin file\n" + errprintf(dev->memory,ERRPREF "Error opening the margin file\n" " `%s'\n for reading (%s).\n", dev->margin_file, s); return_error(gs_error_invalidfileaccess); @@ -564,7 +564,7 @@ int hpdj_read_margins(hpdj_device *dev) /* Check for buffer overflow */ if ((s = strchr(buffer, '\n')) == NULL && fgetc(f) != EOF) { - fprintf(stderr, + errprintf(dev->memory, ERRPREF "Exceeding line length %d in margin file\n %s, line %d.\n", BUFFER_SIZE - 2, dev->margin_file, line); cleanup(); @@ -602,7 +602,7 @@ int hpdj_read_margins(hpdj_device *dev) margin_desc *new_list; new_list = (margin_desc *)realloc(list, (read+1)*sizeof(margin_desc)); if (new_list == NULL) { - fprintf(stderr, ERRPREF + errprintf(dev->memory,ERRPREF "Memory allocation failure in hpdj_read_margins(), errno is %d.\n", errno); cleanup(); @@ -622,7 +622,7 @@ int hpdj_read_margins(hpdj_device *dev) ¤t->bottom, ¤t->right, ¤t->top, &chars_read) != 5 || buffer[chars_read] != '\0') { #endif /* _MSC_VER */ - fprintf(stderr, + errprintf(dev->memory, ERRPREF "Syntax error in margin file %s, line %d:\n %s\n", dev->margin_file, line, buffer); cleanup(); @@ -643,7 +643,7 @@ int hpdj_read_margins(hpdj_device *dev) notice the reason without help, hence we check. */ if (current->code == pcl_ps_custom) { if (hpdj_model[dev->model].custom == NULL) { - fprintf(stderr, ERRPREF "The margin file %s\n" + errprintf(dev->memory,ERRPREF "The margin file %s\n" " contains a custom page size entry in line %d, " "but custom page sizes\n" " are not supported by the DeskJet %s.\n", @@ -657,7 +657,7 @@ int hpdj_read_margins(hpdj_device *dev) while (hpdj_mdim[j].code != pcl_ps_none && current->code != hpdj_mdim[j].code) j++; if (hpdj_mdim[j].code == pcl_ps_none) { - fprintf(stderr, ERRPREF + errprintf(dev->memory,ERRPREF "Unknown PCL page size code (%d) in margin file\n %s, line %d.\n", (int)current->code, dev->margin_file, line); cleanup(); @@ -667,13 +667,13 @@ int hpdj_read_margins(hpdj_device *dev) /* Too small a right margin is possibly harmful */ if (current->right <= 0.124998*BP_PER_IN) /* deliberately fuzzy */ - fprintf(stderr, WARNPREF + errprintf(dev->memory,WARNPREF "Margin file %s, line %d:\n The right margin is less than 0.125 in.\n" " This can lead to the print head being caught at the paper's edge.\n", dev->margin_file, line); } if (ferror(f)) { - fprintf(stderr, + errprintf(dev->memory, ERRPREF "Unknown system error in reading `%s'.\n", dev->margin_file); cleanup(); return_error(gs_error_invalidfileaccess); @@ -682,19 +682,18 @@ int hpdj_read_margins(hpdj_device *dev) /* Was the file empty? */ if (read == 0) { - fprintf(stderr, ERRPREF + errprintf(dev->memory,dev->memory,ERRPREF "The margin file %s\n does not contain any margin definitions.\n", dev->margin_file); return_error(gs_error_rangecheck); } /* Create a list in the device structure */ - dev->margin_overrides = (margin_desc *) gs_malloc(read + 1, + dev->margin_overrides = (margin_desc *) gs_malloc(dev->memory, read + 1, sizeof(margin_desc), "hpdj_read_margins"); if (dev->margin_overrides == NULL) { - fputs(ERRPREF - "Memory allocation failure from gs_malloc() in hpdj_read_margins().\n", - stderr); + errprintf(dev->memory,dev->memory,ERRPREF + "Memory allocation failure from gs_malloc() in hpdj_read_margins().\n"); free(list); return_error(gs_error_VMerror); } @@ -807,7 +806,7 @@ int hpdj_put_params(gx_device *device, g width = dev->width; /* see comments at the end of this function */ #ifdef HPDJ_TRACE - fputs("! hpdj_put_params()...\n", stderr); + errprintf(dev->memory,"! hpdj_put_params()...\n"); #endif /* BlackLevels. Various depending values will be adjusted below. */ @@ -821,7 +820,7 @@ int hpdj_put_params(gx_device *device, g dev->black_levels = temp; } else { - fprintf(stderr, ERRPREF + errprintf(dev->memory,ERRPREF "The value for BlackLevels is outside the range permitted: %d.\n", temp); last_error = gs_error_rangecheck; @@ -840,7 +839,7 @@ int hpdj_put_params(gx_device *device, g dev->cmy_levels = temp; } else { - fprintf(stderr, ERRPREF + errprintf(dev->memory,ERRPREF "The value for CMYLevels is outside the range permitted: %d.\n", temp); last_error = gs_error_rangecheck; param_signal_error(plist, pname, last_error); @@ -856,9 +855,9 @@ int hpdj_put_params(gx_device *device, g rc = get_option_value(&string_value, hpdj_colour_mode_list, &temp); \ if (rc != 0 || temp < mono || cmyk < temp) { \ if (rc != gs_error_VMerror) { \ - fputs(ERRPREF "Unknown colour mode: `", stderr); \ - fwrite(string_value.data, sizeof(char), string_value.size, stderr); \ - fputs("'.\n", stderr); \ + errprintf(dev->memory,ERRPREF "Unknown colour mode: `"); \ + errwrite(dev->memory,string_value.data, string_value.size); \ + errprintf(dev->memory,"'.\n"); \ } \ if (rc != 0) last_error = rc; else last_error = gs_error_rangecheck; \ param_signal_error(plist, pname, last_error); \ @@ -909,7 +908,7 @@ int hpdj_put_params(gx_device *device, g == 0) { if (temp != pcl_cm_none && temp != pcl_cm_rl && temp != pcl_cm_tiff && temp != pcl_cm_delta && temp != pcl_cm_crdr) { - fprintf(stderr, + errprintf(dev->memory, ERRPREF "Unsupported compression method: %d.\n", temp); last_error = gs_error_rangecheck; param_signal_error(plist, pname, last_error); @@ -923,7 +922,7 @@ int hpdj_put_params(gx_device *device, g if ((rc = param_read_int(plist, (pname = "DryTime"), &temp)) == 0) { if (-1 <= temp && temp <= 1200) dev->dry_time = temp; else { - fprintf(stderr, + errprintf(dev->memory, ERRPREF "Illegal value for the dry time: %d.\n", temp); last_error = gs_error_rangecheck; param_signal_error(plist, pname, last_error); @@ -944,26 +943,25 @@ int hpdj_put_params(gx_device *device, g == 0) { /* Free old storage */ if (dev->margin_file != NULL) { - gs_free(dev->margin_file, strlen(dev->margin_file) + 1, sizeof(char), + gs_free(dev->memory, dev->margin_file, strlen(dev->margin_file) + 1, sizeof(char), "hpdj_put_params"); dev->margin_file = NULL; } if (dev->margin_overrides != NULL) { int n = 0; while (dev->margin_overrides[n].code != pcl_ps_none) n++; - gs_free(dev->margin_overrides, n+1, sizeof(margin_desc), + gs_free(dev->memory, dev->margin_overrides, n+1, sizeof(margin_desc), "hpdj_put_params"); dev->margin_overrides = NULL; } /* Read margin file, unless the name is the empty string */ if (string_value.size > 0) { - dev->margin_file = (char *)gs_malloc(string_value.size + 1, sizeof(char), + dev->margin_file = (char *)gs_malloc(dev->memory, string_value.size + 1, sizeof(char), "hpdj_put_params"); if (dev->margin_file == NULL) { - fputs(ERRPREF - "Memory allocation failure from gs_malloc() in hpdj_put_params().\n", - stderr); + errprintf(dev->memory,ERRPREF + "Memory allocation failure from gs_malloc() in hpdj_put_params().\n"); last_error = gs_error_VMerror; param_signal_error(plist, pname, last_error); } @@ -974,7 +972,7 @@ int hpdj_put_params(gx_device *device, g if ((rc = hpdj_read_margins(dev)) != 0) { last_error = rc; param_signal_error(plist, pname, last_error); - gs_free(dev->margin_file, strlen(dev->margin_file) + 1, sizeof(char), + gs_free(dev->memory, dev->margin_file, strlen(dev->margin_file) + 1, sizeof(char), "hpdj_put_params"); dev->margin_file = NULL; } @@ -996,15 +994,15 @@ int hpdj_put_params(gx_device *device, g rc = get_option_value(&string_value, media_type_list, &dev->media_type); if (rc != 0) { if (rc != gs_error_VMerror) { - fputs(ERRPREF "Unknown media type: `", stderr); - fwrite(string_value.data, sizeof(char), string_value.size, stderr); - fputs("'.\n", stderr); + errprintf(dev->memory,ERRPREF "Unknown media type: `"); + errwrite(dev->memory,string_value.data, string_value.size); + errprintf(dev->memory,"'.\n"); } last_error = rc; param_signal_error(plist, pname, last_error); } else if (dev->media_type < 0 || 5 < dev->media_type) - fprintf(stderr, WARNPREF "Unknown media type: %d.\n", dev->media_type); + errprintf(dev->memory,WARNPREF "Unknown media type: %d.\n", dev->media_type); } else if (rc < 0) last_error = rc; @@ -1026,9 +1024,9 @@ int hpdj_put_params(gx_device *device, g } } else { - fputs(ERRPREF "Unknown model name: `", stderr); - fwrite(string_value.data, sizeof(char), string_value.size, stderr); - fputs("'.\n", stderr); + errprintf(dev->memory,ERRPREF "Unknown model name: `"); + errwrite(dev->memory,string_value.data, string_value.size); + errprintf(dev->memory,"'.\n"); last_error = gs_error_rangecheck; param_signal_error(plist, pname, last_error); } @@ -1041,19 +1039,18 @@ int hpdj_put_params(gx_device *device, g == 0) { /* Free old storage */ if (dev->pagecount_file != NULL) { - gs_free(dev->pagecount_file, strlen(dev->pagecount_file) + 1, + gs_free(dev->memory, dev->pagecount_file, strlen(dev->pagecount_file) + 1, sizeof(char), "hpdj_put_params"); dev->pagecount_file = NULL; } /* Store file name unless it is the empty string */ if (string_value.size > 0) { - dev->pagecount_file = (char *)gs_malloc(string_value.size + 1, + dev->pagecount_file = (char *)gs_malloc(dev->memory, string_value.size + 1, sizeof(char), "hpdj_put_params"); if (dev->pagecount_file == NULL) { - fputs(ERRPREF - "Memory allocation failure from gs_malloc() in hpdj_put_params().\n", - stderr); + errprintf(dev->memory,ERRPREF + "Memory allocation failure from gs_malloc() in hpdj_put_params().\n"); last_error = gs_error_VMerror; param_signal_error(plist, pname, last_error); } @@ -1075,15 +1072,15 @@ int hpdj_put_params(gx_device *device, g &dev->print_quality); if (rc != 0) { if (rc != gs_error_VMerror) { - fputs(ERRPREF "Unknown print quality: `", stderr); - fwrite(string_value.data, sizeof(char), string_value.size, stderr); - fputs("'.\n", stderr); + errprintf(dev->memory,ERRPREF "Unknown print quality: `"); + errwrite(dev->memory,string_value.data, string_value.size); + errprintf(dev->memory,"'.\n"); } last_error = rc; param_signal_error(plist, pname, last_error); } else if (dev->print_quality < -1 || 1 < dev->print_quality) - fprintf(stderr, WARNPREF "Unknown print quality: %d.\n", + errprintf(dev->memory,WARNPREF "Unknown print quality: %d.\n", dev->print_quality); } else if (rc < 0) last_error = rc; @@ -1104,7 +1101,7 @@ int hpdj_put_params(gx_device *device, g */ if ((rc = param_read_int(plist, (pname = "BitsPerPixel"), &temp)) == 0) { if (temp != dev->color_info.depth) { - fprintf(stderr, ERRPREF "Inconsistent value for `BitsPerPixel': %d.\n" + errprintf(dev->memory,ERRPREF "Inconsistent value for `BitsPerPixel': %d.\n" " You should never specify this parameter when using hpdj.\n", temp); last_error = gs_error_rangecheck; @@ -1140,10 +1137,9 @@ int hpdj_put_params(gx_device *device, g if (!dev->initialized) rc = hpdj_set_page_layout(dev); else { /* Change after writing the first page */ - fputs(ERRPREF + errprintf(dev->memory,ERRPREF "This driver does not support changes in media size or resolution " - "within a document.\n", - stderr); + "within a document.\n"); /* Actually, one could easily support this, at least between pages. DeskJets, however, do not have the ability to automatically select one of several input trays based on the media size demanded. And it's --- hpdj/hpdjprn.c +++ hpdj/hpdjprn.c 2007-09-04 10:30:27.000000000 +0000 @@ -352,7 +352,7 @@ static int send_plane(bool final, if (*method_used != choice) { /* Raster Graphics Compression Method */ if (fprintf(out, "%dm", choice) < 0) { - fprintf(stderr, ERRPREF "Error from fprintf(), errno == %d.\n", errno); + errprintf_nomem(ERRPREF "Error from fprintf(), errno == %d.\n", errno); return -1; } *method_used = choice; @@ -366,18 +366,18 @@ static int send_plane(bool final, else fputc('v', out); /* Transfer Raster Graphics Data by Plane: 0 octets */ if (errno != 0) { - fprintf(stderr, ERRPREF "Error from fputc(), errno == %d.\n", errno); + errprintf_nomem(ERRPREF "Error from fputc(), errno == %d.\n", errno); return -1; } } else { /* Transfer Raster Graphics Data by Row/Plane */ if (fprintf(out, "%d%c", send.length, final? 'w': 'v') < 0) { - fprintf(stderr, ERRPREF "Error from fprintf(), errno == %d.\n", errno); + errprintf_nomem(ERRPREF "Error from fprintf(), errno == %d.\n", errno); return -1; } if (fwrite(send.str, sizeof(pcl_octet), send.length, out) != send.length) { - fprintf(stderr, ERRPREF "Error in fwrite(), errno == %d.\n", errno); + errprintf_nomem(ERRPREF "Error in fwrite(), errno == %d.\n", errno); return -1; } } @@ -835,7 +835,7 @@ static int write_page(hpdj_device *dev, downwards on the page */ #ifdef HPDJ_TRACE - fputs("! Entering write_page()...\n", stderr); + errprintf(dev->memory,"! Entering write_page()...\n"); #endif /* Things are a bit complicated here. HP DeskJet printers want to have their @@ -888,7 +888,7 @@ static int write_page(hpdj_device *dev, if (j < dev->color_info.depth || row.str == NULL || prev_row.str == NULL || comp_bf1 == NULL || dev->compression_method == pcl_cm_delta && comp_bf2 == NULL) { - fputs(ERRPREF "Memory allocation failure in write_page().\n", stderr); + errprintf(dev->memory,ERRPREF "Memory allocation failure in write_page().\n"); /* Remember: free(NULL) is legal. */ free(row.str); free(prev_row.str); free(comp_bf1); free(comp_bf2); if (plane != NULL && prev_plane != NULL) @@ -993,7 +993,7 @@ static int write_page(hpdj_device *dev, rc = send_row(dev, &method, &zero_row, plane, prev_plane, out, comp_bf1, comp_bf2); if (rc != 0) { - fputs(ERRPREF "Aborting.\n", stderr); + errprintf(dev->memory,ERRPREF "Aborting.\n"); break; } @@ -1006,7 +1006,7 @@ static int write_page(hpdj_device *dev, rc = send_row(dev, &method, &zero_row, plane, prev_plane, out, comp_bf1, comp_bf2); if (rc != 0) { - fputs(ERRPREF "Aborting.\n", stderr); + errprintf(dev->memory,ERRPREF "Aborting.\n"); break; } } @@ -1032,7 +1032,7 @@ static int write_page(hpdj_device *dev, comp_bf1, comp_bf2); if (rc != 0) { /* This must be a serious error in writing */ - fputs(ERRPREF "Aborting.\n", stderr); + errprintf(dev->memory,ERRPREF "Aborting.\n"); break; } @@ -1054,7 +1054,7 @@ static int write_page(hpdj_device *dev, fprintf(out, "\033*r%c\f", /* End Raster Graphics, eject page */ dev->model == hpdj500? 'B': 'C'); if (rc == 0 && ferror(out)) { - fputs(ERRPREF "Unknown system error in writing the output file.\n", stderr); + errprintf(dev->memory,ERRPREF "Unknown system error in writing the output file.\n"); rc = -1; } @@ -1068,12 +1068,12 @@ static int write_page(hpdj_device *dev, } #ifdef HPDJ_TIMING - fprintf(stderr, "! Time used in write_page(): %f s.\n", + errprintf(dev->memory,"! Time used in write_page(): %f s.\n", ((float)(clock() - start_time))/CLOCKS_PER_SEC); #endif #ifdef HPDJ_TRACE - fputs("! ... leaving write_page().\n", stderr); + errprintf(dev->memory,"! ... leaving write_page().\n"); #endif if (rc != 0) return_error(gs_error_ioerror); @@ -1082,10 +1082,9 @@ static int write_page(hpdj_device *dev, if (dev->pagecount_file != NULL) { if (pcf_inccount(dev->pagecount_file, 1) != 0) { /* pcf_inccount() has issued an error message. */ - fputs( - " No further attempts will be made to access the page count file.\n", - stderr); - gs_free(dev->pagecount_file, strlen(dev->pagecount_file) + 1, + errprintf(dev->memory, + " No further attempts will be made to access the page count file.\n"); + gs_free(dev->memory, dev->pagecount_file, strlen(dev->pagecount_file) + 1, sizeof(char), "write_page"); dev->pagecount_file = NULL; } @@ -1111,7 +1110,7 @@ int hpdj_print_page(gx_device_printer *d /* See hpdj_put_params() */ if (!dev->is_valid) { - fputs(ERRPREF "Aborting because of previous error(s).\n", stderr); + errprintf(dev->memory,ERRPREF "Aborting because of previous error(s).\n"); return_error(gs_error_unknownerror); }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor