Fix two issues discovered by Coverity:
1. properly mark one switch case as fall-through
2. unroll a loop that only executes once
CID:
1369623
CID:
1019001
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Samuel Thibault <samuel.thibautl@ens-lyon.org>
padc = '0';
goto reswitch;
}
+ /* fallthrough */
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
for (n = 0;; ++fmt) {
width = 1;
if (flags & SUPPRESS) {
size_t sum = 0;
- for (;;) {
- if ((n = inr) < width) {
- sum += n;
- width -= n;
- inp += n;
- if (sum == 0)
- goto input_failure;
- break;
- } else {
- sum += width;
- inr -= width;
- inp += width;
- break;
- }
+ if ((n = inr) < width) {
+ sum += n;
+ width -= n;
+ inp += n;
+ if (sum == 0)
+ goto input_failure;
+ } else {
+ sum += width;
+ inr -= width;
+ inp += width;
}
nread += sum;
} else {