[gimp] metadata: Use glib base64 decoder instead of local copy



commit 7ebcf3f755f30441a9db843f6c587eaf1788d2f0
Author: Mukund Sivaraman <muks banu com>
Date:   Thu Oct 6 20:19:11 2011 +0530

    metadata: Use glib base64 decoder instead of local copy

 plug-ins/metadata/Makefile.am  |   17 ---
 plug-ins/metadata/base64.c     |  236 ----------------------------------------
 plug-ins/metadata/base64.h     |   41 -------
 plug-ins/metadata/testbase64.c |  166 ----------------------------
 plug-ins/metadata/xmp-parse.c  |   16 ++-
 5 files changed, 11 insertions(+), 465 deletions(-)
---
diff --git a/plug-ins/metadata/Makefile.am b/plug-ins/metadata/Makefile.am
index 60e1642..91d43c0 100644
--- a/plug-ins/metadata/Makefile.am
+++ b/plug-ins/metadata/Makefile.am
@@ -26,8 +26,6 @@ libexec_PROGRAMS = metadata
 metadata_SOURCES = \
 	metadata.c		\
 	metadata.h		\
-	base64.h		\
-	base64.c		\
 	xmp-model.h		\
 	xmp-model.c		\
 	xmp-parse.h		\
@@ -54,8 +52,6 @@ metadata_SOURCES = \
 noinst_PROGRAMS = xmpdump
 xmpdump_SOURCES = \
 	xmpdump.c	\
-	base64.h	\
-	base64.c	\
 	xmp-schemas.h	\
 	xmp-schemas.c	\
 	xmp-encode.h	\
@@ -84,16 +80,3 @@ LDADD = \
 	$(RT_LIBS)		\
 	$(INTLLIBS)		\
 	$(metadata_RC)
-
-# test program, not built by default
-
-TESTS = testbase64$(EXEEXT)
-
-EXTRA_PROGRAMS = testbase64
-
-testbase64_SOURCES = \
-	base64.h	\
-	base64.c	\
-	testbase64.c	
-
-CLEANFILES = $(EXTRA_PROGRAMS)
diff --git a/plug-ins/metadata/xmp-parse.c b/plug-ins/metadata/xmp-parse.c
index 7d6113c..2347bd1 100644
--- a/plug-ins/metadata/xmp-parse.c
+++ b/plug-ins/metadata/xmp-parse.c
@@ -54,7 +54,6 @@
 #  define _(String) (String)
 #  define N_(String) (String)
 #endif
-#include "base64.h"
 #include "xmp-parse.h"
 
 GQuark
@@ -1065,17 +1064,24 @@ text_handler           (GMarkupParseContext  *markup_context,
 
     case STATE_INSIDE_ALT_LI_RSC_IMG:
       {
-        gint   max_size;
+        size_t len, max_size;
         gchar *decoded;
         gint   decoded_size;
+        gint   state;
+        guint  save;
 
 #ifdef DEBUG_XMP_PARSER
         /* g_print ("XMP: Pushing text:\n%s\n", text); */
 #endif
-        max_size = text_len - text_len / 4 + 1;
+        len = text_len - text_len;
+        max_size = (len / 4) * 3 + 3;
         decoded = g_malloc (max_size);
-        decoded_size = base64_decode (text, text_len, decoded, max_size,
-                                      FALSE);
+
+        state = 0;
+        save = 0;
+        decoded_size = g_base64_decode_step (text, text_len,
+                                             decoded,
+                                             &state, &save);
 #ifdef DEBUG_XMP_PARSER
         if (decoded_size > 0)
           {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]