fix property set/remove list size checks

Thu, 28 Nov 2024 17:18:43 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Thu, 28 Nov 2024 17:18:43 +0100
changeset 848
b71598a22e11
parent 847
61a3892a8dfb
child 849
c949c6ab5346

fix property set/remove list size checks

libidav/methods.c file | annotate | diff | comparison | revisions
libidav/pwdstore.h file | annotate | diff | comparison | revisions
libidav/resource.c file | annotate | diff | comparison | revisions
libidav/xml.c file | annotate | diff | comparison | revisions
--- a/libidav/methods.c	Sun Nov 17 13:11:14 2024 +0100
+++ b/libidav/methods.c	Thu Nov 28 17:18:43 2024 +0100
@@ -836,7 +836,7 @@
     {
         char prefix[8];
         int pfxnum = 0;
-        if (data->set) {
+        if (cxListSize(data->set) > 0) {
             CxIterator i = cxListIterator(data->set);
             cx_foreach(DavProperty*, p, i) {
                 if (strcmp(p->ns->name, "DAV:")) {
@@ -845,7 +845,7 @@
                 }
             }
         }
-        if (data->remove) {
+        if (cxListSize(data->remove) > 0) {
             CxIterator i = cxListIterator(data->remove);
             cx_foreach(DavProperty*, p, i) {
                 if (strcmp(p->ns->name, "DAV:")) {
--- a/libidav/pwdstore.h	Sun Nov 17 13:11:14 2024 +0100
+++ b/libidav/pwdstore.h	Thu Nov 28 17:18:43 2024 +0100
@@ -181,7 +181,6 @@
 void pwdstore_free(PwdStore* p);
 
 int pwdstore_has_id(PwdStore *s, const char *id);
-int pwdstore_has_location(PwdStore *s, const char *location);
 
 PwdEntry* pwdstore_get(PwdStore *p, const char *id);
 
--- a/libidav/resource.c	Sun Nov 17 13:11:14 2024 +0100
+++ b/libidav/resource.c	Thu Nov 28 17:18:43 2024 +0100
@@ -1043,7 +1043,7 @@
     // store properties
     int r = 0;
     sn->error = DAV_OK;
-    if(data->set || data->remove) {
+    if(cxListSize(data->set) > 0 || cxListSize(data->remove) > 0) {
         CxBuffer *request = create_proppatch_request(data);
         CxBuffer *response = cxBufferCreate(NULL, 1024, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
         //printf("request:\n%.*s\n\n", request->pos, request->space);
--- a/libidav/xml.c	Sun Nov 17 13:11:14 2024 +0100
+++ b/libidav/xml.c	Thu Nov 28 17:18:43 2024 +0100
@@ -174,8 +174,8 @@
                 prefix = cxMapGet(nsmap, cx_hash_key_str(node->namespace));
                 if(!prefix) {
                     cxmutstr newpre = cx_asprintf("x%zu", cxMapSize(nsmap)+1);
-                    // TODO: fix namespace declaration
-                    //ucx_map_cstr_put(nsmap, node->namespace, newpre.ptr);
+                    // TODO: fix
+                    //cxMapPut(nsmap, node->namespace, newpre.ptr);
                     prefix = newpre.ptr;
                     prefix_fr = prefix;
                     cx_fprintf(

mercurial