From: Michihiro NAKAJIMA Date: Sun, 25 Apr 2010 09:14:57 +0000 (-0400) Subject: To be simple, remove zisofs=indirect option. X-Git-Tag: v3.0.0a~1090 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=de5b167e5e10cbd64a2b334c3d350ea660ecda30;p=thirdparty%2Flibarchive.git To be simple, remove zisofs=indirect option. Suggested by: Tim Kientzle SVN-Revision: 2275 --- diff --git a/libarchive/archive_write_set_format_iso9660.c b/libarchive/archive_write_set_format_iso9660.c index d026d78d9..48a1c6e73 100644 --- a/libarchive/archive_write_set_format_iso9660.c +++ b/libarchive/archive_write_set_format_iso9660.c @@ -735,15 +735,10 @@ struct iso_option { #define VOLUME_IDENTIFIER_SIZE 32 /* - * Usage : zisofs[=indirect|direct] + * Usage : zisofs * : !zisofs [DEFAULT] * : Disable to generate RRIP 'ZF' extension. - * : zisofs=indirect - * : Generate RRIP 'ZF' extension for special files - * : which is made by mkzftree utility. - * : [COMPAT: mkisofs -z] * : zisofs - * : zisofs=direct * : Make files zisofs file and generate RRIP 'ZF' * : extension. So you do not need mkzftree utility * : for making zisofs. @@ -762,14 +757,12 @@ struct iso_option { * : 'boot-image' file won't be converted to zisofs file. * Type : boolean, string * Default: Disabled - * COMPAT : mkisofs -z * * Generates RRIP 'ZF' System Use Entry. */ unsigned int zisofs:2; #define OPT_ZISOFS_DISABLED 0 -#define OPT_ZISOFS_INDIRECT 1 -#define OPT_ZISOFS_DIRECT 2 +#define OPT_ZISOFS_DIRECT 1 #define OPT_ZISOFS_DEFAULT OPT_ZISOFS_DISABLED /* @@ -1647,25 +1640,18 @@ iso9660_options(struct archive_write *a, const char *key, const char *value) if (strcmp(key, "zisofs") == 0) { if (value == NULL) iso9660->opt.zisofs = OPT_ZISOFS_DISABLED; - else if (strcmp(value, "1") == 0) - iso9660->opt.zisofs = OPT_ZISOFS_DIRECT; - else if (strcmp(value, "indirect") == 0) - iso9660->opt.zisofs = OPT_ZISOFS_INDIRECT; + else { #ifdef HAVE_ZLIB_H - else if (strcmp(value, "direct") == 0) iso9660->opt.zisofs = OPT_ZISOFS_DIRECT; #else - else if (strcmp(value, "direct") == 0) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "``zisofs=%s'' " + "``zisofs'' " "is not supported on this platform.", value); return (ARCHIVE_FATAL); - } #endif - else - goto invalid_value; + } return (ARCHIVE_OK); } if (strcmp(key, "zisofs-exclude") == 0) { @@ -4154,15 +4140,9 @@ write_information_block(struct archive_write *a) if (iso9660->opt.volume_id != OPT_VOLUME_ID_DEFAULT) set_option_info(&info, &opt, "volume-id", KEY_STR, iso9660->volume_identifier.s); - if (iso9660->opt.zisofs != OPT_ZISOFS_DEFAULT) { - if (iso9660->opt.zisofs == OPT_ZISOFS_DISABLED || - iso9660->opt.zisofs == OPT_ZISOFS_DIRECT) - set_option_info(&info, &opt, "zisofs", - KEY_FLG, iso9660->opt.zisofs); - else if (iso9660->opt.zisofs == OPT_ZISOFS_INDIRECT) - set_option_info(&info, &opt, "zisofs", - KEY_STR, "direct"); - } + if (iso9660->opt.zisofs != OPT_ZISOFS_DEFAULT) + set_option_info(&info, &opt, "zisofs", + KEY_FLG, iso9660->opt.zisofs); #ifdef HAVE_ZLIB_H if (iso9660->opt.zisofs_exclude != OPT_ZISOFS_EXCLUDE_DEFAULT) { int i; @@ -7662,8 +7642,7 @@ zisofs_init(struct archive_write *a, struct isofile *file) iso9660->zisofs.detect_magic = 1; iso9660->zisofs.magic_cnt = 0; } - if (iso9660->opt.zisofs == OPT_ZISOFS_INDIRECT || - !iso9660->zisofs.detect_magic) + if (!iso9660->zisofs.detect_magic) return (ARCHIVE_OK); #ifdef HAVE_ZLIB_H @@ -7671,8 +7650,7 @@ zisofs_init(struct archive_write *a, struct isofile *file) * will use in iso-image file is the same as the number of * Logical Blocks which zisofs(compressed) data will use * in ISO-image file. It won't reduce iso-image file size. */ - if (iso9660->opt.zisofs == OPT_ZISOFS_DIRECT && - archive_entry_size(file->entry) <= LOGICAL_BLOCK_SIZE) + if (archive_entry_size(file->entry) <= LOGICAL_BLOCK_SIZE) return (ARCHIVE_OK); /* @@ -7977,24 +7955,22 @@ zisofs_finish_entry(struct archive_write *a) unsigned char buff[16]; size_t s; int64_t tail; + int bk1, bk2; - if (iso9660->opt.zisofs == OPT_ZISOFS_DIRECT) { - int bk1, bk2; - - bk1 = (file->zisofs.uncompressed_size + - LOGICAL_BLOCK_SIZE -1) / LOGICAL_BLOCK_SIZE; - bk2 = (iso9660->zisofs.total_size + - LOGICAL_BLOCK_SIZE -1) / LOGICAL_BLOCK_SIZE; + bk1 = (file->zisofs.uncompressed_size + + LOGICAL_BLOCK_SIZE -1) / LOGICAL_BLOCK_SIZE; + bk2 = (iso9660->zisofs.total_size + + LOGICAL_BLOCK_SIZE -1) / LOGICAL_BLOCK_SIZE; - /* The number of Logical Blocks which uncompressed data - * will use in iso-image file is the same as the number of - * Logical Blocks which zisofs(compressed) data will use - * in ISO-image file. It won't reduce iso-image file size. */ - if (bk1 == bk2) { - zisofs_cancel(iso9660, file); - return (ARCHIVE_OK); - } + /* The number of Logical Blocks which uncompressed data + * will use in iso-image file is the same as the number of + * Logical Blocks which zisofs(compressed) data will use + * in ISO-image file. It won't reduce iso-image file size. */ + if (bk1 == bk2) { + zisofs_cancel(iso9660, file); + return (ARCHIVE_OK); } + if (file->zisofs.keep_original) /* Maybe we will use the original data, which is * uncompressed but we cannot decide it now. */ diff --git a/libarchive/test/test_write_format_iso9660_zisofs.c b/libarchive/test/test_write_format_iso9660_zisofs.c index 27062d067..5b5cdeb93 100644 --- a/libarchive/test/test_write_format_iso9660_zisofs.c +++ b/libarchive/test/test_write_format_iso9660_zisofs.c @@ -77,7 +77,7 @@ DEFINE_TEST(test_write_format_iso9660_zisofs) assert((a = archive_write_new()) != NULL); assertA(0 == archive_write_set_format_iso9660(a)); assertA(0 == archive_write_set_compression_none(a)); - r = archive_write_set_options(a, "zisofs=direct"); + r = archive_write_set_options(a, "zisofs"); if (r == ARCHIVE_FATAL) { skipping("zisofs option not supported on this platform"); assertEqualInt(ARCHIVE_OK, archive_write_free(a));