aboutsummaryrefslogtreecommitdiff
path: root/clectio.c
diff options
context:
space:
mode:
Diffstat (limited to 'clectio.c')
-rw-r--r--clectio.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/clectio.c b/clectio.c
index 24cb4b6..4d464f3 100644
--- a/clectio.c
+++ b/clectio.c
@@ -12,8 +12,8 @@
#include "config.h"
#include LITURGY /* gen/liturgy_<form>.h: names,parts,cites_*,vpool,readings,rpool,days,cal,EPOCH,NDAYS */
-#include "text.lz.h" /* embedded LZSS text blob: text_lz[], text_lz_len */
-#include "lz.h"
+#include "text.lz.h" /* embedded DEFLATE text blob: text_lz[], text_lz_len */
+#include "puff.h"
#include <stdio.h>
#include <stdlib.h>
@@ -39,12 +39,13 @@ 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;
+ unsigned long rawlen = text_lz[0] | text_lz[1] << 8 | text_lz[2] << 16 | (unsigned long)text_lz[3] << 24;
+ unsigned long dstlen = rawlen, srclen = text_lz_len - 4;
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);
- textbuf[raw] = 0;
+ textbuf = malloc(rawlen + 1);
+ puff((unsigned char *)textbuf, &dstlen, text_lz + 4, &srclen);
+ textbuf[dstlen] = 0;
verse = malloc(cap * sizeof(*verse));
verse[n++] = textbuf;
for (p = textbuf; *p; p++)