From: Aki Tuomi Date: Mon, 12 May 2025 08:20:18 +0000 (+0300) Subject: global: Drop support for old iconv() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8dd2ec82f63ba1bf9ddf1b74243e00185ebba9b1;p=thirdparty%2Fdovecot%2Fcore.git global: Drop support for old iconv() iconv() is part of POSIX.1-2001. --- diff --git a/Makefile.am b/Makefile.am index ebf55dcd01..c8355b04b2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -47,7 +47,6 @@ dovecot-config: dovecot-config.in Makefile (echo "DOVECOT_INSTALLED=no"; cat dovecot-config.in | sed \ -e "s|\$$(top_builddir)|$$abs_builddir|g" \ -e "s|\$$(incdir)|$$abs_srcdir|g" \ - -e "s|\$$(LIBICONV)|$(LIBICONV)|g" \ -e "s|\$$(MODULE_LIBS)|$(MODULE_LIBS)|g" \ -e "s|^\(dovecot_pkgincludedir\)=|\1=$(pkgincludedir)|" \ -e "s|^\(dovecot_pkglibdir\)=|\1=$(pkglibdir)|" \ diff --git a/autogen.sh b/autogen.sh index f6a57fc278..872167c61f 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,15 +1,3 @@ #!/bin/sh -# If you've non-standard directories, set these -#GETTEXT_DIR= - -if ! test -f build-aux/config.rpath; then - for dir in $GETTEXT_DIR /usr/share/gettext /usr/local/share/gettext; do - if test -f $dir/config.rpath; then - /bin/cp -f $dir/config.rpath build-aux/ - break - fi - done -fi - autoreconf -vif diff --git a/configure.ac b/configure.ac index 8c711964de..9680421873 100644 --- a/configure.ac +++ b/configure.ac @@ -263,7 +263,6 @@ AS_IF([test "$FLEX" = ":" && test ! -e "$srcdir/src/lib/event-filter-lexer.c"], ]) AC_C_INLINE LT_INIT -AM_ICONV # SIZE_MAX is missing without this CXXFLAGS="$CXXFLAGS -D__STDC_LIMIT_MACROS" @@ -608,7 +607,7 @@ if test "$want_shared_libs" = "yes"; then fi else LIBDOVECOT_DEPS="$LIBDOVECOT_LA_LIBS" - LIBDOVECOT="$LIBDOVECOT_DEPS \$(LIBICONV) \$(MODULE_LIBS)" + LIBDOVECOT="$LIBDOVECOT_DEPS \$(MODULE_LIBS)" LIBDOVECOT_STORAGE_DEPS='$(top_builddir)/src/lib-storage/libstorage.la' LIBDOVECOT_LOGIN='$(top_builddir)/src/login-common/liblogin.la' LIBDOVECOT_LDA='$(top_builddir)/src/lib-lda/liblda.la' diff --git a/src/lib-charset/Makefile.am b/src/lib-charset/Makefile.am index 5c41f074c0..dd0b7b9283 100644 --- a/src/lib-charset/Makefile.am +++ b/src/lib-charset/Makefile.am @@ -4,11 +4,9 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src/lib \ -I$(top_srcdir)/src/lib-test -libcharset_la_LIBADD = $(LTLIBICONV) libcharset_la_SOURCES = \ charset-iconv.c \ - charset-utf8.c \ - charset-utf8-only.c + charset-utf8.c headers = \ charset-utf8.h \ diff --git a/src/lib-charset/charset-iconv.c b/src/lib-charset/charset-iconv.c index 7b2921955f..8f5898fb1c 100644 --- a/src/lib-charset/charset-iconv.c +++ b/src/lib-charset/charset-iconv.c @@ -4,8 +4,6 @@ #include "buffer.h" #include "charset-utf8-private.h" -#ifdef HAVE_ICONV - #include #include @@ -56,7 +54,7 @@ charset_to_utf8_try(struct charset_translation *t, const unsigned char *src, size_t *src_size, buffer_t *dest, enum charset_result *result) { - ICONV_CONST char *ic_srcbuf; + char *ic_srcbuf; char tmpbuf[8192], *ic_destbuf; size_t srcleft, destleft, tmpbuf_used; bool ret = TRUE; @@ -69,7 +67,7 @@ charset_to_utf8_try(struct charset_translation *t, destleft = sizeof(tmpbuf); ic_destbuf = tmpbuf; srcleft = *src_size; - ic_srcbuf = (ICONV_CONST char *) src; + ic_srcbuf = (char *) src; if (iconv(t->cd, &ic_srcbuf, &srcleft, &ic_destbuf, &destleft) != SIZE_MAX) { @@ -143,5 +141,3 @@ const struct charset_utf8_vfuncs charset_iconv = { .to_utf8_reset = iconv_charset_to_utf8_reset, .to_utf8 = iconv_charset_to_utf8, }; - -#endif diff --git a/src/lib-charset/charset-utf8-only.c b/src/lib-charset/charset-utf8-only.c deleted file mode 100644 index e8ea810b8d..0000000000 --- a/src/lib-charset/charset-utf8-only.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (c) 2002-2018 Dovecot authors, see the included COPYING file */ - -#include "lib.h" -#include "charset-utf8-private.h" - -struct charset_translation { - normalizer_func_t *normalizer; -}; - -static int -utf8only_charset_to_utf8_begin(const char *charset, - normalizer_func_t *normalizer, - struct charset_translation **t_r) -{ - struct charset_translation *t; - - if (!charset_is_utf8(charset)) { - /* no support for charsets that need translation */ - return -1; - } - - t = i_new(struct charset_translation, 1); - t->normalizer = normalizer; - *t_r = t; - return 0; -} - -static void utf8only_charset_to_utf8_end(struct charset_translation *t) -{ - i_free(t); -} - -static void -utf8only_charset_to_utf8_reset(struct charset_translation *t ATTR_UNUSED) -{ -} - -static enum charset_result -utf8only_charset_to_utf8(struct charset_translation *t, - const unsigned char *src, size_t *src_size, - buffer_t *dest) -{ - return charset_utf8_to_utf8(t->normalizer, src, src_size, dest); -} - -const struct charset_utf8_vfuncs charset_utf8only = { - .to_utf8_begin = utf8only_charset_to_utf8_begin, - .to_utf8_end = utf8only_charset_to_utf8_end, - .to_utf8_reset = utf8only_charset_to_utf8_reset, - .to_utf8 = utf8only_charset_to_utf8, -}; diff --git a/src/lib-charset/charset-utf8.c b/src/lib-charset/charset-utf8.c index 22038e5592..1ccd535586 100644 --- a/src/lib-charset/charset-utf8.c +++ b/src/lib-charset/charset-utf8.c @@ -7,11 +7,7 @@ #include -#ifdef HAVE_ICONV const struct charset_utf8_vfuncs *charset_utf8_vfuncs = &charset_iconv; -#else -const struct charset_utf8_vfuncs *charset_utf8_vfuncs = &charset_utf8only; -#endif bool charset_is_utf8(const char *charset) {