ghostscript/ghostscript-iccprofiles-initdir.patch

36 lines
1.3 KiB
Diff
Raw Normal View History

2011-02-10 10:32:12 +00:00
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;
2010-09-23 10:57:49 +00:00
}
+extern_gx_io_device_table();
+
static void
current_icc_directory(i_ctx_t *i_ctx_p, gs_param_string * pval)
{
2011-02-10 10:32:12 +00:00
static const char *const rfs = DEFAULT_DIR_ICC; /* as good as any other */
2010-09-23 10:57:49 +00:00
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 : "");
+ }
2011-02-10 10:32:12 +00:00
pval->data = (const byte *)( (pis->icc_manager->profiledir == NULL) ?
rfs : pis->icc_manager->profiledir);
2010-09-23 10:57:49 +00:00
pval->size = strlen((const char *)pval->data);