diff options
author | mistachkin <mistachkin@noemail.net> | 2016-01-05 01:48:29 +0000 |
---|---|---|
committer | mistachkin <mistachkin@noemail.net> | 2016-01-05 01:48:29 +0000 |
commit | 98486c046f1d245b5ffa1df8a850e349e4e25154 (patch) | |
tree | e1e52b94955ba917e4233fc67131d3648d987f05 /src/test_fs.c | |
parent | 11e3e538d672188c95430b7277b1e238533c5ee1 (diff) | |
download | sqlite-98486c046f1d245b5ffa1df8a850e349e4e25154.tar.gz sqlite-98486c046f1d245b5ffa1df8a850e349e4e25154.zip |
Permit the 'test_fs' test module to be compiled and used on MinGW.
FossilOrigin-Name: ac27f38eef7a241d56124c263d9f8c91f372a77f
Diffstat (limited to 'src/test_fs.c')
-rw-r--r-- | src/test_fs.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/test_fs.c b/src/test_fs.c index ab6bed8a9..45db0b53b 100644 --- a/src/test_fs.c +++ b/src/test_fs.c @@ -70,7 +70,7 @@ #include <sys/stat.h> #include <fcntl.h> -#if SQLITE_OS_UNIX +#if SQLITE_OS_UNIX || defined(__MINGW_H) # include <unistd.h> # include <dirent.h> # ifndef DIRENT @@ -79,7 +79,9 @@ #endif #if SQLITE_OS_WIN # include <io.h> -# include "test_windirent.h" +# if !defined(__MINGW_H) +# include "test_windirent.h" +# endif # ifndef S_ISREG # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) # endif @@ -231,7 +233,14 @@ static int fsdirNext(sqlite3_vtab_cursor *cur){ if( pCsr->pDir ){ struct DIRENT *pRes = 0; +#if defined(__MINGW_H) + pRes = readdir(pCsr->pDir); + if( pRes!=0 ){ + memcpy(&pCsr->entry, pRes, sizeof(struct DIRENT)); + } +#else readdir_r(pCsr->pDir, &pCsr->entry, &pRes); +#endif if( pRes==0 ){ closedir(pCsr->pDir); pCsr->pDir = 0; |