Remove zlib/

This commit is contained in:
2022-09-06 16:30:29 +10:00
parent 89e9356cd4
commit f78bcbf8f8
238 changed files with 32 additions and 79516 deletions

View File

@@ -1,3 +1,4 @@
#undef NDEBUG
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
@@ -59,6 +60,7 @@ void asserts(void) {
assert(sizeof(Group) == 24); // Group struct incorrect size
assert(sizeof((Group) { 0 }.label) == 4); // Label union in group struct incorrect size
assert(sizeof(Field) == 6); // Field struct incorrect size
assert(sizeof(uLongf) == sizeof(uint32_t)); // zlib compatability
}
void espr_walk(char *data, size_t size, struct walker_callbacks cb) {
@@ -174,11 +176,11 @@ void decompress_pre(Node n, void *decom_ptr, void **carry_out) {
// decompress directly into buffer
// first 4 bytes are the decompressed size
const size_t dc_size = *((uint32_t *)n.data);
size_t to_copy = dc_size;
size_t cur_size = n.header.record->size - sizeof(uint32_t);
const uint32_t dc_size = *((uint32_t *)n.data);
uint32_t to_copy = dc_size;
uint32_t cur_size = n.header.record->size - sizeof(uint32_t);
char *data_start = n.data + sizeof(uint32_t);
int ret = uncompress(d->buf, &to_copy, data_start, cur_size);
int ret = uncompress((Bytef *)d->buf, (uLongf *)&to_copy, (Bytef *)data_start, (uLong)cur_size);
assert(ret == Z_OK);
assert(to_copy == dc_size);
@@ -225,7 +227,7 @@ void decompress_post(Node n, void *decom_ptr, void **carry_in) {
// only need to handle group resize
if (n.type == NT_GROUP) {
Group *g = (Group *)(*carry_in);
size_t new_size = (char *)d->buf - (char *)g;
uint32_t new_size = (uint32_t)((char *)d->buf - (char *)g);
g->size = new_size;
}
}
@@ -377,7 +379,8 @@ void print_record_flags(Record *header) {
if (flag_lut) {
while (flags != 0) {
// will always be >= 0 as flags is not 0
size_t highest = 31 - __lzcnt(flags);
int highest = 31 - __lzcnt(flags);
assert(highest >= 0);
const char *const str = (*flag_lut)[highest];
if (str) {
printf(" - %s\n", str);