[FFmpeg-cvslog] r23462 - in trunk: libavcodec/libtheoraenc.c libavformat/httpauth.c libavutil/base64.c

hyc subversion
Fri Jun 4 03:15:41 CEST 2010


Author: hyc
Date: Fri Jun  4 03:15:41 2010
New Revision: 23462

Log:
Use AV_BASE64_SIZE() macro

Modified:
   trunk/libavcodec/libtheoraenc.c
   trunk/libavformat/httpauth.c
   trunk/libavutil/base64.c

Modified: trunk/libavcodec/libtheoraenc.c
==============================================================================
--- trunk/libavcodec/libtheoraenc.c	Fri Jun  4 03:15:07 2010	(r23461)
+++ trunk/libavcodec/libtheoraenc.c	Fri Jun  4 03:15:41 2010	(r23462)
@@ -101,7 +101,7 @@ static int get_stats(AVCodecContext *avc
         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);

Modified: trunk/libavformat/httpauth.c
==============================================================================
--- trunk/libavformat/httpauth.c	Fri Jun  4 03:15:07 2010	(r23461)
+++ trunk/libavformat/httpauth.c	Fri Jun  4 03:15:41 2010	(r23462)
@@ -294,7 +294,7 @@ char *ff_http_auth_create_response(HTTPA
         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);

Modified: trunk/libavutil/base64.c
==============================================================================
--- trunk/libavutil/base64.c	Fri Jun  4 03:15:07 2010	(r23461)
+++ trunk/libavutil/base64.c	Fri Jun  4 03:15:41 2010	(r23462)
@@ -79,7 +79,7 @@ char *av_base64_encode(char *out, int ou
     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) {



More information about the ffmpeg-cvslog mailing list