summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-11-06 09:33:40 -0500
committerSolomon Peachy <pizza@shaftnet.org>2024-11-06 09:40:06 -0500
commitd1ffaa8949998099abcc8611e5f66a0c496c66ee (patch)
treeb48b7a0fe30af5ffb0ef6e2c168b7548153d97ae
parent000a575d13d3b11a920361dda45fcfb63447317d (diff)
downloadrockbox-d1ffaa8949.tar.gz
rockbox-d1ffaa8949.zip
convbdf: Properly support a compiled sysfont of over 64K.
The 'struct font' definition says: const void *offset; /* offsets into bitmap data, uint16_t if bits_size < 0xFFDB else uint32_t*/ However convbdf was unconditionally using 'unsigned short' without checking bits_size. This generated a bogus table if used with an uncapped SYSFONT due to offeset overflows. And a pile of complier warnings. That said, we're still capping SYSFONT at 255 chars due to space constraints -- 14-Rockbox-mix jumps from 2.6K to 1022K if left uncapped. Yowza. Change-Id: I4577da08ab1633ab7abbc167523196f38c8a348a
-rw-r--r--tools/convbdf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/convbdf.c b/tools/convbdf.c
index 58ab2645b4..4602b9e633 100644
--- a/tools/convbdf.c
+++ b/tools/convbdf.c
@@ -1347,7 +1347,7 @@ int gen_c_source(struct font* pf, char *path)
if (pf->offset) {
/* output offset table */
fprintf(ofp, "/* Character->glyph mapping. */\n"
- "static const unsigned short _sysfont_offset[] = {\n");
+ "static const unsigned %s _sysfont_offset[] = {\n", pf->bits_size > 0xffdb ? "long" : "short");
for (i=0; i<pf->size; ++i) {
int offset = pf->offset[i];