diff options
author | Christian Persch <chpe@src.gnome.org> | 2008-05-19 05:50:13 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2008-05-19 05:50:13 +0800 |
commit | 0af6930a1c31f1e854629a15646d01af600105a4 (patch) | |
tree | 88f9def84cb3b88867b840dceb027d24147715fc /embed/mozilla | |
parent | 1d5298f2586e48798d193a75315f71005a4d1c55 (diff) | |
download | gsoc2013-epiphany-0af6930a1c31f1e854629a15646d01af600105a4.tar gsoc2013-epiphany-0af6930a1c31f1e854629a15646d01af600105a4.tar.gz gsoc2013-epiphany-0af6930a1c31f1e854629a15646d01af600105a4.tar.bz2 gsoc2013-epiphany-0af6930a1c31f1e854629a15646d01af600105a4.tar.lz gsoc2013-epiphany-0af6930a1c31f1e854629a15646d01af600105a4.tar.xz gsoc2013-epiphany-0af6930a1c31f1e854629a15646d01af600105a4.tar.zst gsoc2013-epiphany-0af6930a1c31f1e854629a15646d01af600105a4.zip |
Convert and control chars to spaces in the prompt strings. Fixes bug #504519.
svn path=/branches/gnome-2-22/; revision=8229
Diffstat (limited to 'embed/mozilla')
-rw-r--r-- | embed/mozilla/EphyPromptService.cpp | 7 | ||||
-rw-r--r-- | embed/mozilla/EphyUtils.cpp | 3 |
2 files changed, 8 insertions, 2 deletions
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; } |