From: Michihiro NAKAJIMA Date: Thu, 24 Mar 2011 06:13:02 +0000 (-0400) Subject: Remove canConvertCharset from test/main.c and test_pax_filename_encoding.c X-Git-Tag: v3.0.0a~611 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e382a1f533bb4749777dfdb26ec6b8ad0e8f9116;p=thirdparty%2Flibarchive.git Remove canConvertCharset from test/main.c and test_pax_filename_encoding.c We can finally use archive_write_set_options(a, "charset=UTF-8") instead. SVN-Revision: 3067 --- diff --git a/libarchive/test/main.c b/libarchive/test/main.c index cdc14fcfb..7ed047c17 100644 --- a/libarchive/test/main.c +++ b/libarchive/test/main.c @@ -1661,23 +1661,6 @@ canGunzip(void) return (value); } -/* - * Can this platform convert character-set. - */ -int -canConvertCharset(const char *to_charset, const char *from_charset) -{ -#if HAVE_ICONV - iconv_t cd = iconv_open(to_charset, from_charset); - if (cd == NULL) - return (0); - iconv_close(cd); - return (1); -#else - return (0); -#endif -} - /* * Sleep as needed; useful for verifying disk timestamp changes by * ensuring that the wall-clock time has actually changed before we diff --git a/libarchive/test/test.h b/libarchive/test/test.h index 780fe58db..aa0e0fc4b 100644 --- a/libarchive/test/test.h +++ b/libarchive/test/test.h @@ -275,9 +275,6 @@ int canGzip(void); /* Return true if this platform can run the "gunzip" program. */ int canGunzip(void); -/* Return true if this patform can convert character-set. */ -int canConvertCharset(const char *, const char *); - /* Suck file into string allocated via malloc(). Call free() when done. */ /* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */ char *slurpfile(size_t *, const char *fmt, ...); diff --git a/libarchive/test/test_pax_filename_encoding.c b/libarchive/test/test_pax_filename_encoding.c index 02a8cd323..017715ec9 100644 --- a/libarchive/test/test_pax_filename_encoding.c +++ b/libarchive/test/test_pax_filename_encoding.c @@ -336,11 +336,6 @@ test_pax_filename_encoding_ru_RU() char buff[4096]; size_t used; - if (!canConvertCharset("UTF-8", "KOI8-R")) { - skipping("This system cannot convert character-set" - " from KOI8-R to UTF-8."); - return; - } if (NULL == setlocale(LC_ALL, "ru_RU.KOI8-R")) { skipping("KOI8-R locale not available on this system."); return; @@ -348,6 +343,12 @@ test_pax_filename_encoding_ru_RU() a = archive_write_new(); assertEqualInt(ARCHIVE_OK, archive_write_set_format_pax(a)); + if (archive_write_set_options(a, "charset=UTF-8") != ARCHIVE_OK) { + skipping("This system cannot convert character-set" + " from KOI8-R to UTF-8."); + archive_write_free(a); + return; + } assertEqualInt(ARCHIVE_OK, archive_write_open_memory(a, buff, sizeof(buff), &used)); entry = archive_entry_new2(a); @@ -375,11 +376,6 @@ test_pax_filename_encoding_ja_JP() wchar_t ws[] = {0x8868, L'.', L't', L'x', L't', 0}; size_t used; - if (!canConvertCharset("UTF-8", "eucJP")) { - skipping("This system cannot convert character-set" - " from eucJP to UTF-8."); - return; - } if (NULL == setlocale(LC_ALL, "ja_JP.eucJP")) { skipping("eucJP locale not available on this system."); return; @@ -387,6 +383,12 @@ test_pax_filename_encoding_ja_JP() a = archive_write_new(); assertEqualInt(ARCHIVE_OK, archive_write_set_format_pax(a)); + if (archive_write_set_options(a, "charset=UTF-8") != ARCHIVE_OK) { + skipping("This system cannot convert character-set" + " from eucJP to UTF-8."); + archive_write_free(a); + return; + } assertEqualInt(ARCHIVE_OK, archive_write_open_memory(a, buff, sizeof(buff), &used)); entry = archive_entry_new2(a);