return 1;
}
+int zpm_readonly(struct zpm *z) {
+ if (z->db && sqlite3_db_readonly(z->db, "main")) {
+ return 1;
+ }
+ return 0;
+}
+
int zpm_db_set_pragma(struct zpm *db, int pragma, int value) {
int rc;
char *sql;
int fd;
void *content = 0;
struct stat sbuf;
- unsigned char tmp[32];
- struct sha256_state md;
sqlite3_stmt *ifile = 0;
int haverow = 0,havedata = 0;
- int j,rc,type;
+ int rc,type;
char hashbuf[65];
/* xz compress it */
return 0;
}
- /* get hash */
- sha256_init(&md);
- sha256_process(&md, content, sbuf.st_size);
- sha256_done(&md, tmp);
- for (j=0;j<32;j++) {
- sprintf(hash+j*2, "%02x", (unsigned)tmp[j]);
- }
+ zpm_hash_mem(content, sbuf.st_size, hash);
hash[64] = 0;
/* TODO check null */