Code

use ne_get_range64 which is new in neon 0.26
[fusedav.git] / src / filecache.c
index e3f9b6b1e79a052a3be47cd24b197e862e45251b..189db27efad69a7ffe5c33847c842657192619b0 100644 (file)
@@ -22,8 +22,6 @@
 #include <config.h>
 #endif
 
-#define _XOPEN_SOURCE 500
-
 #include <errno.h>
 #include <string.h>
 #include <limits.h>
@@ -32,6 +30,8 @@
 #include <unistd.h>
 #include <assert.h>
 #include <pthread.h>
+#include <inttypes.h>
+#include <limits.h>
 
 #include <ne_props.h>
 #include <ne_uri.h>
@@ -158,7 +158,7 @@ int file_cache_close(void *f) {
 }
 
 void* file_cache_open(const char *path, int flags) {
-    struct file_info *fi;
+    struct file_info *fi = NULL;
     char tempfile[PATH_MAX];
     const char *length = NULL;
     ne_request *req = NULL;
@@ -233,7 +233,8 @@ fail:
 }
 
 static int load_up_to_unlocked(struct file_info *fi, off_t l) {
-    ne_content_range range;
+
+    ne_content_range64 range;
     ne_session *session;
 
     assert(fi);
@@ -251,12 +252,12 @@ static int load_up_to_unlocked(struct file_info *fi, off_t l) {
 
     if (lseek(fi->fd, fi->present, SEEK_SET) != fi->present)
         return -1;
-
+    
     range.start = fi->present;
     range.end = l-1;
     range.total = 0;
     
-    if (ne_get_range(session, fi->filename, &range, fi->fd) != NE_OK) {
+    if (ne_get_range64(session, fi->filename, &range, fi->fd) != NE_OK) {
         fprintf(stderr, "GET failed: %s\n", ne_get_error(session));
         errno = ENOENT;
         return -1;