aboutsummaryrefslogtreecommitdiff
path: root/lz.h
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-28 23:01:17 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-28 23:01:17 +0200
commit8995fbbaece599f27698bdc08ab4b6fdeb685e51 (patch)
treea36b0e72425a4251ecd6bdb08775bb5f09234154 /lz.h
parent59fc2e62cbfb94e901ac24c0d85a7bec738473e0 (diff)
downloadclectio-8995fbbaece599f27698bdc08ab4b6fdeb685e51.tar.gz
clectio-8995fbbaece599f27698bdc08ab4b6fdeb685e51.zip
clean: silence strict -Wsign-conversion / -Wunused-function
Make the build clean under -Wconversion -Wsign-conversion and -Wunused-function (beyond the Makefile's -Wall -Wextra), so it compiles warning-free on stricter setups and other compilers: size_t for the verse-index counters in load_text, a cast in the LZSS matcher, and lz_unpack marked inline (it is unused in the packer-only mktext translation unit). No behaviour change; packed output is byte-identical. Claude-Session: https://claude.ai/code/session_01S1CD1u3tgSS4xNu6WHfp5a
Diffstat (limited to 'lz.h')
-rw-r--r--lz.h9
1 files changed, 5 insertions, 4 deletions
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;