2020#include < cppp/reiconv.hpp>
2121
2222#include < limits.h>
23- #include < stdlib.h>
24- #include < string.h>
25-
26- #ifdef __CYGWIN__
27- #include < cygwin/version.h>
28- #endif
23+ #include < iostream>
24+ #include < cstdlib>
25+ #include < cstring>
2926
3027namespace cppp {namespace base {namespace reiconv
3128{
3229
33- #ifdef ENABLE_EXTRA
30+ #if ENABLE_EXTRA
3431 /*
3532 * Consider all system dependent encodings, for any system,
3633 * and the extra encodings.
@@ -592,20 +589,6 @@ namespace cppp{namespace base{namespace reiconv
592589 /* version number: (major<<8) + minor */
593590 int reiconv_version = (3 << 8 ) + 0 ;
594591
595- #if defined __FreeBSD__ && !defined __gnu_freebsd__
596- /* GNU libiconv is the native FreeBSD iconv implementation since 2002.
597- It wants to define the symbols 'iconv_open', 'iconv', 'iconv_close'. */
598- #define strong_alias (name, aliasname ) _strong_alias(name, aliasname)
599- #define _strong_alias (name, aliasname ) \
600- extern __typeof (name) aliasname __attribute__ ((alias (#name)));
601- #undef iconv_open
602- #undef iconv
603- #undef iconv_close
604- strong_alias (libiconv_open, iconv_open)
605- strong_alias (libiconv, iconv)
606- strong_alias (libiconv_close, iconv_close)
607- #endif
608-
609592 #endif
610593
611594 #define tmpbufsize 4096
@@ -620,6 +603,8 @@ namespace cppp{namespace base{namespace reiconv
620603 if (cd == (iconv_t )(-1 )) {
621604 if (errno != EINVAL)
622605 return -1 ;
606+ /* Autodetect feature is a extra feature. */
607+ #if ENABLE_EXTRA
623608 /* Unsupported fromcode or tocode. Check whether the caller requested
624609 autodetection. */
625610 if (!strcmp (fromcode," autodetect_utf8" )) {
@@ -662,6 +647,7 @@ namespace cppp{namespace base{namespace reiconv
662647 ret = iconv_string (tocode," EUC-KR" ,start,end,resultp,lengthp);
663648 return ret;
664649 }
650+ #endif
665651 errno = EINVAL;
666652 return -1 ;
667653 }
0 commit comments