diff options
author | LibArchive Upstream <libarchive-discuss@googlegroups.com> | 2011-12-31 18:54:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-01-05 13:52:42 (GMT) |
commit | 4f4fe6e50bb3dbe59f9bc3cc848cbd07dead324d (patch) | |
tree | 9051c1592328819c0adb69ba8148393cf9129f04 /libarchive/archive_write_set_format_7zip.c | |
parent | 2f4a3792bbfdb4e05cf7468059b3f6308f5ed91f (diff) | |
download | CMake-4f4fe6e50bb3dbe59f9bc3cc848cbd07dead324d.zip CMake-4f4fe6e50bb3dbe59f9bc3cc848cbd07dead324d.tar.gz CMake-4f4fe6e50bb3dbe59f9bc3cc848cbd07dead324d.tar.bz2 |
libarchive 3.0.2-r4051 (reduced)
Extract upstream libarchive using the following shell code.
url=https://libarchive.googlecode.com/svn/release/3.0
v=3.0.2
r=4051
paths="
CMakeLists.txt
COPYING
CTestConfig.cmake
build/cmake
build/pkgconfig
build/utils
build/version
libarchive/*.*
"
date=$(svn log -q -c$r $url |
sed -n "/^r/ {s/[^|]*|[^|]*|//;p;}")
svn export -r$r $url libarchive-$v-r$r &&
mkdir libarchive-$v-r$r-reduced &&
(cd libarchive-$v-r$r && tar c $paths) |
(cd libarchive-$v-r$r-reduced && tar x)
echo "r$r date: $date"
Diffstat (limited to 'libarchive/archive_write_set_format_7zip.c')
-rw-r--r-- | libarchive/archive_write_set_format_7zip.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/libarchive/archive_write_set_format_7zip.c b/libarchive/archive_write_set_format_7zip.c index f405d1f..022b3a4 100644 --- a/libarchive/archive_write_set_format_7zip.c +++ b/libarchive/archive_write_set_format_7zip.c @@ -96,7 +96,7 @@ enum la_zaction { }; /* - * Universal zstream. + * A stream object of universal compressor. */ struct la_zstream { const uint8_t *next_in; @@ -154,8 +154,8 @@ struct file { #define HAS_STREAM (1<<4) struct { - time_t time; - long time_ns; + time_t time; + long time_ns; } times[3]; #define MTIME 0 #define ATIME 1 @@ -455,6 +455,7 @@ _7z_write_header(struct archive_write *a, struct archive_entry *entry) zip->total_number_entry++; zip->total_bytes_entry_name += file->name_len + 2; if (file->size == 0) { + /* Count up the number of empty files. */ zip->total_number_empty_entry++; if (file->dir) zip->total_number_dir_entry++; @@ -488,6 +489,9 @@ _7z_write_header(struct archive_write *a, struct archive_entry *entry) zip->entry_bytes_remaining = file->size; zip->entry_crc32 = 0; + /* + * Store a symbolic link name as file contents. + */ if (archive_entry_filetype(entry) == AE_IFLNK) { ssize_t bytes; const void *p = (const void *)archive_entry_symlink(entry); @@ -501,6 +505,9 @@ _7z_write_header(struct archive_write *a, struct archive_entry *entry) return (r); } +/* + * Write data to a temporary file. + */ static int write_to_temp(struct archive_write *a, const void *buff, size_t s) { @@ -719,19 +726,22 @@ _7z_close(struct archive_write *a) zip->total_number_nonempty_entry = zip->total_number_entry - zip->total_number_empty_entry; + /* Connect an empty file list. */ *zip->file_list.last = zip->empty_list.first; zip->file_list.last = zip->empty_list.last; + /* Connect a directory file list. */ ARCHIVE_RB_TREE_FOREACH(n, &(zip->rbtree)) { file_register(zip, (struct file *)n); } /* * NOTE: 7z command supports just LZMA1, LZMA2 and COPY for - * the header. + * the compression type for encoding the header. */ #if HAVE_LZMA_H header_compression = _7Z_LZMA1; - /* If the stored file is only one, do not encode the header. */ + /* If the stored file is only one, do not encode the header. + * This is the same way 7z command does. */ if (zip->total_number_entry == 1) header_compression = _7Z_COPY; #else @@ -823,6 +833,9 @@ _7z_close(struct archive_write *a) return (r); } +/* + * Encode 64 bits value into 7-Zip's encoded UINT64 value. + */ static int enc_uint64(struct archive_write *a, uint64_t val) { @@ -1586,6 +1599,9 @@ compression_unsupported_encoder(struct archive *a, } #endif +/* + * _7_COPY compressor. + */ static int compression_init_encoder_copy(struct archive *a, struct la_zstream *lastrm) { @@ -1631,6 +1647,9 @@ compression_end_copy(struct archive *a, struct la_zstream *lastrm) return (ARCHIVE_OK); } +/* + * _7_DEFLATE compressor. + */ #ifdef HAVE_ZLIB_H static int compression_init_encoder_deflate(struct archive *a, @@ -1741,6 +1760,9 @@ compression_init_encoder_deflate(struct archive *a, } #endif +/* + * _7_BZIP2 compressor. + */ #if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR) static int compression_init_encoder_bzip2(struct archive *a, @@ -1860,6 +1882,9 @@ compression_init_encoder_bzip2(struct archive *a, } #endif +/* + * _7_LZMA1, _7_LZMA2 compressor. + */ #if defined(HAVE_LZMA_H) static int compression_init_encoder_lzma(struct archive *a, @@ -2047,7 +2072,7 @@ compression_init_encoder_lzma2(struct archive *a, #endif /* - * PPMd compression. + * _7_PPMD compressor. */ static void * ppmd_alloc(void *p, size_t size) @@ -2201,6 +2226,9 @@ compression_end_ppmd(struct archive *a, struct la_zstream *lastrm) return (ARCHIVE_OK); } +/* + * Universal compressor initializer. + */ static int _7z_compression_init_encoder(struct archive_write *a, unsigned compression, int compression_level) |