diff options
author | Michihiro NAKAJIMA <ggcueroad@gmail.com> | 2011-04-12 11:02:35 -0400 |
---|---|---|
committer | Michihiro NAKAJIMA <ggcueroad@gmail.com> | 2011-04-12 11:02:35 -0400 |
commit | 97ed974bedaee424577c6b3faf76f5f9e9d3143c (patch) | |
tree | e0572d787544412427d6976fcc26254985a7a2dd /libarchive/archive_read_support_format_cab.c | |
parent | b5876a16758ac8f70e6c9c852eb7b813fec2182e (diff) | |
download | libarchive-97ed974bedaee424577c6b3faf76f5f9e9d3143c.tar.gz |
Apply the default string conversion(mostly OEMCP ==> ACP) to cab reader.
As you know, it works for Windows platform only.
SVN-Revision: 3219
Diffstat (limited to 'libarchive/archive_read_support_format_cab.c')
-rw-r--r-- | libarchive/archive_read_support_format_cab.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libarchive/archive_read_support_format_cab.c b/libarchive/archive_read_support_format_cab.c index 114e774d..6eb22466 100644 --- a/libarchive/archive_read_support_format_cab.c +++ b/libarchive/archive_read_support_format_cab.c @@ -291,7 +291,9 @@ struct cab { unsigned char *uncompressed_buffer; size_t uncompressed_buffer_size; + int init_default_conversion; struct archive_string_conv *sconv; + struct archive_string_conv *sconv_default; struct archive_string_conv *sconv_utf8; char format_name[64]; @@ -815,8 +817,19 @@ cab_read_header(struct archive_read *a) return (ARCHIVE_FATAL); } sconv = cab->sconv_utf8; - } else + } else if (cab->sconv != NULL) { + /* Choose the conversion specified by the option. */ sconv = cab->sconv; + } else { + /* Choose the default conversion. */ + if (!cab->init_default_conversion) { + cab->sconv_default = + archive_string_default_conversion_for_read( + &(a->archive)); + cab->init_default_conversion = 1; + } + sconv = cab->sconv_default; + } /* Copy and translate a pathname. * if the conversion fail, we report it when return this entry. */ if (archive_strncpy_in_locale(&(file->pathname), p, len, sconv) != 0) |