commit 2125dc4: [Minor] Remove legacy iconv stuff
Vsevolod Stakhov
vsevolod at highsecure.ru
Sat May 15 20:28:04 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-05-15 21:22:37 +0100
URL: https://github.com/rspamd/rspamd/commit/2125dc455412385a2fd3d2fa9fdd7c0e08454b74 (HEAD -> master)
[Minor] Remove legacy iconv stuff
---
CMakeLists.txt | 16 ----------------
src/libmime/mime_encoding.c | 16 ++++++++--------
src/libmime/mime_encoding.h | 2 +-
3 files changed, 9 insertions(+), 25 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b53793008..5f12ae437 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,7 +42,6 @@ ENDIF(NOT RSPAMD_USER)
# Default for SysV Init
SET(RSPAMD_WORKER_NORMAL "*:11333")
SET(RSPAMD_WORKER_CONTROLLER "*:11334")
-SET_PROPERTY(GLOBAL PROPERTY ALLOW_DUPLICATE_CUSTOM_TARGETS 1)
############################# OPTIONS SECTION #############################################
OPTION(ENABLE_LUAJIT "Link with libluajit [default: ON]" ON)
@@ -336,21 +335,6 @@ CHECK_C_SOURCE_COMPILES(
return timezone;
}" HAVE_SANE_TZSET)
-IF(WITH_ICONV)
- CHECK_C_SOURCE_COMPILES("
-#include <iconv.h>
-int main(){
- iconv_t conv = 0;
- const char* in = 0;
- size_t ilen = 0;
- char* out = 0;
- size_t olen = 0;
- iconv(conv, &in, &ilen, &out, &olen);
- return 0;
-}
-" ICONV_SECOND_ARGUMENT_IS_CONST)
-ENDIF(WITH_ICONV)
-
# Check macros
CHECK_SYMBOL_EXISTS(PATH_MAX limits.h HAVE_PATH_MAX)
CHECK_SYMBOL_EXISTS(MAXPATHLEN sys/param.h HAVE_MAXPATHLEN)
diff --git a/src/libmime/mime_encoding.c b/src/libmime/mime_encoding.c
index 3f79465e4..edbee1a30 100644
--- a/src/libmime/mime_encoding.c
+++ b/src/libmime/mime_encoding.c
@@ -82,9 +82,9 @@ struct rspamd_charset_converter {
};
static GQuark
-rspamd_iconv_error_quark (void)
+rspamd_charset_conv_error_quark (void)
{
- return g_quark_from_static_string ("iconv error");
+ return g_quark_from_static_string ("charset conversion error");
}
static void
@@ -354,7 +354,7 @@ rspamd_mime_text_to_utf8 (rspamd_mempool_t *pool,
utf8_converter = rspamd_get_utf8_converter ();
if (conv == NULL) {
- g_set_error (err, rspamd_iconv_error_quark (), EINVAL,
+ g_set_error (err, rspamd_charset_conv_error_quark(), EINVAL,
"cannot open converter for %s: %s",
in_enc, u_errorName (uc_err));
@@ -366,7 +366,7 @@ rspamd_mime_text_to_utf8 (rspamd_mempool_t *pool,
r = rspamd_converter_to_uchars (conv, tmp_buf, len + 1, input, len, &uc_err);
if (!U_SUCCESS (uc_err)) {
- g_set_error (err, rspamd_iconv_error_quark (), EINVAL,
+ g_set_error (err, rspamd_charset_conv_error_quark(), EINVAL,
"cannot convert data to unicode from %s: %s",
in_enc, u_errorName (uc_err));
g_free (tmp_buf);
@@ -381,7 +381,7 @@ rspamd_mime_text_to_utf8 (rspamd_mempool_t *pool,
r = ucnv_fromUChars (utf8_converter, d, dlen, tmp_buf, r, &uc_err);
if (!U_SUCCESS (uc_err)) {
- g_set_error (err, rspamd_iconv_error_quark (), EINVAL,
+ g_set_error (err, rspamd_charset_conv_error_quark(), EINVAL,
"cannot convert data from unicode from %s: %s",
in_enc, u_errorName (uc_err));
g_free (tmp_buf);
@@ -419,7 +419,7 @@ rspamd_mime_text_part_utf8_convert (struct rspamd_task *task,
utf8_converter = rspamd_get_utf8_converter ();
if (conv == NULL) {
- g_set_error (err, rspamd_iconv_error_quark (), EINVAL,
+ g_set_error (err, rspamd_charset_conv_error_quark(), EINVAL,
"cannot open converter for %s: %s",
charset, u_errorName (uc_err));
@@ -436,7 +436,7 @@ rspamd_mime_text_part_utf8_convert (struct rspamd_task *task,
&uc_err);
if (!U_SUCCESS (uc_err)) {
- g_set_error (err, rspamd_iconv_error_quark (), EINVAL,
+ g_set_error (err, rspamd_charset_conv_error_quark(), EINVAL,
"cannot convert data to unicode from %s: %s",
charset, u_errorName (uc_err));
g_free (tmp_buf);
@@ -452,7 +452,7 @@ rspamd_mime_text_part_utf8_convert (struct rspamd_task *task,
tmp_buf, uc_len, &uc_err);
if (!U_SUCCESS (uc_err)) {
- g_set_error (err, rspamd_iconv_error_quark (), EINVAL,
+ g_set_error (err, rspamd_charset_conv_error_quark(), EINVAL,
"cannot convert data from unicode from %s: %s",
charset, u_errorName (uc_err));
g_free (tmp_buf);
diff --git a/src/libmime/mime_encoding.h b/src/libmime/mime_encoding.h
index 56216b46c..c7b387ef0 100644
--- a/src/libmime/mime_encoding.h
+++ b/src/libmime/mime_encoding.h
@@ -31,7 +31,7 @@ struct rspamd_mime_text_part;
struct rspamd_charset_converter;
/**
- * Convert charset to a valid iconv charset
+ * Convert charset alias to a canonic charset name
* @param pool pool to store temporary data
* @param in
* @return
More information about the Commits
mailing list