talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit bf373b8226f1b3b335619a75de80041ee5ad9761
parent b20b2b3508765ce95842aff8e13feb86ff2b599a
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Thu, 13 Aug 2015 20:24:48 +0200

Provide an up to date version of g_base64_decode() for older GLib.

Patch by Jean Diraison, closes bug #3473.

Diffstat:
Msrc/common/utils.c | 18++++++++++++++++++
Msrc/common/utils.h | 5+++++
Msrc/unmime.c | 1+
3 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/src/common/utils.c b/src/common/utils.c @@ -89,6 +89,24 @@ static gboolean debug_mode = FALSE; static GSList *tempfiles=NULL; #endif +#if !GLIB_CHECK_VERSION(2, 26, 0) +guchar *g_base64_decode_wa(const gchar *text, gsize *out_len) +{ + guchar *ret; + gsize input_length; + gint state = 0; + guint save = 0; + + input_length = strlen(text); + + ret = g_malloc0((input_length / 4) * 3 + 1); + + *out_len = g_base64_decode_step(text, input_length, ret, &state, &save); + + return ret; +} +#endif + /* Return true if we are running as root. This function should beused instead of getuid () == 0. */ gboolean superuser_p (void) diff --git a/src/common/utils.h b/src/common/utils.h @@ -75,6 +75,11 @@ typedef gint64 goffset; #define HAVE_U32_TYPEDEF #endif +#if !GLIB_CHECK_VERSION(2, 26, 0) +#define g_base64_decode(t,l) g_base64_decode_wa((t),(l)) +guchar *g_base64_decode_wa(const gchar *text, gsize *out_len); +#endif + #if !GLIB_CHECK_VERSION(2, 25, 0) # ifdef G_OS_WIN32 typedef _g_stat_struct GStatBuf; diff --git a/src/unmime.c b/src/unmime.c @@ -26,6 +26,7 @@ #include <string.h> #include <ctype.h> +#include "utils.h" #include "codeconv.h" #include "quoted-printable.h"