summaryrefslogtreecommitdiffstats
path: root/Directory.cxx
diff options
context:
space:
mode:
authorKWSys Upstream <kwrobot@kitware.com>2020-05-27 11:59:02 (GMT)
committerBrad King <brad.king@kitware.com>2020-05-27 12:33:38 (GMT)
commitc47501bcca7c5d47aa22478071a16fae5cef9c63 (patch)
tree70970ede1617838c5edecc344b93e38ee27480f8 /Directory.cxx
parent8fd4c19e1b39efa6912321a72ac12a1c0121264e (diff)
downloadCMake-c47501bcca7c5d47aa22478071a16fae5cef9c63.zip
CMake-c47501bcca7c5d47aa22478071a16fae5cef9c63.tar.gz
CMake-c47501bcca7c5d47aa22478071a16fae5cef9c63.tar.bz2
KWSys 2020-05-27 (a3263389)
Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit a3263389bcaab27fd62a23599d4ce9bdaa01479a (master). Upstream Shortlog ----------------- Brad King (7): ce4941c9 IOStream: Drop this component of KWSys 49d04c2c hashtable: Drop this component of KWSys a0bd892c SystemInformation: Use 'long long' unconditionally 441dd494 Drop unused checks for 'long long' and '__int64' 2b749749 Drop unused C type macros check 74daf33b Drop unused Borland and OpenWatcom preprocessor conditions c4e8126a Drop unused CXX cstdio check
Diffstat (limited to 'Directory.cxx')
-rw-r--r--Directory.cxx30
1 files changed, 5 insertions, 25 deletions
diff --git a/Directory.cxx b/Directory.cxx
index be9158e..0c2190a 100644
--- a/Directory.cxx
+++ b/Directory.cxx
@@ -92,26 +92,12 @@ void Directory::Clear()
# include <sys/stat.h>
# include <sys/types.h>
-// Wide function names can vary depending on compiler:
-# ifdef __BORLANDC__
-# define _wfindfirst_func __wfindfirst
-# define _wfindnext_func __wfindnext
-# else
-# define _wfindfirst_func _wfindfirst
-# define _wfindnext_func _wfindnext
-# endif
-
namespace KWSYS_NAMESPACE {
bool Directory::Load(const std::string& name, std::string* errorMessage)
{
this->Clear();
-# if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__)
- // Older Visual C++ and Embarcadero compilers.
- long srchHandle;
-# else // Newer Visual C++
intptr_t srchHandle;
-# endif
char* buf;
size_t n = name.size();
if (name.back() == '/' || name.back() == '\\') {
@@ -130,8 +116,8 @@ bool Directory::Load(const std::string& name, std::string* errorMessage)
struct _wfinddata_t data; // data of current file
// Now put them into the file array
- srchHandle = _wfindfirst_func(
- (wchar_t*)Encoding::ToWindowsExtendedPath(buf).c_str(), &data);
+ srchHandle =
+ _wfindfirst((wchar_t*)Encoding::ToWindowsExtendedPath(buf).c_str(), &data);
delete[] buf;
if (srchHandle == -1) {
@@ -141,7 +127,7 @@ bool Directory::Load(const std::string& name, std::string* errorMessage)
// Loop through names
do {
this->Internal->Files.push_back(Encoding::ToNarrow(data.name));
- } while (_wfindnext_func(srchHandle, &data) != -1);
+ } while (_wfindnext(srchHandle, &data) != -1);
this->Internal->Path = name;
return _findclose(srchHandle) != -1;
}
@@ -149,12 +135,7 @@ bool Directory::Load(const std::string& name, std::string* errorMessage)
unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
std::string* errorMessage)
{
-# if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__)
- // Older Visual C++ and Embarcadero compilers.
- long srchHandle;
-# else // Newer Visual C++
intptr_t srchHandle;
-# endif
char* buf;
size_t n = name.size();
if (name.back() == '/') {
@@ -167,8 +148,7 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
struct _wfinddata_t data; // data of current file
// Now put them into the file array
- srchHandle =
- _wfindfirst_func((wchar_t*)Encoding::ToWide(buf).c_str(), &data);
+ srchHandle = _wfindfirst((wchar_t*)Encoding::ToWide(buf).c_str(), &data);
delete[] buf;
if (srchHandle == -1) {
@@ -179,7 +159,7 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
unsigned long count = 0;
do {
count++;
- } while (_wfindnext_func(srchHandle, &data) != -1);
+ } while (_wfindnext(srchHandle, &data) != -1);
_findclose(srchHandle);
return count;
}