diff options
author | Eric Covener <covener@apache.org> | 2022-06-28 13:39:11 +0000 |
---|---|---|
committer | Eric Covener <covener@apache.org> | 2022-06-28 13:39:11 +0000 |
commit | 17ab72e940b86ec420057e27dbe543f54c9b21ff (patch) | |
tree | 5013b0e7c4ab3166407d4389ce41ec0f6054ea21 /encoding | |
parent | a1b7cca450d35c69f0695e8eb0ef7c13b0c31df2 (diff) | |
download | apr-17ab72e940b86ec420057e27dbe543f54c9b21ff.tar.gz |
more whitespace
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902321 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'encoding')
-rw-r--r-- | encoding/apr_base64.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/encoding/apr_base64.c b/encoding/apr_base64.c index 45ea4fe60..ab200cd7e 100644 --- a/encoding/apr_base64.c +++ b/encoding/apr_base64.c @@ -168,24 +168,24 @@ APR_DECLARE(int) apr_base64_decode_binary(unsigned char *bufplain, bufin = (const unsigned char *) bufcoded; while (nprbytes >= 4) { - *(bufout++) = - (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4); - *(bufout++) = - (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2); - *(bufout++) = - (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]); - bufin += 4; - nprbytes -= 4; + *(bufout++) = + (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4); + *(bufout++) = + (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2); + *(bufout++) = + (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]); + bufin += 4; + nprbytes -= 4; } /* Note: (nprbytes == 1) would be an error, so just ignore that case */ if (nprbytes > 1) { - *(bufout++) = - (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4); + *(bufout++) = + (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4); } if (nprbytes > 2) { - *(bufout++) = - (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2); + *(bufout++) = + (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2); } return nbytesdecoded - (int)((4u - nprbytes) & 3u); @@ -223,26 +223,26 @@ APR_DECLARE(int) apr_base64_encode(char *encoded, const char *string, int len) p = encoded; for (i = 0; i < len - 2; i += 3) { - *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F]; - *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) | - ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)]; - *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2) | - ((int) (os_toascii[string[i + 2]] & 0xC0) >> 6)]; - *p++ = basis_64[os_toascii[string[i + 2]] & 0x3F]; + *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F]; + *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) | + ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)]; + *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2) | + ((int) (os_toascii[string[i + 2]] & 0xC0) >> 6)]; + *p++ = basis_64[os_toascii[string[i + 2]] & 0x3F]; } if (i < len) { - *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F]; - if (i == (len - 1)) { - *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4)]; + *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F]; + if (i == (len - 1)) { + *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4)]; + *p++ = '='; + } + else { + *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) | + ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)]; + *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2)]; + } *p++ = '='; } - else { - *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) | - ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)]; - *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2)]; - } - *p++ = '='; - } *p++ = '\0'; return (unsigned int)(p - encoded); |