aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2026-05-22 18:08:58 +0000
committerEd Maste <emaste@FreeBSD.org>2026-07-20 20:46:50 +0000
commitb273481f2a840a05e4039655be99528e1fa9388c (patch)
tree9b907c9bef4bdbce0716ca9c909e8985c9942856
parent6dbeaf1afaba52ba224f24773cbaac6317e11ff2 (diff)
vtfontcvt: Avoid dead store in add_char
The fallback glyph is stored at index 0, and does not need to be inserted into a mapping. Previously there was a dead store of add_glyph's return value for the fallback case, which upset Clang's static analyzer. Now, cast the return value to (void) to make it clear this is intentional. Also change add_glyph's fallback parameter to a c99 bool to make its use more clear. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57174
-rw-r--r--usr.bin/vtfontcvt/vtfontcvt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/vtfontcvt/vtfontcvt.c b/usr.bin/vtfontcvt/vtfontcvt.c
index f39076b09be6..29294f589fb5 100644
--- a/usr.bin/vtfontcvt/vtfontcvt.c
+++ b/usr.bin/vtfontcvt/vtfontcvt.c
@@ -254,7 +254,7 @@ dedup_mapping(unsigned int map_idx)
}
static struct glyph *
-add_glyph(const uint8_t *bytes, unsigned int map_idx, int fallback)
+add_glyph(const uint8_t *bytes, unsigned int map_idx, bool fallback)
{
struct glyph *gl;
int hash;
@@ -321,13 +321,13 @@ add_char(unsigned curchar, unsigned map_idx, uint8_t *bytes, uint8_t *bytes_r)
/* Prevent adding two glyphs for 0xFFFD */
if (curchar == 0xFFFD) {
if (map_idx < VFNT_MAP_BOLD)
- gl = add_glyph(bytes, 0, 1);
+ (void)add_glyph(bytes, 0, true);
} else if (filter == false || curchar >= 0x20) {
- gl = add_glyph(bytes, map_idx, 0);
+ gl = add_glyph(bytes, map_idx, false);
if (add_mapping(gl, curchar, map_idx) != 0)
return (1);
if (bytes_r != NULL) {
- gl = add_glyph(bytes_r, map_idx + 1, 0);
+ gl = add_glyph(bytes_r, map_idx + 1, false);
if (add_mapping(gl, curchar, map_idx + 1) != 0)
return (1);
}