ghostscript/ghostscript-iccprofiles-initdir.patch
2010-09-24 14:36:59 +01:00

38 lines
1.4 KiB
Diff

diff -up ghostscript-9.00/psi/zusparam.c.iccprofiles-initdir ghostscript-9.00/psi/zusparam.c
--- ghostscript-9.00/psi/zusparam.c.iccprofiles-initdir 2010-09-23 14:15:24.628921593 +0100
+++ ghostscript-9.00/psi/zusparam.c 2010-09-23 14:29:21.189796748 +0100
@@ -593,14 +593,31 @@ set_default_gray_icc(i_ctx_t *i_ctx_p, g
return(code);
}
+extern_gx_io_device_table();
+
static void
current_icc_directory(i_ctx_t *i_ctx_p, gs_param_string * pval)
{
static const char *const rfs = "%rom%iccprofiles/"; /* as good as any other */
const gs_imager_state * pis = (gs_imager_state *) igs;
+ int have_rom_device = 0;
+
+ if (pis->icc_manager->profiledir != NULL)
+ pval->data = (const byte *) pis->icc_manager->profiledir;
+ else {
+ int i;
+ for (i = 0; i < gx_io_device_table_count; i++) {
+ const gx_io_device *iodev = gx_io_device_table[i];
+ const char *dname = iodev->dname;
+
+ if (dname && strlen(dname) == 5 && !memcmp("%rom%", dname, 5)) {
+ have_rom_device = 1;
+ break;
+ }
+ }
- pval->data = (const byte *)( (pis->icc_manager->profiledir == NULL) ?
- rfs : pis->icc_manager->profiledir);
+ pval->data = (const byte *) (have_rom_device ? rfs : "");
+ }
pval->size = strlen((const char *)pval->data);
pval->persistent = true;
}