summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2018-02-06 11:46:56 +0000
committerKen Sharp <ken.sharp@artifex.com>2018-02-06 11:46:56 +0000
commitf6005484617ada241d2f5f4deee4808616474831 (patch)
tree47e31609e0c7d6b161621748e9fedbba61c0d90b
parent16688a8b833cf4e8950265e933604c32b1f2392e (diff)
downloadghostpdl-f6005484617ada241d2f5f4deee4808616474831.tar.gz
Address more scanbuild/gcc/clang warnings
gdevkrnlsclass.c Change a while...do into a do...while to see if it pacifies a 'dereference of NULL pointer' in scanbuild gsparamx.c Incorrect return code could lead to an earlier error not being preserved. Fortunately this is currently only called by claptrap. gsptype1.c remove unnecessary assignments gssprintf.c " " " gstype2.c " " " gstype42.c " " " gxfill.c " " " gsptype2.c rejig the code to avoid setting a return code that isn't used. Add a check on a return code that was missing. gxchar.c add return code checking gxcmap.c " " " "
-rw-r--r--base/gdevkrnlsclass.c20
-rw-r--r--base/gsparamx.c2
-rw-r--r--base/gsptype1.c9
-rw-r--r--base/gsptype2.c10
-rw-r--r--base/gssprintf.c1
-rw-r--r--base/gstype2.c1
-rw-r--r--base/gstype42.c2
-rw-r--r--base/gxchar.c5
-rw-r--r--base/gxcmap.c5
-rw-r--r--base/gxfill.c1
10 files changed, 27 insertions, 29 deletions
diff --git a/base/gdevkrnlsclass.c b/base/gdevkrnlsclass.c
index db129856f..88617a43a 100644
--- a/base/gdevkrnlsclass.c
+++ b/base/gdevkrnlsclass.c
@@ -40,10 +40,10 @@ int install_internal_subclass_devices(gx_device **ppdev, int *devices_loaded)
saved = dev = dev->child;
/* Open all devices *after* the new current device */
- while(dev) {
+ do {
dev->is_open = true;
dev = dev->child;
- }
+ }while(dev);
dev = saved;
@@ -52,10 +52,10 @@ int install_internal_subclass_devices(gx_device **ppdev, int *devices_loaded)
dev = dev->parent;
/* Note in all devices in chain that we have loaded the PageHandler */
- while(dev) {
- dev->PageHandlerPushed = true;
+ do {
+ dev->is_open = true;
dev = dev->child;
- }
+ }while(dev);
dev = saved;
if (devices_loaded)
@@ -73,10 +73,10 @@ int install_internal_subclass_devices(gx_device **ppdev, int *devices_loaded)
saved = dev = dev->child;
/* Open all devices *after* the new current device */
- while(dev) {
+ do {
dev->is_open = true;
dev = dev->child;
- }
+ }while(dev);
dev = saved;
@@ -85,10 +85,10 @@ int install_internal_subclass_devices(gx_device **ppdev, int *devices_loaded)
dev = dev->parent;
/* Note in all devices in chain that we have loaded the ObjectHandler */
- while(dev) {
- dev->ObjectHandlerPushed = true;
+ do {
+ dev->is_open = true;
dev = dev->child;
- }
+ }while(dev);
dev = saved;
if (devices_loaded)
diff --git a/base/gsparamx.c b/base/gsparamx.c
index ae2c3d26e..33f248d78 100644
--- a/base/gsparamx.c
+++ b/base/gsparamx.c
@@ -57,7 +57,7 @@ param_put_enum(gs_param_list * plist, gs_param_name param_name,
ecode = code;
param_signal_error(plist, param_name, code);
}
- return code;
+ return ecode;
}
/* Put a Boolean value. */
diff --git a/base/gsptype1.c b/base/gsptype1.c
index 85888614e..2f106279c 100644
--- a/base/gsptype1.c
+++ b/base/gsptype1.c
@@ -1799,9 +1799,6 @@ gx_dc_pattern_trans_write_raster(gx_color_tile *ptile, int64_t offset, byte *dat
/* copy that amount */
ptr = ptile->ttrans->transbytes;
memcpy(dp, ptr + (offset1 - size_h), u);
- left -= u;
- dp += u;
- offset1 += u;
}
return 0;
}
@@ -1979,8 +1976,6 @@ gx_dc_pattern_read_raster(gx_color_tile *ptile, const gx_dc_serialized_tile_t *b
memcpy(ptile->tmask.data +
(offset1 - sizeof(gx_dc_serialized_tile_t) - size_b - sizeof(gx_strip_bitmap)), dp, l);
left -= l;
- offset1 += l;
- dp += l;
}
return size - left;
}
@@ -2017,8 +2012,6 @@ gx_dc_pattern_read_trans_buff(gx_color_tile *ptile, int64_t offset,
sizeof(tile_trans_clist_info_t), dp, u);
trans_pat->transbytes = save;
left -= u;
- offset1 += u;
- dp += u;
}
return size - left;
}
@@ -2188,7 +2181,6 @@ gx_dc_pattern_read(
return gx_dc_pattern_read_raster(ptile, NULL, offset1, dp, left, mem);
size_b = ptile->tbits.size.x;
- size_c = ptile->tbits.size.y;
}
if (offset1 <= sizeof(buf) + size_b) {
l = min(left, size_b - (offset1 - sizeof(buf)));
@@ -2208,7 +2200,6 @@ gx_dc_pattern_read(
return code;
l = code;
left -= l;
- offset1 += l;
}
return size - left;
}
diff --git a/base/gsptype2.c b/base/gsptype2.c
index bee51da71..791e538c0 100644
--- a/base/gsptype2.c
+++ b/base/gsptype2.c
@@ -348,13 +348,15 @@ gx_dc_pattern2_clip_with_bbox(const gx_device_color * pdevc, gx_device * pdev,
gx_path_init_local(&box_path, mem);
code = gx_dc_shading_path_add_box(&box_path, pdevc);
- if (code == gs_error_limitcheck) {
- /* Ignore huge BBox - bug 689027. */
- code = 0;
- } else {
+ if (code != gs_error_limitcheck) {
+ /* Ignore huge BBox causing limitcheck - bug 689027. */
if (code >= 0) {
gx_cpath_init_local_shared(cpath_local, *ppcpath1, mem);
code = gx_cpath_intersect(cpath_local, &box_path, gx_rule_winding_number, (gs_gstate *)pinst->saved);
+ if (code < 0) {
+ gx_path_free(&box_path, "gx_default_fill_path(path_bbox)");
+ return code;
+ }
*ppcpath1 = cpath_local;
}
}
diff --git a/base/gssprintf.c b/base/gssprintf.c
index adaa4b48b..49f54bd42 100644
--- a/base/gssprintf.c
+++ b/base/gssprintf.c
@@ -132,7 +132,6 @@ static char *apr_cvt(double arg, int ndigits, int *decpt, int *sign,
arg = -arg;
}
arg = modf(arg, &fi);
- p1 = &buf[NDIG];
/*
* Do integer part
*/
diff --git a/base/gstype2.c b/base/gstype2.c
index e51d0fe8d..70dec6fa2 100644
--- a/base/gstype2.c
+++ b/base/gstype2.c
@@ -778,7 +778,6 @@ flex: {
}
if (code < 0)
return code;
- csp -= 13;
}
cnext;
case ce2_hflex1:
diff --git a/base/gstype42.c b/base/gstype42.c
index a8814cb03..54c4e8adc 100644
--- a/base/gstype42.c
+++ b/base/gstype42.c
@@ -861,7 +861,6 @@ gs_type42_substitute_glyph_index_vertical(gs_font_type42 *pfont, uint glyph_inde
return new_glyph;
}
} else if (k0 >= k1 - 1) {
- k += 0; /* A place for breakpoint. */
break; /* Not found. */
} else if (glyph_index < glyph)
k1 = k;
@@ -900,7 +899,6 @@ gs_type42_substitute_glyph_index_vertical(gs_font_type42 *pfont, uint glyph_inde
return new_glyph;
}
} else if (k0 >= k1 - 1) {
- k += 0; /* A place for breakpoint. */
break; /* Not found. */
} else if (glyph_index < rr.Start)
k1 = k;
diff --git a/base/gxchar.c b/base/gxchar.c
index b1895c791..0db594147 100644
--- a/base/gxchar.c
+++ b/base/gxchar.c
@@ -608,6 +608,9 @@ set_cache_device(gs_show_enum * penum, gs_gstate * pgs, double llx, double lly,
log2_scale.x + log2_scale.y > alpha_bits ?
penum->dev_cache2 : NULL),
iwidth, iheight, &log2_scale, depth, &cc);
+ if (code < 0)
+ return code;
+
if (cc == 0) {
/* too big for cache or no cache */
gx_path box_path;
@@ -633,6 +636,8 @@ set_cache_device(gs_show_enum * penum, gs_gstate * pgs, double llx, double lly,
if (code < 0)
return code;
code = gx_cpath_clip(pgs, pgs->clip_path, &box_path, gx_rule_winding_number);
+ if (code < 0)
+ return code;
gx_path_free(&box_path, "set_cache_device");
pgs->in_cachedevice = CACHE_DEVICE_NONE_AND_CLIP;
return 0;
diff --git a/base/gxcmap.c b/base/gxcmap.c
index 677deec95..ef2bd61cc 100644
--- a/base/gxcmap.c
+++ b/base/gxcmap.c
@@ -676,6 +676,9 @@ gs_color_select_t select)
proper color management for the CMYK portions IF you are using
an NCLR output profile. */
code = dev_proc(dev, get_profile)(dev, &dev_profile);
+ if (code < 0)
+ return false;
+
/* Check if the profile is DeviceN (NCLR) */
if (dev_profile->device_profile[0]->data_cs == gsNCHANNEL) {
if (dev_profile->spotnames == NULL)
@@ -684,6 +687,8 @@ gs_color_select_t select)
/* Note that if the improper NCLR profile is used, then the
composite preview will be wrong. */
code = gsicc_set_devicen_equiv_colors(dev, pgs, dev_profile->device_profile[0]);
+ if (code < 0)
+ return false;
dev_profile->spotnames->equiv_cmyk_set = true;
}
gx_remap_concrete_devicen(conc, pdc, pgs, dev, select);
diff --git a/base/gxfill.c b/base/gxfill.c
index a332ff123..d07804c30 100644
--- a/base/gxfill.c
+++ b/base/gxfill.c
@@ -1892,7 +1892,6 @@ intersect_al(line_list *ll, fixed y, fixed *y_top, int draw, bool all_bands)
nx = nx0;
}
endp->x_next = alp->x_next = nx; /* Ensure same X. */
- draw = 0;
/* Can't guarantee same x for triple intersections here.
Will take care below */
}