Move handling of last byte outside of innermost loop.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
| ... | ... |
@@ -93,8 +93,10 @@ char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size) |
| 93 | 93 |
do {
|
| 94 | 94 |
*dst++ = b64[(i_bits << 6 >> i_shift) & 0x3f]; |
| 95 | 95 |
i_shift -= 6; |
| 96 |
- } while (i_shift > 6 || (bytes_remaining == 0 && i_shift > 0)); |
|
| 96 |
+ } while (i_shift > 6); |
|
| 97 | 97 |
} |
| 98 |
+ if (i_shift > 0) |
|
| 99 |
+ *dst++ = b64[(i_bits << 6 >> i_shift) & 0x3f]; |
|
| 98 | 100 |
while ((dst - ret) & 3) |
| 99 | 101 |
*dst++ = '='; |
| 100 | 102 |
*dst = '\0'; |