14 /* TODO pass in the outbuf ? */
15 /* or wrap lzma_stream_buffer_bound */
16 void *compresslzma(void *buf, size_t bufsize, size_t *len) {
23 outsize = lzma_stream_buffer_bound(bufsize);
24 outbuf = malloc(outsize);
27 fprintf(stderr, "failed to malloc compression buffer\n");
30 /* TODO adjust encoding level for size */
31 switch (err = lzma_easy_buffer_encode(6, LZMA_CHECK_CRC64, NULL,
33 outbuf, &outlen, outsize
36 case LZMA_OPTIONS_ERROR: fprintf(stderr, "lzma options error\n");
37 default: fprintf(stderr, "lzma error %d\n", err);