libidav/resource.c

branch
dav-2
changeset 891
4d58cbcc9efa
parent 889
42cdbf9bbd49
--- a/libidav/resource.c	Sun Dec 07 20:16:59 2025 +0100
+++ b/libidav/resource.c	Fri Dec 19 17:53:18 2025 +0100
@@ -360,7 +360,7 @@
     cxstring ns_str = cx_str(ns);
     cxstring name_str = cx_str(name);
     
-    return cx_strcat_a(a, 4, ns_str, CX_STR("\0"), name_str, CX_STR("\0"));
+    return cx_strcat_a(a, 4, ns_str, cx_str("\0"), name_str, cx_str("\0"));
 }
 
 
@@ -619,7 +619,7 @@
 
 static int add2propertylist(const CxAllocator *a, CxList **list, DavProperty *property) {
     if(!*list) {
-        CxList *newlist = cxLinkedListCreate(a, NULL, CX_STORE_POINTERS);
+        CxList *newlist = cxLinkedListCreate(a, CX_STORE_POINTERS);
         if(!newlist) {
             return 1;
         }
@@ -788,7 +788,7 @@
     CxMempool *mp = cxMempoolCreateSimple(64);
     const CxAllocator *a = mp->allocator;
     
-    CxList *proplist = cxArrayListCreate(a, NULL, sizeof(DavProperty), numprop);
+    CxList *proplist = cxArrayListCreate(a, sizeof(DavProperty), numprop);
     for(size_t i=0;i<numprop;i++) {
         DavProperty p;
         p.name = properties[i].name;
@@ -870,7 +870,7 @@
                         data->read,
                         data->seek);
             } else {
-                buf = cxBufferCreate(data->content, data->length, cxDefaultAllocator, 0);
+                buf = cxBufferCreate(cxDefaultAllocator, data->content, data->length, 0);
                 buf->size = data->length;
                 enc = aes_encrypter_new(
                         sn->key,
@@ -912,7 +912,7 @@
             HashStream hstr;
             CxBuffer *iobuf = NULL;
             if(!data->read) {
-                iobuf = cxBufferCreate(data->content, data->length, cxDefaultAllocator, 0);
+                iobuf = cxBufferCreate(cxDefaultAllocator, data->content, data->length, 0);
                 iobuf->size = data->length;
                 init_hash_stream(
                         &hstr,
@@ -1045,7 +1045,7 @@
     sn->error = DAV_OK;
     if(data->set || data->remove > 0) {
         CxBuffer *request = create_proppatch_request(data);
-        CxBuffer *response = cxBufferCreate(NULL, 1024, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
+        CxBuffer *response = cxBufferCreate(cxDefaultAllocator, NULL, 1024, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
         //printf("request:\n%.*s\n\n", request->pos, request->space);
 
         CURLcode ret = do_proppatch_request(sn, locktoken, request, response);
@@ -1196,7 +1196,7 @@
     DavLock *lock = dav_get_lock(res->session, res->path);
     char *locktoken = lock ? lock->token : NULL;
     
-    CxBuffer *response = cxBufferCreate(NULL, 4096, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
+    CxBuffer *response = cxBufferCreate(cxDefaultAllocator, NULL, 4096, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
     CURLcode ret = do_delete_request(res->session, locktoken, response);
     long status = 0;
     curl_easy_getinfo (handle, CURLINFO_RESPONSE_CODE, &status);
@@ -1399,7 +1399,7 @@
     util_set_url(sn, dav_resource_get_href(res));
     
     CxBuffer *request = create_lock_request();
-    CxBuffer *response = cxBufferCreate(NULL, 512, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
+    CxBuffer *response = cxBufferCreate(cxDefaultAllocator, NULL, 512, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
     CURLcode ret = do_lock_request(sn, request, response, timeout);
     
     //printf("\nlock\n");
@@ -1476,7 +1476,7 @@
     }
     
     CxBuffer *request = create_crypto_proppatch_request(sn, sn->key, name, hash);
-    CxBuffer *response = cxBufferCreate(NULL, 1024, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
+    CxBuffer *response = cxBufferCreate(cxDefaultAllocator, NULL, 1024, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
     
     util_set_url(sn, href);
     // TODO: lock
@@ -1503,11 +1503,11 @@
         return NULL;
     }
     
-    CxBuffer *content = cxBufferCreate(NULL, 2048, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
+    CxBuffer *content = cxBufferCreate(cxDefaultAllocator, NULL, 2048, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
     
     // create an xml document containing all properties
     CxMap *nsmap = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 8);
-    cxDefineDestructor(nsmap, free);
+    cxSetDestructor(nsmap, free);
     cxMapPut(nsmap, cx_hash_key_str("DAV:"), strdup("D"));
     
     cxBufferPutString(content, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");

mercurial