commit 3f327b1
V. Luna
·
2026-10-07 23:45:42 +0000 UTC
parent 6fc1a9c
W fix
3 files changed,
+8,
-7
M
Makefile
+2,
-2
1@@ -11,10 +11,10 @@ snac: snac.o main.o sandbox.o data.o http.o httpd.o webfinger.o \
2 test: tests/b64_vectors
3
4 tests/b64_vectors: tests/b64_vectors.o
5- $(CC) $(CFLAGS) -L$(PREFIX)/lib $< $(LDFLAGS) -o $@
6+ $(CC) $(CFLAGS) -L$(PREFIX)/lib tests/b64_vectors.o $(LDFLAGS) -o $@
7
8 .c.o:
9- $(CC) $(CFLAGS) $(CPPFLAGS) -I$(PREFIX)/include -c $< -o $@
10+ $(CC) $(CFLAGS) $(CPPFLAGS) -I$(PREFIX)/include -I/home/v/opt/bearssl/include -c $< -o $@
11
12 clean:
13 rm -rf *.o tests/*.o tests/b64_vectors *.core snac makefile.depend
+0,
-0
+6,
-5
1@@ -53,6 +53,7 @@ xs_str* xs_base64_enc(const xs_val* data, int size) { // NOLINT
2 s[j++] = b64_tab[(v >> 18) & 0x3f];
3 s[j++] = b64_tab[(v >> 12) & 0x3f];
4 s[j++] = b64_tab[(v >> 6) & 0x3f];
5+ s[j++] = b64_tab[v & 0x3f];
6 i += b64_bytes;
7 }
8
9@@ -97,13 +98,13 @@ xs_val* xs_base64_dec(const xs_str* data, int* size) {
10 bits -= 8;
11 out[o++] = (acc >> bits) & 0xff;
12 }
13+ }
14
15- out = xs_realloc(out, _xs_blk_size(o + 1));
16- out[o] = '\0';
17- *size = 0;
18+ out = xs_realloc(out, _xs_blk_size(o + 1));
19+ out[o] = '\0';
20+ *size = o;
21
22- return (xs_val*)out;
23- }
24+ return (xs_val*)out;
25 }
26 #endif // _XS_BASE64_H
27