summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoward Chu <hyc@highlandsun.com>2010-06-04 01:15:41 +0000
committerHoward Chu <hyc@highlandsun.com>2010-06-04 01:15:41 +0000
commit784824a68c00d95dd81085483950b92203345a65 (patch)
tree145bcb0cf533b1c6dc5dd2e7e1856631ed0c84b3
parent31878fcf430cf0f0eb39741c65ccee02b22ef785 (diff)
Use AV_BASE64_SIZE() macro
Originally committed as revision 23462 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/libtheoraenc.c2
-rw-r--r--libavformat/httpauth.c2
-rw-r--r--libavutil/base64.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c
index 2dc45a92cb..b502942718 100644
--- a/libavcodec/libtheoraenc.c
+++ b/libavcodec/libtheoraenc.c
@@ -101,7 +101,7 @@ static int get_stats(AVCodecContext *avctx, int eos)
memcpy(h->stats + h->stats_offset, buf, bytes);
h->stats_offset += bytes;
} else {
- int b64_size = ((h->stats_offset + 2) / 3) * 4 + 1;
+ int b64_size = AV_BASE64_SIZE(h->stats_offset);
// libtheora generates a summary header at the end
memcpy(h->stats, buf, bytes);
avctx->stats_out = av_malloc(b64_size);
diff --git a/libavformat/httpauth.c b/libavformat/httpauth.c
index 799f84d17a..47db46b8ac 100644
--- a/libavformat/httpauth.c
+++ b/libavformat/httpauth.c
@@ -294,7 +294,7 @@ char *ff_http_auth_create_response(HTTPAuthState *state, const char *auth,
return NULL;
if (state->auth_type == HTTP_AUTH_BASIC) {
- int auth_b64_len = (strlen(auth) + 2) / 3 * 4 + 1;
+ int auth_b64_len = AV_BASE64_SIZE(strlen(auth));
int len = auth_b64_len + 30;
char *ptr;
authstr = av_malloc(len);
diff --git a/libavutil/base64.c b/libavutil/base64.c
index d84ca36984..1b70fa9f33 100644
--- a/libavutil/base64.c
+++ b/libavutil/base64.c
@@ -79,7 +79,7 @@ char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size)
int bytes_remaining = in_size;
if (in_size >= UINT_MAX / 4 ||
- out_size < (in_size+2) / 3 * 4 + 1)
+ out_size < AV_BASE64_SIZE(in_size))
return NULL;
ret = dst = out;
while (bytes_remaining) {