From 26f1d04d35245fa23b469f2629d9564701ef4182 Mon Sep 17 00:00:00 2001 From: Michael Zucci Date: Thu, 31 Aug 2000 01:49:21 +0000 Subject: (append_latin1): Do an additional mask for account for c's undefined behaviour for sign extension whilst shifting right. svn path=/trunk/; revision=5129 --- camel/ChangeLog | 2 ++ camel/camel-mime-utils.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index de5d145e77..6c587fe801 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -5,6 +5,8 @@ us-ascii. We just have to encode high chars into utf-8. (header_decode_text): Call append_latin1 for appending unencoded text segments. + (append_latin1): Do an additional mask for account for c's + undefined behaviour for sign extension whilst shifting right. 2000-08-30 Jeffrey Stedfast diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 193d9d00c5..749c968279 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -927,7 +927,7 @@ append_latin1(GString *out, const char *in, int len) c = (unsigned int)*in++; len--; if (c & 0x80) { - out = g_string_append_c(out, 0xc0 | (c>>6)); /* 110000xx */ + out = g_string_append_c(out, 0xc0 | ((c>>6) & 0x3)); /* 110000xx */ out = g_string_append_c(out, 0x80 | (c&0x3f)); /* 10xxxxxx */ } else { out = g_string_append_c(out, c); -- cgit v1.2.3