13 /* TODO pass in the outbuf ? */
14 /* or wrap lzma_stream_buffer_bound */
15 void *compresslzma(void *buf, size_t bufsize, size_t *len) {
22 outsize = lzma_stream_buffer_bound(bufsize);
23 outbuf = malloc(outsize);
26 fprintf(stderr, "failed to malloc compression buffer\n");
29 /* TODO adjust encoding level for size */
30 switch (err = lzma_easy_buffer_encode(6, LZMA_CHECK_CRC64, NULL,
32 outbuf, &outlen, outsize
35 case LZMA_OPTIONS_ERROR: fprintf(stderr, "lzma options error\n");
36 default: fprintf(stderr, "lzma error %d\n", err);
45 static int callback(void *NotUsed, int argc, char **argv, char **azColName){
47 for(i=0; i<argc; i++){
48 printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
54 static char *create_table = "create table if not exists files (hash text primary key, size integer, compression text, content blob)";