[Cmake-commits] CMake branch, next, updated. v3.6.1-1035-g174049d
Brad King
brad.king at kitware.com
Tue Aug 2 09:22:53 EDT 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 174049de9c674d86052f6f091f6dfe1c9259266d (commit)
via 35995fa6b5872b58f086d16b16ca90d7d259d9b0 (commit)
via 6bc3073e23af70bde3e8a7659aa51a784deeec9c (commit)
from 49fc180cabb53ac734b335cdf0d05c22192690c8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=174049de9c674d86052f6f091f6dfe1c9259266d
commit 174049de9c674d86052f6f091f6dfe1c9259266d
Merge: 49fc180 35995fa
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Aug 2 09:22:52 2016 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Aug 2 09:22:52 2016 -0400
Merge topic 'update-kwsys' into next
35995fa6 Merge branch 'upstream-KWSys' into update-kwsys
6bc3073e KWSys 2016-08-01 (560bcdbb)
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=35995fa6b5872b58f086d16b16ca90d7d259d9b0
commit 35995fa6b5872b58f086d16b16ca90d7d259d9b0
Merge: fd59f9a 6bc3073
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Aug 2 09:21:52 2016 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Aug 2 09:21:52 2016 -0400
Merge branch 'upstream-KWSys' into update-kwsys
* upstream-KWSys:
KWSys 2016-08-01 (560bcdbb)
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6bc3073e23af70bde3e8a7659aa51a784deeec9c
commit 6bc3073e23af70bde3e8a7659aa51a784deeec9c
Author: KWSys Upstream <kwrobot at kitware.com>
AuthorDate: Mon Aug 1 15:20:05 2016 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Aug 2 09:21:31 2016 -0400
KWSys 2016-08-01 (560bcdbb)
Code extracted from:
http://public.kitware.com/KWSys.git
at commit 560bcdbb972cbf4c7ea77010363c652b697b9933 (master).
Upstream Shortlog
-----------------
Brad King (1):
560bcdbb SystemTools: Factor out common `const char* GetEnv()` private implementation
James Johnston (1):
1c147abb Directory: Use Windows API wherever possible and port to Embarcadero
diff --git a/Directory.cxx b/Directory.cxx
index c549792..15480e1 100644
--- a/Directory.cxx
+++ b/Directory.cxx
@@ -84,9 +84,9 @@ void Directory::Clear()
} // namespace KWSYS_NAMESPACE
-// First microsoft compilers
+// First Windows platforms
-#if defined(_MSC_VER) || defined(__WATCOMC__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
#include <windows.h>
#include <io.h>
#include <ctype.h>
@@ -97,15 +97,25 @@ 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)
{
this->Clear();
-#if _MSC_VER < 1300
+#if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__)
+ // Older Visual C++ and Embarcadero compilers.
long srchHandle;
-#else
+#else // Newer Visual C++
intptr_t srchHandle;
#endif
char* buf;
@@ -132,7 +142,7 @@ bool Directory::Load(const std::string& name)
struct _wfinddata_t data; // data of current file
// Now put them into the file array
- srchHandle = _wfindfirst((wchar_t*)Encoding::ToWide(buf).c_str(), &data);
+ srchHandle = _wfindfirst_func((wchar_t*)Encoding::ToWide(buf).c_str(), &data);
delete [] buf;
if ( srchHandle == -1 )
@@ -145,16 +155,17 @@ bool Directory::Load(const std::string& name)
{
this->Internal->Files.push_back(Encoding::ToNarrow(data.name));
}
- while ( _wfindnext(srchHandle, &data) != -1 );
+ while ( _wfindnext_func(srchHandle, &data) != -1 );
this->Internal->Path = name;
return _findclose(srchHandle) != -1;
}
unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name)
{
-#if _MSC_VER < 1300
+#if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__)
+ // Older Visual C++ and Embarcadero compilers.
long srchHandle;
-#else
+#else // Newer Visual C++
intptr_t srchHandle;
#endif
char* buf;
@@ -172,7 +183,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((wchar_t*)Encoding::ToWide(buf).c_str(), &data);
+ srchHandle = _wfindfirst_func((wchar_t*)Encoding::ToWide(buf).c_str(), &data);
delete [] buf;
if ( srchHandle == -1 )
@@ -186,7 +197,7 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name)
{
count++;
}
- while ( _wfindnext(srchHandle, &data) != -1 );
+ while ( _wfindnext_func(srchHandle, &data) != -1 );
_findclose(srchHandle);
return count;
}
diff --git a/SystemTools.cxx b/SystemTools.cxx
index 0526372..9b56db0 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -523,7 +523,7 @@ void SystemTools::GetPath(std::vector<std::string>& path, const char* env)
}
}
-const char* SystemTools::GetEnv(const char* key)
+const char* SystemTools::GetEnvImpl(const char* key)
{
const char *v = 0;
#if defined(_WIN32)
@@ -540,9 +540,14 @@ const char* SystemTools::GetEnv(const char* key)
return v;
}
+const char* SystemTools::GetEnv(const char* key)
+{
+ return SystemTools::GetEnvImpl(key);
+}
+
const char* SystemTools::GetEnv(const std::string& key)
{
- return SystemTools::GetEnv(key.c_str());
+ return SystemTools::GetEnvImpl(key.c_str());
}
bool SystemTools::GetEnv(const char* key, std::string& result)
diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in
index 8f01e75..aa1bf1b 100644
--- a/SystemTools.hxx.in
+++ b/SystemTools.hxx.in
@@ -984,6 +984,7 @@ private:
std::vector<std::string>(),
bool no_system_path = false);
+ static const char* GetEnvImpl(const char* key);
/**
* Path translation table from dir to refdir
-----------------------------------------------------------------------
Summary of changes:
Source/kwsys/Directory.cxx | 31 +++++++++++++++++++++----------
Source/kwsys/SystemTools.cxx | 9 +++++++--
Source/kwsys/SystemTools.hxx.in | 1 +
3 files changed, 29 insertions(+), 12 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list