aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-01-20 22:56:18 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-01-21 00:24:10 +0100
commitea4da9489595ba531ef57c75e583303556b728e5 (patch)
tree73d168fd230bd04b5b1a2c4418286755ccc21c3a
parent112bca91b054e61dd4ec8ec19dd423afc41be14c (diff)
downloadffmpeg-ea4da9489595ba531ef57c75e583303556b728e5.tar.gz
base64: simplify end handling in av_base64_encode()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavutil/base64.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/libavutil/base64.c b/libavutil/base64.c
index 26e28b719f..cd3cb9e8c0 100644
--- a/libavutil/base64.c
+++ b/libavutil/base64.c
@@ -99,14 +99,11 @@ char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size)
i_bits = (i_bits << 8) + *in++;
bytes_remaining--;
i_shift += 8;
-
- do {
- *dst++ = b64[(i_bits << 6 >> i_shift) & 0x3f];
- i_shift -= 6;
- } while (i_shift > 6);
}
- if (i_shift > 0)
+ while (i_shift > 0) {
*dst++ = b64[(i_bits << 6 >> i_shift) & 0x3f];
+ i_shift -= 6;
+ }
while ((dst - ret) & 3)
*dst++ = '=';
*dst = '\0';