Mercurial > libavutil.hg
changeset 320:ca1f5d65e653 libavutil
expose av_base64_decode and av_base64_encode
author | lu_zero |
---|---|
date | Mon, 19 Mar 2007 00:48:47 +0000 |
parents | aac7ff53ef86 |
children | 39cdbea1a8f1 |
files | Makefile avutil.h base64.c base64.h |
diffstat | 4 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Wed Mar 14 19:47:58 2007 +0000 +++ b/Makefile Mon Mar 19 00:48:47 2007 +0000 @@ -18,7 +18,7 @@ HEADERS = avutil.h common.h mathematics.h integer.h rational.h \ intfloat_readwrite.h md5.h adler32.h log.h fifo.h lzo.h \ - random.h mem.h + random.h mem.h base64.h NAME=avutil LIBVERSION=$(LAVUVERSION)
--- a/avutil.h Wed Mar 14 19:47:58 2007 +0000 +++ b/avutil.h Mon Mar 19 00:48:47 2007 +0000 @@ -34,8 +34,8 @@ #define AV_STRINGIFY(s) AV_TOSTRING(s) #define AV_TOSTRING(s) #s -#define LIBAVUTIL_VERSION_INT ((49<<16)+(3<<8)+0) -#define LIBAVUTIL_VERSION 49.3.0 +#define LIBAVUTIL_VERSION_INT ((49<<16)+(4<<8)+0) +#define LIBAVUTIL_VERSION 49.4.0 #define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT #define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
--- a/base64.c Wed Mar 14 19:47:58 2007 +0000 +++ b/base64.c Mon Mar 19 00:48:47 2007 +0000 @@ -70,7 +70,7 @@ * fixed edge cases and made it work from data (vs. strings) by ryan. *****************************************************************************/ -char *av_base64_encode(uint8_t * src, int len) +char *av_base64_encode(char * buf, int buf_len, uint8_t * src, int len) { static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; @@ -79,11 +79,10 @@ int i_shift = 0; int bytes_remaining = len; - if (len < UINT_MAX / 4) { - ret = dst = av_malloc(len * 4 / 3 + 12); - } else + if (len >= UINT_MAX / 4 || + buf_len < len * 4 / 3 + 12) return NULL; - + ret = dst = buf; if (len) { // special edge case, what should we really do here? while (bytes_remaining) { i_bits = (i_bits << 8) + *src++;
--- a/base64.h Wed Mar 14 19:47:58 2007 +0000 +++ b/base64.h Mon Mar 19 00:48:47 2007 +0000 @@ -28,6 +28,7 @@ /** * encodes base64 * @param src data, not a string + * @param buf output string */ -char *av_base64_encode(uint8_t * src, int len); +char *av_base64_encode(char * buf, int buf_len, uint8_t * src, int len);