1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2024-11-05 02:29:03 -08:00

pad compressed files to multiple of 16 bytes

This commit is contained in:
Connor Olding 2018-03-21 08:30:17 +01:00
parent 5c42efeae8
commit 6f98d2f214

View file

@ -260,7 +260,13 @@ int main(int argc, char *argv[])
long csize = encodeYaz0(bufi, bufo + 16, size) + 16;
fwrite(bufo, csize, 1, stdout);
// pad compressed file to be a multiple of 16 bytes.
long ceilsize = (csize + 15) & ~0xF;
for (long i = csize; i < ceilsize; i++) {
bufo[i] = 0;
}
fwrite(bufo, ceilsize, 1, stdout);
free(bufo);
}
free(bufi);