Coverity 1234, unreachable code
Alex Cherepanov <[email protected]> Thu, 25 Dec 2008 17:03:28 -0500
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--------------050007050806000602050203
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Remove trivial unreachable code found by Coverity and condition
out non-trivial one.
--------------050007050806000602050203
Content-Type: text/plain;
name="cov1234.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="cov1234.diff"
Index: gs/base/gdevcdj.c
===================================================================
--- gs/base/gdevcdj.c (revision 9301)
+++ gs/base/gdevcdj.c (working copy)
@@ -838,7 +838,8 @@
break;
- /*NOTREACHED*/
+#if 0
+ /*NOTREACHED from pre-historic times */
/*
* The margins must be set so that the resulting page length will be
@@ -858,8 +859,8 @@
- bjcm[3] - (float) pdimen / 10.;
} while (bjcm[1] < BJC_LOWER_LIMIT);
}
-
break;
+#endif
}
gx_device_set_margins(pdev, m, true);
return gdev_prn_open(pdev);
@@ -2879,16 +2880,12 @@
case 1:
return (c | m | y) > gx_max_color_value / 2 ?
(gx_color_index) 1 : (gx_color_index) 0;
- /*NOTREACHED*/
- break;
case 8:
return ((ulong) c * lum_red_weight * 10
+ (ulong) m * lum_green_weight * 10
+ (ulong) y * lum_blue_weight * 10)
>> (gx_color_value_bits + 2);
- /*NOTREACHED*/
- break;
}
}
@@ -3224,8 +3221,6 @@
switch (ccomps) {
default:
return gs_error_rangecheck;
- /*NOTREACHED*/
- break;
case 1:
bpp = 1;
Index: gs/contrib/gdevcd8.c
===================================================================
--- gs/contrib/gdevcd8.c (revision 9301)
+++ gs/contrib/gdevcd8.c (working copy)
@@ -3202,8 +3202,6 @@
switch (ccomps) {
default:
return gs_error_rangecheck;
- /*NOTREACHED */
- break;
case 1:
bpp = 1;
@@ -3450,16 +3448,12 @@
case 1:
return (c | m | y) > gx_max_color_value / 2 ?
(gx_color_index) 1 : (gx_color_index) 0;
- /*NOTREACHED */
- break;
case 8:
return ((ulong) c * lum_red_weight * 10
+ (ulong) m * lum_green_weight * 10
+ (ulong) y * lum_blue_weight * 10)
>> (gx_color_value_bits + 2);
- /*NOTREACHED */
- break;
}
}
Index: gs/contrib/gdevdj9.c
===================================================================
--- gs/contrib/gdevdj9.c (revision 9301)
+++ gs/contrib/gdevdj9.c (working copy)
@@ -2094,8 +2094,6 @@
default:
return gs_error_rangecheck;
- /*NOTREACHED */
- break;
case 1:
bpp = 1;
@@ -2345,16 +2343,12 @@
switch (pdev->color_info.depth) {
case 1:
return (c | m | y) > gx_max_color_value / 2 ? (gx_color_index) 1 : (gx_color_index) 0;
- /*NOTREACHED */
- break;
case 8:
return ((ulong) c * lum_red_weight * 10
+ (ulong) m * lum_green_weight * 10
+ (ulong) y * lum_blue_weight * 10)
>> (gx_color_value_bits + 2);
- /*NOTREACHED */
- break;
}
}
--------------050007050806000602050203
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
gs-code-review mailing list
[email protected]
http://www.ghostscript.com/mailman/listinfo/gs-code-review
--------------050007050806000602050203--