Check for `iconv()` instead of `iconv_open()`, adjust utils test
This commit is contained in:
parent
a447f0d628
commit
96ea2c82fd
|
@ -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)
|
||||
|
|
|
@ -3331,8 +3331,8 @@
|
|||
"-DHAVE_LIBGEN",
|
||||
"-DHAVE_STRCASECMP",
|
||||
"-DHAVE_ZLIB",
|
||||
"-DHAVE_ICONV",
|
||||
);
|
||||
OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
|
||||
PRODUCT_NAME = transmission;
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -3496,6 +3496,7 @@
|
|||
"-DHAVE_LIBGEN",
|
||||
"-DHAVE_STRCASECMP",
|
||||
"-DHAVE_ZLIB",
|
||||
"-DHAVE_ICONV",
|
||||
);
|
||||
PRODUCT_NAME = transmission;
|
||||
};
|
||||
|
@ -3709,6 +3710,7 @@
|
|||
"-DHAVE_LIBGEN",
|
||||
"-DHAVE_STRCASECMP",
|
||||
"-DHAVE_ZLIB",
|
||||
"-DHAVE_ICONV",
|
||||
);
|
||||
PRODUCT_NAME = transmission;
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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]);
|
||||
|
|
Loading…
Reference in New Issue