Merge pull request #47 from Memphiz/win32fix3
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Sun, 12 Jan 2014 23:18:59 +0000 (15:18 -0800)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Sun, 12 Jan 2014 23:18:59 +0000 (15:18 -0800)
[win32] - fixed bad number casting when using libnfs on 64bit win8 syste...

include/nfsc/libnfs.h
lib/libnfs-sync.c
lib/libnfs.c

index 81750db3ec0189ba14fd1f83f82c4f05985fa739..388ea78e6293685ebe5ad028fe063c8f55e33cc0 100644 (file)
@@ -217,8 +217,11 @@ EXTERN int nfs_stat_async(struct nfs_context *nfs, const char *path, nfs_cb cb,
  *      0 : The operation was successfull.
  * -errno : The command failed.
  */
+#ifdef WIN32
+EXTERN int nfs_stat(struct nfs_context *nfs, const char *path, struct __stat64 *st);
+#else
 EXTERN int nfs_stat(struct nfs_context *nfs, const char *path, struct stat *st);
-
+#endif
 
 /*
  * FSTAT()
@@ -242,7 +245,11 @@ EXTERN int nfs_fstat_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb
  *      0 : The operation was successfull.
  * -errno : The command failed.
  */
+#ifdef WIN32
+EXTERN int nfs_fstat(struct nfs_context *nfs, struct nfsfh *nfsfh, struct __stat64 *st);
+#else
 EXTERN int nfs_fstat(struct nfs_context *nfs, struct nfsfh *nfsfh, struct stat *st);
+#endif
 
 
 
index 7de245f64531d90c3ee1bba65ad56641d7f99382..baadefa9962df6482ab938823b0da3a51d576c9d 100644 (file)
@@ -208,11 +208,18 @@ static void stat_cb(int status, struct nfs_context *nfs, void *data, void *priva
                nfs_set_error(nfs, "stat call failed with \"%s\"", (char *)data);
                return;
        }
-
-       memcpy(cb_data->return_data, data, sizeof(struct stat));
+#ifdef WIN32
+       memcpy(cb_data->return_data, data, sizeof(struct __stat64));
+#else
+  memcpy(cb_data->return_data, data, sizeof(struct stat));
+#endif
 }
 
+#ifdef WIN32
+int nfs_stat(struct nfs_context *nfs, const char *path, struct __stat64 *st)
+#else
 int nfs_stat(struct nfs_context *nfs, const char *path, struct stat *st)
+#endif
 {
        struct sync_cb_data cb_data;
 
index ed6cb2313e261351d7e3035f8ae51f3a14b65157..ca8ed379de8d529a9f3609e419fc740f629c37d3 100644 (file)
@@ -1027,7 +1027,11 @@ static void nfs_stat_1_cb(struct rpc_context *rpc, int status, void *command_dat
        GETATTR3res *res;
        struct nfs_cb_data *data = private_data;
        struct nfs_context *nfs = data->nfs;
+#ifdef WIN32
+  struct __stat64 st;
+#else
        struct stat st;
+#endif
 
        assert(rpc->magic == RPC_CONTEXT_MAGIC);