[Cmake-commits] CMake branch, next, updated. v3.3.0-rc3-1001-g4a91202

Brad King brad.king at kitware.com
Mon Jul 13 09:13:24 EDT 2015


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  4a9120277a42a1cafc80cc2acdcbb2a2bf464623 (commit)
       via  62275956c1951e86ad013f8454d709ef9849bae4 (commit)
       via  dc822da8158af5b568ca01fbb519d7170553376a (commit)
      from  c8be06c52ddfc10355d00dececf3e5e469bd1593 (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4a9120277a42a1cafc80cc2acdcbb2a2bf464623
commit 4a9120277a42a1cafc80cc2acdcbb2a2bf464623
Merge: c8be06c 6227595
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Jul 13 09:13:23 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Jul 13 09:13:23 2015 -0400

    Merge topic 'update-kwsys' into next
    
    62275956 Merge branch 'upstream-kwsys' into update-kwsys
    dc822da8 KWSys 2015-07-10 (c9336bcf)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=62275956c1951e86ad013f8454d709ef9849bae4
commit 62275956c1951e86ad013f8454d709ef9849bae4
Merge: c8f46af dc822da
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Jul 13 09:13:01 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Jul 13 09:13:01 2015 -0400

    Merge branch 'upstream-kwsys' into update-kwsys


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dc822da8158af5b568ca01fbb519d7170553376a
commit dc822da8158af5b568ca01fbb519d7170553376a
Author:     KWSys Robot <kwrobot at kitware.com>
AuthorDate: Fri Jul 10 09:36:55 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Jul 13 09:12:56 2015 -0400

    KWSys 2015-07-10 (c9336bcf)
    
    Extract upstream KWSys using the following shell commands.
    
    $ git archive --prefix=upstream-kwsys/ c9336bcf | tar x
    $ git shortlog --no-merges --abbrev=8 --format='%h %s' d3ba91e1..c9336bcf
    Brad King (2):
          86a24794 SystemTools: Fix GetActualCaseForPath drive letter case handling
          c9336bcf SystemTools: Optimize GetActualCaseForPath memoization

diff --git a/SystemTools.cxx b/SystemTools.cxx
index fed1c9c..3452259 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -385,6 +385,26 @@ class SystemToolsTranslationMap :
 {
 };
 
+#ifdef _WIN32
+struct SystemToolsPathCaseCmp
+{
+  bool operator()(kwsys_stl::string const& l, kwsys_stl::string const& r) const
+    {
+# ifdef _MSC_VER
+    return _stricmp(l.c_str(), r.c_str()) < 0;
+# elif defined(__GNUC__)
+    return strcasecmp(l.c_str(), r.c_str()) < 0;
+# else
+    return SystemTools::Strucmp(l.c_str(), r.c_str()) < 0;
+# endif
+    }
+};
+
+class SystemToolsPathCaseMap:
+  public kwsys_stl::map<kwsys_stl::string, kwsys_stl::string,
+                        SystemToolsPathCaseCmp> {};
+#endif
+
 // adds the elements of the env variable path to the arg passed in
 void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char* env)
 {
@@ -3690,6 +3710,11 @@ static int GetCasePathName(const kwsys_stl::string & pathIn,
   // Start with root component.
   kwsys_stl::vector<kwsys_stl::string>::size_type idx = 0;
   casePath = path_components[idx++];
+  // make sure drive letter is always upper case
+  if(casePath.size() > 1 && casePath[1] == ':')
+    {
+    casePath[0] = toupper(casePath[0]);
+    }
   const char* sep = "";
 
   // If network path, fill casePath with server/share so FindFirstFile
@@ -3745,27 +3770,21 @@ kwsys_stl::string SystemTools::GetActualCaseForPath(const kwsys_stl::string& p)
 #ifndef _WIN32
   return p;
 #else
-  kwsys_stl::string casePath = p;
-  // make sure drive letter is always upper case
-  if(casePath.size() > 1 && casePath[1] == ':')
-    {
-    casePath[0] = toupper(casePath[0]);
-    }
-
   // Check to see if actual case has already been called
-  // for this path, and the result is stored in the LongPathMap
-  SystemToolsTranslationMap::iterator i =
-    SystemTools::LongPathMap->find(casePath);
-  if(i != SystemTools::LongPathMap->end())
+  // for this path, and the result is stored in the PathCaseMap
+  SystemToolsPathCaseMap::iterator i =
+    SystemTools::PathCaseMap->find(p);
+  if(i != SystemTools::PathCaseMap->end())
     {
     return i->second;
     }
+  kwsys_stl::string casePath;
   int len = GetCasePathName(p, casePath);
   if(len == 0 || len > MAX_PATH+1)
     {
     return p;
     }
-  (*SystemTools::LongPathMap)[p] = casePath;
+  (*SystemTools::PathCaseMap)[p] = casePath;
   return casePath;
 #endif
 }
@@ -5139,7 +5158,9 @@ bool SystemTools::ParseURL( const kwsys_stl::string& URL,
 // necessary.
 static unsigned int SystemToolsManagerCount;
 SystemToolsTranslationMap *SystemTools::TranslationMap;
-SystemToolsTranslationMap *SystemTools::LongPathMap;
+#ifdef _WIN32
+SystemToolsPathCaseMap *SystemTools::PathCaseMap;
+#endif
 #ifdef __CYGWIN__
 SystemToolsTranslationMap *SystemTools::Cyg2Win32Map;
 #endif
@@ -5187,7 +5208,9 @@ void SystemTools::ClassInitialize()
 #endif
   // Allocate the translation map first.
   SystemTools::TranslationMap = new SystemToolsTranslationMap;
-  SystemTools::LongPathMap = new SystemToolsTranslationMap;
+#ifdef _WIN32
+  SystemTools::PathCaseMap = new SystemToolsPathCaseMap;
+#endif
 #ifdef __CYGWIN__
   SystemTools::Cyg2Win32Map = new SystemToolsTranslationMap;
 #endif
@@ -5244,7 +5267,9 @@ void SystemTools::ClassInitialize()
 void SystemTools::ClassFinalize()
 {
   delete SystemTools::TranslationMap;
-  delete SystemTools::LongPathMap;
+#ifdef _WIN32
+  delete SystemTools::PathCaseMap;
+#endif
 #ifdef __CYGWIN__
   delete SystemTools::Cyg2Win32Map;
 #endif
diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in
index 93cde02..7899141 100644
--- a/SystemTools.hxx.in
+++ b/SystemTools.hxx.in
@@ -54,6 +54,8 @@ namespace @KWSYS_NAMESPACE@
 {
 
 class SystemToolsTranslationMap;
+class SystemToolsPathCaseMap;
+
 /** \class SystemToolsManager
  * \brief Use to make sure SystemTools is initialized before it is used
  * and is the last static object destroyed
@@ -944,7 +946,9 @@ private:
    * Each time 'dir' will be found it will be replace by 'refdir'
    */
   static SystemToolsTranslationMap *TranslationMap;
-  static SystemToolsTranslationMap *LongPathMap;
+#ifdef _WIN32
+  static SystemToolsPathCaseMap *PathCaseMap;
+#endif
 #ifdef __CYGWIN__
   static SystemToolsTranslationMap *Cyg2Win32Map;
 #endif

-----------------------------------------------------------------------

Summary of changes:
 Source/kwsys/SystemTools.cxx    |   55 ++++++++++++++++++++++++++++-----------
 Source/kwsys/SystemTools.hxx.in |    6 ++++-
 2 files changed, 45 insertions(+), 16 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list