size_t outsize;
void *outbuf;
size_t outlen = 0;
+ int err = LZMA_OK;
outsize = lzma_stream_buffer_bound(bufsize);
outbuf = malloc(outsize);
if (!outbuf) {
*len = 0;
+ fprintf(stderr, "failed to malloc compression buffer\n");
return NULL;
}
/* TODO adjust encoding level for size */
- lzma_easy_buffer_encode(6, LZMA_CHECK_CRC64, NULL,
+ switch (err = lzma_easy_buffer_encode(6, LZMA_CHECK_CRC64, NULL,
buf, bufsize,
outbuf, &outlen, outsize
- );
+ )) {
+ case LZMA_OK: break;
+ case LZMA_OPTIONS_ERROR: fprintf(stderr, "lzma options error\n");
+ default: fprintf(stderr, "lzma error %d\n", err);
+ return NULL;
+ break;
+ }
*len = outlen;
return outbuf;
}
+#if 0
static int callback(void *NotUsed, int argc, char **argv, char **azColName){
int i;
for(i=0; i<argc; i++){
}
static char *create_table = "create table if not exists files (hash text primary key, size integer, compression text, content blob)";
+#endif
struct dbh {
sqlite3 *db;
return 0;
}
+#if 0
static char *create_table = "create table if not exists files (hash text primary key, size integer, compression text, content blob)";
+#endif
struct dbh {
sqlite3 *db;