libidav/resource.c

branch
dav-2
changeset 920
92fcd6a8cf9e
parent 903
457faa53fd7e
--- 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;

mercurial