From: Ben Harris Date: Fri, 7 Jul 2017 23:51:44 +0000 (+0100) Subject: In do_palt(), mask out unused data bits. X-Git-Tag: bedstead-001.003~16 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=7ba21188c816fd0c2291ce1364d5a781fa4c0bc8;p=bedstead.git In do_palt(), mask out unused data bits. This avoids an infinite loop if one of them is inadvertently (or advertently) set. Why might one be set advertently? Well, it would allow us to replace our long lists of numbers with short strings. For instance, the U+0024 DOLLAR SIGN glyph is "NUTNEUN". Sadly that would make the program incompatible with non-ASCII systems and since I claim ANSI C I should probably continue to support those. --- diff --git a/bedstead.c b/bedstead.c index 275028d..5231513 100644 --- a/bedstead.c +++ b/bedstead.c @@ -1491,7 +1491,7 @@ dopalt(struct glyph const *g) * characters get an advance width of three pixels. */ for (i = 0; i < YSIZE; i++) - cols |= g->data[i]; + cols |= g->data[i] & ((1 << XSIZE) - 1); if (cols == 0) dh = 3 - XSIZE; else {