Use GLib's implementation of Base64 instead of our own.
[claws.git] / src / prefs_customheader.c
index b5cec772f3c102e99edf4a6168b7cf2d0fdf66e0..a82e0ecc24292804ffa475bc3cec7176bedd598c 100644 (file)
@@ -46,7 +46,6 @@
 #include "utils.h"
 #include "gtkutils.h"
 #include "alertpanel.h"
-#include "base64.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;
-                       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(
@@ -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) {
-                               base64_encode(outbuf, inbuf, B64_LINE_SIZE);
+                               outbuf = g_base64_encode(inbuf, B64_LINE_SIZE);
 
                                tmp = contents;
                                contents = g_strconcat(tmp?tmp:"",outbuf, NULL);
+                               g_free(outbuf);
                                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);
+                               g_free(outbuf);
                                g_free(tmp);
                        }
                        fclose(fp);
@@ -914,12 +915,7 @@ static gboolean prefs_custom_header_selected(GtkTreeSelection *selector,
                pixbuf = gtk_image_get_pixbuf(preview);
                gtk_image_set_from_pixbuf (GTK_IMAGE(customhdr.preview), pixbuf);
                gtk_widget_show(customhdr.preview);
-#if GLIB_CHECK_VERSION(2,10,0)
                g_object_ref_sink (G_OBJECT(preview));
-#else
-               gtk_object_ref (G_OBJECT(preview));
-               gtk_object_sink (G_OBJECT(preview));
-#endif
        } 
 #if HAVE_LIBCOMPFACE
 else if (!strcmp2("X-Face", ch->name)) {
@@ -927,12 +923,7 @@ else if (!strcmp2("X-Face", ch->name)) {
                pixbuf = gtk_image_get_pixbuf(preview);
                gtk_image_set_from_pixbuf (GTK_IMAGE(customhdr.preview), pixbuf);
                gtk_widget_show(customhdr.preview);
-#if GLIB_CHECK_VERSION(2,10,0)
                g_object_ref_sink (G_OBJECT(preview));
-#else
-               gtk_object_ref (G_OBJECT(preview));
-               gtk_object_sink (G_OBJECT(preview));
-#endif
        } 
 #endif
 else {