changeset 24437:8a9d8919ebe8

(Fbase64_encode_string): Allocate sufficient memory for newlines added when the arg NO-LINE-BREAK is nil.
author Kenichi Handa <handa@m17n.org>
date Thu, 04 Mar 1999 11:35:42 +0000
parents e5af0407bcd6
children 4a78f6354310
files src/fns.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/fns.c	Thu Mar 04 11:34:47 1999 +0000
+++ b/src/fns.c	Thu Mar 04 11:35:42 1999 +0000
@@ -2910,8 +2910,12 @@
 
   CHECK_STRING (string, 1);
 
+  /* We need to allocate enough room for encoding the text.
+     We need 33 1/3% more space, plus a newline every 76
+     characters, and then we round up. */
   length = STRING_BYTES (XSTRING (string));
-  allength = length + length/3 + 1 + 6;
+  allength = length + length/3 + 1;
+  allength += allength / MIME_LINE_LENGTH + 1 + 6;
 
   /* We need to allocate enough room for decoding the text. */
   if (allength <= MAX_ALLOCA)