[librsvg] Use g_utf8_make_valid() instead of our own; require glib 2.52.0



commit e297b3427b761529b2581628acacdf622e16b040
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Dec 6 07:48:43 2017 -0600

    Use g_utf8_make_valid() instead of our own; require glib 2.52.0

 configure.ac |    2 +-
 rsvg-base.c  |    2 +-
 rsvg-text.c  |   38 --------------------------------------
 rsvg-text.h  |    2 --
 4 files changed, 2 insertions(+), 42 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d26e312..12795ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,7 +38,7 @@ AC_SUBST([LIBRSVG_MICRO_VERSION],[rsvg_micro_version])
 
 dnl ===========================================================================
 
-GLIB_REQUIRED=2.12.0
+GLIB_REQUIRED=2.52.0
 GIO_REQUIRED=2.24.0
 LIBXML_REQUIRED=2.9.0
 CAIRO_REQUIRED=1.2.0
diff --git a/rsvg-base.c b/rsvg-base.c
index 699ea45..ba0a9fa 100644
--- a/rsvg-base.c
+++ b/rsvg-base.c
@@ -480,7 +480,7 @@ rsvg_extra_handler_characters (RsvgSaxHandler * self, const char *ch, gssize len
 
     if (!g_utf8_validate ((char *) ch, len, NULL)) {
         char *utf8;
-        utf8 = rsvg_make_valid_utf8 ((char *) ch, len);
+        utf8 = g_utf8_make_valid (ch, len);
         g_string_append (z->string, utf8);
         g_free (utf8);
     } else {
diff --git a/rsvg-text.c b/rsvg-text.c
index a114b8c..84554d8 100644
--- a/rsvg-text.c
+++ b/rsvg-text.c
@@ -51,44 +51,6 @@ struct _RsvgNodeTref {
     char *link;
 };
 
-char *
-rsvg_make_valid_utf8 (const char *str, gssize len)
-{
-    GString *string;
-    const char *remainder, *invalid;
-    gssize remaining_bytes, valid_bytes;
-
-    string = NULL;
-    remainder = str;
-
-    if (len < 0)
-        remaining_bytes = strlen (str);
-    else
-        remaining_bytes = len;
-
-    while (remaining_bytes != 0) {
-        if (g_utf8_validate (remainder, remaining_bytes, &invalid))
-            break;
-        valid_bytes = invalid - remainder;
-
-        if (string == NULL)
-            string = g_string_sized_new (remaining_bytes);
-
-        g_string_append_len (string, remainder, valid_bytes);
-        g_string_append_c (string, '?');
-
-        remaining_bytes -= valid_bytes + 1;
-        remainder = invalid + 1;
-    }
-
-    if (string == NULL)
-        return len < 0 ? g_strndup (str, len) : g_strdup (str);
-
-    g_string_append (string, remainder);
-
-    return g_string_free (string, FALSE);
-}
-
 static GString *
 _rsvg_text_chomp (RsvgState *state, GString * in, gboolean * lastwasspace)
 {
diff --git a/rsvg-text.h b/rsvg-text.h
index d30bac0..e29d892 100644
--- a/rsvg-text.h
+++ b/rsvg-text.h
@@ -38,8 +38,6 @@ G_GNUC_INTERNAL
 RsvgNode    *rsvg_new_tspan        (const char *element_name, RsvgNode *parent);
 G_GNUC_INTERNAL
 RsvgNode    *rsvg_new_tref         (const char *element_name, RsvgNode *parent);
-G_GNUC_INTERNAL
-char       *rsvg_make_valid_utf8   (const char *str, gssize len);
 
 G_END_DECLS
 


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