summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2020-02-25 15:57:36 +0000
committerChris Liddell <chris.liddell@artifex.com>2020-02-26 08:18:49 +0000
commita00c75369e082798d82202a2b64d8e4b484d0c11 (patch)
tree16431a9e812cdba9711e86bf63875efd774f4e54
parent32f3d6703a7e5c6582c066837783c6697e98b1ca (diff)
downloadghostpdl-a00c75369e082798d82202a2b64d8e4b484d0c11.tar.gz
Fix coverity issues 354292 and 354293.
Don't bother testing an unsigned value for clipping against 0.
-rw-r--r--base/gxblend.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/base/gxblend.c b/base/gxblend.c
index e95eb7cc8..334f9717d 100644
--- a/base/gxblend.c
+++ b/base/gxblend.c
@@ -4705,9 +4705,7 @@ template_mark_fill_rect(int w, int h, byte *gs_restrict dst_ptr, byte *gs_restri
} else {
/* We need val_new = (val_old * old_alpha) / new_alpha */
uint32_t val = (scale * (255 - pdst[k]) + 128)>>8;
- if (val < 0)
- val = 0;
- else if (val > 255)
+ if (val > 255)
val = 255;
dst_ptr[k * planestride] = val;
}
@@ -5294,9 +5292,7 @@ template_mark_fill_rect16(int w, int h, uint16_t *gs_restrict dst_ptr, uint16_t
} else {
/* We need val_new = (val_old * old_alpha) / new_alpha */
uint64_t val = (scale * (65535 - pdst[k]) + 32768)>>16;
- if (val < 0)
- val = 0;
- else if (val > 65535)
+ if (val > 65535)
val = 65535;
dst_ptr[k * planestride] = val;
}