Use archive_string_conv object for the test to know if current locale is
UTF-8.
Delay the initialization of variables in strncpy_to_utf16be and
strncpy_from_utf16be until those are really needed.
maintain BC aliases (ARCHIVE_VERSION_NUMBER < 4000000). if fact,
the new names are wrappers around the old ones as i want to switch
the tests to the new names and have the old names still tested.
the wrappers revealed a mismatch between
archive_read_support_compression_program_signature declaration in
archive.h and its definition (const void* vs void*), i'm going with
const void*.
Improve character-set conversion functions.
- Change the interface in order to reduece the comparison of
charset names. Previous version always did it when the functions
were called; it was very inefficient. So I have made a conversion
object, struct archive_string_conv, to resolve that issue.
- Integrate *_from_charset and *_to_charset into *_in_locale because
of above.
- Integrate *_from_utf16be and *_to_utf16be into *in_locale.
- On Windows, Make a codepage from a charset name to know whether
current codepage and specified charset are the same or not.
Roman Neuhauser [Mon, 28 Mar 2011 09:18:49 +0000 (05:18 -0400)]
libarchive_changes.3: changes in libarchive interface
this is meant to be the target of 'man removed_function' and
'man deprecated_function'. we don't have the needed machinery (yet).
the FreeBSD-bundled copy of libarchive installs many links using
a FreeBSD-provided mechanism, we could probably get that into
Makefile.am (http://sources.redhat.com/automake/automake.html#Extending
sadly doesn't mention install-man in the list of extensible targets..).
not sure about cmake. spotted nothing interesting in the 2.8 manual,
google returned nothing relevant.
Roman Neuhauser [Mon, 28 Mar 2011 09:17:47 +0000 (05:17 -0400)]
archive_write_finish_entry.3: separate man page
this moves archive_write_finish_entry() out of sight a bit:
its description says it's not normally necessary, so the man page
is referenced only from archive_write_data.3 (for now)
On Windows test_fuzz sometimes failed by fopen error that it opened image data.
It seems previous close operation did not completely end at that time.
I think it some security soft was grabbing the file handle for its check
of file access. So we should take a wait for a time while the operation
running.
Tim Kientzle [Sat, 26 Mar 2011 05:53:58 +0000 (01:53 -0400)]
Issue 151: clients and filters are now guaranteed to have their
close() function invoked exactly once in all cases.
In particular, this avoids a leak when read_open_filename()
fails because of format errors.
In Zip writer, set bit 11(stored filename charset is UTF-8) to general
purpose flags when the filename has non ASCII code and writing charset
is UTF-8. it is useful for Zip reader not only for ours that that would
help Zip reader know what a filename encoding is. This is the same behaviour
Info-ZIP does.
We should use mbrtowc/mbtowc at archive_wstring_append_from_mbs instead of
mbsrtowcs/mbstowcs because we cannot check the MBS limit specified by
a caller with a parameter 'len', and it is possible that mbsrtowcs/mbstowcs
convert extra MBS when strlen(MBS) > 'len'.
Update comment about the return code of conversion functions.
archive_string_append_from_unicode_to_mbs always returns -1
if the platform have neither wctomb nor wcrtomb.
Remove UTF-8 <===> WCS conversion code, which was highly based on the wrog
assumption that WCS was UNICODE. What format WCS has is deeply dependent on
platform, and WCS must be converted to/from locale dependent MBS on every
platform through mbstowcs/wcstombs or related functions, which the platforms
provide. We should, thus, respect the platform policy about WCS for potability.
Add an mbs version of ACL control functions in order to reduce
extra character conversion.
previous:
Create : Disk -> MBS -> WCS -> MBS -> UTF-8 -> Pax archive file.
Extract: Pax archive file -> UTF-8 -> MBS -> WCS ->MBS -> Disk.
In ZIP archive file, a filename and comments field is UTF-8 when Language
encoding flag (Bit 11 of the general purpose bit flag) is set.
So we should convert filenames from UTF-8 to current locale.
Improve character-set conversion functions on the platform which does not have
iconv.
Even if current locale and specified locale are the same, we should
whether the MBS has all correct bytes, in order to simulate iconv's behavior.
Instead of canConvertCharset(), use archive_read_set_options("charset=xxxx")
to check what a conversion of character-set is supported.
It is better only libarchive knows if a character-set conversion works,
but at this time a use of canConvertCharset() still remains in
test_pax_filename_encoding.
Tim Kientzle [Mon, 21 Mar 2011 00:41:14 +0000 (20:41 -0400)]
Test from Roman Neuhauser for the "raw" format to verify that it
correctly handles read_next_header and read_data_skip. Fix the bug
this uncovers (a second header request should return EOF but didn't).
Add support for charset option to lha format reader.
Automatically convert filenames in a lha archive if a well-known codepage
is specified in its header, but it will not overwrite a character-set
specified by the charset option.
Issue 144: Improve the operation of use-set option of an mtree writer.
Correctly tabulate uid,gid,mode and fflags of files in a directory and
use the most used value of those file attributes for /set keyword while
use-set option specified.
Tim Kientzle [Fri, 18 Mar 2011 05:49:40 +0000 (01:49 -0400)]
From Roman Neuhauser: Rework textual options handling.
* New functions archive_{read,write}_set_{format,filter}_option accept
three strings: module name, option name, value.
This is a better match for C clients of the library, who want
to set one option at a time anyway for better error handling.
* archive_{read,write}_set_options still accept a single string
with possibly multiple options, but are now much simpler internally
because they build on the above.
* New tests for all of the above.
* Update a lot of tests to give good coverage of the new functions.
Do not pass 0 to third parameter of ReadFile(), which parameter specify read bytes,
because ReadFile() will not return if the parameter is 0;
test_archive_read_close_twice_open_filename did not end.
Improve UTF-16BE conversion functions.
- rename archive_string_copy_from_utf16be to archive_strncpy_from_utf16be.
- rename archive_string_copy_to_utf16be to archive_strncpy_to_utf16be and
change its argument from struct archive_string * to a set of const char *
and size_t.
Use ICONV_CONST instead of ICONV_IS_POSIX; switch a detection of iconv to AM_ICONV.
This version needs to solve about config.rpath, which AM_ICONV requires.