Commit adce81a2 authored by Michael Catanzaro's avatar Michael Catanzaro

Revert "Utils: deprecate make_valid_utf8(), use g_utf8_make_valid()"

This reverts commit 50053bf2.
parent 0bb9fc2a
......@@ -245,17 +245,48 @@ gedit_utils_str_end_truncate (const gchar *string,
return tepl_utils_str_end_truncate (string, truncate_length);
}
/**
* gedit_utils_make_valid_utf8:
* @name:
*
* Returns:
* Deprecated: 3.36: Use g_utf8_make_valid() instead.
*/
gchar *
gedit_utils_make_valid_utf8 (const char *name)
{
return g_utf8_make_valid (name, -1);
GString *string;
const char *remainder, *invalid;
int remaining_bytes, valid_bytes;
g_return_val_if_fail (name != NULL, NULL);
string = NULL;
remainder = name;
remaining_bytes = strlen (name);
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);
/* append U+FFFD REPLACEMENT CHARACTER */
g_string_append (string, "\357\277\275");
remaining_bytes -= valid_bytes + 1;
remainder = invalid + 1;
}
if (string == NULL)
{
return g_strdup (name);
}
g_string_append (string, remainder);
g_assert (g_utf8_validate (string->str, -1, NULL));
return g_string_free (string, FALSE);
}
static gchar *
......
......@@ -66,7 +66,6 @@ void gedit_utils_set_atk_relation (G
void gedit_warning (GtkWindow *parent,
const gchar *format,
...) G_GNUC_PRINTF(2, 3);
G_DEPRECATED_FOR (g_utf8_make_valid)
gchar *gedit_utils_make_valid_utf8 (const char *name);
......
......@@ -60,7 +60,7 @@ libgd_sp = subproject(
)
# Dependencies
glib_req = '>= 2.52'
glib_req = '>= 2.44.0'
gtk_req = '>= 3.22.0'
gtksourceview_req = '>= 4.0.2'
tepl_req = '>= 4.3'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment