diff options
author | Not Zed <NotZed@HelixCode.com> | 2000-06-03 06:57:31 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2000-06-03 06:57:31 +0800 |
commit | 31642359471574aad4a8427a18692d2558c91c5c (patch) | |
tree | 5444753f00af1c370132db852c86d831b4b8d53a /camel/camel-mime-filter-smtp.c | |
parent | 1dd2867a79778abf8a91b4b5f9ffeb643f217862 (diff) | |
download | gsoc2013-evolution-31642359471574aad4a8427a18692d2558c91c5c.tar gsoc2013-evolution-31642359471574aad4a8427a18692d2558c91c5c.tar.gz gsoc2013-evolution-31642359471574aad4a8427a18692d2558c91c5c.tar.bz2 gsoc2013-evolution-31642359471574aad4a8427a18692d2558c91c5c.tar.lz gsoc2013-evolution-31642359471574aad4a8427a18692d2558c91c5c.tar.xz gsoc2013-evolution-31642359471574aad4a8427a18692d2558c91c5c.tar.zst gsoc2013-evolution-31642359471574aad4a8427a18692d2558c91c5c.zip |
Ick, damn signs! Fix a bug with sign extended bytes.
2000-06-02 Not Zed <NotZed@HelixCode.com>
* camel-mime-utils.c (base64_encode_step): Ick, damn signs! Fix a
bug with sign extended bytes.
* camel-mime-filter-smtp.c (filter): Changed layout/logic slightly
(to match From filter)
svn path=/trunk/; revision=3408
Diffstat (limited to 'camel/camel-mime-filter-smtp.c')
-rw-r--r-- | camel/camel-mime-filter-smtp.c | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/camel/camel-mime-filter-smtp.c b/camel/camel-mime-filter-smtp.c index 2b769fde72..f02a951306 100644 --- a/camel/camel-mime-filter-smtp.c +++ b/camel/camel-mime-filter-smtp.c @@ -119,32 +119,33 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s } left = inend - inptr; - if (left < 2) { - if (*inptr == '.') { - camel_mime_filter_backup (mf, inptr, left); - midline = FALSE; - inend = inptr; - break; - } - } else { - /* we only need to escape dots if they start the line */ - if (left > 0 && *inptr == '.' && *(inptr+1) != '.') { - midline = TRUE; - dotcount++; - node = alloca (sizeof (*node)); - node->type = DOT_NODE; - node->pointer = inptr; - node->next = NULL; - tail->next = node; - tail = node; - inptr++; + if (left > 0) { + midline = TRUE; + if (left < 2) { + if (*inptr == '.') { + camel_mime_filter_backup (mf, inptr, left); + midline = FALSE; + inend = inptr; + break; + } } else { - midline = TRUE; + /* we only need to escape dots if they start the line */ + if (*inptr == '.' && *(inptr+1) != '.') { + midline = TRUE; + dotcount++; + node = alloca (sizeof (*node)); + node->type = DOT_NODE; + node->pointer = inptr; + node->next = NULL; + tail->next = node; + tail = node; + inptr++; + } } + } else { + /* \n is at end of line, check next buffer */ + midline = FALSE; } - } else { - /* \n is at end of line, check next buffer */ - midline = FALSE; } } @@ -156,16 +157,13 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s inptr = in; outptr = mf->outbuf; while (node) { + g_assert(node->pointer >= inptr); + memcpy (outptr, inptr, node->pointer - inptr); + outptr += node->pointer - inptr; if (node->type == EOLN_NODE) { - memcpy (outptr, inptr, node->pointer - inptr); - outptr += node->pointer - inptr; *outptr++ = '\r'; - } else { - if (node->type == DOT_NODE) { - memcpy (outptr, inptr, node->pointer - inptr); - outptr += node->pointer - inptr; - *outptr++ = '.'; - } + } else if (node->type == DOT_NODE) { + *outptr++ = '.'; } inptr = node->pointer; node = node->next; @@ -176,7 +174,7 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s *outlen = outptr - mf->outbuf; *outprespace = mf->outbuf - mf->outreal; - d(printf ("Filtered '%.*s'\n", *outlen, *out)); + d(printf ("Filtered [%d] '%.*s'\n", *outlen, *outlen, *out)); } else { *out = in; *outlen = inend - in; |