summaryrefslogtreecommitdiff
path: root/gs/base
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2011-07-07 13:47:03 +0100
committerChris Liddell <chris.liddell@artifex.com>2011-07-07 13:49:44 +0100
commit76cfa1cb5d015fee914f80fbbee41b39d707facb (patch)
treed55255017257b365c20d5c22e8eedcbafbc129d7 /gs/base
parent70a824e77c39eed68d7bc7a44351f3beec26fb93 (diff)
Bug 688528-addendum: quell warnings and handle errors.
Diffstat (limited to 'gs/base')
-rw-r--r--gs/base/gdevvec.c7
-rw-r--r--gs/base/gsdevice.c20
-rw-r--r--gs/base/gximag3x.c16
3 files changed, 37 insertions, 6 deletions
diff --git a/gs/base/gdevvec.c b/gs/base/gdevvec.c
index 624d7910a..2573a0d9d 100644
--- a/gs/base/gdevvec.c
+++ b/gs/base/gdevvec.c
@@ -263,6 +263,7 @@ gdev_vector_open_file_options(gx_device_vector * vdev, uint strmbuf_size,
{
bool binary = !(open_options & VECTOR_OPEN_FILE_ASCII);
int code = -1; /* (only for testing, never returned) */
+ cmm_dev_profile_t *icc_array;
/* Open the file as seekable or sequential, as requested. */
if (!(open_options & VECTOR_OPEN_FILE_SEQUENTIAL)) {
@@ -277,6 +278,10 @@ gdev_vector_open_file_options(gx_device_vector * vdev, uint strmbuf_size,
code = gx_device_open_output_file((gx_device *)vdev, vdev->fname,
binary, false, &vdev->file);
}
+ if (code > 0) {
+ code = dev_proc(vdev, get_profile)((gx_device *)vdev, &icc_array);
+ }
+
if (code < 0)
return code;
if ((vdev->strmbuf = gs_alloc_bytes(vdev->v_memory, strmbuf_size,
@@ -317,7 +322,7 @@ gdev_vector_open_file_options(gx_device_vector * vdev, uint strmbuf_size,
gx_device_bbox_init(vdev->bbox_device, NULL, vdev->v_memory);
rc_increment(vdev->bbox_device);
- code = dev_proc(vdev, get_profile)((gx_device *)vdev, &vdev->bbox_device->icc_array);
+ vdev->bbox_device->icc_array = icc_array;
rc_increment(vdev->bbox_device->icc_array);
gx_device_set_resolution((gx_device *) vdev->bbox_device,
diff --git a/gs/base/gsdevice.c b/gs/base/gsdevice.c
index 59e8880ba..1dbdf1a65 100644
--- a/gs/base/gsdevice.c
+++ b/gs/base/gsdevice.c
@@ -434,15 +434,24 @@ gs_setdevice_no_erase(gs_state * pgs, gx_device * dev)
before we start filling pages, if we can */
if (dev->procs.get_profile != NULL) {
code = dev_proc(dev, get_profile)(dev, &dev_profile);
+ if (code < 0) {
+ return(code);
+ }
if (dev_profile == NULL ||
dev_profile->device_profile[gsDEFAULTPROFILE] == NULL) {
/* Go ahead and set the directory in the device params. */
gsicc_set_device_icc_dir(pis, pis->icc_manager->profiledir);
code = gsicc_init_device_profile_struct(dev, NULL,
gsDEFAULTPROFILE);
- /* set the intent too */
+ if (code < 0) {
+ return(code);
+ }
+ /* set the intent too */
code = gsicc_set_device_profile_intent(dev, gsPERCEPTUAL,
gsDEFAULTPROFILE);
+ if (code < 0) {
+ return(code);
+ }
}
}
}
@@ -461,15 +470,24 @@ gs_setdevice_no_erase(gs_state * pgs, gx_device * dev)
const gs_imager_state *pis = (const gs_imager_state* ) pgs;
if (dev->procs.get_profile != NULL) {
code = dev_proc(dev, get_profile)(dev, &dev_profile);
+ if (code < 0) {
+ return(code);
+ }
if (dev_profile == NULL ||
dev_profile->device_profile[gsDEFAULTPROFILE] == NULL) {
/* Go ahead and set the directory in the device params. */
gsicc_set_device_icc_dir(pis, pis->icc_manager->profiledir);
code = gsicc_init_device_profile_struct(dev, NULL,
gsDEFAULTPROFILE);
+ if (code < 0) {
+ return(code);
+ }
/* set the intent too */
code = gsicc_set_device_profile_intent(dev, gsPERCEPTUAL,
gsDEFAULTPROFILE);
+ if (code < 0) {
+ return(code);
+ }
}
}
}
diff --git a/gs/base/gximag3x.c b/gs/base/gximag3x.c
index 4033caf79..73938de37 100644
--- a/gs/base/gximag3x.c
+++ b/gs/base/gximag3x.c
@@ -541,16 +541,24 @@ make_mcdex_default(gx_device *dev, const gs_imager_state *pis,
* that can be freed at the end and that simply forwards all calls.
* The most convenient device for this purpose is the bbox device.
*/
- gx_device_bbox *bbdev =
- gs_alloc_struct_immovable(mem, gx_device_bbox, &st_device_bbox,
- "make_mcdex_default");
+ gx_device_bbox *bbdev;
int code;
+ cmm_dev_profile_t *icc_array;
+
+ code = dev_proc(dev, get_profile)(dev, &icc_array);
+ if (code < 0) {
+ return(code);
+ }
+
+ bbdev = gs_alloc_struct_immovable(mem, gx_device_bbox, &st_device_bbox,
+ "make_mcdex_default");
if (bbdev == 0)
return_error(gs_error_VMerror);
+
gx_device_bbox_init(bbdev, dev, mem);
- code = dev_proc(dev, get_profile)(dev, &bbdev->icc_array);
+ bbdev->icc_array = icc_array;
rc_increment(bbdev->icc_array);
gx_device_bbox_fwd_open_close(bbdev, false);