X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=daemon%2Fclient.c;h=814ee0ff79d48bc17d80ff4fc9b188e064db2c14;hb=0d8c93cb58054c3998b023e9e5ab53f15f9cb2fc;hp=1bf24206684a6d12245ffc0bfaf532c46de016fd;hpb=a55f78c6558bbeb45d1048eafefa0d88cbb21adb;p=doldaconnect.git diff --git a/daemon/client.c b/daemon/client.c index 1bf2420..814ee0f 100644 --- a/daemon/client.c +++ b/daemon/client.c @@ -178,10 +178,13 @@ struct hash *parsehash(wchar_t *text) wchar_t *unparsehash(struct hash *hash) { - wchar_t *buf, *whbuf; + static wchar_t *buf = NULL; + wchar_t *whbuf; char *hbuf; size_t bufsize, bufdata; + if(buf != NULL) + free(buf); buf = NULL; bufsize = bufdata = 0; hbuf = base64encode(hash->buf, hash->len); @@ -195,9 +198,21 @@ wchar_t *unparsehash(struct hash *hash) addtobuf(buf, ':'); bufcat(buf, whbuf, wcslen(whbuf)); free(whbuf); + addtobuf(buf, 0); return(buf); } +int hashcmp(struct hash *h1, struct hash *h2) +{ + if(wcscmp(h1->algo, h2->algo)) + return(0); + if(h1->len != h2->len) + return(0); + if(memcmp(h1->buf, h2->buf, h1->len)) + return(0); + return(1); +} + static struct hashcache *newhashcache(void) { struct hashcache *new;