From 5d9d7aee83cb3e5db29640f985b6d69e0060e39d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 1 Mar 2008 03:35:51 +0100 Subject: Use libavutil's base64 functions, and get rid again of internal copy of base64. --- src/xine-engine/configfile.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index 37a4e38ad..a41abf193 100644 --- a/src/xine-engine/configfile.c +++ b/src/xine-engine/configfile.c @@ -33,7 +33,7 @@ #include #include #include "bswap.h" -#include "base64.h" +#include #define LOG_MODULE "configfile" #define LOG_VERBOSE @@ -1342,7 +1342,12 @@ static char* config_get_serialized_entry (config_values_t *this, const char *key } /* and now the output encoding */ - output = _x_base64_encode (buffer, total_len, &output_len); + /* We're going to encode total_len bytes in base64 + * libavutil's base64 encoding functions want the size to + * be at least len * 4 / 3 + 12, so let's use that! + */ + output = malloc(total_len * 4 / 3 + 12); + av_base64_encode(output, total_len * 4 / 3 + 12, buffer, total_len); free(buffer); } @@ -1410,11 +1415,13 @@ static char* config_register_serialized_entry (config_values_t *this, const char int bytes; int pos; void *output = NULL; - unsigned long output_len; + size_t output_len; int value_count = 0; int i; - output = _x_base64_decode (value, strlen(value), &output_len); + output_len = strlen(value) * 3 / 4 + 1; + output = malloc(output_len); + av_base64_decode(output, value, output_len); pos = 0; pos += bytes = get_int(output, output_len, pos, &type); -- cgit v1.2.3