Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #4014 from Memphiz/win32nfsstat64

[win32/nfs] - fix wrong struct stat size when running on win8 64
  • Loading branch information...
commit 734efe1b7d8d02708f4d1ddd228c7bc15dee85ba 2 parents 4398243 + ba0a082
@Memphiz Memphiz authored
View
2  project/BuildDependencies/scripts/0_package.list
@@ -13,7 +13,7 @@ lame_enc-3.99.5-win32.7z
libass-0.10.2-win32.7z
libbluray-0.4.0-win32.zip
libjpeg-turbo-1.2.0-win32.7z
-libnfs-1.6.1-win32.7z
+libnfs-1.6.2-win32.7z
libshairplay-c159ca7-win32.7z
libssh-0.5.0-1-win32.zip
libxml2-2.7.8_1-win32.7z
View
15 xbmc/filesystem/DllLibNfs.h
@@ -30,6 +30,13 @@ extern "C" {
}
#endif
+#if defined(TARGET_WINDOWS)
+struct __stat64;
+#define NFSSTAT struct __stat64
+#else
+#define NFSSTAT struct stat
+#endif
+
class DllLibNfsInterface
{
public:
@@ -54,8 +61,8 @@ class DllLibNfsInterface
virtual void nfs_closedir(struct nfs_context *nfs, struct nfsdir *nfsdir)=0;
virtual struct nfsdirent *nfs_readdir(struct nfs_context *nfs, struct nfsdir *nfsdir)=0;
virtual int nfs_mount(struct nfs_context *nfs, const char *server, const char *exportname)=0;
- virtual int nfs_stat(struct nfs_context *nfs, const char *path, struct stat *st)=0;
- virtual int nfs_fstat(struct nfs_context *nfs, struct nfsfh *nfsfh, struct stat *st)=0;
+ virtual int nfs_stat(struct nfs_context *nfs, const char *path, NFSSTAT *st)=0;
+ virtual int nfs_fstat(struct nfs_context *nfs, struct nfsfh *nfsfh, NFSSTAT *st)=0;
virtual int nfs_truncate(struct nfs_context *nfs, const char *path, uint64_t length)=0;
virtual int nfs_ftruncate(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t length)=0;
virtual int nfs_opendir(struct nfs_context *nfs, const char *path, struct nfsdir **nfsdir)=0;
@@ -100,8 +107,8 @@ class DllLibNfs : public DllDynamic, DllLibNfsInterface
DEFINE_METHOD2(void,nfs_closedir, (struct nfs_context *p1, struct nfsdir *p2))
DEFINE_METHOD2(int, nfs_close, (struct nfs_context *p1, struct nfsfh *p2))
DEFINE_METHOD3(int, nfs_mount, (struct nfs_context *p1, const char *p2, const char *p3))
- DEFINE_METHOD3(int, nfs_stat, (struct nfs_context *p1, const char *p2, struct stat *p3))
- DEFINE_METHOD3(int, nfs_fstat, (struct nfs_context *p1, struct nfsfh *p2, struct stat *p3))
+ DEFINE_METHOD3(int, nfs_stat, (struct nfs_context *p1, const char *p2, NFSSTAT *p3))
+ DEFINE_METHOD3(int, nfs_fstat, (struct nfs_context *p1, struct nfsfh *p2, NFSSTAT *p3))
DEFINE_METHOD3(int, nfs_truncate, (struct nfs_context *p1, const char *p2, uint64_t p3))
DEFINE_METHOD3(int, nfs_ftruncate, (struct nfs_context *p1, struct nfsfh *p2, uint64_t p3))
DEFINE_METHOD3(int, nfs_opendir, (struct nfs_context *p1, const char *p2, struct nfsdir **p3))
View
4 xbmc/filesystem/NFSDirectory.cpp
@@ -127,7 +127,7 @@ bool CNFSDirectory::ResolveSymlink( const CStdString &dirName, struct nfsdirent
if(ret == 0)
{
- struct stat tmpBuffer = {0};
+ NFSSTAT tmpBuffer = {0};
fullpath = dirName;
URIUtils::AddSlashAtEnd(fullpath);
fullpath.append(resolvedLink);
@@ -350,7 +350,7 @@ bool CNFSDirectory::Exists(const char* strPath)
if(!gNfsConnection.Connect(url,folderName))
return false;
- struct stat info;
+ NFSSTAT info;
ret = gNfsConnection.GetImpl()->nfs_stat(gNfsConnection.GetNfsContext(), folderName.c_str(), &info);
if (ret != 0)
View
9 xbmc/filesystem/NFSFile.cpp
@@ -24,7 +24,6 @@
#include "system.h"
#ifdef HAS_FILESYSTEM_NFS
-#include "DllLibNfs.h"
#include "NFSFile.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
@@ -430,7 +429,7 @@ void CNfsConnection::keepAlive(std::string _exportPath, struct nfsfh *_pFileHan
m_pLibNfs->nfs_lseek(pContext, _pFileHandle, offset, SEEK_SET, &offset);
}
-int CNfsConnection::stat(const CURL &url, struct stat *statbuff)
+int CNfsConnection::stat(const CURL &url, NFSSTAT *statbuff)
{
CSingleLock lock(*this);
int nfsRet = 0;
@@ -598,7 +597,7 @@ int CNFSFile::Stat(const CURL& url, struct __stat64* buffer)
return -1;
- struct stat tmpBuffer = {0};
+ NFSSTAT tmpBuffer = {0};
ret = gNfsConnection.GetImpl()->nfs_stat(gNfsConnection.GetNfsContext(), filename.c_str(), &tmpBuffer);
@@ -612,6 +611,9 @@ int CNFSFile::Stat(const CURL& url, struct __stat64* buffer)
{
if(buffer)
{
+#if defined(TARGET_WINDOWS)// TODO get rid of this define after gotham
+ memcpy(buffer, &tmpBuffer, sizeof(struct __stat64));
+#else
memset(buffer, 0, sizeof(struct __stat64));
buffer->st_dev = tmpBuffer.st_dev;
buffer->st_ino = tmpBuffer.st_ino;
@@ -624,6 +626,7 @@ int CNFSFile::Stat(const CURL& url, struct __stat64* buffer)
buffer->st_atime = tmpBuffer.st_atime;
buffer->st_mtime = tmpBuffer.st_mtime;
buffer->st_ctime = tmpBuffer.st_ctime;
+#endif
}
}
return ret;
View
3  xbmc/filesystem/NFSFile.h
@@ -28,6 +28,7 @@
#include <list>
#include "SectionLoader.h"
#include <map>
+#include "DllLibNfs.h" // for define NFSSTAT
#ifdef TARGET_WINDOWS
#define S_IRGRP 0
@@ -80,7 +81,7 @@ class CNfsConnection : public CCriticalSection
//special stat which uses its own context
//needed for getting intervolume symlinks to work
- int stat(const CURL &url, struct stat *statbuff);
+ int stat(const CURL &url, NFSSTAT *statbuff);
void AddActiveConnection();
void AddIdleConnection();
Please sign in to comment.
Something went wrong with that request. Please try again.