make some string property function ns/name args const dav-2 tip

Wed, 01 Jul 2026 21:09:22 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Wed, 01 Jul 2026 21:09:22 +0200
branch
dav-2
changeset 920
92fcd6a8cf9e
parent 919
7f250903d903

make some string property function ns/name args const

dav/main.c file | annotate | diff | comparison | revisions
dav/sync.c file | annotate | diff | comparison | revisions
libidav/davqlexec.c file | annotate | diff | comparison | revisions
libidav/davqlexec.h file | annotate | diff | comparison | revisions
libidav/methods.c file | annotate | diff | comparison | revisions
libidav/resource.c file | annotate | diff | comparison | revisions
libidav/utils.c file | annotate | diff | comparison | revisions
libidav/utils.h file | annotate | diff | comparison | revisions
libidav/webdav.c file | annotate | diff | comparison | revisions
libidav/webdav.h file | annotate | diff | comparison | revisions
test/webdav.c file | annotate | diff | comparison | revisions
test/webdav_resource.c file | annotate | diff | comparison | revisions
--- a/dav/main.c	Sun Jun 28 20:42:43 2026 +0200
+++ b/dav/main.c	Wed Jul 01 21:09:22 2026 +0200
@@ -510,7 +510,7 @@
         flags[0] = 'd';
         type = "";
     }
-    char *keyprop = dav_get_string_property_ns(
+    const char *keyprop = dav_get_string_property_ns(
             res,
             DAV_NS,
             "crypto-key");
@@ -523,7 +523,7 @@
         if(dav_get_string_property(res, "D:lockdiscovery")) {
             flags[2] = 'l';
         }
-        char *executable = dav_get_string_property_ns(
+        const char *executable = dav_get_string_property_ns(
                 res,
                 "http://apache.org/dav/props/",
                 "executable");
@@ -1658,8 +1658,8 @@
     int ret = 0;
     DavResource *res = dav_get(sn, path, NULL);
     if(res) {
-        char *cryptoname = dav_get_string_property_ns(res, DAV_NS, "crypto-name");
-        char *cryptokey = dav_get_string_property_ns(res, DAV_NS, "crypto-key");
+        const char *cryptoname = dav_get_string_property_ns(res, DAV_NS, "crypto-name");
+        const char *cryptokey = dav_get_string_property_ns(res, DAV_NS, "crypto-key");
         if(cryptoname && cryptokey) {
             // encrypted resource with an encrypted name
             // renaming is done by simply setting the crypto-name property
@@ -1787,7 +1787,7 @@
         propname.ns = namespace;
         propname.name = property;
     } else {
-        dav_get_property_namespace_str(ctx, property, &propname.ns, &propname.name);
+        dav_get_property_namespace_str(ctx, property, (const char**)&propname.ns, (const char**)&propname.name);
         if(!propname.ns || !propname.name) {
             fprintf(stderr, "Error: unknown namespace prefix\n");
             return -1;
@@ -1924,7 +1924,7 @@
         propname.ns = namespace;
         propname.name = property;
     } else {
-        dav_get_property_namespace_str(ctx, property, &propname.ns, &propname.name);
+        dav_get_property_namespace_str(ctx, property, (const char**)&propname.ns, (const char**)&propname.name);
     }
     
     int ret = 0;
@@ -2301,7 +2301,7 @@
         DavResource *v = list;
         int addnl = 0;
         while(v) {
-            char *vname = dav_get_string_property(v, "D:version-name");
+            const char *vname = dav_get_string_property(v, "D:version-name");
             
             if(longlist) {
                 if(addnl) {
@@ -2329,7 +2329,7 @@
     while(list) {
         DavResource *next = list->next;
         if(!ret) {
-            char *vname = dav_get_string_property(list, "D:version-name");
+            const char *vname = dav_get_string_property(list, "D:version-name");
             if(vname && !strcmp(vname, version)) {
                 ret = list;
             }
--- a/dav/sync.c	Sun Jun 28 20:42:43 2026 +0200
+++ b/dav/sync.c	Wed Jul 01 21:09:22 2026 +0200
@@ -884,7 +884,7 @@
                 continue;
             }
             
-            char *status = dav_get_string_property(res, "idav:status");
+            const char *status = dav_get_string_property(res, "idav:status");
             if(status && !strcmp(status, "broken")) {
                 localres_keep(db, res->path);
                 cxListAdd(res_broken, res);
@@ -1185,7 +1185,7 @@
 {
     DavBool update_db = FALSE;
     
-    char *etag = dav_get_string_property(res, "D:getetag");
+    const char *etag = dav_get_string_property(res, "D:getetag");
     if(!etag) {
         fprintf(stderr, "Error: resource %s has no etag\n", res->path);
         return REMOTE_NO_CHANGE;
@@ -1204,7 +1204,7 @@
     LocalResource *local = cxMapGet(db->resources, resource_path_key(res));
     char *local_path = create_local_path(dir, res->path);
     
-    char *link = SYNC_SYMLINK(dir) ? 
+    const char *link = SYNC_SYMLINK(dir) ? 
             dav_get_string_property_ns(res, DAV_PROPS_NS, "link") : NULL;
     
     SYS_STAT s;
@@ -1400,7 +1400,7 @@
         } // else: hash already updated
         if(link) {
             nullfree(local->link_target);
-            local->link_target = link;
+            local->link_target = strdup(link);
         }
     }
         
@@ -1453,7 +1453,7 @@
         uint64_t partnum = 0;
         if(util_strtouint(res_name, &partnum)) {
             DavBool download_part = FALSE;
-            char *etag = dav_get_string_property_ns(part, "DAV:", "getetag");
+            const char *etag = dav_get_string_property_ns(part, "DAV:", "getetag");
             if(partnum >= local_numparts) {
                 // new part
                 download_part = TRUE;
@@ -1581,7 +1581,7 @@
     }
     (*counter)++;
     
-    char *etag = dav_get_string_property(res, "D:getetag");
+    const char *etag = dav_get_string_property(res, "D:getetag");
     char *content_hash = sync_get_content_hash(res);
     
     LocalResource *local = NULL;
@@ -1638,7 +1638,7 @@
         DavBool update_db,
         int *counter)
 { 
-    char *link = SYNC_SYMLINK(dir) ?
+    const char *link = SYNC_SYMLINK(dir) ?
             dav_get_string_property_ns(res, DAV_PROPS_NS, "link") : NULL;
     
     LocalResource *local = cxMapGet(db->resources, path);
@@ -1652,11 +1652,11 @@
         local_path = create_local_path(dir, path);
     }
     
-    char *etag = dav_get_string_property(res, "D:getetag");
+    const char *etag = dav_get_string_property(res, "D:getetag");
     SYS_STAT s;
     memset(&s, 0, sizeof(SYS_STAT));
     
-    char *blocksize_str = dav_get_string_property_ns(res, DAV_NS, "split");
+    const char *blocksize_str = dav_get_string_property_ns(res, DAV_NS, "split");
     uint64_t blocksize = 0;
     DavBool issplit = FALSE;
     if(blocksize_str && !link) {
@@ -2504,7 +2504,7 @@
                 DavBool res_conflict = FALSE;
                 int changed = remote_resource_is_changed(sn, dir, db, res, local_res, &equal);
                 if(equal) {
-                    char *etag = dav_get_string_property(res, "D:getetag");
+                    const char *etag = dav_get_string_property(res, "D:getetag");
                     if(local_res->metadata_updated) {
                         cxListInsert(ls_update, 0, local_res);
                     } else if(etag) {
@@ -2842,7 +2842,7 @@
                 log_printf("skip: %s\n", resource->path);
                 continue;
             }
-            char *status = dav_get_string_property(res, "idav:status");
+            const char *status = dav_get_string_property(res, "idav:status");
             if(status && !strcmp(status, "broken")) {
                 log_error("Resource %s broken\n", res->path);
                 continue;
@@ -3265,7 +3265,7 @@
                 return 1;
             }
             if(!res->isdirectory && restore_modified && remote) {
-                char *etag = dav_get_string_property(remote, "D:getetag");
+                const char *etag = dav_get_string_property(remote, "D:getetag");
                 if(!etag || (db_res->etag && strcmp(etag, db_res->etag))) {
                     res->restore = TRUE;
                     return 1;
@@ -3409,11 +3409,11 @@
         return 1;
     }
     
-    char *link = dav_get_string_property_ns(remote, DAV_PROPS_NS, "link");
+    const char *link = dav_get_string_property_ns(remote, DAV_PROPS_NS, "link");
     
     int ret = 0;
     if(err == 0) {
-        char *etag = dav_get_string_property(remote, "D:getetag");
+        const char *etag = dav_get_string_property(remote, "D:getetag");
         char *hash = sync_get_content_hash(remote);
         
         if(res->link_target_db || link) {
@@ -3531,7 +3531,7 @@
     }
     
     size_t svr_blocksize = 0;
-    char *svr_blocksize_str = dav_get_string_property_ns(res, DAV_NS, "split");
+    const char *svr_blocksize_str = dav_get_string_property_ns(res, DAV_NS, "split");
     if(svr_blocksize_str) {
         uint64_t i = 0;
         if(util_strtouint(svr_blocksize_str, &i)) {
@@ -3570,7 +3570,7 @@
 
 
 DavResource *versioning_simple_find(DavResource *res, const char *version) {
-    char *vcol_href = dav_get_string_property_ns(res, DAV_NS, VERSION_PATH_PROPERTY);
+    const char *vcol_href = dav_get_string_property_ns(res, DAV_NS, VERSION_PATH_PROPERTY);
     if(!vcol_href) {
         return NULL;
     }
@@ -3609,7 +3609,7 @@
     while(list) {
         DavResource *next = list->next;
         if(!ret) {
-            char *vname = dav_get_string_property(list, "D:version-name");
+            const char *vname = dav_get_string_property(list, "D:version-name");
             if(vname && !strcmp(vname, version)) {
                 ret = list;
             }
@@ -3999,7 +3999,7 @@
         // if there is no history collection for this resource, we create one
         
         char *history_href = NULL;
-        char *vcol_path = dav_get_string_property_ns(res, DAV_NS, VERSION_PATH_PROPERTY);
+        const char *vcol_path = dav_get_string_property_ns(res, DAV_NS, VERSION_PATH_PROPERTY);
         if(!vcol_path) {
             DavResource *history_res = NULL;
             
@@ -4030,7 +4030,7 @@
             
             dav_resource_free(history_res);
         } else {
-            history_href = vcol_path;
+            history_href = strdup(vcol_path);
         }
         
         // find a free url and move 'res' to this location
@@ -4314,7 +4314,7 @@
         // every part we uploaded is in the map
         // if we get parts that are not in the map, someone else uploaded it
         if(fp) {
-            char *etag = dav_get_string_property(part, "D:getetag");
+            const char *etag = dav_get_string_property(part, "D:getetag");
             if(etag) {
                 if(strlen(etag) > 2 && etag[0] == 'W' && etag[1] == '/') {
                     etag = etag + 2;
@@ -4531,7 +4531,7 @@
                 sync_set_status(res, "broken");
             } else {
                 // everything seems fine, we can update the local resource
-                char *etag = dav_get_string_property(up_res, "D:getetag");
+                const char *etag = dav_get_string_property(up_res, "D:getetag");
                 local_resource_set_etag(local, etag);
                 
                 if(!issplit && SYNC_STORE_HASH(dir)) {
@@ -4628,7 +4628,7 @@
         (*counter)++;
         
         // everything seems fine, we can update the local resource
-        char *etag = dav_get_string_property(up_res, "D:getetag");
+        const char *etag = dav_get_string_property(up_res, "D:getetag");
         local_resource_set_etag(local, etag);
         
         local->last_modified = s.st_mtime;
@@ -4668,7 +4668,7 @@
             }
         }
     } else {
-        char *etag = dav_get_string_property(res, "D:getetag");
+        const char *etag = dav_get_string_property(res, "D:getetag");
         if(etag) {
             if(strlen(etag) > 2 && etag[0] == 'W' && etag[1] == '/') {
                 etag = etag + 2;
@@ -5072,7 +5072,7 @@
     return 0;
 }
 
-void print_resource_version(DavResource *res, char *name) {
+void print_resource_version(DavResource *res, const char *name) {
     time_t now = res->lastmodified;
     struct tm *date = gmtime(&now);
     char str[32];
@@ -5140,7 +5140,7 @@
                 ret = 1;
                 break;
             }
-            char *vcol_href = dav_get_string_property_ns(res, DAV_NS, VERSION_PATH_PROPERTY); 
+            const char *vcol_href = dav_get_string_property_ns(res, DAV_NS, VERSION_PATH_PROPERTY); 
             if(!vcol_href) {
                 ret = 1;
                 break;
@@ -5186,7 +5186,7 @@
             if(!first) {
                 putchar('\n');
             }
-            char *vname = dav_get_string_property(v, "D:version-name");
+            const char *vname = dav_get_string_property(v, "D:version-name");
             print_resource_version(v, vname);
             first = 0;
             v = v->next;
@@ -5749,8 +5749,8 @@
 char* sync_get_content_hash(DavResource *res) {
     uint32_t flags = res->session->flags;
     if((flags & DAV_SESSION_ENCRYPT_CONTENT) == DAV_SESSION_ENCRYPT_CONTENT) {
-        char *enc_hash = dav_get_string_property_ns(res, DAV_NS, "crypto-hash");
-        char *keyname = dav_get_string_property_ns(res, DAV_NS, "crypto-key");
+        const char *enc_hash = dav_get_string_property_ns(res, DAV_NS, "crypto-hash");
+        const char *keyname = dav_get_string_property_ns(res, DAV_NS, "crypto-key");
         if(enc_hash && keyname) {
             DavKey *key = dav_context_get_key(res->session->context, keyname);
             if(!key) {
@@ -5768,7 +5768,7 @@
             return hex_hash;
         }
     } else {
-        char *hash = dav_get_string_property_ns(res, DAV_NS, "content-hash");
+        const char *hash = dav_get_string_property_ns(res, DAV_NS, "content-hash");
         if(hash) {
             return strdup(hash);
         }
--- a/libidav/davqlexec.c	Sun Jun 28 20:42:43 2026 +0200
+++ b/libidav/davqlexec.c	Wed Jul 01 21:09:22 2026 +0200
@@ -502,8 +502,8 @@
                         mp->allocator,
                         sizeof(DavCompiledField));
 
-                char *ns;
-                char *name;
+                const char *ns;
+                const char *name;
                 dav_get_property_namespace_str(
                     sn->context,
                     cx_strdup_a(mp->allocator, field->name).ptr,
@@ -553,8 +553,8 @@
                 davqlresprop_t resprop;
                 cxstring propertyname = cx_strchr(column->srctext, ':');
                 if(propertyname.length > 0) {
-                    char *ns;
-                    char *name;
+                    const char *ns;
+                    const char *name;
                     dav_get_property_namespace_str(
                             sn->context,
                             cx_strdup_a(mp->allocator, column->srctext).ptr,
@@ -820,16 +820,16 @@
             cmd.type = DAVQL_CMD_RES_IDENTIFIER;
             if(propertyname.length > 0) {
                 cmd.type = DAVQL_CMD_PROP_IDENTIFIER;
-                char *ns;
-                char *name;
+                const char *ns;
+                const char *name;
                 dav_get_property_namespace_str(
                         ctx,
                         cx_strdup_a(a, src).ptr,
                         &ns,
                         &name);
                 if(ns && name) {
-                    cmd.data.property.ns = ns;
-                    cmd.data.property.name = name;
+                    cmd.data.property.ns = (char*)ns;
+                    cmd.data.property.name = (char*)name;
                 } else {
                     // error
                     return -1;
--- a/libidav/davqlexec.h	Sun Jun 28 20:42:43 2026 +0200
+++ b/libidav/davqlexec.h	Wed Jul 01 21:09:22 2026 +0200
@@ -141,8 +141,8 @@
 };
 
 typedef struct DavCompiledField {
-    char *ns;
-    char *name;
+    const char *ns;
+    const char *name;
     CxBuffer *code;
 } DavCompiledField;
 
--- a/libidav/methods.c	Sun Jun 28 20:42:43 2026 +0200
+++ b/libidav/methods.c	Wed Jul 01 21:09:22 2026 +0200
@@ -717,12 +717,12 @@
 }
 
 void set_davprops(DavResource *res) {
-    char *cl = dav_get_string_property_ns(res, "DAV:", "getcontentlength");
-    char *ct = dav_get_string_property_ns(res, "DAV:", "getcontenttype");
-    char *cd = dav_get_string_property_ns(res, "DAV:", "creationdate");
-    char *lm = dav_get_string_property_ns(res, "DAV:", "getlastmodified");
+    const char *cl = dav_get_string_property_ns(res, "DAV:", "getcontentlength");
+    const char *ct = dav_get_string_property_ns(res, "DAV:", "getcontenttype");
+    const char *cd = dav_get_string_property_ns(res, "DAV:", "creationdate");
+    const char *lm = dav_get_string_property_ns(res, "DAV:", "getlastmodified");
     
-    res->contenttype = ct;
+    res->contenttype = (char*)ct;
     if(cl) {
         char *end = NULL;
         res->contentlength = strtoull(cl, &end, 0);
--- a/libidav/resource.c	Sun Jun 28 20:42:43 2026 +0200
+++ b/libidav/resource.c	Wed Jul 01 21:09:22 2026 +0200
@@ -495,9 +495,9 @@
     }
 }
 
-char* dav_get_string_property(DavResource *res, char *name) {
-    char *pns;
-    char *pname;
+const char* dav_get_string_property(DavResource *res, const char *name) {
+    const char *pns;
+    const char *pname;
     dav_get_property_namespace_str(res->session->context, name, &pns, &pname);
     if(!pns || !pname) {
         return NULL;
@@ -505,7 +505,7 @@
     return dav_get_string_property_ns(res, pns, pname);
 }
 
-char* dav_get_string_property_ns(DavResource *res, char *ns, char *name) {
+const char* dav_get_string_property_ns(DavResource *res, const char *ns, const char *name) {
     DavXmlNode *prop = dav_get_property_ns(res, ns, name);
     if(!prop) {
         return NULL;
@@ -514,8 +514,8 @@
 }
 
 DavXmlNode* dav_get_property(DavResource *res, char *name) {
-    char *pns;
-    char *pname;
+    const char *pns;
+    const char *pname;
     dav_get_property_namespace_str(res->session->context, name, &pns, &pname);
     if(!pns || !pname) {
         return NULL;
@@ -605,9 +605,9 @@
     return property;
 }
 
-int dav_set_string_property(DavResource *res, char *name, char *value) {
-    char *pns;
-    char *pname;
+int dav_set_string_property(DavResource *res, const char *name, const char *value) {
+    const char *pns;
+    const char *pname;
     dav_get_property_namespace_str(res->session->context, name, &pns, &pname);
     if(!pns) {
         res->session->errorstr = "Property namespace not found";
@@ -629,7 +629,7 @@
     return 0;
 }
 
-void dav_set_string_property_ns(DavResource *res, char *ns, char *name, char *value) {
+void dav_set_string_property_ns(DavResource *res, const char *ns, const char *name, const char *value) {
     DavSession *sn = res->session;
     const CxAllocator *a = res->session->mp->allocator;
     DavResourceData *data = res->data;
@@ -644,14 +644,14 @@
     }
 }
 
-void dav_set_property(DavResource *res, char *name, DavXmlNode *value) {
-    char *pns;
-    char *pname;
+void dav_set_property(DavResource *res, const char *name, DavXmlNode *value) {
+    const char *pns;
+    const char *pname;
     dav_get_property_namespace_str(res->session->context, name, &pns, &pname);
     dav_set_property_ns(res, pns, pname, value);
 }
 
-void dav_set_property_ns(DavResource *res, char *ns, char *name, DavXmlNode *value) {
+void dav_set_property_ns(DavResource *res, const char *ns, const char *name, DavXmlNode *value) {
     DavSession *sn = res->session;
     const CxAllocator *a = sn->mp->allocator; 
     DavResourceData *data = res->data;
@@ -668,14 +668,14 @@
     }
 }
 
-void dav_remove_property(DavResource *res, char *name) {
-    char *pns;
-    char *pname;
+void dav_remove_property(DavResource *res, const char *name) {
+    const char *pns;
+    const char *pname;
     dav_get_property_namespace_str(res->session->context, name, &pns, &pname);
     dav_remove_property_ns(res, pns, pname);
 }
 
-void dav_remove_property_ns(DavResource *res, char *ns, char *name) {
+void dav_remove_property_ns(DavResource *res, const char *ns, const char *name) {
     DavSession *sn = res->session;
     DavResourceData *data = res->data;
     const CxAllocator *a = res->session->mp->allocator;
@@ -1101,7 +1101,7 @@
     AESDecrypter *dec = NULL;
     DavKey *key = NULL;
     if(DAV_DECRYPT_CONTENT(sn)) {
-        char *keyname = dav_get_string_property_ns(res, DAV_NS, "crypto-key");
+        const char *keyname = dav_get_string_property_ns(res, DAV_NS, "crypto-key");
         if(keyname) {
             key = dav_context_get_key(sn->context, keyname);
             if(key) {
@@ -1146,7 +1146,7 @@
         int verify_failed = 0;
         if(DAV_DECRYPT_CONTENT(sn) && key) {
             // try to verify the content
-            char *res_hash = dav_get_string_property_ns(res, DAV_NS, "crypto-hash");
+            const char *res_hash = dav_get_string_property_ns(res, DAV_NS, "crypto-hash");
 
             if(res_hash) {
                 size_t len = 0;
--- a/libidav/utils.c	Sun Jun 28 20:42:43 2026 +0200
+++ b/libidav/utils.c	Wed Jul 01 21:09:22 2026 +0200
@@ -79,7 +79,7 @@
     return n;
 }
 
-static time_t parse_iso8601(char *iso8601str) {
+static time_t parse_iso8601(const char *iso8601str) {
 
     // safety
     if(!iso8601str) {
@@ -176,7 +176,7 @@
 }
 
 
-time_t util_parse_creationdate(char *str) {
+time_t util_parse_creationdate(const char *str) {
     // parse a ISO-8601 date (rfc-3339)
     // example: 2012-11-29T21:35:35Z
     if(!str) {
@@ -186,7 +186,7 @@
     return parse_iso8601(str);
 }
 
-time_t util_parse_lastmodified(char *str) {
+time_t util_parse_lastmodified(const char *str) {
     // parse a rfc-1123 date
     // example: Thu, 29 Nov 2012 21:35:35 GMT
     if(!str) {
--- a/libidav/utils.h	Sun Jun 28 20:42:43 2026 +0200
+++ b/libidav/utils.h	Wed Jul 01 21:09:22 2026 +0200
@@ -67,8 +67,8 @@
 extern "C" {
 #endif
 
-time_t util_parse_creationdate(char *str);
-time_t util_parse_lastmodified(char *str);
+time_t util_parse_creationdate(const char *str);
+time_t util_parse_lastmodified(const char *str);
 
 int util_mkdir(char *path, mode_t mode);
 
--- a/libidav/webdav.c	Sun Jun 28 20:42:43 2026 +0200
+++ b/libidav/webdav.c	Wed Jul 01 21:09:22 2026 +0200
@@ -305,13 +305,13 @@
 
 void dav_get_property_namespace_str(
         DavContext *ctx,
-        char *prefixed_name,
-        char **ns,
-        char **name)
+        const char *prefixed_name,
+        const char **ns,
+        const char **name)
 {
     // TODO: rewrite using dav_get_property_ns
     
-    char *pname = strchr(prefixed_name, ':');
+    const char *pname = strchr(prefixed_name, ':');
     char *pns = "DAV:";
     if(pname) {
         DavNamespace *davns = dav_get_namespace_s(
--- a/libidav/webdav.h	Sun Jun 28 20:42:43 2026 +0200
+++ b/libidav/webdav.h	Wed Jul 01 21:09:22 2026 +0200
@@ -329,9 +329,9 @@
 cxmutstr dav_property_key(const char *ns, const char *name);
 void dav_get_property_namespace_str(
         DavContext *ctx,
-        char *prefixed_name,
-        char **ns,
-        char **name);
+        const char *prefixed_name,
+        const char **ns,
+        const char **name);
 DavNamespace* dav_get_property_namespace(
         DavContext *ctx,
         char *prefixed_name,
@@ -367,14 +367,14 @@
 DavXmlNode* dav_get_property(DavResource *res, char *name);
 DavXmlNode* dav_get_property_ns(DavResource *res, const char *ns, const char *name);
 DavXmlNode* dav_get_encrypted_property_ns(DavResource *res, const char *ns, const char *name);
-char* dav_get_string_property(DavResource *res, char *name);
-char* dav_get_string_property_ns(DavResource *res, char *ns, char *name);
-int dav_set_string_property(DavResource *res, char *name, char *value);
-void dav_set_string_property_ns(DavResource *res, char *ns, char *name, char *value);
-void dav_set_property(DavResource *res, char *name, DavXmlNode *value);
-void dav_set_property_ns(DavResource *res, char *ns, char *name, DavXmlNode *value);
-void dav_remove_property(DavResource *res, char *name);
-void dav_remove_property_ns(DavResource *res, char *ns, char *name);
+const char* dav_get_string_property(DavResource *res, const char *name);
+const char* dav_get_string_property_ns(DavResource *res, const char *ns, const char *name);
+int dav_set_string_property(DavResource *res, const char *name, const char *value);
+void dav_set_string_property_ns(DavResource *res, const char *ns, const char *name, const char *value);
+void dav_set_property(DavResource *res, const char *name, DavXmlNode *value);
+void dav_set_property_ns(DavResource *res, const char *ns, const char *name, DavXmlNode *value);
+void dav_remove_property(DavResource *res, const char *name);
+void dav_remove_property_ns(DavResource *res, const char *ns, const char *name);
 void dav_set_encrypted_property_ns(DavResource *res, char *ns, char *name, DavXmlNode *value);
 void dav_set_encrypted_string_property_ns(DavResource *res, char *ns, char *name, char *value);
 void dav_remove_encrypted_property_ns(DavResource *res, char *ns, char *name);
--- a/test/webdav.c	Sun Jun 28 20:42:43 2026 +0200
+++ b/test/webdav.c	Wed Jul 01 21:09:22 2026 +0200
@@ -80,8 +80,8 @@
         CX_TEST_ASSERT(!ret);
         const char *name = util_resource_name(res->href);
         CX_TEST_ASSERT(strcmp(name, "hello.txt"));
-        char *crypto_name = dav_get_string_property_ns(res, DAV_NS, "crypto-name");
-        char *crypto_key = dav_get_string_property_ns(res, DAV_NS, "crypto-key");
+        const char *crypto_name = dav_get_string_property_ns(res, DAV_NS, "crypto-name");
+        const char *crypto_key = dav_get_string_property_ns(res, DAV_NS, "crypto-key");
         CX_TEST_ASSERT(crypto_name != NULL && strlen(crypto_name) > 0);
         CX_TEST_ASSERT(!cx_strcmp(crypto_key, "libidav_testkey"));
         
--- a/test/webdav_resource.c	Sun Jun 28 20:42:43 2026 +0200
+++ b/test/webdav_resource.c	Wed Jul 01 21:09:22 2026 +0200
@@ -259,8 +259,8 @@
         ret = dav_load(res2);
         CX_TEST_ASSERT(!ret);
         
-        char *strprop1 = dav_get_string_property_ns(res2, DAV_TEST_NS, name1);
-        char *strprop2 = dav_get_string_property_ns(res2, DAV_TEST_NS, name2);
+        const char *strprop1 = dav_get_string_property_ns(res2, DAV_TEST_NS, name1);
+        const char *strprop2 = dav_get_string_property_ns(res2, DAV_TEST_NS, name2);
         
         CX_TEST_ASSERT(strprop1);
         CX_TEST_ASSERT(strprop2);

mercurial