[Cmake-commits] CMake branch, next, updated. v3.3.0-1802-ge540a54

Brad King brad.king at kitware.com
Mon Aug 3 13:37:29 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  e540a5464bda433d5850908065e73261b9c4fea1 (commit)
       via  3da431379bae33374edd7c62c6f4261b4e3a663f (commit)
       via  9a59ae5c198f7c413bcaf29f1ab107a265677b95 (commit)
      from  940f14edf440b4a58ed4f22468ae9bf474b46629 (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=e540a5464bda433d5850908065e73261b9c4fea1
commit e540a5464bda433d5850908065e73261b9c4fea1
Merge: 940f14e 3da4313
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Aug 3 13:37:28 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Aug 3 13:37:28 2015 -0400

    Merge topic 'update-kwsys' into next
    
    3da43137 Merge branch 'upstream-kwsys' into update-kwsys
    9a59ae5c KWSys 2015-08-03 (dad68c33)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3da431379bae33374edd7c62c6f4261b4e3a663f
commit 3da431379bae33374edd7c62c6f4261b4e3a663f
Merge: 7ac2b12 9a59ae5
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Aug 3 13:17:54 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Aug 3 13:17:54 2015 -0400

    Merge branch 'upstream-kwsys' into update-kwsys


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9a59ae5c198f7c413bcaf29f1ab107a265677b95
commit 9a59ae5c198f7c413bcaf29f1ab107a265677b95
Author:     KWSys Robot <kwrobot at kitware.com>
AuthorDate: Mon Aug 3 13:14:14 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Aug 3 13:17:50 2015 -0400

    KWSys 2015-08-03 (dad68c33)
    
    Extract upstream KWSys using the following shell commands.
    
    $ git archive --prefix=upstream-kwsys/ dad68c33 | tar x
    $ git shortlog --no-merges --abbrev=8 --format='%h %s' f63febb7..dad68c33
    James Johnston (1):
          dad68c33 Encoding: Fix undefined behavior if out of memory.
    
    Jean-Christophe Fillion-Robin (2):
          e5c23738 SystemTools: Fix DetectFileType failure on missing file
          6d83c113 SystemTools: Fix DetectFileType failure on directory
    
    Sebastian Schuberth (1):
          4db8e69f SystemTools: Implement FileIsSymlink on Windows

diff --git a/EncodingC.c b/EncodingC.c
index ba2cec2..32b9bff 100644
--- a/EncodingC.c
+++ b/EncodingC.c
@@ -45,8 +45,11 @@ wchar_t* kwsysEncoding_DupToWide(const char* str)
   if(length > 0)
     {
     ret = (wchar_t*)malloc((length)*sizeof(wchar_t));
-    ret[0] = 0;
-    kwsysEncoding_mbstowcs(ret, str, length);
+    if(ret)
+      {
+      ret[0] = 0;
+      kwsysEncoding_mbstowcs(ret, str, length);
+      }
     }
   return ret;
 }
@@ -72,8 +75,11 @@ char* kwsysEncoding_DupToNarrow(const wchar_t* str)
   if(length > 0)
     {
     ret = (char*)malloc(length);
-    ret[0] = 0;
-    kwsysEncoding_wcstombs(ret, str, length);
+    if(ret)
+      {
+      ret[0] = 0;
+      kwsysEncoding_wcstombs(ret, str, length);
+      }
     }
   return ret;
 }
diff --git a/SystemTools.cxx b/SystemTools.cxx
index 3452259..0714344 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -3198,8 +3198,16 @@ bool SystemTools::FileIsDirectory(const kwsys_stl::string& inName)
 bool SystemTools::FileIsSymlink(const kwsys_stl::string& name)
 {
 #if defined( _WIN32 )
-  (void)name;
-  return false;
+  DWORD attr = GetFileAttributesW(
+    SystemTools::ConvertToWindowsExtendedPath(name).c_str());
+  if (attr != INVALID_FILE_ATTRIBUTES)
+    {
+    return (attr & FILE_ATTRIBUTE_REPARSE_POINT) != 0;
+    }
+  else
+    {
+    return false;
+    }
 #else
   struct stat fs;
   if(lstat(name.c_str(), &fs) == 0)
@@ -4230,6 +4238,11 @@ SystemTools::DetectFileType(const char *filename,
     return SystemTools::FileTypeUnknown;
     }
 
+  if (SystemTools::FileIsDirectory(filename))
+    {
+    return SystemTools::FileTypeUnknown;
+    }
+
   FILE *fp = Fopen(filename, "rb");
   if (!fp)
     {
@@ -4243,6 +4256,7 @@ SystemTools::DetectFileType(const char *filename,
   fclose(fp);
   if (read_length == 0)
     {
+    delete [] buffer;
     return SystemTools::FileTypeUnknown;
     }
 
diff --git a/testSystemTools.cxx b/testSystemTools.cxx
index 15d8eab..7b5c025 100644
--- a/testSystemTools.cxx
+++ b/testSystemTools.cxx
@@ -98,6 +98,10 @@ static bool CheckEscapeChars(kwsys_stl::string input,
 static bool CheckFileOperations()
 {
   bool res = true;
+  const kwsys_stl::string testNonExistingFile(TEST_SYSTEMTOOLS_SOURCE_DIR
+    "/testSystemToolsNonExistingFile");
+  const kwsys_stl::string testDotFile(TEST_SYSTEMTOOLS_SOURCE_DIR
+    "/.");
   const kwsys_stl::string testBinFile(TEST_SYSTEMTOOLS_SOURCE_DIR
     "/testSystemTools.bin");
   const kwsys_stl::string testTxtFile(TEST_SYSTEMTOOLS_SOURCE_DIR
@@ -106,6 +110,24 @@ static bool CheckFileOperations()
     "/testSystemToolsNewDir");
   const kwsys_stl::string testNewFile(testNewDir + "/testNewFile.txt");
 
+  if (kwsys::SystemTools::DetectFileType(testNonExistingFile.c_str()) !=
+      kwsys::SystemTools::FileTypeUnknown)
+    {
+    kwsys_ios::cerr
+      << "Problem with DetectFileType - failed to detect type of: "
+      << testNonExistingFile << kwsys_ios::endl;
+    res = false;
+    }
+
+  if (kwsys::SystemTools::DetectFileType(testDotFile.c_str()) !=
+      kwsys::SystemTools::FileTypeUnknown)
+    {
+    kwsys_ios::cerr
+      << "Problem with DetectFileType - failed to detect type of: "
+      << testDotFile << kwsys_ios::endl;
+    res = false;
+    }
+
   if (kwsys::SystemTools::DetectFileType(testBinFile.c_str()) !=
       kwsys::SystemTools::FileTypeBinary)
     {

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

Summary of changes:
 Source/kwsys/EncodingC.c         |   14 ++++++++++----
 Source/kwsys/SystemTools.cxx     |   18 ++++++++++++++++--
 Source/kwsys/testSystemTools.cxx |   22 ++++++++++++++++++++++
 3 files changed, 48 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list