From 6af0c81915760f544a257c18299c021e1a273118 Mon Sep 17 00:00:00 2001 From: LRN Date: Tue, 30 Oct 2012 21:23:27 +0000 Subject: Just use unistring --- src/util/strings.c | 52 ---------------------------------------------------- 1 file changed, 52 deletions(-) diff --git a/src/util/strings.c b/src/util/strings.c index f2f0569c8..8063be07f 100644 --- a/src/util/strings.c +++ b/src/util/strings.c @@ -372,52 +372,6 @@ GNUNET_STRINGS_conv (const char *input, size_t len, const char *input_charset, c { char *ret; -#if ENABLE_NLS && HAVE_ICONV - size_t tmpSize; - size_t finSize; - char *tmp; - char *itmp; - iconv_t cd; - - cd = iconv_open (output_charset, input_charset); - if (cd == (iconv_t) - 1) - { - LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "iconv_open"); - LOG (GNUNET_ERROR_TYPE_WARNING, _("Character sets requested were `%s'->`%s'\n"), - input_charset, output_charset); - ret = GNUNET_malloc (len + 1); - memcpy (ret, input, len); - ret[len] = '\0'; - return ret; - } - tmpSize = 3 * len + 4; - tmp = GNUNET_malloc (tmpSize); - itmp = tmp; - finSize = tmpSize; - if (iconv (cd, -#if FREEBSD || DARWIN || WINDOWS - (const char **) &input, -#else - (char **) &input, -#endif - &len, &itmp, &finSize) == SIZE_MAX) - { - LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "iconv"); - iconv_close (cd); - GNUNET_free (tmp); - ret = GNUNET_malloc (len + 1); - memcpy (ret, input, len); - ret[len] = '\0'; - return ret; - } - ret = GNUNET_malloc (tmpSize - finSize + 1); - memcpy (ret, tmp, tmpSize - finSize); - ret[tmpSize - finSize] = '\0'; - GNUNET_free (tmp); - if (0 != iconv_close (cd)) - LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "iconv_close"); - return ret; -#elif ENABLE_NLS /* libunistring is a mandatory dependency \o/ ! */ uint8_t *u8_string; char *encoded_string; size_t u8_string_length; @@ -455,12 +409,6 @@ GNUNET_STRINGS_conv (const char *input, size_t len, const char *input_charset, c ret[encoded_string_length] = '\0'; free (encoded_string); return ret; -#else - ret = GNUNET_malloc (len + 1); - memcpy (ret, input, len); - ret[len] = '\0'; - return ret; -#endif } -- cgit v1.2.3