summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2018-11-14 21:04:46 +0000
committerChris Liddell <chris.liddell@artifex.com>2018-11-16 15:04:28 +0000
commite8be28b49c6a43db1861119288933b5a8fdbef73 (patch)
treedb2b9ec672755e566a3486958ec63a0b2e6b4401
parent5db929cf393fa330bf916da37f5d2a5954a3b0c3 (diff)
downloadghostpdl-e8be28b49c6a43db1861119288933b5a8fdbef73.tar.gz
Bug 700176: Use the actual output device for both devices in setdevice
Also fixes bug 700189. The pdf14 compositor device, despite being a forwarding device, does not forward all spec_ops to it's target, only a select few are special cased for that. gxdso_current_output_device needs to be included in those special cases. The original commit (661e8d8fb8248) changed the code to use the spec_op to retrieve the output device, checking that for LockSafetyParams. If LockSafetyParams is set, it returns an invalidaccess error if the new device differs from the current device. When we do the comparison between the two devices, we need to check the output device in both cases. This is complicated by the fact that the new device may not have ever been set (and thus fully initialised), and may not have a spec_op method available at that point.
-rw-r--r--base/gdevp14.c3
-rw-r--r--psi/zdevice.c18
2 files changed, 18 insertions, 3 deletions
diff --git a/base/gdevp14.c b/base/gdevp14.c
index 3019131c7..537a56475 100644
--- a/base/gdevp14.c
+++ b/base/gdevp14.c
@@ -5617,7 +5617,8 @@ pdf14_dev_spec_op(gx_device *pdev, int dev_spec_op,
return 0;
}
}
- if (dev_spec_op == gxdso_get_dev_param || dev_spec_op == gxdso_restrict_bbox) {
+ if (dev_spec_op == gxdso_get_dev_param || dev_spec_op == gxdso_restrict_bbox
+ || dev_spec_op == gxdso_current_output_device) {
return dev_proc(p14dev->target, dev_spec_op)(p14dev->target, dev_spec_op, data, size);
}
diff --git a/psi/zdevice.c b/psi/zdevice.c
index 7ede0a181..bd2c542fb 100644
--- a/psi/zdevice.c
+++ b/psi/zdevice.c
@@ -509,16 +509,30 @@ int
zsetdevice(i_ctx_t *i_ctx_p)
{
gx_device *odev = NULL, *dev = gs_currentdevice(igs);
+ gx_device *ndev = NULL;
os_ptr op = osp;
int code = dev_proc(dev, dev_spec_op)(dev,
gxdso_current_output_device, (void *)&odev, 0);
if (code < 0)
return code;
-
check_write_type(*op, t_device);
+
+ /* slightly icky special case: the new device may not have had
+ * it's procs initialised, at this point - but we need to check
+ * whether we're being asked to change the device here
+ */
+ if (dev_proc((op->value.pdevice), dev_spec_op) == NULL)
+ ndev = op->value.pdevice;
+ else
+ code = dev_proc((op->value.pdevice), dev_spec_op)(op->value.pdevice,
+ gxdso_current_output_device, (void *)&ndev, 0);
+
+ if (code < 0)
+ return code;
+
if (odev->LockSafetyParams) { /* do additional checking if locked */
- if(op->value.pdevice != odev) /* don't allow a different device */
+ if(ndev != odev) /* don't allow a different device */
return_error(gs_error_invalidaccess);
}
dev->ShowpageCount = 0;