minor fixes in snprintf and build system

Mon, 14 Oct 2013 13:36:28 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 14 Oct 2013 13:36:28 +0200
changeset 94
6b15a094d996
parent 93
95b77e842db3
child 95
74a81d9e19d0

minor fixes in snprintf and build system

.hgignore file | annotate | diff | comparison | revisions
config.mk file | annotate | diff | comparison | revisions
configure file | annotate | diff | comparison | revisions
make/clang.mk file | annotate | diff | comparison | revisions
src/server/safs/service.c file | annotate | diff | comparison | revisions
src/server/util/Makefile file | annotate | diff | comparison | revisions
src/server/webdav/webdav.c file | annotate | diff | comparison | revisions
--- a/.hgignore	Mon Sep 09 12:15:54 2013 +0200
+++ b/.hgignore	Mon Oct 14 13:36:28 2013 +0200
@@ -2,3 +2,9 @@
 relre:^build/.*$
 relre:^config.mk$
 relre:DS_Store
+\.orig\..*$
+\.orig$
+\.chg\..*$
+\.rej$
+\.conflict\~$
+^nbproject/.*$
--- a/config.mk	Mon Sep 09 12:15:54 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-#
-# config.mk generated by configure
-#
-
-INSTALL_DIR = /export/home/olaf/Projekte/webserver/work
-HOST = sunfire
-
-
-include $(BUILD_ROOT)/make/suncc.mk
-include $(BUILD_ROOT)/make/solaris.mk
-
-CFLAGS += -I/usr/include/libxml2 -I/usr/sfw/include  
-LDFLAGS += -R/usr/sfw/lib -L/usr/sfw/lib -lxml2 -lpthread -lz -lm -lssl -lcrypto -lsocket -lnsl -ldl  
-
-
--- a/configure	Mon Sep 09 12:15:54 2013 +0200
+++ b/configure	Mon Oct 14 13:36:28 2013 +0200
@@ -54,18 +54,22 @@
 # platform
 
 if [ $OS = SunOS ]; then
-CCONF=suncc.mk
-PLATFORM=solaris.mk
+   CCONF=suncc.mk
+   PLATFORM=solaris.mk
 fi
 
 if [ $OS = Linux ]; then
-CCONF=gcc.mk
-PLATFORM=linux.mk
+    if `type clang > /dev/null`; then
+        CCONF=clang.mk
+    else
+        CCONF=gcc.mk
+    fi
+    PLATFORM=linux.mk
 fi
 
 if [ $OS = Darwin ]; then
-CCONF=clang.mk
-PLATFORM=osx.mk
+    CCONF=clang.mk
+    PLATFORM=osx.mk
 fi
 
 echo "
--- a/make/clang.mk	Mon Sep 09 12:15:54 2013 +0200
+++ b/make/clang.mk	Mon Oct 14 13:36:28 2013 +0200
@@ -27,9 +27,11 @@
 #
 
 CFLAGS = -g
+LDFLAGS = -Wl,-R,'$$ORIGIN/../lib'
 
-CC  = cc
-CXX = c++
-LD = cc
+CC  = clang
+CXX = clang
+LD = clang
 
-SHLIB_FLAGS = -shared
+SHLIB_CFLAGS = -fPIC
+SHLIB_LDFLAGS = -shared
--- a/src/server/safs/service.c	Mon Sep 09 12:15:54 2013 +0200
+++ b/src/server/safs/service.c	Mon Oct 14 13:36:28 2013 +0200
@@ -86,7 +86,7 @@
 
     // add content-length header
     char contentLength[32];
-    int len = snprintf(contentLength, 32, "%lld", s->st_size);
+    int len = snprintf(contentLength, 32, "%jd", s->st_size);
 
     pblock_kvinsert(pb_key_content_length, contentLength, len, rq->srvhdrs);
 
--- a/src/server/util/Makefile	Mon Sep 09 12:15:54 2013 +0200
+++ b/src/server/util/Makefile	Mon Oct 14 13:36:28 2013 +0200
@@ -27,6 +27,7 @@
 #
 
 UTIL_CFLAGS = 
+
 $(UTIL_OBJPRE)%.o: util/%.c
 	$(CC) -o $@ -c $(UTIL_CFLAGS) $(CFLAGS) $<
 
--- a/src/server/webdav/webdav.c	Mon Sep 09 12:15:54 2013 +0200
+++ b/src/server/webdav/webdav.c	Mon Oct 14 13:36:28 2013 +0200
@@ -590,7 +590,7 @@
         if(!S_ISDIR(st.st_mode)) {
             prop.name = "getcontentlength";
             char buf[32];
-            size_t n = snprintf(buf, 32, "%lld", st.st_size);
+            size_t n = snprintf(buf, 32, "%jd", st.st_size);
             dav_propfind_add_str_prop(rq, &prop, buf, n);
         }
         
@@ -618,7 +618,7 @@
             }
         } else if(!strcmp(s, "getcontentlength") && !S_ISDIR(st.st_mode)) {
             char buf[32];
-            size_t n = snprintf(buf, 32, "%lld", st.st_size);
+            size_t n = snprintf(buf, 32, "%jd", st.st_size);
             dav_propfind_add_str_prop(rq, prop, buf, n);
         } else if(!strcmp(s, "getlastmodified")) {
             sstr_t s = date_format_http(st.st_mtime, rq->sn->pool);

mercurial