X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Fimap_utf7.c;h=0c3d5a20dc125e55f9e1994d96ff86ad67c3cf8c;hb=a7f2e07bcc7b132e7f007f26417775218f3fda1c;hp=b2695cdb913169338eb9672d0454578119807566;hpb=fc362fc531e0ffc898c784e09f097327f5814289;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/imap_utf7.c b/src/src/imap_utf7.c index b2695cdb9..0c3d5a20d 100644 --- a/src/src/imap_utf7.c +++ b/src/src/imap_utf7.c @@ -1,6 +1,6 @@ #include "exim.h" -#ifdef EXPERIMENTAL_INTERNATIONAL +#ifdef SUPPORT_I18N uschar * imap_utf7_encode(uschar *string, const uschar *charset, uschar sep, @@ -12,8 +12,8 @@ int ptr = 0; int size = 0; size_t slen; uschar *sptr, *yield = NULL; -int i, j; -uschar c; +int i = 0, j; /* compiler quietening */ +uschar c = 0; /* compiler quietening */ BOOL base64mode = FALSE; BOOL lastsep = FALSE; uschar utf16buf[256]; @@ -57,7 +57,7 @@ if ((icd = iconv_open("UTF-16BE", CCS charset)) == (iconv_t)-1) errno == EINVAL ? " (maybe unsupported conversion)" : ""); return NULL; } -#endif +#endif while (slen > 0) { @@ -76,7 +76,7 @@ while (slen > 0) return NULL; } #else - for (utf16ptr = utf16buf; + for (utf16ptr = utf16buf; slen > 0 && (utf16ptr - utf16buf) < sizeof(utf16buf); utf16ptr += 2, slen--, sptr++) { @@ -92,19 +92,19 @@ while (slen > 0) if ( s[0] != 0 || s[1] >= 0x7f || s[1] < 0x20 - || (strchr(specials, s[1]) && s[1] != sep) + || (Ustrchr(specials, s[1]) && s[1] != sep) ) { lastsep = FALSE; /* Encode as modified BASE64 */ - if (!base64mode) + if (!base64mode) { *outptr++ = '&'; base64mode = TRUE; i = 0; } - for (j = 0; j < 2; j++, s++) switch (i++) + for (j = 0; j < 2; j++, s++) switch (i++) { case 0: /* Top 6 bits of the first octet */ @@ -130,7 +130,7 @@ while (slen > 0) /* Encode as self (almost) */ if (base64mode) { - switch (i) + switch (i) { case 1: /* Remaining bottom 2 bits of the last octet */ @@ -165,22 +165,21 @@ while (slen > 0) 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, &size, &ptr, outbuf, outptr - outbuf); outptr = outbuf; } } - } /* End of input string */ + } /* End of input string */ -if (base64mode) +if (base64mode) { - switch (i) + switch (i) { case 1: /* Remaining bottom 2 bits of the last octet */ @@ -197,7 +196,7 @@ if (base64mode) iconv_close(icd); #endif -yield = string_cat(yield, &size, &ptr, outbuf, outptr - outbuf); +yield = string_catn(yield, &size, &ptr, outbuf, outptr - outbuf); if (yield[ptr-1] == '.') ptr--; yield[ptr] = '\0';