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  6b20752ff1ad247bf537b2715c2b0f3eb365cbce (commit)
       via  b508de59e852a5068f3b9838e2be8a485235b934 (commit)
      from  002fc94ec2e5c67e0aa846f29991df4094c7d07a (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=6b20752ff1ad247bf537b2715c2b0f3eb365cbce
commit 6b20752ff1ad247bf537b2715c2b0f3eb365cbce
Merge: 002fc94 b508de5
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed Apr 16 13:13:45 2014 -0400
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Wed Apr 16 13:13:45 2014 -0400

    Merge topic 'archive-null-error' into next
    
    b508de59 cmArchiveWrite: Handle NULL error string (#14882)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b508de59e852a5068f3b9838e2be8a485235b934
commit b508de59e852a5068f3b9838e2be8a485235b934
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed Apr 16 13:07:55 2014 -0400
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Wed Apr 16 13:13:28 2014 -0400

    cmArchiveWrite: Handle NULL error string (#14882)
    
    If archive_error_string returns NULL, use a placeholder string instead
    of crashing.

diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index b410e44..18ab29e 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -17,6 +17,13 @@
 #include <cm_libarchive.h>
 
 //----------------------------------------------------------------------------
+static std::string cm_archive_error_string(struct archive* a)
+{
+  const char* e = archive_error_string(a);
+  return e? e : "unknown error";
+}
+
+//----------------------------------------------------------------------------
 class cmArchiveWrite::Entry
 {
   struct archive_entry* Object;
@@ -59,7 +66,7 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, 
Type t):
       if(archive_write_set_compression_none(this->Archive) != ARCHIVE_OK)
         {
         this->Error = "archive_write_set_compression_none: ";
-        this->Error += archive_error_string(this->Archive);
+        this->Error += cm_archive_error_string(this->Archive);
         return;
         }
       break;
@@ -67,7 +74,7 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, 
Type t):
       if(archive_write_set_compression_compress(this->Archive) != ARCHIVE_OK)
         {
         this->Error = "archive_write_set_compression_compress: ";
-        this->Error += archive_error_string(this->Archive);
+        this->Error += cm_archive_error_string(this->Archive);
         return;
         }
       break;
@@ -75,7 +82,7 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, 
Type t):
       if(archive_write_set_compression_gzip(this->Archive) != ARCHIVE_OK)
         {
         this->Error = "archive_write_set_compression_gzip: ";
-        this->Error += archive_error_string(this->Archive);
+        this->Error += cm_archive_error_string(this->Archive);
         return;
         }
       break;
@@ -83,7 +90,7 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, 
Type t):
       if(archive_write_set_compression_bzip2(this->Archive) != ARCHIVE_OK)
         {
         this->Error = "archive_write_set_compression_bzip2: ";
-        this->Error += archive_error_string(this->Archive);
+        this->Error += cm_archive_error_string(this->Archive);
         return;
         }
       break;
@@ -91,7 +98,7 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, 
Type t):
       if(archive_write_set_compression_lzma(this->Archive) != ARCHIVE_OK)
         {
         this->Error = "archive_write_set_compression_lzma: ";
-        this->Error += archive_error_string(this->Archive);
+        this->Error += cm_archive_error_string(this->Archive);
         return;
         }
       break;
@@ -99,7 +106,7 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, 
Type t):
       if(archive_write_set_compression_xz(this->Archive) != ARCHIVE_OK)
         {
         this->Error = "archive_write_set_compression_xz: ";
-        this->Error += archive_error_string(this->Archive);
+        this->Error += cm_archive_error_string(this->Archive);
         return;
         }
       break;
@@ -108,7 +115,7 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress 
c, Type t):
   if (archive_read_disk_set_standard_lookup(this->Disk) != ARCHIVE_OK)
     {
     this->Error = "archive_read_disk_set_standard_lookup: ";
-    this->Error += archive_error_string(this->Archive);
+    this->Error += cm_archive_error_string(this->Archive);
     return;;
     }
 #endif
@@ -118,7 +125,7 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress 
c, Type t):
       if(archive_write_set_format_zip(this->Archive) != ARCHIVE_OK)
         {
         this->Error = "archive_write_set_format_zip: ";
-        this->Error += archive_error_string(this->Archive);
+        this->Error += cm_archive_error_string(this->Archive);
         return;
         }
       break;
@@ -126,7 +133,7 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress 
c, Type t):
       if(archive_write_set_format_pax_restricted(this->Archive) != ARCHIVE_OK)
         {
         this->Error = "archive_write_set_format_pax_restricted: ";
-        this->Error += archive_error_string(this->Archive);
+        this->Error += cm_archive_error_string(this->Archive);
         return;
         }
     break;
@@ -136,7 +143,7 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress 
c, Type t):
   if (archive_write_set_bytes_in_last_block(this->Archive, 1))
     {
     this->Error = "archive_write_set_bytes_in_last_block: ";
-    this->Error += archive_error_string(this->Archive);
+    this->Error += cm_archive_error_string(this->Archive);
     return;
     }
 
@@ -146,7 +153,7 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress 
c, Type t):
        0) != ARCHIVE_OK)
     {
     this->Error = "archive_write_open: ";
-    this->Error += archive_error_string(this->Archive);
+    this->Error += cm_archive_error_string(this->Archive);
     return;
     }
 }
@@ -234,7 +241,7 @@ bool cmArchiveWrite::AddFile(const char* file,
   if(archive_read_disk_entry_from_file(this->Disk, e, -1, 0) != ARCHIVE_OK)
     {
     this->Error = "archive_read_disk_entry_from_file: ";
-    this->Error += archive_error_string(this->Disk);
+    this->Error += cm_archive_error_string(this->Disk);
     return false;
     }
   // Clear acl and xattr fields not useful for distribution.
@@ -244,7 +251,7 @@ bool cmArchiveWrite::AddFile(const char* file,
   if(archive_write_header(this->Archive, e) != ARCHIVE_OK)
     {
     this->Error = "archive_write_header: ";
-    this->Error += archive_error_string(this->Archive);
+    this->Error += cm_archive_error_string(this->Archive);
     return false;
     }
 
@@ -291,7 +298,7 @@ bool cmArchiveWrite::AddData(const char* file, size_t size)
     if(archive_write_data(this->Archive, buffer, nnext) != nnext_s)
       {
       this->Error = "archive_write_data: ";
-      this->Error += archive_error_string(this->Archive);
+      this->Error += cm_archive_error_string(this->Archive);
       return false;
       }
     nleft -= nnext;

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

Summary of changes:
 Source/cmArchiveWrite.cxx |   35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits

Reply via email to