summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Riemann <friemann@gnome.org>2023-01-07 17:09:34 +0000
committerFelix Riemann <friemann@gnome.org>2023-01-07 17:09:34 +0000
commite1cbb0c47ac27def91147236602734dfc3096b45 (patch)
tree4dd2ccf39570fbd1ba62808b3094c100c40ba174
parent21c83b5c3911492006ebc0e0f44773dda965ed9e (diff)
parent73f522ca8c99ff4f0edee96687cd0e98603136ad (diff)
downloadeog-e1cbb0c47ac27def91147236602734dfc3096b45.tar.gz
Merge branch 'make-valid-utf8' into 'master'
Drop eog_util_make_valid_utf8 See merge request GNOME/eog!146
-rw-r--r--src/eog-error-message-area.c4
-rw-r--r--src/eog-exif-util.c2
-rw-r--r--src/eog-metadata-details.c4
-rw-r--r--src/eog-util.c41
-rw-r--r--src/eog-util.h3
5 files changed, 5 insertions, 49 deletions
diff --git a/src/eog-error-message-area.c b/src/eog-error-message-area.c
index 804606fd..394f0fe6 100644
--- a/src/eog-error-message-area.c
+++ b/src/eog-error-message-area.c
@@ -221,7 +221,7 @@ eog_image_load_error_message_area_new (const gchar *caption,
error_message = g_strdup_printf (_("Could not load image ā€œ%sā€."),
pango_escaped_caption);
- message_details = eog_util_make_valid_utf8 (error->message);
+ message_details = g_utf8_make_valid (error->message, -1);
message_area = create_error_message_area (error_message,
message_details,
@@ -263,7 +263,7 @@ eog_image_save_error_message_area_new (const gchar *caption,
error_message = g_strdup_printf (_("Could not save image ā€œ%sā€."),
pango_escaped_caption);
- message_details = eog_util_make_valid_utf8 (error->message);
+ message_details = g_utf8_make_valid (error->message, -1);
message_area = create_error_message_area (error_message,
message_details,
diff --git a/src/eog-exif-util.c b/src/eog-exif-util.c
index b77a5a2b..513661f4 100644
--- a/src/eog-exif-util.c
+++ b/src/eog-exif-util.c
@@ -215,7 +215,7 @@ eog_exif_util_set_label_text (GtkLabel *label,
if (tag_id == EXIF_TAG_DATE_TIME_ORIGINAL && buf_ptr)
label_text = eog_exif_util_format_date (buf_ptr);
else
- label_text = eog_util_make_valid_utf8 (buf_ptr);
+ label_text = g_utf8_make_valid (buf_ptr, -1);
}
gtk_label_set_text (label, label_text);
diff --git a/src/eog-metadata-details.c b/src/eog-metadata-details.c
index 208f1eaa..12df3398 100644
--- a/src/eog-metadata-details.c
+++ b/src/eog-metadata-details.c
@@ -335,13 +335,13 @@ set_row_data (GtkTreeStore *store, char *path, char *parent, const char *attribu
}
}
- utf_attribute = eog_util_make_valid_utf8 (attribute);
+ utf_attribute = g_utf8_make_valid (attribute, -1);
gtk_tree_store_set (store, &iter, MODEL_COLUMN_ATTRIBUTE, utf_attribute, -1);
g_free (utf_attribute);
if (value != NULL) {
- utf_value = eog_util_make_valid_utf8 (value);
+ utf_value = g_utf8_make_valid (value, -1);
gtk_tree_store_set (store, &iter, MODEL_COLUMN_VALUE, utf_value, -1);
g_free (utf_value);
}
diff --git a/src/eog-util.c b/src/eog-util.c
index 4fcdf21c..acac720c 100644
--- a/src/eog-util.c
+++ b/src/eog-util.c
@@ -83,47 +83,6 @@ eog_util_show_help (const gchar *section, GtkWindow *parent)
}
}
-gchar *
-eog_util_make_valid_utf8 (const gchar *str)
-{
- GString *string;
- const char *remainder, *invalid;
- int remaining_bytes, valid_bytes;
-
- string = NULL;
- remainder = str;
- remaining_bytes = strlen (str);
-
- 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 g_strdup (str);
- }
-
- g_string_append (string, remainder);
- g_string_append (string, _(" (invalid Unicode)"));
-
- g_assert (g_utf8_validate (string->str, -1, NULL));
-
- return g_string_free (string, FALSE);
-}
-
GSList*
eog_util_parse_uri_string_list_to_file_list (const gchar *uri_list)
{
diff --git a/src/eog-util.h b/src/eog-util.h
index c4a72e8d..8442e8d6 100644
--- a/src/eog-util.h
+++ b/src/eog-util.h
@@ -33,9 +33,6 @@ void eog_util_show_help (const gchar *section,
GtkWindow *parent);
G_GNUC_INTERNAL
-gchar *eog_util_make_valid_utf8 (const gchar *name);
-
-G_GNUC_INTERNAL
GSList *eog_util_parse_uri_string_list_to_file_list (const gchar *uri_list);
G_GNUC_INTERNAL