# HG changeset patch # User Olaf Wintermann # Date 1562943548 -7200 # Node ID 3e4c0285a8688dc77d526c2a820a760bb58681df # Parent 5dc7fe41e8f85ad63afbc358f7453485a832b61b fix build on windows diff -r 5dc7fe41e8f8 -r 3e4c0285a868 dav/finfo.h --- a/dav/finfo.h Sat Jun 22 16:36:52 2019 +0200 +++ b/dav/finfo.h Fri Jul 12 16:59:08 2019 +0200 @@ -33,6 +33,8 @@ #include #include +#include "system.h" + #ifdef __cplusplus extern "C" { #endif diff -r 5dc7fe41e8f8 -r 3e4c0285a868 dav/pwd.c --- a/dav/pwd.c Sat Jun 22 16:36:52 2019 +0200 +++ b/dav/pwd.c Fri Jul 12 16:59:08 2019 +0200 @@ -29,14 +29,16 @@ #include #include -#include - #include "pwd.h" #include #include - +#ifdef _WIN32 +#include +#else +#include +#endif PwdStore* pwdstore_open(const char *file) { FILE *in = fopen(file, "r"); diff -r 5dc7fe41e8f8 -r 3e4c0285a868 dav/sync.c --- a/dav/sync.c Sat Jun 22 16:36:52 2019 +0200 +++ b/dav/sync.c Fri Jul 12 16:59:08 2019 +0200 @@ -737,7 +737,7 @@ UcxList *elm = res_new; UcxList *prev = NULL; UcxList *next = NULL; - struct stat s; + SYS_STAT s; for(;elm;elm=next) { DavResource *res = elm->data; prev = elm->prev; @@ -758,7 +758,7 @@ } char *local_path = util_concat_path(dir->path, local->path); - int staterr = stat(local_path, &s); + int staterr = sys_stat(local_path, &s); free(local_path); if(staterr) { // origin doesn't exist or is inaccessible @@ -845,8 +845,8 @@ fprintf(stderr, "Metadata update failed: %s\n", res->path); sync_error++; } else { - struct stat s; - if(stat(local_path, &s)) { + SYS_STAT s; + if(sys_stat(local_path, &s)) { fprintf(stderr, "Cannot stat file after update: %s\n", strerror(errno)); } sync_set_metadata_from_stat(local, &s); @@ -1066,7 +1066,7 @@ return ret; } -void sync_set_metadata_from_stat(LocalResource *local, struct stat *s) { +void sync_set_metadata_from_stat(LocalResource *local, SYS_STAT *s) { local->last_modified = s->st_mtime; local->mode = s->st_mode & 07777; local->uid = s->st_uid; diff -r 5dc7fe41e8f8 -r 3e4c0285a868 dav/sync.h --- a/dav/sync.h Sat Jun 22 16:36:52 2019 +0200 +++ b/dav/sync.h Fri Jul 12 16:59:08 2019 +0200 @@ -38,6 +38,7 @@ #include "scfg.h" #include "config.h" #include "sopt.h" +#include "system.h" #include "version.h" @@ -106,7 +107,7 @@ SyncDirectory *dir, SyncDatabase *db); -void sync_set_metadata_from_stat(LocalResource *local, struct stat *s); +void sync_set_metadata_from_stat(LocalResource *local, SYS_STAT *s); int sync_move_resource( CmdArgs *a, SyncDirectory *dir, diff -r 5dc7fe41e8f8 -r 3e4c0285a868 dav/system.c --- a/dav/system.c Sat Jun 22 16:36:52 2019 +0200 +++ b/dav/system.c Fri Jul 12 16:59:08 2019 +0200 @@ -247,15 +247,7 @@ } int sys_lstat(const char *path, SYS_STAT *s) { - // TODO: fix - wchar_t *fpath = path2winpath(path, FALSE, NULL); - if(!fpath) { - fprintf(stderr, "Cannot convert path \"%s\" to UTF16\n", path); - return -1; - } - int ret = _wstat64(fpath, s); - free(fpath); - return ret; + return sys_stat(path, s); // unsupported on windows } int sys_rename(const char *oldpath, const char *newpath) { diff -r 5dc7fe41e8f8 -r 3e4c0285a868 dav/system.h --- a/dav/system.h Sat Jun 22 16:36:52 2019 +0200 +++ b/dav/system.h Fri Jul 12 16:59:08 2019 +0200 @@ -57,6 +57,11 @@ #define SYS_DIR struct WinDir* #define SYS_STAT struct __stat64 +#define S_ISLNK(s) 0 + +typedef int uid_t; +typedef int gid_t; + #else typedef struct SysDir { diff -r 5dc7fe41e8f8 -r 3e4c0285a868 mingw.mk --- a/mingw.mk Sat Jun 22 16:36:52 2019 +0200 +++ b/mingw.mk Fri Jul 12 16:59:08 2019 +0200 @@ -42,6 +42,6 @@ LIB_EXT = .a APP_EXT = .exe -DAV_CFLAGS = `xml2-config --cflags` -DAV_LDFLAGS = `xml2-config --libs` -lcurl -lssl -lcrypto -lws2_32 -lgdi32 -lregex +DAV_CFLAGS = `xml2-config --cflags` -I/mingw/include +DAV_LDFLAGS = `xml2-config --libs` -L/mingw/lib -lcurl -lssl -lcrypto -lws2_32 -lgdi32 -lgnurx