merge

Sun, 16 Apr 2023 14:08:19 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 16 Apr 2023 14:08:19 +0200
changeset 745
aea83a43b09a
parent 744
f0d7178043c1 (diff)
parent 742
7e67689241fd (current diff)
child 746
a569148841ff

merge

dav/Makefile file | annotate | diff | comparison | revisions
libidav/Makefile file | annotate | diff | comparison | revisions
--- a/dav/Makefile	Sat Feb 25 11:01:46 2023 +0100
+++ b/dav/Makefile	Sun Apr 16 14:08:19 2023 +0200
@@ -26,9 +26,9 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-BUILD_ROOT = ..
-
-include ../config.mk
+CONF=gcc
+include ../$(CONF).mk
+include ../cppcheck.mk
 
 DAV_SRC  = main.c
 DAV_SRC += config.c
@@ -61,29 +61,26 @@
 SYNC_OBJ = $(SYNC_SRC:%.c=../build/tool/%$(OBJ_EXT))
 XATTR_OBJ = $(XATTR_SRC:%.c=../build/tool/%$(OBJ_EXT))
 
-DAV_BIN = ../build/bin/dav$(APP_EXT)
-DAV_SYNC_BIN = ../build/bin/dav-sync$(APP_EXT)
-XATTRTOOL_BIN = ../build/bin/xattrtool$(APP_EXT)
+
+all: ../build/dav ../build/dav-sync ../build/xattrtool
 
-all: ../build/bin/dav ../build/bin/dav-sync ../build/bin/xattrtool
-
-$(DAV_BIN): $(DAV_OBJ) ../build/libidav$(LIB_EXT)
-	$(LD) -o $(DAV_BIN) $(DAV_OBJ) \
+../build/dav: $(DAV_OBJ) ../build/libidav$(LIB_EXT)
+	$(LD) -o ../build/dav$(APP_EXT) $(DAV_OBJ) \
 		../build/libidav$(LIB_EXT) ../build/libucx$(LIB_EXT)  \
 		$(LDFLAGS) $(DAV_LDFLAGS)
 
-$(DAV_SYNC_BIN): $(SYNC_OBJ) ../build/libidav$(LIB_EXT)
-	$(LD) -o $(DAV_SYNC_BIN) $(SYNC_OBJ) \
+../build/dav-sync: $(SYNC_OBJ) ../build/libidav$(LIB_EXT)
+	$(LD) -o ../build/dav-sync$(APP_EXT) $(SYNC_OBJ) \
 		../build/libidav$(LIB_EXT) ../build/libucx$(LIB_EXT)  \
 		$(LDFLAGS) $(DAV_LDFLAGS)
 
-$(XATTRTOOL_BIN): $(XATTR_OBJ)
-	$(LD) -o $(XATTRTOOL_BIN) $(XATTR_OBJ) $(LDFLAGS)
+../build/xattrtool: $(XATTR_OBJ)
+	$(LD) -o ../build/xattrtool$(APP_EXT) $(XATTR_OBJ) $(LDFLAGS)
 
 ../build/tool/%$(OBJ_EXT): %.c 
-	$(CC) $(CFLAGS) $(DAV_CFLAGS) -I../ -I../ucx -c -o $@ $<
+	$(CC) $(CFLAGS) $(DAV_CFLAGS) -I../ -I../ucx/ -o $@ $<
 
 
 cppcheck: $(DAV_SRC) $(SYNC_SRC)
-	$(CPPCHECK) $(CPPCHECK_CONFIG) $(CPPCHECK_FLAGS) -I../ucx -I../ $+ 2>> ../$(CPPCHECK_LOG)
+	$(CPPCHECK) $(CPPCHECK_CONFIG) $(CPPCHECK_FLAGS) -I../ -I../ucx -I../ $+ 2>> ../$(CPPCHECK_LOG)
 
--- a/dav/main.c	Sat Feb 25 11:01:46 2023 +0100
+++ b/dav/main.c	Sun Apr 16 14:08:19 2023 +0200
@@ -1235,6 +1235,17 @@
         
         if(!root) {
             printf("mkcol: %s\n", file);
+            DavResource *res = dav_resource_new(sn, path);
+            res->iscollection = TRUE;
+            if(!dav_exists(res)) {
+                if(dav_create(res)) {
+                    fprintf(stderr, "Cannot create collection %s\n", path);
+                    print_resource_error(sn, res->path);
+                    dav_resource_free(res);
+                    return 1;
+                }
+            }
+            dav_resource_free(res);
         }
         
         SYS_DIR dir = sys_opendir(file);
@@ -1268,20 +1279,6 @@
             }
         }
         sys_closedir(dir);
-        
-        if(nument == 0) {
-            // create empty directory
-            DavResource *res = dav_resource_new(sn, path);
-            res->iscollection = TRUE;
-            if(!dav_exists(res)) {
-                if(dav_create(res)) {
-                    fprintf(stderr, "Cannot create collection %s\n", path);
-                    print_resource_error(sn, res->path);
-                    ret = 1;
-                }
-            }
-            dav_resource_free(res);
-        }
     } else if(S_ISREG(s.st_mode)) {
         if(printfile) {
             printf("put: %s\n", file);
--- a/libidav/Makefile	Sat Feb 25 11:01:46 2023 +0100
+++ b/libidav/Makefile	Sun Apr 16 14:08:19 2023 +0200
@@ -26,9 +26,9 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-BUILD_ROOT = ..
-
-include ../config.mk
+CONF=gcc
+include ../$(CONF).mk
+include ../cppcheck.mk
 
 # list of source files
 SRC  = webdav.c
@@ -50,7 +50,7 @@
 	$(AR) $(ARFLAGS) $(AOFLAGS)../build/libidav$(LIB_EXT) $(OBJ)
 
 ../build/libidav/%$(OBJ_EXT): %.c
-	$(CC) $(CFLAGS) $(DAV_CFLAGS) -I.. -I../ucx -c -o $@ $<
+	$(CC) -I../ucx/  $(CFLAGS) $(DAV_CFLAGS) $(COFLAGS)$@ $<
 
 cppcheck: $(SRC)
 	$(CPPCHECK) $(CPPCHECK_CONFIG) $(CPPCHECK_FLAGS) -I../ucx $+ 2>> ../$(CPPCHECK_LOG)
--- a/libidav/methods.c	Sat Feb 25 11:01:46 2023 +0100
+++ b/libidav/methods.c	Sun Apr 16 14:08:19 2023 +0200
@@ -656,7 +656,7 @@
                                 if(parse_resource_type(n)) {
                                     iscollection = TRUE;
                                 }
-                            } else if(xstreq(n->ns->href, DAV_NS)) {
+                            } else if(n->ns && xstreq(n->ns->href, DAV_NS)) {
                                 if(xstreq(n->name, "crypto-name")) {
                                     crypto_name = util_xml_get_text(n);
                                 } else if(xstreq(n->name, "crypto-key")) {
@@ -713,6 +713,9 @@
     
     UCX_FOREACH(elm, properties) {
         xmlNode *prop = elm->data;
+        if(!prop->ns) {
+            continue;
+        }
         resource_add_property(res, (char*)prop->ns->href, (char*)prop->name, prop->children);
         
         if (decrypt_props &&

mercurial