X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=base64.c;h=69ae3a73cc7d768ace1d36ea0030e16f4c940b5d;hp=4e632922d20dcdcd3fcb752180dd078ec3d2f411;hb=4b1dc0d42a3165db9201ba40af9ad041f33333a5;hpb=f404a0ca916be07049af51a3022baaaaab94def6 diff --git a/base64.c b/base64.c index 4e63292..69ae3a7 100644 --- a/base64.c +++ b/base64.c @@ -13,8 +13,8 @@ * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111, USA. + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. * */ @@ -50,22 +50,20 @@ /* raw bytes to null-terminated base 64 string */ void mutt_to_base64 (unsigned char *out, const unsigned char *in, size_t len, - size_t olen) + size_t olen) { - while (len >= 3 && olen > 10) - { + while (len >= 3 && olen > 10) { *out++ = B64Chars[in[0] >> 2]; *out++ = B64Chars[((in[0] << 4) & 0x30) | (in[1] >> 4)]; *out++ = B64Chars[((in[1] << 2) & 0x3c) | (in[2] >> 6)]; *out++ = B64Chars[in[2] & 0x3f]; - olen -= 4; - len -= 3; - in += 3; + olen -= 4; + len -= 3; + in += 3; } /* clean up remainder */ - if (len > 0 && olen > 4) - { + if (len > 0 && olen > 4) { unsigned char fragment; *out++ = B64Chars[in[0] >> 2]; @@ -86,8 +84,7 @@ int mutt_from_base64 (char *out, const char *in) int len = 0; register unsigned char digit1, digit2, digit3, digit4; - do - { + do { digit1 = in[0]; if (digit1 > 127 || base64val (digit1) == BAD) return -1; @@ -103,16 +100,14 @@ int mutt_from_base64 (char *out, const char *in) in += 4; /* digits are already sanity-checked */ - *out++ = (base64val(digit1) << 2) | (base64val(digit2) >> 4); + *out++ = (base64val (digit1) << 2) | (base64val (digit2) >> 4); len++; - if (digit3 != '=') - { - *out++ = ((base64val(digit2) << 4) & 0xf0) | (base64val(digit3) >> 2); + if (digit3 != '=') { + *out++ = ((base64val (digit2) << 4) & 0xf0) | (base64val (digit3) >> 2); len++; - if (digit4 != '=') - { - *out++ = ((base64val(digit3) << 6) & 0xc0) | base64val(digit4); - len++; + if (digit4 != '=') { + *out++ = ((base64val (digit3) << 6) & 0xc0) | base64val (digit4); + len++; } } }