From: Kenichi Handa Date: Thu, 22 Aug 2002 01:18:39 +0000 (+0000) Subject: (base64_encode_1): Handle eight-bit chars correctly. X-Git-Tag: emacs-pretest-23.0.90~8295^2~1864^2~393 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=680d4b87f3d88a8b79f883cf3635036747588250;p=emacs.git (base64_encode_1): Handle eight-bit chars correctly. --- diff --git a/src/fns.c b/src/fns.c index 2a442816405..5865cdf1a93 100644 --- a/src/fns.c +++ b/src/fns.c @@ -3047,7 +3047,9 @@ base64_encode_1 (from, to, length, line_break, multibyte) if (multibyte) { c = STRING_CHAR_AND_LENGTH (from + i, length - i, bytes); - if (c >= 256) + if (CHAR_BYTE8_P (c)) + c = CHAR_TO_BYTE8 (c); + else if (c >= 256) return -1; i += bytes; } @@ -3085,7 +3087,9 @@ base64_encode_1 (from, to, length, line_break, multibyte) if (multibyte) { c = STRING_CHAR_AND_LENGTH (from + i, length - i, bytes); - if (c >= 256) + if (CHAR_BYTE8_P (c)) + c = CHAR_TO_BYTE8 (c); + else if (c >= 256) return -1; i += bytes; } @@ -3107,7 +3111,9 @@ base64_encode_1 (from, to, length, line_break, multibyte) if (multibyte) { c = STRING_CHAR_AND_LENGTH (from + i, length - i, bytes); - if (c >= 256) + if (CHAR_BYTE8_P (c)) + c = CHAR_TO_BYTE8 (c); + else if (c >= 256) return -1; i += bytes; }