diff options
| author | Eli Zaretskii | 2019-06-08 11:14:31 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2019-06-08 11:14:31 +0300 |
| commit | 1cc90d21d6e1aa21ab99d163796b41920b413ac7 (patch) | |
| tree | 21cdaa9bd77ab857b45c6a8c8bb149a64edaa3b0 /src | |
| parent | 468e7fb5d44af1cf7b2e16de398cf9dd73e6dc93 (diff) | |
| download | emacs-1cc90d21d6e1aa21ab99d163796b41920b413ac7.tar.gz emacs-1cc90d21d6e1aa21ab99d163796b41920b413ac7.zip | |
Minor fixes for the last commits
* src/fns.c (Fbase64url_encode_region)
(Fbase64url_encode_string, Fbase64_decode_region)
(Fbase64_decode_string): Fix doc strings.
(base64_decode_1): Minor stylistic code changes.
* doc/lispref/text.texi (Base 64): Fix typos and improve
wording of the last committed text.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 30 |
1 files changed, 11 insertions, 19 deletions
| @@ -3317,7 +3317,7 @@ DEFUN ("base64url-encode-region", Fbase64url_encode_region, Sbase64url_encode_re | |||
| 3317 | Return the length of the encoded text. | 3317 | Return the length of the encoded text. |
| 3318 | Optional second argument NO-PAD means do not add padding char =. | 3318 | Optional second argument NO-PAD means do not add padding char =. |
| 3319 | 3319 | ||
| 3320 | This is the variant defined in RFC4648. */) | 3320 | This produces the URL variant of base 64 encoding defined in RFC 4648. */) |
| 3321 | (Lisp_Object beg, Lisp_Object end, Lisp_Object no_pad) | 3321 | (Lisp_Object beg, Lisp_Object end, Lisp_Object no_pad) |
| 3322 | { | 3322 | { |
| 3323 | return base64_encode_region_1(beg, end, false, NILP(no_pad), true); | 3323 | return base64_encode_region_1(beg, end, false, NILP(no_pad), true); |
| @@ -3396,7 +3396,7 @@ DEFUN ("base64url-encode-string", Fbase64url_encode_string, Sbase64url_encode_st | |||
| 3396 | doc: /* Base64url-encode STRING and return the result. | 3396 | doc: /* Base64url-encode STRING and return the result. |
| 3397 | Optional second argument NO-PAD means do not add padding char =. | 3397 | Optional second argument NO-PAD means do not add padding char =. |
| 3398 | 3398 | ||
| 3399 | This is the variant defined in RFC4648. */) | 3399 | This produces the URL variant of base 64 encoding defined in RFC 4648. */) |
| 3400 | (Lisp_Object string, Lisp_Object no_pad) | 3400 | (Lisp_Object string, Lisp_Object no_pad) |
| 3401 | { | 3401 | { |
| 3402 | 3402 | ||
| @@ -3553,8 +3553,8 @@ DEFUN ("base64-decode-region", Fbase64_decode_region, Sbase64_decode_region, | |||
| 3553 | doc: /* Base64-decode the region between BEG and END. | 3553 | doc: /* Base64-decode the region between BEG and END. |
| 3554 | Return the length of the decoded text. | 3554 | Return the length of the decoded text. |
| 3555 | If the region can't be decoded, signal an error and don't modify the buffer. | 3555 | If the region can't be decoded, signal an error and don't modify the buffer. |
| 3556 | Optional third argument BASE64URL define if base64Url variant will be used | 3556 | Optional third argument BASE64URL determines whether to use the URL variant |
| 3557 | see RFC4648. */) | 3557 | of the base 64 encoding, as defined in RFC 4648. */) |
| 3558 | (Lisp_Object beg, Lisp_Object end, Lisp_Object base64url) | 3558 | (Lisp_Object beg, Lisp_Object end, Lisp_Object base64url) |
| 3559 | { | 3559 | { |
| 3560 | ptrdiff_t ibeg, iend, length, allength; | 3560 | ptrdiff_t ibeg, iend, length, allength; |
| @@ -3615,9 +3615,9 @@ see RFC4648. */) | |||
| 3615 | 3615 | ||
| 3616 | DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string, | 3616 | DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string, |
| 3617 | 1, 2, 0, | 3617 | 1, 2, 0, |
| 3618 | doc: /* Base64-decode STRING and return the result | 3618 | doc: /* Base64-decode STRING and return the result as a string. |
| 3619 | Optional argument BASE64URL define if base64Url variant will be used | 3619 | Optional argument BASE64URL determines whether to use the URL variant of |
| 3620 | see RFC4648. */) | 3620 | the base 64 encoding, as defined in RFC 4648. */) |
| 3621 | (Lisp_Object string, Lisp_Object base64url) | 3621 | (Lisp_Object string, Lisp_Object base64url) |
| 3622 | { | 3622 | { |
| 3623 | char *decoded; | 3623 | char *decoded; |
| @@ -3693,13 +3693,9 @@ base64_decode_1 (const char *from, char *to, ptrdiff_t length, | |||
| 3693 | /* Process third byte of a quadruplet. */ | 3693 | /* Process third byte of a quadruplet. */ |
| 3694 | 3694 | ||
| 3695 | if (!base64url) | 3695 | if (!base64url) |
| 3696 | { | 3696 | READ_QUADRUPLET_BYTE (-1); |
| 3697 | READ_QUADRUPLET_BYTE (-1); | ||
| 3698 | } | ||
| 3699 | else | 3697 | else |
| 3700 | { | 3698 | READ_QUADRUPLET_BYTE (e-to); |
| 3701 | READ_QUADRUPLET_BYTE (e-to); | ||
| 3702 | } | ||
| 3703 | 3699 | ||
| 3704 | if (c == '=') | 3700 | if (c == '=') |
| 3705 | { | 3701 | { |
| @@ -3724,13 +3720,9 @@ base64_decode_1 (const char *from, char *to, ptrdiff_t length, | |||
| 3724 | /* Process fourth byte of a quadruplet. */ | 3720 | /* Process fourth byte of a quadruplet. */ |
| 3725 | 3721 | ||
| 3726 | if (!base64url) | 3722 | if (!base64url) |
| 3727 | { | 3723 | READ_QUADRUPLET_BYTE (-1); |
| 3728 | READ_QUADRUPLET_BYTE (-1); | ||
| 3729 | } | ||
| 3730 | else | 3724 | else |
| 3731 | { | 3725 | READ_QUADRUPLET_BYTE (e-to); |
| 3732 | READ_QUADRUPLET_BYTE (e-to); | ||
| 3733 | } | ||
| 3734 | 3726 | ||
| 3735 | if (c == '=') | 3727 | if (c == '=') |
| 3736 | continue; | 3728 | continue; |