]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Remove canConvertCharset from test/main.c and test_pax_filename_encoding.c
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 24 Mar 2011 06:13:02 +0000 (02:13 -0400)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 24 Mar 2011 06:13:02 +0000 (02:13 -0400)
We can finally use archive_write_set_options(a, "charset=UTF-8") instead.

SVN-Revision: 3067

libarchive/test/main.c
libarchive/test/test.h
libarchive/test/test_pax_filename_encoding.c

index cdc14fcfb0452700ca4df268492dce2fe4a5a44e..7ed047c17645fdde069a975fa78710a19324ff5f 100644 (file)
@@ -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
index 780fe58db1c887e1d4c8929f56e77a7f5bfa4c8c..aa0e0fc4b27ae27eac5746d73770ec5d8d3d3e8a 100644 (file)
@@ -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, ...);
index 02a8cd3231a143c43e7d2244ae590de0838dc78a..017715ec9f3c11bf3e2ec349d22cc665f323b9fe 100644 (file)
@@ -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);