+/* Copyright (c) University of Cambridge 1995 - 2018 */
+/* See the file NOTICE for conditions of use and distribution. */
+
#include "exim.h"
#ifdef SUPPORT_I18N
{
static uschar encode_base64[64] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,";
-int ptr = 0;
-int size = 0;
size_t slen;
-uschar *sptr, *yield = NULL;
-int i = 0, j; /* compiler quietening */
+uschar *sptr;
+gstring * yield = NULL;
+int i = 0; /* compiler quietening */
uschar c = 0; /* compiler quietening */
BOOL base64mode = FALSE;
BOOL lastsep = FALSE;
i = 0;
}
- for (j = 0; j < 2; j++, s++) switch (i++)
+ for (int j = 0; j < 2; j++, s++) switch (i++)
{
case 0:
/* Top 6 bits of the first octet */
else
{
*error = string_sprintf("imapfolder: illegal character '%c'", s[1]);
- if (yield) store_reset(yield);
return NULL;
}
if (outptr > outbuf + sizeof(outbuf) - 3)
{
- yield = string_cat(yield, &size, &ptr, outbuf, outptr - outbuf);
+ yield = string_catn(yield, outbuf, outptr - outbuf);
outptr = outbuf;
}
iconv_close(icd);
#endif
-yield = string_cat(yield, &size, &ptr, outbuf, outptr - outbuf);
-if (yield[ptr-1] == '.')
- ptr--;
-yield[ptr] = '\0';
+yield = string_catn(yield, outbuf, outptr - outbuf);
+
+if (yield->s[yield->ptr-1] == '.')
+ yield->ptr--;
-return yield;
+return string_from_gstring(yield);
}
#endif /* whole file */