summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2007-03-19 00:48:47 +0000
committerLuca Barbato <lu_zero@gentoo.org>2007-03-19 00:48:47 +0000
commitbd03c380ce67cffaaf3c456407cc98e02917ebf7 (patch)
treebeccff1ab797befddbd59f9e744d57d847a443e1 /libavutil
parent559fd1e79524ca47efde195e28feb4499dd48761 (diff)
expose av_base64_decode and av_base64_encode
Originally committed as revision 8448 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/Makefile2
-rw-r--r--libavutil/avutil.h4
-rw-r--r--libavutil/base64.c9
-rw-r--r--libavutil/base64.h3
4 files changed, 9 insertions, 9 deletions
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 1203281993..a760401ab7 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -18,7 +18,7 @@ OBJS= mathematics.o \
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)
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index d85755cd8b..32bc40bfbf 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -34,8 +34,8 @@ extern "C" {
#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)
diff --git a/libavutil/base64.c b/libavutil/base64.c
index 6279244d3b..bee800c824 100644
--- a/libavutil/base64.c
+++ b/libavutil/base64.c
@@ -70,7 +70,7 @@ int av_base64_decode(uint8_t * out, const char *in, int out_length)
* 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 @@ char *av_base64_encode(uint8_t * src, int len)
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++;
diff --git a/libavutil/base64.h b/libavutil/base64.h
index 5658ee837a..3d905313cf 100644
--- a/libavutil/base64.h
+++ b/libavutil/base64.h
@@ -28,6 +28,7 @@ int av_base64_decode(uint8_t * out, const char *in, int out_length);
/**
* 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);