summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaya Rashish <maya@NetBSD.org>2019-01-10 20:49:28 +0200
committerMaya Rashish <maya@NetBSD.org>2019-01-10 20:49:28 +0200
commitc214ab0d7deae30acdf90933ed14b223118dcf67 (patch)
tree01dc334330dffe1c2ac9ceb0a3e32f6c6d4cd02f
parent8e34a2aa7c4dea5aa07dc08a40dacd90e2148a89 (diff)
Avoid undefined behaviour
Left shifting a negative is undefined. For consistency, use the equivalent form of multiplication for the positive numbers as well.
-rw-r--r--struct.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/struct.c b/struct.c
index c0a3add..294f498 100644
--- a/struct.c
+++ b/struct.c
@@ -491,8 +491,8 @@ fontMetrics(FontPtr font,
{
int i, rc;
int max_awidth = 0;
- int min_x = 10000 << 16, min_y = 10000 << 16;
- int max_x = -10000 << 16, max_y = -10000 << 16;
+ int min_x = 10000 * 65536, min_y = 10000 * 65536;
+ int max_x = -10000 * 65536, max_y = -10000 * 65536;
for(i = 0; i < FONT_CODES; i++) {
int awidth, x0, y0, x1, y1;
rc = glyphMetrics(font, i, &awidth, &x0, &y0, &x1, &y1);