aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2000-06-03 06:57:31 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-06-03 06:57:31 +0800
commit31642359471574aad4a8427a18692d2558c91c5c (patch)
tree5444753f00af1c370132db852c86d831b4b8d53a /camel
parent1dd2867a79778abf8a91b4b5f9ffeb643f217862 (diff)
downloadgsoc2013-evolution-31642359471574aad4a8427a18692d2558c91c5c.tar.gz
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')
-rw-r--r--camel/ChangeLog8
-rw-r--r--camel/camel-mime-filter-smtp.c62
-rw-r--r--camel/camel-mime-utils.c6
3 files changed, 41 insertions, 35 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index a3b614049f..92bd478802 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,11 @@
+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)
+
2000-06-02 Jeffrey Stedfast <fejj@helixcode.com>
* camel-mime-filter-smtp.c (filter): Fixed the filter so that it wouldn't
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;
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index c893c10050..ae4b0820b8 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -298,9 +298,9 @@ base64_encode_step(unsigned char *in, int len, unsigned char *out, int *state, i
already = *state;
switch (((char *)save)[0]) {
- case 1: c1 = ((char *)save)[1]; goto skip1;
- case 2: c1 = ((char *)save)[1];
- c2 = ((char *)save)[2]; goto skip2;
+ case 1: c1 = ((unsigned char *)save)[1]; goto skip1;
+ case 2: c1 = ((unsigned char *)save)[1];
+ c2 = ((unsigned char *)save)[2]; goto skip2;
}
/* yes, we jump into the loop, no i'm not going to change it, its beautiful! */