Hi Peter and everyone,
I'm trying to justify the following patch that was made from 2.3.1 to
2.3.0 to the Debian release managers who are now reviewing
2.3.0-1sarge2.
Is the following fix absolutely essential for external address support
to work with Balsa 2.3.0?
Cheers,
Andrew Lau
diff -ruN balsa-2.3.0.orig/libbalsa/address-book-ldif.c balsa-2.3.0/libbalsa/address-book-ldif.c
--- balsa-2.3.0.orig/libbalsa/address-book-ldif.c 2005-02-07 14:03:03.000000000 +1100
+++ balsa-2.3.0/libbalsa/address-book-ldif.c 2005-05-13 01:54:43.000000000 +1000
@@ -228,15 +228,17 @@
/* raw bytes to null-terminated base 64 string */
static void
-string_to_base64(unsigned char *out, const unsigned char *in, size_t len,
- size_t olen)
+string_to_base64(char *out, const char *in, size_t len, size_t olen)
{
+ unsigned char in0, in1, in2;
+
while (len >= 3 && olen > 10)
{
- *out++ = B64Chars[in[0] >> 2];
- *out++ = B64Chars[((in[0] << 4) & 0x30) | (in[1] >> 4)];
- *out++ = B64Chars[((in[1] << 2) & 0x3c) | (in[2] >> 6)];
- *out++ = B64Chars[in[2] & 0x3f];
+ in0 = in[0]; in1 = in[1]; in2 = in[2];
+ *out++ = B64Chars[in0 >> 2];
+ *out++ = B64Chars[((in0 << 4) & 0x30) | (in1 >> 4)];
+ *out++ = B64Chars[((in1 << 2) & 0x3c) | (in2 >> 6)];
+ *out++ = B64Chars[in2 & 0x3f];
olen -= 4;
len -= 3;
in += 3;
@@ -247,12 +249,18 @@
{
unsigned char fragment;
- *out++ = B64Chars[in[0] >> 2];
- fragment = (in[0] << 4) & 0x30;
- if (len > 1)
- fragment |= in[1] >> 4;
- *out++ = B64Chars[fragment];
- *out++ = (len < 2) ? '=' : B64Chars[(in[1] << 2) & 0x3c];
+ in0 = in[0];
+ *out++ = B64Chars[in0 >> 2];
+ fragment = (in0 << 4) & 0x30;
+ if (len > 1) {
+ in1 = in[1];
+ fragment |= in1 >> 4;
+ *out++ = B64Chars[fragment];
+ *out++ = B64Chars[(in1 << 2) & 0x3c];
+ } else {
+ *out++ = B64Chars[fragment];
+ *out++ = '=';
+ }
*out++ = '=';
}
*out = '\0';
--
---------------------------------------------------------------------------
Andrew "Netsnipe" Lau <http://www.cse.unsw.edu.au/~alau/>
Debian GNU/Linux Maintainer & Computer Science, UNSW
-
"Nobody expects the Debian Inquisition!
Our two weapons are fear and surprise...and ruthless efficiency!"
---------------------------------------------------------------------------
Attachment:
signature.asc
Description: Digital signature