From 0af6930a1c31f1e854629a15646d01af600105a4 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sun, 18 May 2008 21:50:13 +0000 Subject: Convert and control chars to spaces in the prompt strings. Fixes bug #504519. svn path=/branches/gnome-2-22/; revision=8229 --- embed/mozilla/EphyPromptService.cpp | 7 +++++-- embed/mozilla/EphyUtils.cpp | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'embed/mozilla') diff --git a/embed/mozilla/EphyPromptService.cpp b/embed/mozilla/EphyPromptService.cpp index a710259d6..58d5a9b6c 100644 --- a/embed/mozilla/EphyPromptService.cpp +++ b/embed/mozilla/EphyPromptService.cpp @@ -177,7 +177,7 @@ Prompter::Prompter (const char *aStock, text = ConvertAndTruncateString (aText, MAX_MESSAGE_LENGTH); } - label = gtk_label_new (text); + label = gtk_label_new (text ? text : ""); g_free (text); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); @@ -333,7 +333,7 @@ Prompter::AddCheckbox (const PRUnichar *aText, if (!aState || !aText) return; char *label = ConvertAndEscapeButtonText (aText, 2 * MAX_BUTTON_TEXT_LENGTH); - mCheck = gtk_check_button_new_with_mnemonic (label); + mCheck = gtk_check_button_new_with_mnemonic (label ? label : ""); g_free (label); gtk_label_set_line_wrap (GTK_LABEL (GTK_BIN (mCheck)->child), TRUE); @@ -609,7 +609,10 @@ Prompter::ConvertAndTruncateString (const PRUnichar *aText, char *converted = g_utf16_to_utf8 ((gunichar2*) aText, aMaxLength, &n_read, &n_written, NULL); /* FIXME loop from the end while !g_unichar_isspace (char)? */ + if (!converted) + return NULL; + g_strdelimit (converted, "\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037", ' '); return converted; } diff --git a/embed/mozilla/EphyUtils.cpp b/embed/mozilla/EphyUtils.cpp index e5c4fb119..77e3d85b7 100644 --- a/embed/mozilla/EphyUtils.cpp +++ b/embed/mozilla/EphyUtils.cpp @@ -160,7 +160,10 @@ EphyUtils::ConvertUTF16toUTF8 (const PRUnichar *aText, char *converted = g_utf16_to_utf8 ((gunichar2*) aText, aMaxLength, &n_read, &n_written, NULL); /* FIXME loop from the end while !g_unichar_isspace (char)? */ + if (!converted) + return NULL; + g_strdelimit (converted, "\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037", ' '); return converted; } -- cgit v1.2.3