Jelajahi Sumber

cmSystemTools: Restore compilation with libarchive versions below 3.3.1

In commit a203fcc63d (cmake: Teach '-E tar' to report errors copying
data, 2018-05-16) we introduced use of `la_ssize_t` but that was not
available until libarchive 3.3.1.  Switch to the `__LA_SSIZE_T` macro
we use elsewhere.
Brad King 7 tahun lalu
induk
melakukan
6d8ae1e6e4
1 mengubah file dengan 5 tambahan dan 1 penghapusan
  1. 5 1
      Source/cmSystemTools.cxx

+ 5 - 1
Source/cmSystemTools.cxx

@@ -14,6 +14,9 @@
 #  ifndef __LA_INT64_T
 #    define __LA_INT64_T la_int64_t
 #  endif
+#  ifndef __LA_SSIZE_T
+#    define __LA_SSIZE_T la_ssize_t
+#  endif
 #endif
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -1726,7 +1729,8 @@ bool copy_data(struct archive* ar, struct archive* aw)
     // Return value:
     // * >= ARCHIVE_OK - write succeed
     // * < ARCHIVE_OK - write failed
-    const la_ssize_t w_size = archive_write_data_block(aw, buff, size, offset);
+    const __LA_SSIZE_T w_size =
+      archive_write_data_block(aw, buff, size, offset);
     if (w_size < ARCHIVE_OK) {
       cmSystemTools::Message("archive_write_data_block()",
                              archive_error_string(aw));