diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2015-06-30 11:56:27 +0100 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2015-07-03 09:58:01 +0100 |
commit | deb559b17388f089663c60d5a4d58fb4f8901398 (patch) | |
tree | 580c11df65fc361bc4d86ed20f9adf6888376d47 | |
parent | 5673541bcba5088abaf5f86d1415a580332d82a7 (diff) | |
download | ghostpdl-deb559b17388f089663c60d5a4d58fb4f8901398.tar.gz |
A few devices only catered for a single subclass.
Robin pointed out that a few devices only catered for one level of subclass
device being installed during their 'open' method. Instead of checking
for the presence of dev->child and then using the child, descend to the
terminus of the chain and use that device.
-rw-r--r-- | gs/base/gdevdevn.c | 2 | ||||
-rw-r--r-- | gs/contrib/opvp/gdevopvp.c | 16 | ||||
-rw-r--r-- | gs/contrib/pcl3/eprn/gdeveprn.c | 5 | ||||
-rw-r--r-- | gs/contrib/pcl3/src/gdevpcl3.c | 4 | ||||
-rw-r--r-- | gs/devices/gdevpbm.c | 6 | ||||
-rw-r--r-- | gs/devices/gdevupd.c | 10 | ||||
-rw-r--r-- | gs/devices/gdevwpr2.c | 13 |
7 files changed, 28 insertions, 28 deletions
diff --git a/gs/base/gdevdevn.c b/gs/base/gdevdevn.c index bac8c6ade..44c74137e 100644 --- a/gs/base/gdevdevn.c +++ b/gs/base/gdevdevn.c @@ -1856,7 +1856,7 @@ spotcmyk_prn_open(gx_device * pdev) { int code = gdev_prn_open(pdev); - if (pdev->child) + while (pdev->child) pdev = pdev->child; set_linear_color_bits_mask_shift(pdev); diff --git a/gs/contrib/opvp/gdevopvp.c b/gs/contrib/opvp/gdevopvp.c index 178ffb963..d156f029a 100644 --- a/gs/contrib/opvp/gdevopvp.c +++ b/gs/contrib/opvp/gdevopvp.c @@ -2059,11 +2059,11 @@ opvp_open(gx_device *dev) ecode = code; return ecode; } - if (dev->child) { - dev = pdev->child; - rdev = (gx_device_oprp *)(pdev->child); - pdev = (gx_device_opvp *)(pdev->child); + while (dev->child) { + dev = dev->child; } + rdev = (gx_device_oprp *)(dev); + pdev = (gx_device_opvp *)(dev); #if GS_VERSION_MAJOR >= 8 if (pdev->bbox_device != NULL) { if (pdev->bbox_device->memory == NULL) { @@ -2079,11 +2079,11 @@ opvp_open(gx_device *dev) ecode = ecode; return ecode; } - if (dev->child) { - dev = pdev->child; - rdev = (gx_device_oprp *)(pdev->child); - pdev = (gx_device_opvp *)(pdev->child); + while (dev->child) { + dev = dev->child; } + rdev = (gx_device_oprp *)(dev); + pdev = (gx_device_opvp *)(dev); /* open output stream */ code = gdev_prn_open_printer_seekable(dev, true, false); if (code < 0) { diff --git a/gs/contrib/pcl3/eprn/gdeveprn.c b/gs/contrib/pcl3/eprn/gdeveprn.c index 5e979a5b7..461369bf9 100644 --- a/gs/contrib/pcl3/eprn/gdeveprn.c +++ b/gs/contrib/pcl3/eprn/gdeveprn.c @@ -1038,10 +1038,9 @@ int eprn_open_device(gx_device *device) /* if device has been subclassed (FirstPage/LastPage device) then make sure we use * the subclassed device. */ - if (device->child) { + while (device->child) device = device->child; - eprn = &((eprn_Device *)device)->eprn; - } + eprn = &((eprn_Device *)device)->eprn; /* Just in case a previous open call failed in a derived device (note that 'octets_per_line' is still the same as then): */ diff --git a/gs/contrib/pcl3/src/gdevpcl3.c b/gs/contrib/pcl3/src/gdevpcl3.c index 5a2233962..7514c04c5 100644 --- a/gs/contrib/pcl3/src/gdevpcl3.c +++ b/gs/contrib/pcl3/src/gdevpcl3.c @@ -1301,9 +1301,11 @@ static int pcl3_open_device(gx_device *device) /* if device has been subclassed (FirstPage/LastPage device) then make sure we use * the subclassed device. */ - if (device->child) + while (device->child) device = device->child; + dev = (pcl3_Device *)device; + /* Fill the still unassigned parts of 'file_data' from the other data */ { pcl_FileData *data = &dev->file_data; diff --git a/gs/devices/gdevpbm.c b/gs/devices/gdevpbm.c index 71f2cc963..08b9641fb 100644 --- a/gs/devices/gdevpbm.c +++ b/gs/devices/gdevpbm.c @@ -280,10 +280,10 @@ ppm_open(gx_device * pdev) #endif code = gdev_prn_open_planar(pdev, bdev->UsePlanarBuffer); - if (pdev->child) { + while (pdev->child) pdev = pdev->child; - bdev = (gx_device_pbm *)pdev;; - } + + bdev = (gx_device_pbm *)pdev;; if (code < 0) return code; diff --git a/gs/devices/gdevupd.c b/gs/devices/gdevupd.c index f7c264e02..efffd99d8 100644 --- a/gs/devices/gdevupd.c +++ b/gs/devices/gdevupd.c @@ -1278,11 +1278,11 @@ upd_open(gx_device *pdev) /** call the super-class open **/ error = gdev_prn_open(pdev); - if (pdev->child) { - pdev = pdev->child; - udev = (upd_device *) pdev; - upd = udev->upd; - } + while (pdev->child) + pdev = pdev->child; + + udev = (upd_device *) pdev; + upd = udev->upd; /** invoke the subroutines, if an upd is present. */ diff --git a/gs/devices/gdevwpr2.c b/gs/devices/gdevwpr2.c index 44149709b..81910621d 100644 --- a/gs/devices/gdevwpr2.c +++ b/gs/devices/gdevwpr2.c @@ -408,15 +408,14 @@ win_pr2_open(gx_device * dev) * device stops working, not sure why. */ if (dev->child) { - gx_device_win_pr2 *windev = (gx_device_win_pr2 *)dev; + gx_device_win_pr2 *windev; - if (windev->original_device == windev) { - windev = (gx_device_win_pr2 *)dev->child; - windev->original_device = (gx_device_win_pr2 *)dev->child; - } + while (dev->child) + dev = dev->child; + + windev = (gx_device_win_pr2 *)dev; - /* We use 'dev' below, so make sure its the actual mswinpr2 device we use */ - dev = dev->child; + windev->original_device = (gx_device_win_pr2 *)dev; } if ((code < 0) && wdev->fname[0]) |