diff options
| author | Kenichi Handa | 1999-03-04 11:35:42 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1999-03-04 11:35:42 +0000 |
| commit | 7f8a0840756e1f3d00c3675f000b169a109652ce (patch) | |
| tree | 6fd7a589f3cb28158e00f21e2db6c133a5913c3c /src | |
| parent | e4a225a97d066b069417d4e0f0e382ca63eb51e0 (diff) | |
| download | emacs-7f8a0840756e1f3d00c3675f000b169a109652ce.tar.gz emacs-7f8a0840756e1f3d00c3675f000b169a109652ce.zip | |
(Fbase64_encode_string): Allocate sufficient memory for
newlines added when the arg NO-LINE-BREAK is nil.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 6 |
1 files changed, 5 insertions, 1 deletions
| @@ -2910,8 +2910,12 @@ into shorter lines.") | |||
| 2910 | 2910 | ||
| 2911 | CHECK_STRING (string, 1); | 2911 | CHECK_STRING (string, 1); |
| 2912 | 2912 | ||
| 2913 | /* We need to allocate enough room for encoding the text. | ||
| 2914 | We need 33 1/3% more space, plus a newline every 76 | ||
| 2915 | characters, and then we round up. */ | ||
| 2913 | length = STRING_BYTES (XSTRING (string)); | 2916 | length = STRING_BYTES (XSTRING (string)); |
| 2914 | allength = length + length/3 + 1 + 6; | 2917 | allength = length + length/3 + 1; |
| 2918 | allength += allength / MIME_LINE_LENGTH + 1 + 6; | ||
| 2915 | 2919 | ||
| 2916 | /* We need to allocate enough room for decoding the text. */ | 2920 | /* We need to allocate enough room for decoding the text. */ |
| 2917 | if (allength <= MAX_ALLOCA) | 2921 | if (allength <= MAX_ALLOCA) |