From 913789b972a5ef734805959939a3b24ec1636195 Mon Sep 17 00:00:00 2001 From: leander-256 Date: Sun, 16 May 2010 23:59:39 +0000 Subject: [PATCH] This is a patch for the previous patch *facepalms* I got confused somehow between the different versions of my modifications and Linux/Windows, anyway it should work now. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2925 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/util/folderiterator.cc | 9 ++++++--- libretroshare/src/util/folderiterator.h | 1 + libretroshare/src/util/rswin.cc | 6 ++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/util/folderiterator.cc b/libretroshare/src/util/folderiterator.cc index 0640a0e78..0ed9c70ba 100644 --- a/libretroshare/src/util/folderiterator.cc +++ b/libretroshare/src/util/folderiterator.cc @@ -41,7 +41,8 @@ bool FolderIterator::readdir() { } return FindNextFileW(handle, &fileInfo) != 0; #else - return readdir(handle) == 0; + ent = ::readdir(handle); + return ent != 0; #endif } @@ -56,7 +57,9 @@ bool FolderIterator::d_name(std::string& dest) return false; } #else - dest = handle->d_name; + if(ent == 0) + return false; + dest = ent->d_name; #endif return true; @@ -72,7 +75,7 @@ bool FolderIterator::closedir() #ifdef WINDOWS_SYS return FindClose(handle) != 0; #else - return closedir(handle) == 0; + return ::closedir(handle) == 0; #endif } diff --git a/libretroshare/src/util/folderiterator.h b/libretroshare/src/util/folderiterator.h index 6d04917e5..bfddc6b74 100644 --- a/libretroshare/src/util/folderiterator.h +++ b/libretroshare/src/util/folderiterator.h @@ -42,6 +42,7 @@ private: _WIN32_FIND_DATAW fileInfo; #else DIR* handle; + struct dirent* ent; #endif }; diff --git a/libretroshare/src/util/rswin.cc b/libretroshare/src/util/rswin.cc index b8550960c..a6b2dbc01 100644 --- a/libretroshare/src/util/rswin.cc +++ b/libretroshare/src/util/rswin.cc @@ -1,6 +1,9 @@ #include "util/rswin.h" +#ifdef WINDOWS_SYS + + namespace librs { namespace util { @@ -47,3 +50,6 @@ bool ConvertUtf16ToUtf8(const std::wstring& source, std::string& dest) { } } // librs::util + + +#endif // WINDOWS_SYS