Advertisement
Guest User

Untitled

a guest
Jan 11th, 2014
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.15 KB | None | 0 0
  1. From ff5978e069dbd100aac3d839a4de5ea748c116e3 Mon Sep 17 00:00:00 2001
  2. From: Memphiz <memphis@machzwo.de>
  3. Date: Sat, 11 Jan 2014 20:12:39 +0100
  4. Subject: [PATCH] [nfs] - try to fix the stat struct size on windows and force
  5. it to 64bi - try to fix the stat struct size on windows and
  6. force it to 64bitt
  7.  
  8. ---
  9. include/nfsc/libnfs.h | 4 ++++
  10. lib/libnfs-sync.c | 9 ++++++++-
  11. lib/libnfs.c | 2 +-
  12. 3 files changed, 13 insertions(+), 2 deletions(-)
  13.  
  14. diff --git a/include/nfsc/libnfs.h b/include/nfsc/libnfs.h
  15. index 094de3c..b8a72e9 100644
  16. --- a/include/nfsc/libnfs.h
  17. +++ b/include/nfsc/libnfs.h
  18. @@ -169,7 +169,11 @@ EXTERN int nfs_stat_async(struct nfs_context *nfs, const char *path, nfs_cb cb,
  19. * 0 : The operation was successfull.
  20. * -errno : The command failed.
  21. */
  22. + #ifdef WIN32
  23. +EXTERN int nfs_stat(struct nfs_context *nfs, const char *path, struct __stat64 *st);
  24. +#else
  25. EXTERN int nfs_stat(struct nfs_context *nfs, const char *path, struct stat *st);
  26. +#endif
  27.  
  28.  
  29. /*
  30. diff --git a/lib/libnfs-sync.c b/lib/libnfs-sync.c
  31. index 7de245f..47772ba 100644
  32. --- a/lib/libnfs-sync.c
  33. +++ b/lib/libnfs-sync.c
  34. @@ -208,11 +208,18 @@ static void stat_cb(int status, struct nfs_context *nfs, void *data, void *priva
  35. nfs_set_error(nfs, "stat call failed with \"%s\"", (char *)data);
  36. return;
  37. }
  38. -
  39. +#ifdef WIN32
  40. memcpy(cb_data->return_data, data, sizeof(struct stat));
  41. +#else
  42. + memcpy(cb_data->return_data, data, sizeof(struct __stat64));
  43. +#endif
  44. }
  45.  
  46. +#ifdef WIN32
  47. +int nfs_stat(struct nfs_context *nfs, const char *path, struct __stat64 *st)
  48. +#else
  49. int nfs_stat(struct nfs_context *nfs, const char *path, struct stat *st)
  50. +#endif
  51. {
  52. struct sync_cb_data cb_data;
  53.  
  54. diff --git a/lib/libnfs.c b/lib/libnfs.c
  55. index f8b294a..f60ac8d 100644
  56. --- a/lib/libnfs.c
  57. +++ b/lib/libnfs.c
  58. @@ -713,7 +713,7 @@ static void nfs_stat_1_cb(struct rpc_context *rpc, int status, void *command_dat
  59. GETATTR3res *res;
  60. struct nfs_cb_data *data = private_data;
  61. struct nfs_context *nfs = data->nfs;
  62. - struct stat st;
  63. + struct __stat64 st;
  64.  
  65. assert(rpc->magic == RPC_CONTEXT_MAGIC);
  66.  
  67. --
  68. 1.7.6.msysgit.0
  69.  
  70.  
  71. diff --git a/xbmc/filesystem/NFSFile.cpp b/xbmc/filesystem/NFSFile.cpp
  72. index 36f9115..e116ab0 100644
  73. --- a/xbmc/filesystem/NFSFile.cpp
  74. +++ b/xbmc/filesystem/NFSFile.cpp
  75. @@ -582,7 +582,7 @@ int CNFSFile::Stat(const CURL& url, struct __stat64* buffer)
  76. return -1;
  77.  
  78.  
  79. - struct stat tmpBuffer = {0};
  80. + struct __stat64 tmpBuffer = {0};
  81.  
  82. ret = gNfsConnection.GetImpl()->nfs_stat(gNfsConnection.GetNfsContext(), filename.c_str(), &tmpBuffer);
  83.  
  84. @@ -594,7 +594,7 @@ int CNFSFile::Stat(const CURL& url, struct __stat64* buffer)
  85. }
  86. else
  87. {
  88. - if(buffer)
  89. + /*if(buffer)
  90. {
  91. memset(buffer, 0, sizeof(struct __stat64));
  92. buffer->st_dev = tmpBuffer.st_dev;
  93. @@ -608,7 +608,8 @@ int CNFSFile::Stat(const CURL& url, struct __stat64* buffer)
  94. buffer->st_atime = tmpBuffer.st_atime;
  95. buffer->st_mtime = tmpBuffer.st_mtime;
  96. buffer->st_ctime = tmpBuffer.st_ctime;
  97. - }
  98. + }*/
  99. + memcpy(buffer, &tmpBuffer, sizeof(struct __stat64));
  100. }
  101. return ret;
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement