-/* $Cambridge: exim/src/src/rfc2047.c,v 1.6 2010/06/07 00:12:42 pdp Exp $ */
-
/*************************************************
* Exim - an Internet mail transport agent *
*************************************************/
-/* Copyright (c) University of Cambridge 1995 - 2009 */
+/* Copyright (c) University of Cambridge 1995 - 2015 */
/* See the file NOTICE for conditions of use and distribution. */
/* This file contains a function for decoding message header lines that may
while (*string != 0)
{
- register int ch = *string++;
+ int ch = *string++;
if (ch == '_') *ptr++ = ' ';
else if (ch == '=')
encoding = toupper((*q1ptr)[1]);
**endptr = 0;
if (encoding == 'B')
- dlen = auth_b64decode(*q2ptr+1, dptrptr);
+ dlen = b64decode(*q2ptr+1, dptrptr);
else if (encoding == 'Q')
dlen = rfc2047_qpdecode(*q2ptr+1, dptrptr);
**endptr = '?'; /* restore */
*error = NULL;
mimeword = decode_mimeword(string, lencheck, &q1, &q2, &endword, &dlen, &dptr);
-if (mimeword == NULL)
+if (!mimeword)
{
- if (lenptr != NULL) *lenptr = size;
+ if (lenptr) *lenptr = size;
return string;
}
yield = store_get(++size);
-while (mimeword != NULL)
+while (mimeword)
{
#if HAVE_ICONV
#endif
if (mimeword != string)
- yield = string_cat(yield, &size, &ptr, string, mimeword - string);
+ yield = string_catn(yield, &size, &ptr, string, mimeword - string);
/* Do a charset translation if required. This is supported only on hosts
that have the iconv() function. Translation errors set error, but carry on,
/* Add the new string onto the result */
- yield = string_cat(yield, &size, &ptr, tptr, tlen);
+ yield = string_catn(yield, &size, &ptr, tptr, tlen);
}
#if HAVE_ICONV
string = endword + 2;
mimeword = decode_mimeword(string, lencheck, &q1, &q2, &endword, &dlen, &dptr);
- if (mimeword != NULL)
+ if (mimeword)
{
uschar *s = string;
while (isspace(*s)) s++;
/* Copy the remaining characters of the string, zero-terminate it, and return
the length as well if requested. */
-yield = string_cat(yield, &size, &ptr, string, Ustrlen(string));
+yield = string_cat(yield, &size, &ptr, string);
yield[ptr] = 0;
-if (lenptr != NULL) *lenptr = ptr;
-if (sizeptr != NULL) *sizeptr = size;
+if (lenptr) *lenptr = ptr;
+if (sizeptr) *sizeptr = size;
return yield;
}