*************************************************/
/* Copyright (c) University of Cambridge 1995 - 2018 */
+/* Copyright (c) The Exim Maintainers 2020 - 2021 */
/* See the file NOTICE for conditions of use and distribution. */
/* This file contains a function for decoding message header lines that may
*/
uschar *
-rfc2047_decode2(uschar *string, BOOL lencheck, uschar *target, int zeroval,
- int *lenptr, int *sizeptr, uschar **error)
+rfc2047_decode2(uschar *string, BOOL lencheck, const uschar *target,
+ int zeroval, int *lenptr, int *sizeptr, uschar **error)
{
int size = Ustrlen(string);
size_t dlen;
#if HAVE_ICONV
*q1 = 0;
- if (target != NULL && strcmpic(target, mimeword+2) != 0)
- {
- icd = iconv_open(CS target, CS(mimeword+2));
-
- if (icd == (iconv_t)(-1))
- {
+ if (target && strcmpic(target, mimeword+2) != 0)
+ if ((icd = iconv_open(CS target, CS(mimeword+2))) == (iconv_t)-1)
*error = string_sprintf("iconv_open(\"%s\", \"%s\") failed: %s%s",
target, mimeword+2, strerror(errno),
(errno == EINVAL)? " (maybe unsupported conversion)" : "");
- }
- }
*q1 = '?';
#endif
argument. */
uschar *
-rfc2047_decode(uschar *string, BOOL lencheck, uschar *target, int zeroval,
+rfc2047_decode(uschar *string, BOOL lencheck, const uschar *target, int zeroval,
int *lenptr, uschar **error)
{
return rfc2047_decode2(string, lencheck, target, zeroval, lenptr, NULL, error);