aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clectio.c2
-rw-r--r--lz.h9
2 files changed, 6 insertions, 5 deletions
diff --git a/clectio.c b/clectio.c
index 7a660cb..6461e51 100644
--- a/clectio.c
+++ b/clectio.c
@@ -40,7 +40,7 @@ static long days_from_civil(long y, unsigned m, unsigned d) {
static void load_text(void) {
unsigned raw = text_lz[0] | text_lz[1] << 8 | text_lz[2] << 16 | (unsigned)text_lz[3] << 24;
- int cap = 8192, n = 0;
+ size_t cap = 8192, n = 0;
char *p;
textbuf = malloc(raw + 1);
lz_unpack(text_lz + 4, text_lz_len - 4, (unsigned char *)textbuf, raw);
diff --git a/lz.h b/lz.h
index d6b4a78..697426d 100644
--- a/lz.h
+++ b/lz.h
@@ -15,9 +15,10 @@
#define LZ_MINM 3
#define LZ_MAXM 258 /* 255 + LZ_MINM */
-/* Decompress `in` (inlen bytes) into `out`, stopping once rawlen bytes emitted. */
-static void lz_unpack(const unsigned char *in, size_t inlen,
- unsigned char *out, size_t rawlen) {
+/* Decompress `in` (inlen bytes) into `out`, stopping once rawlen bytes emitted.
+ * inline so the packer-only build (mktext) does not warn it unused. */
+static inline void lz_unpack(const unsigned char *in, size_t inlen,
+ unsigned char *out, size_t rawlen) {
size_t p = 0, o = 0;
while (o < rawlen && p < inlen) {
unsigned char ctrl = in[p++];
@@ -66,7 +67,7 @@ static unsigned char *lz_pack(const unsigned char *src, size_t srclen, size_t *o
size_t l = 0, maxl = srclen - i;
if (maxl > LZ_MAXM)
maxl = LZ_MAXM;
- while (l < maxl && src[j + l] == src[i + l])
+ while (l < maxl && src[(size_t)j + l] == src[i + l])
l++;
if ((int)l > bestlen) {
bestlen = (int)l;