diff options
author | LRN <lrn1986@gmail.com> | 2012-10-30 21:23:27 +0000 |
---|---|---|
committer | LRN <lrn1986@gmail.com> | 2012-10-30 21:23:27 +0000 |
commit | 6af0c81915760f544a257c18299c021e1a273118 (patch) | |
tree | 3d18c23d01021718d31aa61c308e136c13fdb065 /src | |
parent | 007aa053cc2a62db2ce07fa2a7a4080060dfaddc (diff) | |
download | gnunet-6af0c81915760f544a257c18299c021e1a273118.tar.gz gnunet-6af0c81915760f544a257c18299c021e1a273118.zip |
Just use unistring
Diffstat (limited to 'src')
-rw-r--r-- | src/util/strings.c | 52 |
1 files changed, 0 insertions, 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 | |||
372 | { | 372 | { |
373 | char *ret; | 373 | char *ret; |
374 | 374 | ||
375 | #if ENABLE_NLS && HAVE_ICONV | ||
376 | size_t tmpSize; | ||
377 | size_t finSize; | ||
378 | char *tmp; | ||
379 | char *itmp; | ||
380 | iconv_t cd; | ||
381 | |||
382 | cd = iconv_open (output_charset, input_charset); | ||
383 | if (cd == (iconv_t) - 1) | ||
384 | { | ||
385 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "iconv_open"); | ||
386 | LOG (GNUNET_ERROR_TYPE_WARNING, _("Character sets requested were `%s'->`%s'\n"), | ||
387 | input_charset, output_charset); | ||
388 | ret = GNUNET_malloc (len + 1); | ||
389 | memcpy (ret, input, len); | ||
390 | ret[len] = '\0'; | ||
391 | return ret; | ||
392 | } | ||
393 | tmpSize = 3 * len + 4; | ||
394 | tmp = GNUNET_malloc (tmpSize); | ||
395 | itmp = tmp; | ||
396 | finSize = tmpSize; | ||
397 | if (iconv (cd, | ||
398 | #if FREEBSD || DARWIN || WINDOWS | ||
399 | (const char **) &input, | ||
400 | #else | ||
401 | (char **) &input, | ||
402 | #endif | ||
403 | &len, &itmp, &finSize) == SIZE_MAX) | ||
404 | { | ||
405 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "iconv"); | ||
406 | iconv_close (cd); | ||
407 | GNUNET_free (tmp); | ||
408 | ret = GNUNET_malloc (len + 1); | ||
409 | memcpy (ret, input, len); | ||
410 | ret[len] = '\0'; | ||
411 | return ret; | ||
412 | } | ||
413 | ret = GNUNET_malloc (tmpSize - finSize + 1); | ||
414 | memcpy (ret, tmp, tmpSize - finSize); | ||
415 | ret[tmpSize - finSize] = '\0'; | ||
416 | GNUNET_free (tmp); | ||
417 | if (0 != iconv_close (cd)) | ||
418 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "iconv_close"); | ||
419 | return ret; | ||
420 | #elif ENABLE_NLS /* libunistring is a mandatory dependency \o/ ! */ | ||
421 | uint8_t *u8_string; | 375 | uint8_t *u8_string; |
422 | char *encoded_string; | 376 | char *encoded_string; |
423 | size_t u8_string_length; | 377 | size_t u8_string_length; |
@@ -455,12 +409,6 @@ GNUNET_STRINGS_conv (const char *input, size_t len, const char *input_charset, c | |||
455 | ret[encoded_string_length] = '\0'; | 409 | ret[encoded_string_length] = '\0'; |
456 | free (encoded_string); | 410 | free (encoded_string); |
457 | return ret; | 411 | return ret; |
458 | #else | ||
459 | ret = GNUNET_malloc (len + 1); | ||
460 | memcpy (ret, input, len); | ||
461 | ret[len] = '\0'; | ||
462 | return ret; | ||
463 | #endif | ||
464 | } | 412 | } |
465 | 413 | ||
466 | 414 | ||