]> granicus.if.org Git - transmission/commitdiff
Check for `iconv()` instead of `iconv_open()`, adjust utils test
authorMike Gelfand <mikedld@mikedld.com>
Sun, 7 Feb 2016 11:54:01 +0000 (11:54 +0000)
committerMike Gelfand <mikedld@mikedld.com>
Sun, 7 Feb 2016 11:54:01 +0000 (11:54 +0000)
CMakeLists.txt
Transmission.xcodeproj/project.pbxproj
configure.ac
libtransmission/utils-test.c
libtransmission/utils.c

index 48f864da9524d9a42f7ca29dcd5bd31ee203473b..5669878fe8154fc4d26bfa6f9546053205d4300b 100644 (file)
@@ -154,9 +154,7 @@ find_package(PkgConfig QUIET)
 
 find_package(CURL ${CURL_MINIMUM} REQUIRED)
 
-if(UNIX)
-    find_package(ICONV REQUIRED)
-endif()
+find_package(ICONV)
 
 if(WITH_CRYPTO STREQUAL "AUTO" OR WITH_CRYPTO STREQUAL "openssl")
     tr_get_required_flag(WITH_CRYPTO OPENSSL_IS_REQUIRED)
@@ -490,7 +488,6 @@ set(NEEDED_FUNCTIONS
     getmntent
     getpagesize
     htonll
-    iconv_open
     localtime_r
     memmem
     mkdtemp
@@ -515,6 +512,10 @@ foreach(F ${NEEDED_FUNCTIONS})
     endif()
 endforeach()
 
+if(ICONV_FOUND)
+    add_definitions(-DHAVE_ICONV_OPEN)
+endif()
+
 # if(MINGW)
 #     check_function_exists(__mingw_printf HAVE_MINGW_PRINTF)
 #     if(HAVE_MINGW_PRINTF)
index 35e1f767b523bd4e816137025b666fbbe82bb5ba..e3ef55e8faf3927d0271ba4835ccabe582c8311e 100644 (file)
                                        "-DHAVE_LIBGEN",
                                        "-DHAVE_STRCASECMP",
                                        "-DHAVE_ZLIB",
+                                       "-DHAVE_ICONV",
                                );
-                               OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
                                PRODUCT_NAME = transmission;
                        };
                        name = Debug;
                                        "-DHAVE_LIBGEN",
                                        "-DHAVE_STRCASECMP",
                                        "-DHAVE_ZLIB",
+                                       "-DHAVE_ICONV",
                                );
                                PRODUCT_NAME = transmission;
                        };
                                        "-DHAVE_LIBGEN",
                                        "-DHAVE_STRCASECMP",
                                        "-DHAVE_ZLIB",
+                                       "-DHAVE_ICONV",
                                );
                                PRODUCT_NAME = transmission;
                        };
index 42ff48fc1bc704f0eb4c5f22e554a5a3ef329b78..c6f7024800f470bd9753c152f31131b1e520001a 100644 (file)
@@ -107,7 +107,7 @@ AC_HEADER_STDC
 AC_HEADER_TIME
 
 AC_CHECK_HEADERS([stdbool.h xlocale.h])
-AC_CHECK_FUNCS([iconv_open pread pwrite lrintf strlcpy daemon dirname basename canonicalize_file_name strcasecmp localtime_r fallocate64 posix_fallocate memmem strsep strtold syslog valloc getpagesize posix_memalign statvfs htonll ntohll mkdtemp uselocale _configthreadlocale])
+AC_CHECK_FUNCS([iconv pread pwrite lrintf strlcpy daemon dirname basename canonicalize_file_name strcasecmp localtime_r fallocate64 posix_fallocate memmem strsep strtold syslog valloc getpagesize posix_memalign statvfs htonll ntohll mkdtemp uselocale _configthreadlocale])
 AC_PROG_INSTALL
 AC_PROG_MAKE_SET
 ACX_PTHREAD
index af1d562984bab199517a776772db0cfb820a4d35..e028cc80ddd1aec61f13e4a38fa49a65599abc51 100644 (file)
@@ -133,14 +133,14 @@ test_utf8 (void)
   in = "\xF4\x00\x81\x82";
   out = tr_utf8clean (in, 4);
   check (out != NULL);
-  check_streq ("?", out);
+  check ((strlen (out) == 1) || (strlen (out) == 2));
   check (tr_utf8_validate (out, TR_BAD_SIZE, NULL));
   tr_free (out);
 
   in = "\xF4\x33\x81\x82";
   out = tr_utf8clean (in, 4);
   check (out != NULL);
-  check_streq ("?3??", out);
+  check ((strlen (out) == 4) || (strlen (out) == 7));
   check (tr_utf8_validate (out, TR_BAD_SIZE, NULL));
   tr_free (out);
 
index b08f4fb4053ebb45dc83e1f23837a7e15cf82d03..2e542734b34d22a5c5c1080cb2447ab114b9a9ba 100644 (file)
@@ -13,7 +13,6 @@
 
 #if defined (XCODE_BUILD)
  #define HAVE_GETPAGESIZE
- #define HAVE_ICONV_OPEN
  #define HAVE_VALLOC
 #endif
 
@@ -37,7 +36,7 @@
  #include <unistd.h> /* getpagesize () */
 #endif
 
-#ifdef HAVE_ICONV_OPEN
+#ifdef HAVE_ICONV
  #include <iconv.h>
 #endif
 
@@ -1026,7 +1025,7 @@ to_utf8 (const char * in, size_t inlen)
 {
   char * ret = NULL;
 
-#ifdef HAVE_ICONV_OPEN
+#ifdef HAVE_ICONV
   int i;
   const char * encodings[] = { "CURRENT", "ISO-8859-15" };
   const int encoding_count = sizeof (encodings) / sizeof (encodings[1]);