ghostscript/ghostscript-iccprofiles-initdir.patch
2011-02-10 10:32:12 +00:00

36 lines
1.3 KiB
Diff

diff -up ghostscript-9.01/psi/zusparam.c.iccprofiles-initdir ghostscript-9.01/psi/zusparam.c
--- ghostscript-9.01/psi/zusparam.c.iccprofiles-initdir 2010-11-16 14:48:31.000000000 +0000
+++ ghostscript-9.01/psi/zusparam.c 2011-02-10 09:51:59.107972983 +0000
@@ -607,12 +607,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 = DEFAULT_DIR_ICC; /* 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 *) (have_rom_device ? rfs : "");
+ }
pval->data = (const byte *)( (pis->icc_manager->profiledir == NULL) ?
rfs : pis->icc_manager->profiledir);
pval->size = strlen((const char *)pval->data);