application/davcontroller.c

changeset 117
b174e721663e
parent 115
e57ca2747782
--- a/application/davcontroller.c	Wed Dec 17 22:36:41 2025 +0100
+++ b/application/davcontroller.c	Sat Dec 27 22:47:56 2025 +0100
@@ -48,7 +48,7 @@
     doc->window = toplevel;
     doc->ctx = ctx;
 
-    doc->navigation_stack = cxLinkedListCreateSimple(CX_STORE_POINTERS);
+    doc->navigation_stack = cxLinkedListCreate(NULL, CX_STORE_POINTERS);
     doc->navstack_enabled = true;
     doc->navstack_pos = 0;
 
@@ -361,44 +361,44 @@
         // default type
     } else if(contenttype) {
         cxstring ctype = cx_str(contenttype);
-        if(cx_strprefix(ctype, CX_STR("text/"))) {
+        if(cx_strprefix(ctype, "text/")) {
             type = DAV_RESOURCE_VIEW_TEXT;
-        } else if(cx_strprefix(ctype, CX_STR("image/"))) {
+        } else if(cx_strprefix(ctype, "image/")) {
             type = DAV_RESOURCE_VIEW_IMAGE;
-        } else if(cx_strprefix(ctype, CX_STR("application/"))) {
-            if(cx_strsuffix(ctype, CX_STR("json"))) {
+        } else if(cx_strprefix(ctype, "application/")) {
+            if(cx_strsuffix(ctype, "json")) {
                 type = DAV_RESOURCE_VIEW_TEXT;
-            } else if(cx_strsuffix(ctype, CX_STR("/xml"))) {
+            } else if(cx_strsuffix(ctype, "/xml")) {
                 type = DAV_RESOURCE_VIEW_TEXT;
-            } else if(cx_strsuffix(ctype, CX_STR("+xml"))) {
+            } else if(cx_strsuffix(ctype, "+xml")) {
                 type = DAV_RESOURCE_VIEW_TEXT;
-            } else if(cx_strsuffix(ctype, CX_STR("/xml"))) {
+            } else if(cx_strsuffix(ctype, "/xml")) {
                 type = DAV_RESOURCE_VIEW_TEXT;
             }
         }
     } else {
         cxstring path = cx_str(res->path);
-        if(cx_strsuffix(path, CX_STR(".png"))) {
+        if(cx_strsuffix(path, ".png")) {
             type = DAV_RESOURCE_VIEW_IMAGE;
-        } else if(cx_strsuffix(path, CX_STR(".jpg"))) {
+        } else if(cx_strsuffix(path, ".jpg")) {
             type = DAV_RESOURCE_VIEW_IMAGE;
-        } else if(cx_strsuffix(path, CX_STR(".jpeg"))) {
+        } else if(cx_strsuffix(path, ".jpeg")) {
             type = DAV_RESOURCE_VIEW_IMAGE;
-        } else if(cx_strsuffix(path, CX_STR(".tif"))) {
+        } else if(cx_strsuffix(path, ".tif")) {
             type = DAV_RESOURCE_VIEW_IMAGE;
-        } else if(cx_strsuffix(path, CX_STR(".tiff"))) {
+        } else if(cx_strsuffix(path, ".tiff")) {
             type = DAV_RESOURCE_VIEW_IMAGE;
-        } else if(cx_strsuffix(path, CX_STR(".webp"))) {
+        } else if(cx_strsuffix(path, ".webp")) {
             type = DAV_RESOURCE_VIEW_IMAGE;
-        } else if(cx_strsuffix(path, CX_STR(".bmp"))) {
+        } else if(cx_strsuffix(path, ".bmp")) {
             type = DAV_RESOURCE_VIEW_IMAGE;
-        } else if(cx_strsuffix(path, CX_STR(".gif"))) {
+        } else if(cx_strsuffix(path, ".gif")) {
             type = DAV_RESOURCE_VIEW_IMAGE;
-        } else if(cx_strsuffix(path, CX_STR(".txt"))) {
+        } else if(cx_strsuffix(path, ".txt")) {
             type = DAV_RESOURCE_VIEW_TEXT;
-        } else if(cx_strsuffix(path, CX_STR(".md"))) {
+        } else if(cx_strsuffix(path, ".md")) {
             type = DAV_RESOURCE_VIEW_TEXT;
-        } else if(cx_strsuffix(path, CX_STR(".xml"))) {
+        } else if(cx_strsuffix(path, ".xml")) {
             type = DAV_RESOURCE_VIEW_TEXT;
         }
     }
@@ -933,7 +933,7 @@
         
         if(res->contentlength < DAV_RESOURCEVIEWER_PREVIEW_MAX_SIZE) {
             if(doc->type == DAV_RESOURCE_VIEW_TEXT) {
-                doc->text_content = cxBufferCreate(NULL, res->contentlength, cxDefaultAllocator, CX_BUFFER_AUTO_EXTEND|CX_BUFFER_FREE_CONTENTS);
+                doc->text_content = cxBufferCreate(cxDefaultAllocator, NULL, res->contentlength, CX_BUFFER_AUTO_EXTEND|CX_BUFFER_FREE_CONTENTS);
                 int err = dav_get_content(res, doc->text_content, (dav_write_func)cxBufferWrite);
                 cxBufferPut(doc->text_content, 0);
                 if(err) {

mercurial