[Cmake-commits] CMake branch, next, updated. v3.4.1-1852-gbe48a89

Brad King brad.king at kitware.com
Thu Jan 7 13:15:21 EST 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  be48a89e5523595edd9ac2851dce73ef2b102692 (commit)
       via  0a5ce85f602a70d166c2cdc1f2dad8aab9a85269 (commit)
       via  f2b0bf6e3f45f4f2a474732f29528299825bf7e9 (commit)
       via  b021455e40f921ab3887dec8cde665838b92bd66 (commit)
       via  bc908abd989c9a241b11733cbda6213520aa0dd8 (commit)
       via  a6cbc89179f7fc6e4ac359df48eb1d31abe027cb (commit)
       via  3d2d17c00c2b20185b7fe0af22ba06bba3730d7c (commit)
      from  acf58fefebf43a7ea17fdc7cbe110c3b04cc63cd (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=be48a89e5523595edd9ac2851dce73ef2b102692
commit be48a89e5523595edd9ac2851dce73ef2b102692
Merge: acf58fe 0a5ce85
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jan 7 13:15:20 2016 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Jan 7 13:15:20 2016 -0500

    Merge topic 'update-kwsys' into next
    
    0a5ce85f Merge branch 'upstream-KWSys' into update-kwsys
    f2b0bf6e KWSys 2016-01-07 (2418443e)
    b021455e CMake Nightly Date Stamp
    bc908abd CMake Nightly Date Stamp
    a6cbc891 CMake Nightly Date Stamp
    3d2d17c0 CMake Nightly Date Stamp


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0a5ce85f602a70d166c2cdc1f2dad8aab9a85269
commit 0a5ce85f602a70d166c2cdc1f2dad8aab9a85269
Merge: b021455 f2b0bf6
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jan 7 13:13:51 2016 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jan 7 13:13:51 2016 -0500

    Merge branch 'upstream-KWSys' into update-kwsys
    
    * upstream-KWSys:
      KWSys 2016-01-07 (2418443e)


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f2b0bf6e3f45f4f2a474732f29528299825bf7e9
commit f2b0bf6e3f45f4f2a474732f29528299825bf7e9
Author:     KWSys Upstream <kwrobot at kitware.com>
AuthorDate: Thu Jan 7 13:00:32 2016 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jan 7 13:13:51 2016 -0500

    KWSys 2016-01-07 (2418443e)
    
    Code extracted from:
    
        http://public.kitware.com/KWSys.git
    
    at commit 2418443ed01e5caeb47908064fd4dad2eff4736f (master).
    
    Upstream Shortlog
    -----------------
    
    Clinton Stimpson (1):
          2418443e FStream: Fix reading BOM on single-character files

diff --git a/FStream.cxx b/FStream.cxx
index 018652c..5a30997 100644
--- a/FStream.cxx
+++ b/FStream.cxx
@@ -34,6 +34,7 @@ BOM ReadBOM(std::istream& in)
   in.read(reinterpret_cast<char*>(bom), 2);
   if(!in.good())
     {
+    in.clear();
     in.seekg(orig);
     return BOM_None;
     }
@@ -68,6 +69,7 @@ BOM ReadBOM(std::istream& in)
     in.seekg(p);
     return BOM_UTF16LE;
     }
+  in.clear();
   in.seekg(orig);
   return BOM_None;
 }
diff --git a/testFStream.cxx b/testFStream.cxx
index ac5220a..5e53725 100644
--- a/testFStream.cxx
+++ b/testFStream.cxx
@@ -41,8 +41,13 @@ static int testNoFile()
   return 0;
 }
 
-static kwsys::FStream::BOM expected_bom[5] =
+static const int num_test_files = 7;
+static const int max_test_file_size = 45;
+
+static kwsys::FStream::BOM expected_bom[num_test_files] =
 {
+  kwsys::FStream::BOM_None,
+  kwsys::FStream::BOM_None,
   kwsys::FStream::BOM_UTF8,
   kwsys::FStream::BOM_UTF16LE,
   kwsys::FStream::BOM_UTF16BE,
@@ -50,8 +55,10 @@ static kwsys::FStream::BOM expected_bom[5] =
   kwsys::FStream::BOM_UTF32BE
 };
 
-static unsigned char expected_bom_data[5][5] =
+static unsigned char expected_bom_data[num_test_files][5] =
 {
+    {0},
+    {0},
     {3, 0xEF, 0xBB, 0xBF},
     {2, 0xFF, 0xFE},
     {2, 0xFE, 0xFF},
@@ -59,8 +66,10 @@ static unsigned char expected_bom_data[5][5] =
     {4, 0x00, 0x00, 0xFE, 0xFF},
 };
 
-static unsigned char file_data[5][45] =
+static unsigned char file_data[num_test_files][max_test_file_size] =
 {
+    {1, 'H'},
+    {11, 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'},
     {11, 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'},
     {22, 0x48, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x20, 0x00,
     0x57, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x6C, 0x00, 0x64, 0x00},
@@ -80,7 +89,7 @@ static unsigned char file_data[5][45] =
 static int testBOM()
 {
   // test various encodings in binary mode
-  for(int i=0; i<5; i++)
+  for(int i=0; i<num_test_files; i++)
     {
       {
       kwsys::ofstream out("bom.txt", kwsys::ofstream::binary);
@@ -97,7 +106,7 @@ static int testBOM()
       std::cout << "Unexpected BOM " << i << std::endl;
       return 1;
       }
-    char data[45];
+    char data[max_test_file_size];
     in.read(data, file_data[i][0]);
     if(!in.good())
       {
@@ -113,66 +122,6 @@ static int testBOM()
 
     }
 
-  // test text file without bom
-  {
-    {
-    kwsys::ofstream out("bom.txt");
-    out << "Hello World";
-    }
-
-    kwsys::ifstream in("bom.txt");
-    kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in);
-    if(bom != kwsys::FStream::BOM_None)
-      {
-      std::cout << "Unexpected BOM for none case" << std::endl;
-      return 1;
-      }
-    char data[45];
-    in.read(data, file_data[0][0]);
-    if(!in.good())
-      {
-      std::cout << "Unable to read data for none case" << std::endl;
-      return 1;
-      }
-
-    if(memcmp(data, file_data[0]+1, file_data[0][0]) != 0)
-      {
-      std::cout << "Incorrect read data for none case" << std::endl;
-      return 1;
-      }
-  }
-
-  // test text file with utf-8 bom
-  {
-    {
-    kwsys::ofstream out("bom.txt");
-    out.write(reinterpret_cast<const char*>(expected_bom_data[0]+1),
-              *expected_bom_data[0]);
-    out << "Hello World";
-    }
-
-    kwsys::ifstream in("bom.txt");
-    kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in);
-    if(bom != kwsys::FStream::BOM_UTF8)
-      {
-      std::cout << "Unexpected BOM for utf-8 case" << std::endl;
-      return 1;
-      }
-    char data[45];
-    in.read(data, file_data[0][0]);
-    if(!in.good())
-      {
-      std::cout << "Unable to read data for utf-8 case" << std::endl;
-      return 1;
-      }
-
-    if(memcmp(data, file_data[0]+1, file_data[0][0]) != 0)
-      {
-      std::cout << "Incorrect read data for utf-8 case" << std::endl;
-      return 1;
-      }
-  }
-
   return 0;
 }
 

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

Summary of changes:
 Source/CMakeVersion.cmake    |    2 +-
 Source/kwsys/FStream.cxx     |    2 ++
 Source/kwsys/testFStream.cxx |   79 ++++++++----------------------------------
 3 files changed, 17 insertions(+), 66 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list