static int zpm_sqlite_vercmp(void *not_used, int lena, const void *a,
int lenb, const void *b) {
- /* not sure what the ints are, possibly string lengths */
+ int rv;
+ char *bufa, *bufb;
+
if (not_used != 0) fprintf(stderr, "sqlite vercmp not_used = %p\n",
not_used);
if (lena == 0 && lenb > 0) return 1;
- return zpm_vercmp(a, b);
+ if (lenb == 0 && lena > 0) return -1;
+
+ bufa = sqlite3_malloc(lena+1);
+ bufb = sqlite3_malloc(lenb+1);
+
+ strncpy(bufa, a, lena);
+ strncpy(bufb, b, lenb);
+ bufa[lena] = 0;
+ bufb[lenb] = 0;
+
+ rv = zpm_vercmp(bufa, bufb);
+ sqlite3_free(bufa);
+ sqlite3_free(bufb);
+ return rv;
}
int zpm_addvercmp(struct zpm *pkg) {