diff options
Diffstat (limited to 'camel/camel-mime-filter-basic.c')
-rw-r--r-- | camel/camel-mime-filter-basic.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/camel/camel-mime-filter-basic.c b/camel/camel-mime-filter-basic.c index 5e2b9f5107..efb9b9818e 100644 --- a/camel/camel-mime-filter-basic.c +++ b/camel/camel-mime-filter-basic.c @@ -54,7 +54,6 @@ camel_mime_filter_basic_init (CamelMimeFilterBasic *obj) { obj->state = 0; obj->save = 0; - obj->uulen = 0; } @@ -82,9 +81,6 @@ reset(CamelMimeFilter *mf) { CamelMimeFilterBasic *f = (CamelMimeFilterBasic *)mf; - f->uu_begin = FALSE; - f->uulen = 0; - switch(f->type) { case CAMEL_MIME_FILTER_BASIC_QP_ENC: f->state = -1; @@ -117,8 +113,7 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, case CAMEL_MIME_FILTER_BASIC_UU_ENC: /* won't go to more than 2 * (x + 2) + 62 */ camel_mime_filter_set_size (mf, (len + 2) * 2 + 62, FALSE); - newlen = uuencode_close (in, len, mf->outbuf, f->uubuf, &f->state, - &f->save, &f->uulen); + newlen = uuencode_close (in, len, mf->outbuf, f->uubuf, &f->state, &f->save); g_assert (newlen <= (len + 2) * 2 + 62); break; case CAMEL_MIME_FILTER_BASIC_BASE64_DEC: @@ -134,10 +129,10 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, g_assert(newlen <= len+2); break; case CAMEL_MIME_FILTER_BASIC_UU_DEC: - if (f->uu_begin) { + if ((f->state & CAMEL_UUDECODE_STATE_BEGIN) && !(f->state & CAMEL_UUDECODE_STATE_END)) { /* "begin <mode> <filename>\n" has been found, so we can now start decoding */ camel_mime_filter_set_size (mf, len + 3, FALSE); - newlen = uudecode_step (in, len, mf->outbuf, &f->state, &f->save, &f->uulen); + newlen = uudecode_step (in, len, mf->outbuf, &f->state, &f->save); } else { newlen = 0; } @@ -181,7 +176,7 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s case CAMEL_MIME_FILTER_BASIC_UU_ENC: /* won't go to more than 2 * (x + 2) + 62 */ camel_mime_filter_set_size (mf, (len + 2) * 2 + 62, FALSE); - newlen = uuencode_step (in, len, mf->outbuf, f->uubuf, &f->state, &f->save, &f->uulen); + newlen = uuencode_step (in, len, mf->outbuf, f->uubuf, &f->state, &f->save); g_assert (newlen <= (len + 2) * 2 + 62); break; case CAMEL_MIME_FILTER_BASIC_BASE64_DEC: @@ -197,7 +192,7 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s g_assert(newlen <= len + 2); break; case CAMEL_MIME_FILTER_BASIC_UU_DEC: - if (!f->uu_begin) { + if (!(f->state & CAMEL_UUDECODE_STATE_BEGIN)) { register char *inptr, *inend; size_t left; @@ -214,7 +209,7 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s for (in = inptr; inptr < inend && *inptr != '\n'; inptr++); if (inptr < inend) { inptr++; - f->uu_begin = TRUE; + f->state |= CAMEL_UUDECODE_STATE_BEGIN; /* we can start uudecoding... */ in = inptr; len = inend - in; @@ -232,10 +227,10 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s } } - if (f->uu_begin) { + if ((f->state & CAMEL_UUDECODE_STATE_BEGIN) && !(f->state & CAMEL_UUDECODE_STATE_END)) { /* "begin <mode> <filename>\n" has been found, so we can now start decoding */ camel_mime_filter_set_size (mf, len + 3, FALSE); - newlen = uudecode_step (in, len, mf->outbuf, &f->state, &f->save, &f->uulen); + newlen = uudecode_step (in, len, mf->outbuf, &f->state, &f->save); } else { newlen = 0; } |