Sat, 23 Mar 2019 10:04:18 +0100
adds blocksize also to the sync db
dav/db.c | file | annotate | diff | comparison | revisions | |
dav/db.h | file | annotate | diff | comparison | revisions | |
libidav/utils.c | file | annotate | diff | comparison | revisions | |
libidav/utils.h | file | annotate | diff | comparison | revisions |
--- a/dav/db.c Fri Mar 22 13:07:31 2019 +0100 +++ b/dav/db.c Sat Mar 23 10:04:18 2019 +0100 @@ -135,6 +135,8 @@ field = 8; } else if(xstreq(name, "remote-tags-hash")) { field = 9; + } else if(xstreq(name, "blocksize")) { + field = 10; } else if(xstreq(name, "skipped")) { res->skipped = TRUE; } else if(xstreq(name, "tags-updated")) { @@ -211,6 +213,18 @@ res->remote_tags_hash = strdup((char*)value); break; } + case 10: { + int64_t blsz = 0; + if(util_strtoint((char*)value, &blsz)) { + if(blsz < -1) { + blsz = -1; + } + if(blsz > 0 && blsz < 16) { + blsz = 0; + } + res->blocksize = blsz; + } + } } } else if(XML_READER_TYPE_END_ELEMENT) { if(xstreq(name, "resource")) { @@ -323,6 +337,19 @@ return -1; } + if(res->blocksize != 0) { + r = xmlTextWriterWriteFormatElement( + writer, + BAD_CAST "mode", + "%" PRId64, + res->blocksize); + if(r < 0) { + fprintf(stderr, "Cannot write blocksize\n"); + xmlFreeTextWriter(writer); + return -1; + } + } + if(settings & DB_STORE_MODE == DB_STORE_MODE) { r = xmlTextWriterWriteFormatElement( writer,
--- a/dav/db.h Fri Mar 22 13:07:31 2019 +0100 +++ b/dav/db.h Sat Mar 23 10:04:18 2019 +0100 @@ -66,6 +66,8 @@ char *xattr_hash; char *remote_tags_hash; + int64_t blocksize; + DavBool tags_updated; DavBool finfo_updated; DavBool xattr_updated;
--- a/libidav/utils.c Fri Mar 22 13:07:31 2019 +0100 +++ b/libidav/utils.c Sat Mar 23 10:04:18 2019 +0100 @@ -193,14 +193,14 @@ } } -int util_getboolean(char *v) { +int util_getboolean(const char *v) { if(v[0] == 'T' || v[0] == 't') { return 1; } return 0; } -int util_strtouint(char *str, uint64_t *value) { +int util_strtouint(const char *str, uint64_t *value) { char *end; errno = 0; uint64_t val = strtoull(str, &end, 0); @@ -212,7 +212,7 @@ } } -int util_strtoint(char *str, int64_t *value) { +int util_strtoint(const char *str, int64_t *value) { char *end; errno = 0; int64_t val = strtoll(str, &end, 0);
--- a/libidav/utils.h Fri Mar 22 13:07:31 2019 +0100 +++ b/libidav/utils.h Sat Mar 23 10:04:18 2019 +0100 @@ -77,9 +77,9 @@ char* util_path_to_url(DavSession *sn, char *path); char* util_parent_path(char *path); -int util_getboolean(char *v); -int util_strtouint(char *str, uint64_t *value); -int util_strtoint(char *str, int64_t *value); +int util_getboolean(const char *v); +int util_strtouint(const char *str, uint64_t *value); +int util_strtoint(const char *str, int64_t *value); int util_szstrtouint(const char *str, uint64_t *value); int util_uint_mul(uint64_t a, uint64_t b, uint64_t *result);