summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gs/base/gdevijs.c9
-rw-r--r--gs/base/gdevos2p.c5
-rw-r--r--gs/base/gdevpdf.c35
-rw-r--r--gs/base/gdevpdfi.c7
-rw-r--r--gs/base/gdevpdfj.c3
-rw-r--r--gs/base/gdevpdfm.c16
-rw-r--r--gs/base/gdevpdfp.c30
-rw-r--r--gs/base/gdevpdfu.c7
-rw-r--r--gs/base/gdevpdtb.c8
-rw-r--r--gs/base/gdevpdtc.c7
-rw-r--r--gs/base/gdevpdtf.c4
-rw-r--r--gs/base/gdevpdtt.c5
-rw-r--r--gs/base/gdevpe.c6
-rw-r--r--gs/base/gdevpsdu.c13
-rw-r--r--gs/base/gdevpsft.c43
-rw-r--r--gs/base/gdevpx.c4
-rw-r--r--gs/base/gdevsgi.c5
-rw-r--r--gs/base/gdevsun.c14
-rw-r--r--gs/base/gdevtsep.c15
-rw-r--r--gs/base/gdevxcmp.c20
-rw-r--r--gs/base/gdevxini.c17
-rw-r--r--gs/base/gsdevice.c8
-rw-r--r--gs/base/gsiorom.c2
-rw-r--r--gs/base/gslib.c26
-rw-r--r--gs/base/gsmisc.c15
-rw-r--r--gs/base/gspaint.c4
-rw-r--r--gs/base/gstype42.c10
-rw-r--r--gs/base/gxblend1.c10
-rw-r--r--gs/base/gxclfile.c2
-rw-r--r--gs/base/gxclmem.c48
-rw-r--r--gs/base/gxclrast.c2
-rw-r--r--gs/base/gxclthrd.c15
-rw-r--r--gs/base/gxcmap.c4
-rw-r--r--gs/base/gxttfb.c19
-rw-r--r--gs/base/gxtype1.c5
-rw-r--r--gs/base/gzspotan.c3
-rw-r--r--gs/base/std.h36
-rw-r--r--gs/contrib/japanese/gdevdmpr.c24
-rw-r--r--gs/psi/fapi_ft.c16
-rw-r--r--gs/psi/fapiufst.c15
-rw-r--r--gs/psi/imain.c22
-rw-r--r--gs/psi/imainarg.c4
-rw-r--r--gs/psi/zfapi.c21
43 files changed, 404 insertions, 180 deletions
diff --git a/gs/base/gdevijs.c b/gs/base/gdevijs.c
index 2d2f47641..605e15f8a 100644
--- a/gs/base/gdevijs.c
+++ b/gs/base/gdevijs.c
@@ -803,7 +803,7 @@ gsijs_open(gx_device *dev)
int fd = -1;
if (strlen(ijsdev->IjsServer) == 0) {
- eprintf("ijs server not specified\n");
+ emprintf(dev->memory, "ijs server not specified\n");
return gs_note_error(gs_error_ioerror);
}
@@ -838,18 +838,19 @@ gsijs_open(gx_device *dev)
*/
ijsdev->ctx = ijs_invoke_server(ijsdev->IjsServer);
if (ijsdev->ctx == (IjsClientCtx *)NULL) {
- eprintf1("Can't start ijs server \042%s\042\n", ijsdev->IjsServer);
+ emprintf1(ijsdev->memory,
+ "Can't start ijs server \042%s\042\n", ijsdev->IjsServer);
return gs_note_error(gs_error_ioerror);
}
ijsdev->ijs_version = ijs_client_get_version (ijsdev->ctx);
if (ijs_client_open(ijsdev->ctx) < 0) {
- eprintf("Can't open ijs\n");
+ emprintf(ijsdev->memory, "Can't open ijs\n");
return gs_note_error(gs_error_ioerror);
}
if (ijs_client_begin_job(ijsdev->ctx, 0) < 0) {
- eprintf("Can't begin ijs job 0\n");
+ emprintf(ijsdev->memory, "Can't begin ijs job 0\n");
ijs_client_close(ijsdev->ctx);
return gs_note_error(gs_error_ioerror);
}
diff --git a/gs/base/gdevos2p.c b/gs/base/gdevos2p.c
index 8befbcee0..c1bcaf7b5 100644
--- a/gs/base/gdevos2p.c
+++ b/gs/base/gdevos2p.c
@@ -656,8 +656,9 @@ os2prn_get_queue_list(gs_memory_t *mem, OS2QL * ql)
}
} else {
/* If we are here we had a bad error code. Print it and some other info. */
- eprintf4("SplEnumQueue Error=%ld, Total=%ld, Returned=%ld, Needed=%ld\n",
- splerr, cTotal, cReturned, cbNeeded);
+ emprintf4(mem,
+ "SplEnumQueue Error=%ld, Total=%ld, Returned=%ld, Needed=%ld\n",
+ splerr, cTotal, cReturned, cbNeeded);
}
if (splerr)
return splerr;
diff --git a/gs/base/gdevpdf.c b/gs/base/gdevpdf.c
index cb1f61c32..bf4de675f 100644
--- a/gs/base/gdevpdf.c
+++ b/gs/base/gdevpdf.c
@@ -389,7 +389,8 @@ pdf_compute_encryption_data(gx_device_pdf * pdev)
stream_arcfour_state sarc4;
if (pdev->PDFX && pdev->KeyLength != 0) {
- eprintf("Encryption is not allowed in a PDF/X doucment.\n");
+ emprintf(pdev->memory,
+ "Encryption is not allowed in a PDF/X doucment.\n");
return_error(gs_error_rangecheck);
}
if (pdev->KeyLength == 0)
@@ -399,34 +400,41 @@ pdf_compute_encryption_data(gx_device_pdf * pdev)
if (pdev->EncryptionV == 0 && pdev->KeyLength > 40)
pdev->EncryptionV = 2;
if (pdev->EncryptionV > 1 && pdev->CompatibilityLevel < 1.4) {
- eprintf("PDF 1.3 only supports 40 bits keys.\n");
+ emprintf(pdev->memory, "PDF 1.3 only supports 40 bits keys.\n");
return_error(gs_error_rangecheck);
}
if (pdev->EncryptionR == 0)
pdev->EncryptionR = 2;
if (pdev->EncryptionR < 2 || pdev->EncryptionR > 3) {
- eprintf("Encryption revisions 2 and 3 are only supported.\n");
+ emprintf(pdev->memory,
+ "Encryption revisions 2 and 3 are only supported.\n");
return_error(gs_error_rangecheck);
}
if (pdev->EncryptionR > 2 && pdev->CompatibilityLevel < 1.4) {
- eprintf("PDF 1.3 only supports the encryption revision 2.\n");
+ emprintf(pdev->memory,
+ "PDF 1.3 only supports the encryption revision 2.\n");
return_error(gs_error_rangecheck);
}
if (pdev->KeyLength > 128) {
- eprintf("The maximal length of PDF encryption key is 128 bits.\n");
+ emprintf(pdev->memory,
+ "The maximal length of PDF encryption key is 128 bits.\n");
return_error(gs_error_rangecheck);
}
if (pdev->KeyLength % 8) {
- eprintf("PDF encryption key length must be a multiple of 8.\n");
+ emprintf(pdev->memory,
+ "PDF encryption key length must be a multiple of 8.\n");
return_error(gs_error_rangecheck);
}
if (pdev->EncryptionR == 2 &&
((pdev->Permissions & (0xFFFFFFC3)) != 0xFFFFFFC0)) {
- eprintf("Some of Permissions are not allowed with R=2.\n");
+ emprintf(pdev->memory,
+ "Some of Permissions are not allowed with R=2.\n");
return_error(gs_error_rangecheck);
}
if (pdev->EncryptionV == 2 && pdev->EncryptionR == 2 && pdev->KeyLength > 40) {
- eprintf("Encryption version 2 revision 2 with KeyLength > 40 appears incompatible to some viewers. With long keys use revision 3.\n");
+ emprintf(pdev->memory, "Encryption version 2 revision 2 with "
+ "KeyLength > 40 appears incompatible to some viewers. With "
+ "long keys use revision 3.\n");
return_error(gs_error_rangecheck);
}
/* Compute O : */
@@ -627,10 +635,12 @@ pdf_open(gx_device * dev)
if (code < 0)
goto fail;
} else if(pdev->UserPassword.size > 0) {
- eprintf("User password is specified. Need an Owner password or both.\n");
+ emprintf(pdev->memory,
+ "User password is specified. Need an Owner password or both.\n");
return_error(gs_error_rangecheck);
} else if (pdev->KeyLength) {
- eprintf("Can't accept encryption options without a password.\n");
+ emprintf(pdev->memory,
+ "Can't accept encryption options without a password.\n");
return_error(gs_error_rangecheck);
}
/* Now create a new dictionary for the local named objects. */
@@ -1399,8 +1409,9 @@ pdf_close(gx_device * dev)
if (pdev->max_referred_page >= pdev->next_page + 1) {
/* Note : pdev->max_referred_page counts from 1,
and pdev->next_page counts from 0. */
- eprintf2("ERROR: A pdfmark destination page %d points beyond the last page %d.\n",
- pdev->max_referred_page, pdev->next_page);
+ emprintf2(pdev->memory, "ERROR: A pdfmark destination page %d "
+ "points beyond the last page %d.\n",
+ pdev->max_referred_page, pdev->next_page);
#if 0 /* Temporary disabled due to Bug 687686. */
if (code >= 0)
code = gs_note_error(gs_error_rangecheck);
diff --git a/gs/base/gdevpdfi.c b/gs/base/gdevpdfi.c
index 8d3d7cf52..de911798e 100644
--- a/gs/base/gdevpdfi.c
+++ b/gs/base/gdevpdfi.c
@@ -258,7 +258,7 @@ make_device_color_space(gx_device_pdf *pdev,
Don't emit rangecheck becuause it would fall back
to a default implementation (rasterisation).
*/
- eprintf("Unsupported ProcessColorModel");
+ emprintf(mem, "Unsupported ProcessColorModel");
return_error(gs_error_undefined);
}
if (cs == NULL)
@@ -684,7 +684,8 @@ pdf_begin_typed_image_impl(gx_device_pdf *pdev, const gs_imager_state * pis,
strcmp(pdev->color_info.cm_name, "DeviceRGB")) ||
(pdev->params.ColorConversionStrategy == ccs_Gray &&
strcmp(pdev->color_info.cm_name, "DeviceGray"))) {
- eprintf("ColorConversionStrategy isn't compatible to ProcessColorModel.");
+ emprintf(pdev->memory, "ColorConversionStrategy isn't "
+ "compatible to ProcessColorModel.");
return_error(gs_error_rangecheck);
}
convert_to_process_colors = true;
@@ -698,7 +699,7 @@ pdf_begin_typed_image_impl(gx_device_pdf *pdev, const gs_imager_state * pis,
case gs_color_space_index_DeviceRGB: sname = names->DeviceRGB; break;
case gs_color_space_index_DeviceCMYK: sname = names->DeviceCMYK; break;
default:
- eprintf("Unsupported ProcessColorModel.");
+ emprintf(pdev->memory, "Unsupported ProcessColorModel.");
return_error(gs_error_undefined);
}
cos_c_string_value(&cs_value, sname);
diff --git a/gs/base/gdevpdfj.c b/gs/base/gdevpdfj.c
index 613e48205..734ea3e27 100644
--- a/gs/base/gdevpdfj.c
+++ b/gs/base/gdevpdfj.c
@@ -133,7 +133,8 @@ pdf_put_pixel_image_values(cos_dict_t *pcd, gx_device_pdf *pdev,
}
if (pim->Interpolate) {
if (pdev->PDFA)
- eprintf("PDFA doesn't allow images with Interpolate true.\n");
+ emprintf(pdev->memory,
+ "PDFA doesn't allow images with Interpolate true.\n");
else
CHECK(cos_dict_put_c_strings(pcd, pin->Interpolate, "true"));
}
diff --git a/gs/base/gdevpdfm.c b/gs/base/gdevpdfm.c
index 597396226..53dd64607 100644
--- a/gs/base/gdevpdfm.c
+++ b/gs/base/gdevpdfm.c
@@ -723,7 +723,8 @@ pdfmark_annot(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
if (pdf_key_eq(pair, "/F")) {
code = sscanf((const char *)pair[1].data, "%ld", &Flags);
if (code != 1)
- eprintf("Annotation has an invalid /Flags attribute\n");
+ emprintf(pdev->memory,
+ "Annotation has an invalid /Flags attribute\n");
break;
}
}
@@ -734,7 +735,8 @@ pdfmark_annot(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
* output file will not be PDF/A compliant
*/
case 0:
- eprintf("Annotation set to non-printing,\n not permitted in PDF/A, reverting to normal PDF output\n");
+ emprintf(pdev->memory,
+ "Annotation set to non-printing,\n not permitted in PDF/A, reverting to normal PDF output\n");
pdev->AbortPDFAX = true;
pdev->PDFA = false;
break;
@@ -742,11 +744,13 @@ pdfmark_annot(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
* include it, but warn the user that it has been dropped.
*/
case 1:
- eprintf("Annotation set to non-printing,\n not permitted in PDF/A, annotation will not be present in output file\n");
+ emprintf(pdev->memory,
+ "Annotation set to non-printing,\n not permitted in PDF/A, annotation will not be present in output file\n");
return 0;
break;
default:
- eprintf("Annotation set to non-printing,\n not permitted in PDF/A, unrecognised PDFACompatibilityLevel,\nreverting to normal PDF output\n");
+ emprintf(pdev->memory,
+ "Annotation set to non-printing,\n not permitted in PDF/A, unrecognised PDFACompatibilityLevel,\nreverting to normal PDF output\n");
pdev->AbortPDFAX = true;
pdev->PDFA = false;
break;
@@ -813,7 +817,9 @@ pdfmark_write_outline(gx_device_pdf * pdev, pdf_outline_node_t * pnode,
if (pnode->action != NULL)
pnode->action->id = pnode->id;
else {
- eprintf1("pdfmark error: Outline node %ld has no action or destination.\n", pnode->id);
+ emprintf1(pdev->memory,
+ "pdfmark error: Outline node %ld has no action or destination.\n",
+ pnode->id);
code = gs_note_error(gs_error_undefined);
}
s = pdev->strm;
diff --git a/gs/base/gdevpdfp.c b/gs/base/gdevpdfp.c
index c92e97761..a4571330b 100644
--- a/gs/base/gdevpdfp.c
+++ b/gs/base/gdevpdfp.c
@@ -449,23 +449,27 @@ gdev_pdf_put_params_impl(gx_device * dev, const gx_device_pdf * save_dev, gs_par
strcmp(pdev->color_info.cm_name, "DeviceRGB")) ||
(pdev->params.ColorConversionStrategy == ccs_Gray &&
strcmp(pdev->color_info.cm_name, "DeviceGray"))) {
- eprintf("ColorConversionStrategy is incompatible to ProcessColorModel.\n");
+ emprintf(pdev->memory,
+ "ColorConversionStrategy is incompatible to ProcessColorModel.\n");
ecode = gs_note_error(gs_error_rangecheck);
pdev->params.ColorConversionStrategy = save_ccs;
}
if (pdev->params.ColorConversionStrategy == ccs_UseDeviceIndependentColor) {
if (!pdev->UseCIEColor) {
- eprintf("Set UseCIEColor for UseDeviceIndependentColor to work properly.\n");
+ emprintf(pdev->memory,
+ "Set UseCIEColor for UseDeviceIndependentColor to work properly.\n");
ecode = gs_note_error(gs_error_rangecheck);
pdev->UseCIEColor = true;
}
}
if (pdev->params.ColorConversionStrategy == ccs_UseDeviceIndependentColorForImages) {
if (!pdev->UseCIEColor) {
- eprintf("UseDeviceDependentColorForImages is not supported. Use UseDeviceIndependentColor.\n");
+ emprintf(pdev->memory,
+ "UseDeviceDependentColorForImages is not supported. Use UseDeviceIndependentColor.\n");
pdev->params.ColorConversionStrategy = ccs_UseDeviceIndependentColor;
if (!pdev->UseCIEColor) {
- eprintf("Set UseCIEColor for UseDeviceIndependentColor to work properly.\n");
+ emprintf(pdev->memory,
+ "Set UseCIEColor for UseDeviceIndependentColor to work properly.\n");
ecode = gs_note_error(gs_error_rangecheck);
pdev->UseCIEColor = true;
}
@@ -473,29 +477,35 @@ gdev_pdf_put_params_impl(gx_device * dev, const gx_device_pdf * save_dev, gs_par
}
if (pdev->params.ColorConversionStrategy == ccs_UseDeviceDependentColor) {
if (!strcmp(pdev->color_info.cm_name, "DeviceCMYK")) {
- eprintf("Replacing the deprecated device parameter value UseDeviceDependentColor with CMYK.\n");
+ emprintf(pdev->memory,
+ "Replacing the deprecated device parameter value UseDeviceDependentColor with CMYK.\n");
pdev->params.ColorConversionStrategy = ccs_CMYK;
} else if (!strcmp(pdev->color_info.cm_name, "DeviceRGB")) {
- eprintf("Replacing the deprecated device parameter value UseDeviceDependentColor with sRGB.\n");
+ emprintf(pdev->memory,
+ "Replacing the deprecated device parameter value UseDeviceDependentColor with sRGB.\n");
pdev->params.ColorConversionStrategy = ccs_sRGB;
} else {
- eprintf("Replacing the deprecated device parameter value UseDeviceDependentColor with Gray.\n");
+ emprintf(pdev->memory,
+ "Replacing the deprecated device parameter value UseDeviceDependentColor with Gray.\n");
pdev->params.ColorConversionStrategy = ccs_Gray;
}
}
if (cl < 1.5 && pdev->params.ColorImage.Filter != NULL &&
!strcmp(pdev->params.ColorImage.Filter, "JPXEncode")) {
- eprintf("JPXEncode requires CompatibilityLevel >= 1.5 .\n");
+ emprintf(pdev->memory,
+ "JPXEncode requires CompatibilityLevel >= 1.5 .\n");
ecode = gs_note_error(gs_error_rangecheck);
}
if (cl < 1.5 && pdev->params.GrayImage.Filter != NULL &&
!strcmp(pdev->params.GrayImage.Filter, "JPXEncode")) {
- eprintf("JPXEncode requires CompatibilityLevel >= 1.5 .\n");
+ emprintf(pdev->memory,
+ "JPXEncode requires CompatibilityLevel >= 1.5 .\n");
ecode = gs_note_error(gs_error_rangecheck);
}
if (cl < 1.4 && pdev->params.MonoImage.Filter != NULL &&
!strcmp(pdev->params.MonoImage.Filter, "JBIG2Encode")) {
- eprintf("JBIG2Encode requires CompatibilityLevel >= 1.4 .\n");
+ emprintf(pdev->memory,
+ "JBIG2Encode requires CompatibilityLevel >= 1.4 .\n");
ecode = gs_note_error(gs_error_rangecheck);
}
if (pdev->HaveTrueTypes && pdev->version == psdf_version_level2) {
diff --git a/gs/base/gdevpdfu.c b/gs/base/gdevpdfu.c
index 0cb64f94d..98e57178e 100644
--- a/gs/base/gdevpdfu.c
+++ b/gs/base/gdevpdfu.c
@@ -181,7 +181,9 @@ copy_ps_file_stripping(stream *s, const char *fname, bool HaveTrueTypes)
m = sizeof(buf) - 1 - l;
if (!m) {
sfclose(f);
- eprintf1("The procset %s contains a too long line.", fname);
+ emprintf1(s->memory,
+ "The procset %s contains a too long line.",
+ fname);
return_error(gs_error_ioerror);
}
n = sfread(buf + l, 1, m, f);
@@ -1557,7 +1559,8 @@ pdf_put_encoded_string(const gx_device_pdf *pdev, const byte *str, uint size, gs
static int
pdf_put_encoded_hex_string(const gx_device_pdf *pdev, const byte *str, uint size, gs_id object_id)
{
- eprintf("Unimplemented function : pdf_put_encoded_hex_string\n");
+ emprintf(pdev->memory,
+ "Unimplemented function : pdf_put_encoded_hex_string\n");
stream_write(pdev->strm, str, size);
return_error(gs_error_unregistered);
}
diff --git a/gs/base/gdevpdtb.c b/gs/base/gdevpdtb.c
index 3ba30b5c1..8dfcfd556 100644
--- a/gs/base/gdevpdtb.c
+++ b/gs/base/gdevpdtb.c
@@ -168,7 +168,9 @@ pdf_base_font_alloc(gx_device_pdf *pdev, pdf_base_font_t **ppbfont,
memcpy(buf, font->font_name.chars, l);
buf[l] = 0;
- eprintf1("Can't embed the complete font %s as it is too large, embedding a subset.\n", buf);
+ emprintf1(pdev->memory,
+ "Can't embed the complete font %s as it is too large, embedding a subset.\n",
+ buf);
}
}
break;
@@ -234,7 +236,9 @@ pdf_base_font_alloc(gx_device_pdf *pdev, pdf_base_font_t **ppbfont,
memcpy(buf, copied->font_name.chars, l);
buf[l] = 0;
- eprintf1("Can't embed the complete font %s due to font error.\n", buf);
+ emprintf1(pdev->memory,
+ "Can't embed the complete font %s due to font error.\n",
+ buf);
goto fail;
}
if (code < 0) {
diff --git a/gs/base/gdevpdtc.c b/gs/base/gdevpdtc.c
index 6e17cbef1..8d7ca9879 100644
--- a/gs/base/gdevpdtc.c
+++ b/gs/base/gdevpdtc.c
@@ -530,8 +530,11 @@ scan_cmap_text(pdf_text_enum_t *pte, void *vbuf)
memcpy(buf, subfont->font_name.chars, l);
buf[l] = 0;
- eprintf3("Missing glyph CID=%d, glyph=%04x in the font %s . The output PDF may fail with some viewers.\n",
- (int)cid, (unsigned int)(glyph - GS_MIN_CID_GLYPH), buf);
+ emprintf3(pdev->memory,
+ "Missing glyph CID=%d, glyph=%04x in the font %s . The output PDF may fail with some viewers.\n",
+ (int)cid,
+ (unsigned int)(glyph - GS_MIN_CID_GLYPH),
+ buf);
pdsubf->used[cid >> 3] |= 0x80 >> (cid & 7);
}
cid = 0, code = 1; /* undefined glyph. */
diff --git a/gs/base/gdevpdtf.c b/gs/base/gdevpdtf.c
index fe8c2f8af..2c3aa505f 100644
--- a/gs/base/gdevpdtf.c
+++ b/gs/base/gdevpdtf.c
@@ -681,7 +681,9 @@ pdf_font_embed_status(gx_device_pdf *pdev, gs_font *font, int *pindex,
len = min(gs_font_name_max, font->font_name.size);
memcpy(name, font->font_name.chars, len);
name[len] = 0;
- eprintf1("\nWarning: %s cannot be embedded because of licensing restrictions\n", name);
+ emprintf1(pdev->memory,
+ "\nWarning: %s cannot be embedded because of licensing restrictions\n",
+ name);
return FONT_EMBED_NO;
}
}
diff --git a/gs/base/gdevpdtt.c b/gs/base/gdevpdtt.c
index 99cc988b9..eb4421b1f 100644
--- a/gs/base/gdevpdtt.c
+++ b/gs/base/gdevpdtt.c
@@ -2538,8 +2538,9 @@ pdf_text_process(gs_text_enum_t *pte)
memcpy(KeyName, penum->current_font->key_name.chars, len);
KeyName[len] = 0x00;
- eprintf4("ERROR: Page %d used undefined glyph '%s' from type 3 font '%s', key '%s'\n",
- pdev->next_page, glyph, FontName, KeyName);
+ emprintf4(pdev->memory,
+ "ERROR: Page %d used undefined glyph '%s' from type 3 font '%s', key '%s'\n",
+ pdev->next_page, glyph, FontName, KeyName);
stream_puts(pdev->strm, "0 0 0 0 0 0 d1\n");
}
diff --git a/gs/base/gdevpe.c b/gs/base/gdevpe.c
index 969d54fdd..062d8d215 100644
--- a/gs/base/gdevpe.c
+++ b/gs/base/gdevpe.c
@@ -93,7 +93,8 @@ int pe_open(gx_device *dev)
{
if (!sscanf(str, "%lx", &(pedev->fbaddr)))
{
- eprintf("Private Eye: PEFBADDR environment string format error\n");
+ emprintf(dev->memory,
+ "Private Eye: PEFBADDR environment string format error\n");
exit(1);
}
}
@@ -102,7 +103,8 @@ int pe_open(gx_device *dev)
{
if (!sscanf(str, "%x", &(pedev->regs)))
{
- eprintf("Private Eye: PEREGS environment string format error\n");
+ emprintf(dev->memory,
+ "Private Eye: PEREGS environment string format error\n");
exit(1);
}
}
diff --git a/gs/base/gdevpsdu.c b/gs/base/gdevpsdu.c
index 8e6ac81e6..e5bf50695 100644
--- a/gs/base/gdevpsdu.c
+++ b/gs/base/gdevpsdu.c
@@ -67,7 +67,9 @@ psdf_setlinecap(gx_device_vector * vdev, gs_line_cap cap)
break;
default:
/* Ensure we don't write a broken file if we don't recognise the cap */
- eprintf1("Unknown line cap enumerator %d, substituting butt\n", cap);
+ emprintf1(vdev->memory,
+ "Unknown line cap enumerator %d, substituting butt\n",
+ cap);
pprintd1(gdev_vector_stream(vdev), "%d J\n", gs_cap_butt);
break;
}
@@ -93,7 +95,9 @@ psdf_setlinejoin(gx_device_vector * vdev, gs_line_join join)
break;
default:
/* Ensure we don't write a broken file if we don't recognise the join */
- eprintf1("Unknown line join enumerator %d, substituting miter\n", join);
+ emprintf1(vdev->memory,
+ "Unknown line join enumerator %d, substituting miter\n",
+ join);
pprintd1(gdev_vector_stream(vdev), "%d j\n", gs_join_miter);
break;
}
@@ -457,8 +461,9 @@ int
psdf_get_bits(gx_device * dev, int y, byte * data, byte ** actual_data)
{
if (dev_proc(dev, get_alpha_bits)(dev, go_graphics) > 1)
- eprintf1("Can't set GraphicsAlphaBits > 1 with a vector device %s.\n",
- dev->dname);
+ emprintf1(dev->memory,
+ "Can't set GraphicsAlphaBits > 1 with a vector device %s.\n",
+ dev->dname);
return_error(gs_error_unregistered);
}
diff --git a/gs/base/gdevpsft.c b/gs/base/gdevpsft.c
index 015911725..b05eed987 100644
--- a/gs/base/gdevpsft.c
+++ b/gs/base/gdevpsft.c
@@ -712,11 +712,14 @@ write_post(stream *s, gs_font *font, post_t *post)
return 0;
}
-static inline bool check_position(int pos1, int pos2)
+static inline bool check_position(const gs_memory_t *mem, int pos1, int pos2)
{
if (pos1 == pos2)
return false;
- eprintf2("Actual TT subtable offset %d differs from one in the TT header %d.\n", pos1, pos2);
+ emprintf2(mem,
+ "Actual TT subtable offset %d differs from one in the TT header %d.\n",
+ pos1,
+ pos2);
return true;
}
@@ -942,7 +945,9 @@ psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options,
*/
enlarged_numGlyphs = max_glyph + 1;
if (enlarged_numGlyphs > 0xFFFF) {
- eprintf1("The number of glyphs %d exceeds capability of True Type format.\n", enlarged_numGlyphs);
+ emprintf1(pfont->memory,
+ "The number of glyphs %d exceeds capability of True Type format.\n",
+ enlarged_numGlyphs);
return_error(gs_error_unregistered);
}
loca_length = (enlarged_numGlyphs + 1) << 2;
@@ -1171,7 +1176,9 @@ psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options,
/* Write glyf. */
- if (check_position(subtable_positions.glyf + start_position, stell(s)))
+ if (check_position(pfont->memory,
+ subtable_positions.glyf + start_position,
+ stell(s)))
return_error(gs_error_unregistered);
psf_enumerate_glyphs_reset(penum);
for (offset = 0; psf_enumerate_glyphs_next(penum, &glyph) != 1; ) {
@@ -1203,7 +1210,9 @@ psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options,
/* Write loca. */
- if (check_position(subtable_positions.loca + start_position, stell(s)))
+ if (check_position(pfont->memory,
+ subtable_positions.loca + start_position,
+ stell(s)))
return_error(gs_error_unregistered);
psf_enumerate_glyphs_reset(penum);
glyph_prev = 0;
@@ -1234,18 +1243,24 @@ psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options,
/* If necessary, write cmap, name, and OS/2. */
if (!have_cmap) {
- if (check_position(subtable_positions.cmap + start_position, stell(s)))
+ if (check_position(pfont->memory,
+ subtable_positions.cmap + start_position,
+ stell(s)))
return_error(gs_error_unregistered);
write_cmap(s, font, TT_BIAS, 256, GS_MIN_GLYPH_INDEX + max_glyph,
options, cmap_length);
}
if (!have_name) {
- if (check_position(subtable_positions.name + start_position, stell(s)))
+ if (check_position(pfont->memory,
+ subtable_positions.name + start_position,
+ stell(s)))
return_error(gs_error_unregistered);
write_name(s, &font_name);
}
if (!have_OS_2) {
- if (check_position(subtable_positions.os_2 + start_position, stell(s)))
+ if (check_position(pfont->memory,
+ subtable_positions.os_2 + start_position,
+ stell(s)))
return_error(gs_error_unregistered);
write_OS_2(s, font, TT_BIAS, 256);
}
@@ -1255,7 +1270,9 @@ psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options,
if (generate_mtx)
for (i = 0; i < 2; ++i)
if (have_hvhea[i]) {
- if (check_position(subtable_positions.mtx[i] + start_position, stell(s)))
+ if (check_position(pfont->memory,
+ subtable_positions.mtx[i] + start_position,
+ stell(s)))
return_error(gs_error_unregistered);
write_mtx(s, pfont, &mtx[i], i);
put_pad(s, mtx[i].length);
@@ -1264,7 +1281,9 @@ psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options,
/* If necessary, write post. */
if (!have_post) {
- if (check_position(subtable_positions.post + start_position, stell(s)))
+ if (check_position(pfont->memory,
+ subtable_positions.post + start_position,
+ stell(s)))
return_error(gs_error_unregistered);
if (options & WRITE_TRUETYPE_POST) {
code = write_post(s, font, &post);
@@ -1294,7 +1313,9 @@ psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options,
#endif
put_u32(head + 8, HEAD_MAGIC - file_checksum); /* per spec */
#undef HEAD_MAGIC
- if (check_position(subtable_positions.head + start_position, stell(s)))
+ if (check_position(pfont->memory,
+ subtable_positions.head + start_position,
+ stell(s)))
return_error(gs_error_unregistered);
stream_write(s, head, 56);
diff --git a/gs/base/gdevpx.c b/gs/base/gdevpx.c
index cdb3b5652..a140738d3 100644
--- a/gs/base/gdevpx.c
+++ b/gs/base/gdevpx.c
@@ -1057,7 +1057,9 @@ pclxl_setlinejoin(gx_device_vector * vdev, gs_line_join join)
stream *s = gdev_vector_stream(vdev);
if ((join < 0) || (join > 3)) {
- eprintf1("Igoring invalid linejoin enumerator %d\n", join);
+ emprintf1(vdev->memory,
+ "Igoring invalid linejoin enumerator %d\n",
+ join);
return 0;
}
/* The PCL XL join styles just happen to be identical to PostScript. */
diff --git a/gs/base/gdevsgi.c b/gs/base/gdevsgi.c
index 226b006c6..81073ec25 100644
--- a/gs/base/gdevsgi.c
+++ b/gs/base/gdevsgi.c
@@ -122,8 +122,9 @@ sgi_begin_page(gx_device_printer *bdev, FILE *pstream, sgi_cursor *pcur)
IMAGE *header;
if (bdev->PageCount >= 1 && !bdev->file_is_new) { /* support single page only */
- eprintf("sgi rgb format only supports one page per file.\n"
- "Please use the '%%d' OutputFile option to create one file for each page.\n");
+ emprintf(bdev->memory,
+ "sgi rgb format only supports one page per file.\n"
+ "Please use the '%%d' OutputFile option to create one file for each page.\n");
return_error(gs_error_rangecheck);
}
line_size = gdev_mem_bytes_per_scan_line((gx_device_printer*)bdev);
diff --git a/gs/base/gdevsun.c b/gs/base/gdevsun.c
index 1e99785b4..fef535d3a 100644
--- a/gs/base/gdevsun.c
+++ b/gs/base/gdevsun.c
@@ -286,8 +286,9 @@ if ( gs_debug['X'] )
xdev->truecolor = 1;
break;
default:
- eprintf1("gs: Cannot handle display of depth %d.\n",
- xdev->pw->pw_pixrect->pr_depth);
+ emprintf1(dev->memory,
+ "gs: Cannot handle display of depth %d.\n",
+ xdev->pw->pw_pixrect->pr_depth);
return -1;
}
@@ -307,7 +308,7 @@ if ( gs_debug['X'] )
xdev->green = (byte *)malloc(CMS_SIZE);
xdev->blue = (byte *)malloc(CMS_SIZE);
if (!xdev->red || !xdev->green || !xdev->blue) {
- eprintf("gs: no memory for colormap\n");
+ emprintf(dev->memory, "gs: no memory for colormap\n");
return -1;
}
@@ -501,7 +502,8 @@ sun_map_rgb_color(gx_device *dev, unsigned short red,
*/
if (xdev->freecols <= 1) {
if (warn) {
- eprintf("gs: last spare color map entry allocated\n");
+ emprintf(dev->memory,
+ "gs: last spare color map entry allocated\n");
warn = 0;
}
return gx_no_color_index;
@@ -541,7 +543,9 @@ sun_map_color_rgb(gx_device *dev, gx_color_index color,
* We just use the colormap to map back to rgb values.
*/
if (color < xdev->freecols || color >= CMS_SIZE) {
- eprintf1("gs: attempt to get RGB values for unallocated color index %d\n", (int)color);
+ emprintf1(dev->memory,
+ "gs: attempt to get RGB values for unallocated color index %d\n",
+ (int)color);
return -1;
}
rgb[0] = (double)xdev->red[color] / (ALL_COLS - 1)
diff --git a/gs/base/gdevtsep.c b/gs/base/gdevtsep.c
index f9744bb75..5f75d5c5a 100644
--- a/gs/base/gdevtsep.c
+++ b/gs/base/gdevtsep.c
@@ -1195,7 +1195,7 @@ sep1_ht_order_to_thresholds(gx_device *pdev, const gs_imager_state *pis)
threshold_array_t *dptr;
if (pis->dev_ht == NULL) {
- eprintf("sep1_order_to_thresholds: no dev_ht available\n");
+ emprintf(mem, "sep1_order_to_thresholds: no dev_ht available\n");
return_error(gs_error_rangecheck); /* error condition */
}
nc = pis->dev_ht->num_comp;
@@ -1204,7 +1204,8 @@ sep1_ht_order_to_thresholds(gx_device *pdev, const gs_imager_state *pis)
dptr = &(tfdev->thresholds[j]);
dptr->dstart = threshold_from_order( d_order, &(dptr->dwidth), &(dptr->dheight), mem);
if( dptr->dstart == NULL ) {
- eprintf("sep1_order_to_thresholds: conversion to thresholds failed.\n");
+ emprintf(mem,
+ "sep1_order_to_thresholds: conversion to thresholds failed.\n");
return_error(gs_error_rangecheck); /* error condition */
}
}
@@ -1255,11 +1256,11 @@ if ( gs_debug_c('h') ) {
"tiffsep1_threshold_array");
if( thresh == NULL ) {
#ifdef DEBUG
- eprintf("threshold_from_order, malloc failed\n");
- eprintf2(" width=%d, height=%d,",
- d_order->width, d_order->height );
- eprintf2(" num_levels=%d, raster=%d\n",
- d_order->num_levels, d_order->raster );
+ emprintf(memory, "threshold_from_order, malloc failed\n");
+ emprintf2(memory, " width=%d, height=%d,",
+ d_order->width, d_order->height );
+ emprintf2(memory, " num_levels=%d, raster=%d\n",
+ d_order->num_levels, d_order->raster );
#endif
return thresh ; /* error if allocation failed */
}
diff --git a/gs/base/gdevxcmp.c b/gs/base/gdevxcmp.c
index faf2de3a2..14207cefb 100644
--- a/gs/base/gdevxcmp.c
+++ b/gs/base/gdevxcmp.c
@@ -267,7 +267,7 @@ gdev_x_setup_colors(gx_device_X * xdev)
nitems = sscanf(buf, "%*s %ld %ld", &(xdev->foreground),
&(xdev->background));
if (nitems != 2 || (*buf != 'M' && *buf != 'G' && *buf != 'C')) {
- eprintf("Malformed GHOSTVIEW_COLOR property.\n");
+ emprintf(xdev->memory, "Malformed GHOSTVIEW_COLOR property.\n");
return_error(gs_error_rangecheck);
}
palette = max(palette, *buf);
@@ -305,7 +305,9 @@ gdev_x_setup_colors(gx_device_X * xdev)
xdev->color_info.depth = 16;
break;
default:
- eprintf1("Unsupported X visual depth: %d\n", xdev->vinfo->depth);
+ emprintf1(xdev->memory,
+ "Unsupported X visual depth: %d\n",
+ xdev->vinfo->depth);
return_error(gs_error_rangecheck);
}
{ /* Set up the reverse map from pixel values to RGB. */
@@ -362,8 +364,11 @@ gdev_x_setup_colors(gx_device_X * xdev)
xdev->color_info.dither_colors = ramp_size;
if (!setup_cube(xdev, ramp_size, true)) {
#ifdef DEBUG
- eprintf3("Warning: failed to allocate %dx%dx%d RGB cube.\n",
- ramp_size, ramp_size, ramp_size);
+ emprintf3(xdev->memory,
+ "Warning: failed to allocate %dx%dx%d RGB cube.\n",
+ ramp_size,
+ ramp_size,
+ ramp_size);
#endif
ramp_size--;
continue;
@@ -409,8 +414,9 @@ grayscale:
xdev->color_info.dither_grays = ramp_size;
if (!setup_cube(xdev, ramp_size, false)) {
#ifdef DEBUG
- eprintf1("Warning: failed to allocate %d level gray ramp.\n",
- ramp_size);
+ emprintf1(xdev->memory,
+ "Warning: failed to allocate %d level gray ramp.\n",
+ ramp_size);
#endif
ramp_size /= 2;
continue;
@@ -432,7 +438,7 @@ monochrome:
xdev->color_info.dither_grays = 2;
break;
default:
- eprintf1("Unknown palette: %s\n", xdev->palette);
+ emprintf1(xdev->memory, "Unknown palette: %s\n", xdev->palette);
if (xdev->cman.color_to_rgb.values) {
gs_x_free(xdev->memory, xdev->cman.color_to_rgb.values, "gdevx color_to_rgb");
xdev->cman.color_to_rgb.values = 0;
diff --git a/gs/base/gdevxini.c b/gs/base/gdevxini.c
index d653fe7b5..f6095b3c4 100644
--- a/gs/base/gdevxini.c
+++ b/gs/base/gdevxini.c
@@ -108,7 +108,8 @@ gdev_x_open(gx_device_X * xdev)
if (!(xdev->dpy = XOpenDisplay((char *)NULL))) {
char *dispname = getenv("DISPLAY");
- eprintf1("Cannot open X display `%s'.\n",
+ emprintf1(xdev->memory,
+ "Cannot open X display `%s'.\n",
(dispname == NULL ? "(null)" : dispname));
return_error(gs_error_ioerror);
}
@@ -116,7 +117,7 @@ gdev_x_open(gx_device_X * xdev)
if ((window_id = getenv("GHOSTVIEW"))) {
if (!(xdev->ghostview = sscanf(window_id, "%ld %ld",
&(xdev->win), &(xdev->dest)))) {
- eprintf("Cannot get Window ID from ghostview.\n");
+ emprintf(xdev->memory, "Cannot get Window ID from ghostview.\n");
return_error(gs_error_ioerror);
}
}
@@ -176,11 +177,12 @@ gdev_x_open(gx_device_X * xdev)
&left_margin, &bottom_margin,
&right_margin, &top_margin);
if (!(nitems == 8 || nitems == 12)) {
- eprintf("Cannot get ghostview property.\n");
+ emprintf(xdev->memory, "Cannot get ghostview property.\n");
return_error(gs_error_ioerror);
}
if (xdev->dest && xdev->bpixmap) {
- eprintf("Both destination and backing pixmap specified.\n");
+ emprintf(xdev->memory,
+ "Both destination and backing pixmap specified.\n");
return_error(gs_error_rangecheck);
}
if (xdev->dest) {
@@ -244,7 +246,7 @@ gdev_x_open(gx_device_X * xdev)
xdev->ImagingBBox_set = true;
} else if (xdev->pwin == (Window) None) {
- eprintf("Cannot get ghostview property.\n");
+ emprintf(xdev->memory, "Cannot get ghostview property.\n");
return_error(gs_error_ioerror);
}
} else {
@@ -268,7 +270,7 @@ gdev_x_open(gx_device_X * xdev)
xvinfo.visualid = XVisualIDFromVisual(xvinfo.visual);
xdev->vinfo = XGetVisualInfo(xdev->dpy, VisualIDMask, &xvinfo, &nitems);
if (xdev->vinfo == NULL) {
- eprintf("Cannot get XVisualInfo.\n");
+ emprintf(xdev->memory, "Cannot get XVisualInfo.\n");
return_error(gs_error_ioerror);
}
/* Buggy X servers may cause a Bad Access on XFreeColors. */
@@ -635,7 +637,8 @@ gdev_x_clear_window(gx_device_X * xdev)
if (x_error_handler.alloc_error) {
xdev->useBackingPixmap = False;
#ifdef DEBUG
- eprintf("Warning: Failed to allocated backing pixmap.\n");
+ emprintf(xdev->memory,
+ "Warning: Failed to allocated backing pixmap.\n");
#endif
if (xdev->bpixmap) {
XFreePixmap(xdev->dpy, xdev->bpixmap);
diff --git a/gs/base/gsdevice.c b/gs/base/gsdevice.c
index 7c5f93734..881c80783 100644
--- a/gs/base/gsdevice.c
+++ b/gs/base/gsdevice.c
@@ -937,13 +937,17 @@ gx_device_open_output_file(const gx_device * dev, char *fname,
code = parsed.iodev->procs.fopen(parsed.iodev, parsed.fname, fmode,
pfile, NULL, 0);
if (code)
- eprintf1("**** Could not open the file %s .\n", parsed.fname);
+ emprintf1(dev->memory,
+ "**** Could not open the file %s .\n",
+ parsed.fname);
return code;
}
*pfile = gp_open_printer((pfname[0] ? pfname : fname), binary);
if (*pfile)
return 0;
- eprintf1("**** Could not open the file %s .\n", (pfname[0] ? pfname : fname));
+ emprintf1(dev->memory,
+ "**** Could not open the file %s .\n",
+ (pfname[0] ? pfname : fname));
return_error(gs_error_invalidfileaccess);
}
diff --git a/gs/base/gsiorom.c b/gs/base/gsiorom.c
index 9b1149130..5d46da19b 100644
--- a/gs/base/gsiorom.c
+++ b/gs/base/gsiorom.c
@@ -214,7 +214,7 @@ s_block_read_process(stream_state * st, stream_cursor_read * ignore_pr,
if (max_count < count) {
#ifdef DEBUG
if ((sbufptr(s)) != s->srlimit)
- eprintf("cbuf not empty as expected\n.");
+ emprintf(s->memory, "cbuf not empty as expected\n.");
#endif
dest = s->cbuf;
need_copy = true;
diff --git a/gs/base/gslib.c b/gs/base/gslib.c
index c735c109a..3c03c7bc6 100644
--- a/gs/base/gslib.c
+++ b/gs/base/gslib.c
@@ -945,31 +945,31 @@ test10(gs_state * pgs, gs_memory_t * mem)
lprintf1("reading HWSize failed! code = %d\n", code);
gs_abort(mem);
}
- eprintf3("HWSize[%d] = [ %d, %d ]\n", HWSa.size,
- HWSa.data[0], HWSa.data[1]);
+ emprintf3(mem, "HWSize[%d] = [ %d, %d ]\n", HWSa.size,
+ HWSa.data[0], HWSa.data[1]);
code = param_read_float_array((gs_param_list *) & list,
"HWResolution", &HWRa);
if (code < 0) {
lprintf1("reading Resolution failed! code = %d\n", code);
gs_abort(mem);
}
- eprintf3("HWResolution[%d] = [ %f, %f ]\n", HWRa.size,
- HWRa.data[0], HWRa.data[1]);
+ emprintf3(mem, "HWResolution[%d] = [ %f, %f ]\n", HWRa.size,
+ HWRa.data[0], HWRa.data[1]);
code = param_read_float_array((gs_param_list *) & list,
"PageSize", &PSa);
if (code < 0) {
lprintf1("reading PageSize failed! code = %d\n", code);
gs_abort(mem);
}
- eprintf3("PageSize[%d] = [ %f, %f ]\n", PSa.size,
- PSa.data[0], PSa.data[1]);
+ emprintf3(mem, "PageSize[%d] = [ %f, %f ]\n", PSa.size,
+ PSa.data[0], PSa.data[1]);
code = param_read_long((gs_param_list *) & list,
"MaxBitmap", &MaxBitmap);
if (code < 0) {
lprintf1("reading MaxBitmap failed! code = %d\n", code);
gs_abort(mem);
}
- eprintf1("MaxBitmap = %ld\n", MaxBitmap);
+ emprintf1(mem, "MaxBitmap = %ld\n", MaxBitmap);
/* Switch to param list functions to "write" */
gs_c_param_list_write(&list, mem);
/* Always set the PageSize. */
@@ -998,8 +998,8 @@ test10(gs_state * pgs, gs_memory_t * mem)
HWRa.data = HWResolution;
HWSize[0] = (int)(HWResolution[0] * ypage_wid);
HWSize[1] = (int)(HWResolution[1] * xpage_len);
- eprintf3(" HWSize = [%d,%d], HWResolution = %f dpi\n",
- HWSize[0], HWSize[1], HWResolution[0]);
+ emprintf3(mem, "\tHWSize = [%d,%d], HWResolution = %f dpi\n",
+ HWSize[0], HWSize[1], HWResolution[0]);
HWSa.data = HWSize;
code = param_write_float_array((gs_param_list *) & list,
"HWResolution", &HWRa);
@@ -1011,7 +1011,7 @@ test10(gs_state * pgs, gs_memory_t * mem)
}
gs_c_param_list_read(&list);
code = gs_putdeviceparams(dev, (gs_param_list *) & list);
- eprintf1("putdeviceparams: code=%d\n", code);
+ emprintf1(mem, "putdeviceparams: code=%d\n", code);
gs_c_param_list_release(&list);
/* note: initgraphics no longer resets the color or color space */
@@ -1026,8 +1026,8 @@ test10(gs_state * pgs, gs_memory_t * mem)
gs_clippath(pgs);
gs_pathbbox(pgs, &cliprect);
- eprintf4(" cliprect = [[%g,%g],[%g,%g]]\n",
- cliprect.p.x, cliprect.p.y, cliprect.q.x, cliprect.q.y);
+ emprintf4(mem, "\tcliprect = [[%g,%g],[%g,%g]]\n",
+ cliprect.p.x, cliprect.p.y, cliprect.q.x, cliprect.q.y);
gs_newpath(pgs);
switch (((rotate_value + 270) / 90) & 3) {
@@ -1049,7 +1049,7 @@ test10(gs_state * pgs, gs_memory_t * mem)
xlate_y = cliprect.q.y;
break;
}
- eprintf2("translate origin to [ %f, %f ]\n", xlate_x, xlate_y);
+ emprintf2(mem, "translate origin to [ %f, %f ]\n", xlate_x, xlate_y);
gs_translate(pgs, xlate_x, xlate_y);
/* further move (before rotate) by user requested amount */
diff --git a/gs/base/gsmisc.c b/gs/base/gsmisc.c
index 3f1d05018..03dfacf32 100644
--- a/gs/base/gsmisc.c
+++ b/gs/base/gsmisc.c
@@ -193,6 +193,21 @@ eprintf_program_ident(const char *program_name,
epf(": ");
}
}
+void
+emprintf_program_ident(const gs_memory_t *mem,
+ const char *program_name,
+ long revision_number)
+{
+ if (program_name) {
+ epfm(mem, (revision_number ? "%s " : "%s"), program_name);
+ if (revision_number) {
+ int fpart = revision_number % 100;
+
+ epfm(mem, "%d.%02d", (int)(revision_number / 100), fpart);
+ }
+ epfm(mem, ": ");
+ }
+}
#if __LINE__ /* compiler provides it */
void
lprintf_file_and_line(const char *file, int line)
diff --git a/gs/base/gspaint.c b/gs/base/gspaint.c
index 74afa5275..9ac14c5ad 100644
--- a/gs/base/gspaint.c
+++ b/gs/base/gspaint.c
@@ -71,7 +71,9 @@ gs_fillpage(gs_state * pgs)
/* If we get here without a valid get_color_mapping_procs, fail */
if (dev_proc(dev, get_color_mapping_procs) == NULL ||
dev_proc(dev, get_color_mapping_procs) == gx_error_get_color_mapping_procs) {
- eprintf1("\n *** Error: No get_color_mapping_procs for device: %s\n", dev->dname);
+ emprintf1(dev->memory,
+ "\n *** Error: No get_color_mapping_procs for device: %s\n",
+ dev->dname);
return_error(gs_error_Fatal);
}
/* Processing a fill object operation */
diff --git a/gs/base/gstype42.c b/gs/base/gstype42.c
index 5a9aca22b..6d2fd7985 100644
--- a/gs/base/gstype42.c
+++ b/gs/base/gstype42.c
@@ -156,8 +156,9 @@ gs_type42_font_init(gs_font_type42 * pfont, int subfontID)
if (!memcmp(OffsetTable, version_ttcf, 4)) {
version = u32(OffsetTable + 4);
if (version != 0x00010000 && version !=0x00020000) {
- eprintf2("Unknown TTC header version %08X in the font %s.\n",
- version, pfont->key_name.chars);
+ emprintf2(pfont->memory,
+ "Unknown TTC header version %08X in the font %s.\n",
+ version, pfont->key_name.chars);
return_error(gs_error_invalidfont);
}
numFonts = u32(OffsetTable + 8);
@@ -273,8 +274,9 @@ gs_type42_font_init(gs_font_type42 * pfont, int subfontID)
} else
buf[0] = 0;
- eprintf3("Warning: 'loca' length %d is greater than numGlyphs %d in the font %s.\n",
- pfont->data.numGlyphs + 1, pfont->data.trueNumGlyphs, buf);
+ emprintf3(pfont->memory,
+ "Warning: 'loca' length %d is greater than numGlyphs %d in the font %s.\n",
+ pfont->data.numGlyphs + 1, pfont->data.trueNumGlyphs, buf);
if (loca_size > pfont->data.trueNumGlyphs + 1) {
/* Bug 689516 demonstrates a font, in which numGlyps is smaller than loca size,
and there are useful glyphs behind maxp.numGlyphs. */
diff --git a/gs/base/gxblend1.c b/gs/base/gxblend1.c
index 1904f104b..6c99c777e 100644
--- a/gs/base/gxblend1.c
+++ b/gs/base/gxblend1.c
@@ -490,8 +490,9 @@ pdf14_compressed_encode_color(gx_device *dev, const gx_color_value colors[])
if (pdevn_params == NULL) {
#ifdef DEBUG
if (strncmp(dev->dname, "pdf14", 5))
- eprintf1("pdf14_compressed_encode_color devn_params not from pdf14 device, device = '%s'\n",
- dev->dname);
+ emprintf1(dev->memory,
+ "pdf14_compressed_encode_color devn_params not from pdf14 device, device = '%s'\n",
+ dev->dname);
#endif
pdevn_params = &(((pdf14_device *)dev)->devn_params);
}
@@ -515,8 +516,9 @@ pdf14_compressed_decode_color(gx_device * dev, gx_color_index color,
if (pdevn_params == NULL) {
#ifdef DEBUG
if (strncmp(dev->dname, "pdf14", 5))
- eprintf1("pdf14_compressed_decode_color devn_params not from pdf14 device, device = '%s'\n",
- dev->dname);
+ emprintf1(dev->memory,
+ "pdf14_compressed_decode_color devn_params not from pdf14 device, device = '%s'\n",
+ dev->dname);
#endif
pdevn_params = &(((pdf14_device *)dev)->devn_params);
}
diff --git a/gs/base/gxclfile.c b/gs/base/gxclfile.c
index 829db808c..3fa29cd8f 100644
--- a/gs/base/gxclfile.c
+++ b/gs/base/gxclfile.c
@@ -41,7 +41,7 @@ clist_fopen(char fname[gp_file_name_sizeof], const char *fmode,
} else
*pcf = gp_fopen(fname, fmode);
if (*pcf == NULL) {
- eprintf1("Could not open the scratch file %s.\n", fname);
+ emprintf1(mem, "Could not open the scratch file %s.\n", fname);
return_error(gs_error_invalidfileaccess);
}
return 0;
diff --git a/gs/base/gxclmem.c b/gs/base/gxclmem.c
index 8ce2739d1..9ac9a6635 100644
--- a/gs/base/gxclmem.c
+++ b/gs/base/gxclmem.c
@@ -263,7 +263,9 @@ memfile_fopen(char fname[gp_file_name_sizeof], const char *fmode,
f = gs_alloc_struct(mem, MEMFILE, &st_MEMFILE,
"memfile_fopen_instance(MEMFILE)");
if (f == NULL) {
- eprintf1("memfile_open_scratch(%s): gs_alloc_struct failed\n", fname);
+ emprintf1(mem,
+ "memfile_open_scratch(%s): gs_alloc_struct failed\n",
+ fname);
code = gs_note_error(gs_error_VMerror);
goto finish;
}
@@ -312,7 +314,9 @@ memfile_fopen(char fname[gp_file_name_sizeof], const char *fmode,
gs_alloc_struct(mem, stream_state, decompress_template->stype,
"memfile_open_scratch(decompress_state)");
if (f->decompress_state == 0) {
- eprintf1("memfile_open_scratch(%s): gs_alloc_struct failed\n", fname);
+ emprintf1(mem,
+ "memfile_open_scratch(%s): gs_alloc_struct failed\n",
+ fname);
code = gs_note_error(gs_error_VMerror);
goto finish;
}
@@ -331,7 +335,9 @@ memfile_fopen(char fname[gp_file_name_sizeof], const char *fmode,
f = gs_alloc_struct(mem, MEMFILE, &st_MEMFILE,
"memfile_open_scratch(MEMFILE)");
if (f == NULL) {
- eprintf1("memfile_open_scratch(%s): gs_alloc_struct failed\n", fname);
+ emprintf1(mem,
+ "memfile_open_scratch(%s): gs_alloc_struct failed\n",
+ fname);
code = gs_note_error(gs_error_VMerror);
goto finish;
}
@@ -370,7 +376,9 @@ memfile_fopen(char fname[gp_file_name_sizeof], const char *fmode,
gs_alloc_struct(mem, stream_state, decompress_template->stype,
"memfile_open_scratch(decompress_state)");
if (f->compress_state == 0 || f->decompress_state == 0) {
- eprintf1("memfile_open_scratch(%s): gs_alloc_struct failed\n", fname);
+ emprintf1(mem,
+ "memfile_open_scratch(%s): gs_alloc_struct failed\n",
+ fname);
code = gs_note_error(gs_error_VMerror);
goto finish;
}
@@ -430,7 +438,9 @@ memfile_fclose(clist_file_ptr cf, const char *fname, bool delete)
if (prev_f->openlist == f)
break;
if (prev_f == NULL) {
- eprintf1("Could not find %p on memfile openlist\n", f);
+ emprintf1(f->memory,
+ "Could not find %p on memfile openlist\n",
+ f);
return_error(gs_error_invalidfileaccess);
}
prev_f->openlist = f->openlist; /* link around the one being fclosed */
@@ -475,7 +485,9 @@ memfile_fclose(clist_file_ptr cf, const char *fname, bool delete)
/* leaks if other users of the memfile don't 'fclose with delete=true */
if (f->openlist != NULL || ((f->base_memfile != NULL) && f->base_memfile->is_open)) {
/* TODO: do the cleanup rather than just giving an error */
- eprintf1("Attempt to delete a memfile still open for read: %p\n", f);
+ emprintf1(f->memory,
+ "Attempt to delete a memfile still open for read: %p\n",
+ f);
return_error(gs_error_invalidfileaccess);
} else {
/* Free the memory used by this memfile */
@@ -639,15 +651,18 @@ compress_log_blk(MEMFILE * f, LOG_MEMFILE_BLK * bp)
* block never ends up getting split across 3 dest blocks.
*/
/* CHANGE memfile_set_memory_warning if this assumption changes. */
- eprintf("Compression required more than one full block!\n");
+ emprintf(f->memory,
+ "Compression required more than one full block!\n");
return_error(gs_error_Fatal);
}
newphys->data_limit = (char *)(f->wt.ptr);
}
compressed_size += f->wt.ptr - start_ptr;
if (compressed_size > MEMFILE_DATA_SIZE) {
- eprintf2("\nCompression didn't - raw=%d, compressed=%ld\n",
- MEMFILE_DATA_SIZE, compressed_size);
+ emprintf2(f->memory,
+ "\nCompression didn't - raw=%d, compressed=%ld\n",
+ MEMFILE_DATA_SIZE,
+ compressed_size);
}
#ifdef DEBUG
tot_compressed += compressed_size;
@@ -782,7 +797,8 @@ memfile_fwrite_chars(const void *data, uint len, clist_file_ptr cf)
}
}
if (f->log_curr_blk->link != 0) {
- eprintf(" Write file truncate -- need to free physical blocks.\n");
+ emprintf(f->memory,
+ " Write file truncate -- need to free physical blocks.\n");
}
while (count) {
uint move_count = f->pdata_end - f->pdata;
@@ -942,7 +958,8 @@ memfile_get_pdata(MEMFILE * f)
status = (*f->decompress_state->template->process)
(f->decompress_state, &(f->rd), &(f->wt), true);
if (status == 0) {
- eprintf("Decompression required more than one full block!\n");
+ emprintf(f->memory,
+ "Decompression required more than one full block!\n");
return_error(gs_error_Fatal);
}
}
@@ -1036,7 +1053,9 @@ memfile_rewind(clist_file_ptr cf, bool discard_data, const char *ignore_fname)
/* Check first to make sure that we have exclusive access */
if (f->openlist != NULL || f->base_memfile != NULL) {
/* TODO: Move the data so it is still connected to other open files */
- eprintf1("memfile_rewind(%p) with discard_data=true failed: ", f);
+ emprintf1(f->memory,
+ "memfile_rewind(%p) with discard_data=true failed: ",
+ f);
f->error_code = gs_note_error(gs_error_ioerror);
return;
}
@@ -1191,7 +1210,7 @@ memfile_init_empty(MEMFILE * f)
/* File empty - get a physical mem block (includes the buffer area) */
pphys = MALLOC(f, sizeof(*pphys), "memfile pphys");
if (!pphys) {
- eprintf("memfile_init_empty: MALLOC for 'pphys' failed\n");
+ emprintf(f->memory, "memfile_init_empty: MALLOC for 'pphys' failed\n");
return_error(gs_error_VMerror);
}
f->total_space += sizeof(*pphys);
@@ -1201,7 +1220,8 @@ memfile_init_empty(MEMFILE * f)
plog = (LOG_MEMFILE_BLK *)MALLOC( f, sizeof(*plog), "memfile_init_empty" );
if (plog == NULL) {
FREE(f, pphys, "memfile_init_empty");
- eprintf("memfile_init_empty: MALLOC for log_curr_blk failed\n");
+ emprintf(f->memory,
+ "memfile_init_empty: MALLOC for log_curr_blk failed\n");
return_error(gs_error_VMerror);
}
f->total_space += sizeof(*plog);
diff --git a/gs/base/gxclrast.c b/gs/base/gxclrast.c
index 3ac0a4e38..58dcf7a6e 100644
--- a/gs/base/gxclrast.c
+++ b/gs/base/gxclrast.c
@@ -2336,7 +2336,7 @@ read_ht_segment(
if (code < 0)
return code;
if (pcb->end - cbp < (int)seg_size) {
- eprintf(" *** ht segment size doesn't fit in buffer ***\n");
+ emprintf(mem, " *** ht segment size doesn't fit in buffer ***\n");
return_error(gs_error_unknownerror);
}
}
diff --git a/gs/base/gxclthrd.c b/gs/base/gxclthrd.c
index 9cb0e776b..272deea3f 100644
--- a/gs/base/gxclthrd.c
+++ b/gs/base/gxclthrd.c
@@ -63,7 +63,7 @@ clist_setup_render_threads(gx_device *dev, int y)
sizeof(clist_render_thread_control_t), "clist_setup_render_threads" );
/* fallback to non-threaded if allocation fails */
if (crdev->render_threads == NULL) {
- eprintf(" VMerror prevented threads from starting.\n");
+ emprintf(mem, " VMerror prevented threads from starting.\n");
return_error(gs_error_VMerror);
}
@@ -81,7 +81,7 @@ clist_setup_render_threads(gx_device *dev, int y)
(code = cdev->page_info.io_procs->fclose(cdev->page_bfile, cdev->page_bfname, false)) < 0) {
gs_free_object(mem, crdev->render_threads, "clist_setup_render_threads");
crdev->render_threads = NULL;
- eprintf("Closing clist files prevented threads from starting.\n");
+ emprintf(mem, "Closing clist files prevented threads from starting.\n");
return_error(gs_error_unknownerror); /* shouldn't happen */
}
cdev->page_cfile = cdev->page_bfile = NULL;
@@ -92,13 +92,16 @@ clist_setup_render_threads(gx_device *dev, int y)
if (strcmp(protodev->dname, dev->dname) == 0)
break;
if (protodev == NULL) {
- eprintf("Could not find prototype device. Rendering threads not started.\n");
+ emprintf(mem,
+ "Could not find prototype device. Rendering threads not started.\n");
return gs_error_rangecheck;
}
gs_c_param_list_write(&paramlist, mem);
if ((code = gs_getdeviceparams(dev, (gs_param_list *)&paramlist)) < 0) {
- eprintf1("Error getting device params, code=%d. Rendering threads not started.\n", code);
+ emprintf1(mem,
+ "Error getting device params, code=%d. Rendering threads not started.\n",
+ code);
return code;
}
@@ -115,7 +118,7 @@ clist_setup_render_threads(gx_device *dev, int y)
* This improves performance of the threads.
*/
if ((code = gs_memory_chunk_wrap(&(thread->memory), mem )) < 0) {
- eprintf1("chunk_wrap returned error code: %d\n", code);
+ emprintf1(mem, "chunk_wrap returned error code: %d\n", code);
break;
}
@@ -212,7 +215,7 @@ clist_setup_render_threads(gx_device *dev, int y)
mem, cdev->bandlist_memory, false);
cdev->page_info.io_procs->fseek(cdev->page_bfile, 0, SEEK_SET, cdev->page_bfname);
}
- eprintf1("Rendering threads not started, code=%d.\n", code);
+ emprintf1(mem, "Rendering threads not started, code=%d.\n", code);
return_error(code);
}
crdev->num_render_threads = i;
diff --git a/gs/base/gxcmap.c b/gs/base/gxcmap.c
index c5b83920d..f72a7066e 100644
--- a/gs/base/gxcmap.c
+++ b/gs/base/gxcmap.c
@@ -369,7 +369,9 @@ gx_error_get_color_mapping_procs(const gx_device * dev)
* routine for the device. This will be noisy, but better than returning NULL which
* would lead to SEGV (Segmentation Fault) errors when this is used.
*/
- eprintf1("No get_color_mapping_procs proc defined for device '%s'\n", dev->dname);
+ emprintf1(dev->memory,
+ "No get_color_mapping_procs proc defined for device '%s'\n",
+ dev->dname);
switch (dev->color_info.num_components) {
case 1: /* DeviceGray or DeviceInvertGray */
return gx_default_DevGray_get_color_mapping_procs(dev);
diff --git a/gs/base/gxttfb.c b/gs/base/gxttfb.c
index 8f8bd37bc..0ef6e9721 100644
--- a/gs/base/gxttfb.c
+++ b/gs/base/gxttfb.c
@@ -268,13 +268,15 @@ static void WarnBadInstruction(gs_font_type42 *pfont, int glyph_index)
memcpy(buf, base_font->font_name.chars, l);
buf[l] = 0;
if (glyph_index >= 0)
- eprintf2("Failed to interpret TT instructions for glyph index %d of font %s. "
- "Continue ignoring instructions of the font.\n",
- glyph_index, buf);
+ emprintf2(pfont->memory,
+ "Failed to interpret TT instructions for glyph index %d of font %s. "
+ "Continue ignoring instructions of the font.\n",
+ glyph_index, buf);
else
- eprintf1("Failed to interpret TT instructions in font %s. "
- "Continue ignoring instructions of the font.\n",
- buf);
+ emprintf1(pfont->memory,
+ "Failed to interpret TT instructions in font %s. "
+ "Continue ignoring instructions of the font.\n",
+ buf);
base_font->data.warning_bad_instruction = true;
}
}
@@ -292,7 +294,10 @@ static void WarnPatented(gs_font_type42 *pfont, ttfFont *ttf, const char *txt)
l = min(sizeof(buf) - 1, base_font->font_name.size);
memcpy(buf, base_font->font_name.chars, l);
buf[l] = 0;
- eprintf2("%s %s requires a patented True Type interpreter.\n", txt, buf);
+ emprintf2(pfont->memory,
+ "%s %s requires a patented True Type interpreter.\n",
+ txt,
+ buf);
base_font->data.warning_patented = true;
}
}
diff --git a/gs/base/gxtype1.c b/gs/base/gxtype1.c
index 0ae337588..dbbedb60d 100644
--- a/gs/base/gxtype1.c
+++ b/gs/base/gxtype1.c
@@ -309,7 +309,10 @@ gs_type1_endchar(gs_type1_state * pcis)
buf0[l0] = 0;
memcpy(buf1, gstr.data, l1);
buf1[l1] = 0;
- eprintf2("The font '%s' misses the glyph '%s' . Continue skipping the glyph.", buf0, buf1);
+ emprintf2(pfont->memory,
+ "The font '%s' misses the glyph '%s' . Continue skipping the glyph.",
+ buf0,
+ buf1);
return 0;
}
if (code < 0)
diff --git a/gs/base/gzspotan.c b/gs/base/gzspotan.c
index 4af16a3b7..4be5b0e85 100644
--- a/gs/base/gzspotan.c
+++ b/gs/base/gzspotan.c
@@ -447,11 +447,12 @@ gx_san__release(gx_device_spot_analyzer **ppadev)
gx_device_spot_analyzer *padev = *ppadev;
if (padev == NULL) {
+ /* Can't use emprintf here! */
eprintf("Extra call to gx_san__release.");
return;
}
if(--padev->lock < 0) {
- eprintf("Wrong lock to gx_san__release.");
+ emprintf(padev->memory, "Wrong lock to gx_san__release.");
return;
}
if (padev->lock == 0) {
diff --git a/gs/base/std.h b/gs/base/std.h
index 2fd64ae9e..68c6c3bdf 100644
--- a/gs/base/std.h
+++ b/gs/base/std.h
@@ -128,7 +128,10 @@ typedef ulong bits32;
* Use dprintf for messages that just go to dpf;
* dlprintf for messages to dpf with optional with file name (and,
* if available, line number);
- * eprintf for error messages to epf that include the program name;
+ * eprintf or eprintfm for error messages to epf that include the program
+ * name (eprintfm requires a memory pointer and is safe to use in
+ * multithreaded environments - eprint does not, and is not, and should
+ * therefore be avoided where possible);
* lprintf for debugging messages that should include line number info.
* Since we all stdout/stderr output must go via outprintf/errprintf,
* we have to define dputc and dputs in terms of errprintf also.
@@ -155,6 +158,7 @@ typedef struct gs_memory_s gs_memory_t;
/* dpf and epf may be redefined */
#define dpf errprintf_nomem
#define epf errprintf_nomem
+#define epfm errprintf
/* To allow stdout and stderr to be redirected, all stdout goes
* though outwrite and all stderr goes through errwrite.
@@ -262,6 +266,9 @@ void dflush(void); /* flush stderr */
void printf_program_ident(const gs_memory_t *mem, const char *program_name, long revision_number);
void eprintf_program_ident(const char *program_name, long revision_number);
+void emprintf_program_ident(const gs_memory_t *mem,
+ const char *program_name,
+ long revision_number);
const char *gs_program_name(void);
long gs_revision_number(void);
@@ -290,7 +297,32 @@ long gs_revision_number(void);
#define eprintf10(str,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)\
(_epi epf(str, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10))
-#if __LINE__ /* compiler provides it */
+#define _epim(mem) emprintf_program_ident(mem, gs_program_name(), gs_revision_number()),
+
+#define emprintf(mem, str)\
+ (_epim(mem) epfm(mem, str))
+#define emprintf1(mem, str,arg1)\
+ (_epim(mem) epfm(mem, str, arg1))
+#define emprintf2(mem, str,arg1,arg2)\
+ (_epim(mem) epfm(mem, str, arg1, arg2))
+#define emprintf3(mem, str,arg1,arg2,arg3)\
+ (_epim(mem) epfm(mem, str, arg1, arg2, arg3))
+#define emprintf4(mem, str,arg1,arg2,arg3,arg4)\
+ (_epim(mem) epfm(mem, str, arg1, arg2, arg3, arg4))
+#define emprintf5(mem, str,arg1,arg2,arg3,arg4,arg5)\
+ (_epim(mem) epfm(mem, str, arg1, arg2, arg3, arg4, arg5))
+#define emprintf6(mem, str,arg1,arg2,arg3,arg4,arg5,arg6)\
+ (_epim(mem) epfm(mem, str, arg1, arg2, arg3, arg4, arg5, arg6))
+#define emprintf7(mem, str,arg1,arg2,arg3,arg4,arg5,arg6,arg7)\
+ (_epim(mem) epfm(mem, str, arg1, arg2, arg3, arg4, arg5, arg6, arg7))
+#define emprintf8(mem, str,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)\
+ (_epim(mem) epfm(mem, str, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8))
+#define emprintf9(mem, str,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)\
+ (_epim(mem) epfm(mem, str, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9))
+#define emprintf10(mem, str,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)\
+ (_epim(mem) epfm(mem, str, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10))
+
+#if __LINE__ /* compiler provides it */
void lprintf_file_and_line(const char *, int);
# define _epl _epi lprintf_file_and_line(__FILE__, __LINE__),
#else
diff --git a/gs/contrib/japanese/gdevdmpr.c b/gs/contrib/japanese/gdevdmpr.c
index aac1cce15..2da8571e7 100644
--- a/gs/contrib/japanese/gdevdmpr.c
+++ b/gs/contrib/japanese/gdevdmpr.c
@@ -664,8 +664,10 @@ gdev_dmprt_close(gx_device *pdev)
if (code < 0) return gdev_dmprt_error_no_dviprt_to_gs(code);
}
if (pddev->dmprt.verbose_f && pddev->PageCount>0) {
- eprintf2("%s: Total %lu bytes output.\n",
- pddev->dname,dviprt_getoutputbytes(pprint));
+ emprintf2(pdev->memory,
+ "%s: Total %lu bytes output.\n",
+ pddev->dname,
+ dviprt_getoutputbytes(pprint));
}
code = dviprt_unsetbuffer(pprint);
if (code < 0) return gdev_dmprt_error_no_dviprt_to_gs(code);
@@ -686,7 +688,7 @@ gdev_dmprt_print_page(gx_device_printer *pdev, FILE *prn_stream)
byte *in;
/* get work buffer */
- in = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), 1, i_buf_size ,"gdev_dmprt_print_page(in)");
+ in = (byte *)gs_malloc(pdev->memory->non_gc_memory, 1, i_buf_size ,"gdev_dmprt_print_page(in)");
if ( in == 0 )
return e_VMerror;
@@ -697,8 +699,14 @@ gdev_dmprt_print_page(gx_device_printer *pdev, FILE *prn_stream)
}
if (pddev->dmprt.verbose_f) {
if (pddev->PageCount == 1)
- eprintf2("%s: %s\n", pddev->dname, pddev->dmprt.prtcfg.strings[CFG_NAME]);
- eprintf2("%s: [%ld]",pddev->dname, pddev->PageCount);
+ emprintf2(pdev->memory,
+ "%s: %s\n",
+ pddev->dname,
+ pddev->dmprt.prtcfg.strings[CFG_NAME]);
+ emprintf2(pdev->memory,
+ "%s: [%ld]",
+ pddev->dname,
+ pddev->PageCount);
}
prev_bytes = dviprt_getoutputbytes(pprint);
code = dviprt_beginpage(pprint);
@@ -734,10 +742,12 @@ gdev_dmprt_print_page(gx_device_printer *pdev, FILE *prn_stream)
}
fflush(pddev->file);
if (pddev->dmprt.verbose_f) {
- eprintf1(" %lu bytes\n",dviprt_getoutputbytes(pprint)-prev_bytes);
+ emprintf1(pdev->memory,
+ " %lu bytes\n",
+ dviprt_getoutputbytes(pprint)-prev_bytes);
}
error_ex:
- gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)in, 1, i_buf_size,"gdev_dmprt_print_page(in)");
+ gs_free(pdev->memory->non_gc_memory, (char *)in, 1, i_buf_size,"gdev_dmprt_print_page(in)");
return code;
}
diff --git a/gs/psi/fapi_ft.c b/gs/psi/fapi_ft.c
index 6c8cbf81a..0d2b35774 100644
--- a/gs/psi/fapi_ft.c
+++ b/gs/psi/fapi_ft.c
@@ -476,7 +476,9 @@ load_glyph(FAPI_font *a_fapi_font, const FAPI_char_ref *a_char_ref,
if (ft_error == FT_Err_Too_Many_Hints) {
#ifdef DEBUG
if (gs_debug_c('1')) {
- eprintf1 ("TrueType glyph %d uses more instructions than the declared maximum in the font. Continuing, ignoring broken glyph\n", a_char_ref->char_code);
+ emprintf1(a_fapi_font->memory,
+ "TrueType glyph %d uses more instructions than the declared maximum in the font. Continuing, ignoring broken glyph\n",
+ a_char_ref->char_code);
}
#endif
ft_error = 0;
@@ -484,7 +486,9 @@ load_glyph(FAPI_font *a_fapi_font, const FAPI_char_ref *a_char_ref,
if (ft_error == FT_Err_Invalid_Argument) {
#ifdef DEBUG
if (gs_debug_c('1')) {
- eprintf1 ("TrueType parsing error in glyph %d in the font. Continuing, ignoring broken glyph\n", a_char_ref->char_code);
+ emprintf1(a_fapi_font->memory,
+ "TrueType parsing error in glyph %d in the font. Continuing, ignoring broken glyph\n",
+ a_char_ref->char_code);
}
#endif
ft_error = 0;
@@ -492,7 +496,9 @@ load_glyph(FAPI_font *a_fapi_font, const FAPI_char_ref *a_char_ref,
if (ft_error == FT_Err_Too_Many_Function_Defs) {
#ifdef DEBUG
if (gs_debug_c('1')) {
- eprintf1 ("TrueType instruction error in glyph %d in the font. Continuing, ignoring broken glyph\n", a_char_ref->char_code);
+ emprintf1(a_fapi_font->memory,
+ "TrueType instruction error in glyph %d in the font. Continuing, ignoring broken glyph\n",
+ a_char_ref->char_code);
}
#endif
ft_error = 0;
@@ -500,7 +506,9 @@ load_glyph(FAPI_font *a_fapi_font, const FAPI_char_ref *a_char_ref,
if (ft_error == FT_Err_Invalid_Glyph_Index) {
#ifdef DEBUG
if (gs_debug_c('1')) {
- eprintf1 ("FreeType is unable to find the glyph %d in the font. Continuing, ignoring missing glyph\n", a_char_ref->char_code);
+ emprintf1(a_fapi_font->memory,
+ "FreeType is unable to find the glyph %d in the font. Continuing, ignoring missing glyph\n",
+ a_char_ref->char_code);
}
#endif
ft_error = 0;
diff --git a/gs/psi/fapiufst.c b/gs/psi/fapiufst.c
index a855a7872..38b697168 100644
--- a/gs/psi/fapiufst.c
+++ b/gs/psi/fapiufst.c
@@ -166,12 +166,14 @@ static FAPI_retcode open_UFST(fapi_ufst_server *r, const byte *server_param, int
sPlugIn[l] = 0;
bPlugIn = true;
} else
- eprintf("Warning: Unknown UFST parameter ignored.\n");
+ emprintf(r->ff->memory,
+ "Warning: Unknown UFST parameter ignored.\n");
}
#if !NO_SYMSET_MAPPING
if (!bSSdir) {
strcpy(ufst_root_dir, ".");
- eprintf("Warning: UFST_SSdir is not specified, will search *.ss files in the curent directory.\n");
+ emprintf(r->ff->memory,
+ "Warning: UFST_SSdir is not specified, will search *.ss files in the curent directory.\n");
}
#endif
code = gx_UFST_init((const UB8 *)ufst_root_dir);
@@ -185,7 +187,8 @@ static FAPI_retcode open_UFST(fapi_ufst_server *r, const byte *server_param, int
return code;
} else {
#ifdef FCO_RDR
- eprintf("Warning: UFST_PlugIn is not specified, some characters may be missing.\n");
+ emprintf(r->ff->memory,
+ "Warning: UFST_PlugIn is not specified, some characters may be missing.\n");
#endif
}
return 0;
@@ -203,7 +206,7 @@ static FAPI_retcode ensure_open(FAPI_server *server, const byte *server_param, i
{
code = open_UFST(r, server_param, server_param_size);
if (code < 0) {
- eprintf("Error opening the UFST font server.\n");
+ emprintf(r->ff->memory, "Error opening the UFST font server.\n");
return code;
}
}
@@ -647,7 +650,9 @@ static FAPI_retcode make_font_data(fapi_ufst_server *r, const char *font_file_pa
} else {
stream *f = sfopen(font_file_path, "rb", (gs_memory_t *)(r->client_mem.client_data));
if (f == NULL) {
- eprintf1("fapiufst: Can't open %s\n", font_file_path);
+ emprintf1((gs_memory_t *)(r->client_mem.client_data),
+ "fapiufst: Can't open %s\n",
+ font_file_path);
return e_undefinedfilename;
}
memcpy(d + 1, font_file_path, strlen(font_file_path) + 1);
diff --git a/gs/psi/imain.c b/gs/psi/imain.c
index b3305cce9..b828aab51 100644
--- a/gs/psi/imain.c
+++ b/gs/psi/imain.c
@@ -446,7 +446,9 @@ gs_main_run_file_open(gs_main_instance * minst, const char *file_name, ref * pfr
{
gs_main_set_lib_paths(minst);
if (gs_main_lib_open(minst, file_name, pfref) < 0) {
- eprintf1("Can't find initialization file %s.\n", file_name);
+ emprintf1(minst->heap,
+ "Can't find initialization file %s.\n",
+ file_name);
return_error(e_Fatal);
}
r_set_attrs(pfref, a_execute + a_executable);
@@ -474,7 +476,9 @@ gs_run_init_file(gs_main_instance * minst, int *pexit_code, ref * perror_object)
scanner_init(&state, &ifile);
code = scan_token(i_ctx_p, &first_token, &state);
if (code != 0 || !r_has_type(&first_token, t_integer)) {
- eprintf1("Initialization file %s does not begin with an integer.\n", gs_init_file);
+ emprintf1(minst->heap,
+ "Initialization file %s does not begin with an integer.\n",
+ gs_init_file);
*pexit_code = 255;
return_error(e_Fatal);
}
@@ -775,7 +779,9 @@ gs_main_finit(gs_main_instance * minst, int exit_status, int code)
code = interp_reclaim(&minst->i_ctx_p, avm_global);
if (code < 0) {
- eprintf1("ERROR %d reclaiming the memory while the interpreter finalization.\n", code);
+ emprintf1(minst->heap,
+ "ERROR %d reclaiming the memory while the interpreter finalization.\n",
+ code);
return e_Fatal;
}
i_ctx_p = minst->i_ctx_p; /* interp_reclaim could change it. */
@@ -795,8 +801,10 @@ gs_main_finit(gs_main_instance * minst, int exit_status, int code)
0 , &exit_code, &error_object);
code = gs_closedevice(pdev);
if (code < 0)
- eprintf2("ERROR %d closing %s device. See gs/src/ierrors.h for code explanation.\n",
- code, dname);
+ emprintf2(pdev->memory,
+ "ERROR %d closing %s device. See gs/src/ierrors.h for code explanation.\n",
+ code,
+ dname);
rc_decrement(pdev, "gs_main_finit"); /* device might be freed */
if (exit_status == 0 || exit_status == e_Quit)
exit_status = code;
@@ -821,7 +829,9 @@ gs_main_finit(gs_main_instance * minst, int exit_status, int code)
i_plugin_holder *h = i_ctx_p->plugin_list;
code = alloc_restore_all(idmemory);
if (code < 0)
- eprintf1("ERROR %d while the final restore. See gs/src/ierrors.h for code explanation.\n", code);
+ emprintf1(mem_raw,
+ "ERROR %d while the final restore. See gs/src/ierrors.h for code explanation.\n",
+ code);
i_plugin_finit(mem_raw, h);
}
#ifndef PSI_INCLUDED
diff --git a/gs/psi/imainarg.c b/gs/psi/imainarg.c
index 1c4e93c4a..34ffd121e 100644
--- a/gs/psi/imainarg.c
+++ b/gs/psi/imainarg.c
@@ -829,7 +829,9 @@ run_finish(gs_main_instance *minst, int code, int exit_code,
case 0:
break;
case e_Fatal:
- eprintf1("Unrecoverable error, exit code %d\n", exit_code);
+ emprintf1(minst->heap,
+ "Unrecoverable error, exit code %d\n",
+ exit_code);
break;
default:
gs_main_dump_stack(minst, code, perror_object);
diff --git a/gs/psi/zfapi.c b/gs/psi/zfapi.c
index 1a9756883..f0597118f 100644
--- a/gs/psi/zfapi.c
+++ b/gs/psi/zfapi.c
@@ -988,7 +988,10 @@ static int FAPI_get_xlatmap(i_ctx_t *i_ctx_p, char **xlatmap)
static int renderer_retcode(i_ctx_t *i_ctx_p, FAPI_server *I, FAPI_retcode rc)
{ if (rc == 0)
return 0;
- eprintf2("Error: Font Renderer Plugin ( %s ) return code = %d\n", I->ig.d->subtype, rc);
+ emprintf2(imemory,
+ "Error: Font Renderer Plugin ( %s ) return code = %d\n",
+ I->ig.d->subtype,
+ rc);
return rc < 0 ? rc : e_invalidfont;
}
@@ -1523,8 +1526,10 @@ static int fapi_finish_render_aux(i_ctx_t *i_ctx_p, gs_font_base *pbfont, FAPI_s
if (dx + rast.left_indent < 0 || dx + rast.left_indent + rast.black_width > dev1->width) {
#ifdef DEBUG
if (gs_debug_c('m')) {
- eprintf2("Warning : Cropping a FAPI glyph while caching : dx=%d,%d.\n",
- dx + rast.left_indent, dx + rast.left_indent + rast.black_width - dev1->width);
+ emprintf2(dev1->memory,
+ "Warning : Cropping a FAPI glyph while caching : dx=%d,%d.\n",
+ dx + rast.left_indent,
+ dx + rast.left_indent + rast.black_width - dev1->width);
}
#endif
if (dx + rast.left_indent < 0)
@@ -1533,8 +1538,10 @@ static int fapi_finish_render_aux(i_ctx_t *i_ctx_p, gs_font_base *pbfont, FAPI_s
if (dy + rast.top_indent < 0 || dy + rast.top_indent + rast.black_height > dev1->height) {
#ifdef DEBUG
if (gs_debug_c('m')) {
- eprintf2("Warning : Cropping a FAPI glyph while caching : dx=%d,%d.\n",
- dy + rast.top_indent, dy + rast.top_indent + rast.black_height - dev1->height);
+ emprintf2(dev1->memory,
+ "Warning : Cropping a FAPI glyph while caching : dx=%d,%d.\n",
+ dy + rast.top_indent,
+ dy + rast.top_indent + rast.black_height - dev1->height);
}
#endif
if (dy + rast.top_indent < 0)
@@ -1981,7 +1988,9 @@ retry_oversampling:
l = sizeof(buf) - 1;
memcpy(buf, cr.char_name, l);
buf[l] = 0;
- eprintf1("Wrong decoding entry for the character '%s'.\n", buf);
+ emprintf1(imemory,
+ "Wrong decoding entry for the character '%s'.\n",
+ buf);
return_error(e_rangecheck);
}
}