Use GLib's implementation of Base64 instead of our own.
[claws.git] / src / prefs_customheader.c
index 3a84d7c9fc76a94b72755c0cbb2ad8c93483e58a..a82e0ecc24292804ffa475bc3cec7176bedd598c 100644 (file)
@@ -46,7 +46,6 @@
 #include "utils.h"
 #include "gtkutils.h"
 #include "alertpanel.h"
 #include "utils.h"
 #include "gtkutils.h"
 #include "alertpanel.h"
-#include "base64.h"
 #include "filesel.h"
 #include "combobox.h"
 
 #include "filesel.h"
 #include "combobox.h"
 
@@ -571,7 +570,7 @@ static void prefs_custom_header_val_from_file_cb(void)
                if (filename && is_file_exist(filename)) {
                        FILE *fp = NULL;
                        gint len;
                if (filename && is_file_exist(filename)) {
                        FILE *fp = NULL;
                        gint len;
-                       gchar inbuf[B64_LINE_SIZE], outbuf[B64_BUFFSIZE];
+                       gchar inbuf[B64_LINE_SIZE], *outbuf;
                        gchar *tmp = NULL;
                        gint w, h;
                        GdkPixbufFormat *format = gdk_pixbuf_get_file_info(
                        gchar *tmp = NULL;
                        gint w, h;
                        GdkPixbufFormat *format = gdk_pixbuf_get_file_info(
@@ -649,16 +648,18 @@ static void prefs_custom_header_val_from_file_cb(void)
                        while ((len = fread(inbuf, sizeof(gchar),
                                            B64_LINE_SIZE, fp))
                               == B64_LINE_SIZE) {
                        while ((len = fread(inbuf, sizeof(gchar),
                                            B64_LINE_SIZE, fp))
                               == B64_LINE_SIZE) {
-                               base64_encode(outbuf, inbuf, B64_LINE_SIZE);
+                               outbuf = g_base64_encode(inbuf, B64_LINE_SIZE);
 
                                tmp = contents;
                                contents = g_strconcat(tmp?tmp:"",outbuf, NULL);
 
                                tmp = contents;
                                contents = g_strconcat(tmp?tmp:"",outbuf, NULL);
+                               g_free(outbuf);
                                g_free(tmp);
                        }
                        if (len > 0 && feof(fp)) {
                                tmp = contents;
                                g_free(tmp);
                        }
                        if (len > 0 && feof(fp)) {
                                tmp = contents;
-                               base64_encode(outbuf, inbuf, len);
+                               outbuf = g_base64_encode(inbuf, len);
                                contents = g_strconcat(tmp?tmp:"",outbuf, NULL);
                                contents = g_strconcat(tmp?tmp:"",outbuf, NULL);
+                               g_free(outbuf);
                                g_free(tmp);
                        }
                        fclose(fp);
                                g_free(tmp);
                        }
                        fclose(fp);