Fixed a bug in espr_stats where the esp_stats structure was not being properly initialised.

Also, significantly sped up the header printing functions.
This commit is contained in:
2022-09-07 20:56:43 +10:00
parent de1a27e337
commit 4d7bdcf3cc
7 changed files with 579 additions and 483 deletions

View File

@@ -28,19 +28,19 @@ int main(void) {
size_t read = fread(buffer, sizeof(char), size, fp);
assert(read == size);
size_t dc_size = espr_decompressed_size(buffer, size);
struct esp_stats stats = espr_stats(buffer, size);
char *decompressed = malloc(dc_size);
char *decompressed = malloc(stats.decompressed_size);
if (!decompressed)
return errno;
espr_decompress(buffer, size, decompressed, dc_size);
espr_print(buffer, size);
espr_decompress(buffer, size, decompressed, stats.decompressed_size);
free(buffer);
size_t formid_count = espr_formid_count(decompressed, dc_size);
printf("FormID Count: %zu\n", formid_count);
// espr_print(decompressed, stats.decompressed_size);
free(decompressed);