]> granicus.if.org Git - neomutt/commit
refactor: create a generic base64 encode/decode
authorDamien Riegel <damien.riegel@savoirfairelinux.com>
Sun, 5 Feb 2017 01:51:17 +0000 (20:51 -0500)
committerRichard Russon <rich@flatcap.org>
Fri, 10 Feb 2017 03:22:57 +0000 (03:22 +0000)
commit69c579ed9e8e845b286c3f7a291ea5fba5101d60
tree702ffb3c6020f2c1dbe5a659130e218f7627525c
parent605ca67e5e808d28b72f02fceb70c0850b24c32f
refactor: create a generic base64 encode/decode

- make sendlib use generic base64 encode function

Sendlib had its own implementation for base64 encoding, so change it to
make use of the generic one defined in base64.c. While we're at it, move
the B64Chars where it belongs, and remove some global variables by
creating a b64_context structure to hold all necessary information.

- make rfc2047 use generic base64 encode function

This was another source of a custom base64 encode function. Let's keep
the same logic as before: encode 3 bytes (or less) at a time. Also,
switch from a `for` to a `while` loop as `dlen` can simply be used as a
stop condition.

- B64Chars can now be made static to base64.c.

closes #360
base64.c
mime.h
rfc2047.c
sendlib.c