comparison src/fns.c @ 24334:c56b72e5f29d

(Fbase64_encode_string): New optional argument `NO_LINE_BREAK'.
author Kenichi Handa <handa@m17n.org>
date Wed, 17 Feb 1999 08:12:31 +0000
parents 40703a998d73
children f881dd22ec7d
comparison
equal deleted inserted replaced
24333:03cf9e15c988 24334:c56b72e5f29d
2895 /* We return the length of the encoded text. */ 2895 /* We return the length of the encoded text. */
2896 return make_number (encoded_length); 2896 return make_number (encoded_length);
2897 } 2897 }
2898 2898
2899 DEFUN ("base64-encode-string", Fbase64_encode_string, Sbase64_encode_string, 2899 DEFUN ("base64-encode-string", Fbase64_encode_string, Sbase64_encode_string,
2900 1, 1, 0, 2900 1, 2, 0,
2901 "Base64-encode STRING and return the result.") 2901 "Base64-encode STRING and return the result.\n\
2902 (string) 2902 Optional second argument NO-LINE-BREAK means do not break long lines\n\
2903 into shorter lines.")
2904 (string, no_line_break)
2903 Lisp_Object string; 2905 Lisp_Object string;
2904 { 2906 {
2905 int allength, length, encoded_length; 2907 int allength, length, encoded_length;
2906 char *encoded; 2908 char *encoded;
2907 Lisp_Object encoded_string; 2909 Lisp_Object encoded_string;
2916 encoded = (char *) alloca (allength); 2918 encoded = (char *) alloca (allength);
2917 else 2919 else
2918 encoded = (char *) xmalloc (allength); 2920 encoded = (char *) xmalloc (allength);
2919 2921
2920 encoded_length = base64_encode_1 (XSTRING (string)->data, 2922 encoded_length = base64_encode_1 (XSTRING (string)->data,
2921 encoded, length, 0); 2923 encoded, length, NILP (no_line_break));
2922 if (encoded_length > allength) 2924 if (encoded_length > allength)
2923 abort (); 2925 abort ();
2924 2926
2925 encoded_string = make_unibyte_string (encoded, encoded_length); 2927 encoded_string = make_unibyte_string (encoded, encoded_length);
2926 if (allength > MAX_ALLOCA) 2928 if (allength > MAX_ALLOCA)