X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=rfc2047e.c;h=e6f8f32bcc4913b5d0d1800dd69197f273f11699;hb=d31db10231e9ed89f64fdf6e0fb7cae182aa377e;hp=fd6ae2bc0f024e14bdd410fcfa2d25b8d709245f;hpb=c3e52ea6ca3178b7ecab4b389a9ba9269662b48f;p=~andy%2Ffetchmail diff --git a/rfc2047e.c b/rfc2047e.c index fd6ae2bc..e6f8f32b 100644 --- a/rfc2047e.c +++ b/rfc2047e.c @@ -17,7 +17,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif #include "fetchmail.h" #include @@ -52,7 +54,7 @@ static char *encode_words(char *const *words, int nwords, const char *charset) l += strlen(words[i]) * 3; /* worst case, encode everything */ l += (strlen(charset) + 8) * (l/60 + 1); - out = v = xmalloc(l); + out = v = (char *)xmalloc(l); t = stpcpy(out, "=?"); t = stpcpy(t, charset); t = stpcpy(t, "?Q?"); @@ -110,14 +112,14 @@ char *rfc2047e(const char *string, const char *charset) { r = string; while (*r) { l = strcspn(r, ws); - words[idx] = xmalloc(l+1); + words[idx] = (char *)xmalloc(l+1); memcpy(words[idx], r, l); words[idx][l] = '\0'; idx++; r += l; if (!*r) break; l = strspn(r, ws); - words[idx] = xmalloc(l+1); + words[idx] = (char *)xmalloc(l+1); memcpy(words[idx], r, l); words[idx][l] = '\0'; idx++; @@ -157,7 +159,7 @@ char *rfc2047e(const char *string, const char *charset) { /* phase 3: limit lengths */ minlen = strlen(charset) + 7; /* allocate ample memory */ - out = xmalloc(l + (l / (72 - minlen) + 1) * (minlen + 2) + 1); + out = (char *)xmalloc(l + (l / (72 - minlen) + 1) * (minlen + 2) + 1); if (count) t = stpcpy(out, words[0]); @@ -174,7 +176,7 @@ char *rfc2047e(const char *string, const char *charset) { if (i + 1 < count) m += strcspn(words[i+1], "\r\n"); if (l + m > 74) - l = 0, t = stpcpy(t, "\r\n"); + t = stpcpy(t, "\r\n"); t = stpcpy(t, words[i]); if (i + 1 < count) { t = stpcpy(t, words[i+1]);