Ralf Wildenhues <[EMAIL PROTECTED]> writes: > - *out++ = b64str[to_uchar (in[0]) >> 2]; > + *out++ = b64str[(to_uchar (in[0]) >> 2) & 0x3f];
This change doesn't feel right to me. It is ignoring the fact that the input to base64_encode is invalid. The input is invalid because base64_encode is supposed to encode a series of octets, and you are working around the problem that the input is not a series of octets. You could change the interface so that base64_encode returns a boolean, indicating encoding failure. Another possibility, which probably makes more sense, is to simply say that CHAR_BIT must be 8. In reference code, you can check this as follows: #if CHAR_BIT != 8 #error "This code assumes that CHAR_BIT is 8." #endif POSIX already assumes CHAR_BIT is 8, so you're on pretty safe grounds nowadays if you assume it. It's not worth going to a lot of effort worrying about non-8-bit hosts. I'm sure there are other bugs in base64.c in this area, and we don't have time to scan for them. _______________________________________________ bug-gnulib mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-gnulib
