[gnome-bluetooth] Bug 585153 – g_strnfill() usage might be wrong



commit d9b7827b76fa4b723fd6a458146ac3bae0b474b2
Author: Bastien Nocera <hadess hadess net>
Date:   Sun Jun 14 00:16:09 2009 +0100

    Bug 585153 â?? g_strnfill() usage might be wrong
    
    Fix display_callback's code when the invisible character is a
    wide character.

 wizard/main.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/wizard/main.c b/wizard/main.c
index 8942b68..6778ce4 100644
--- a/wizard/main.c
+++ b/wizard/main.c
@@ -201,11 +201,20 @@ static gboolean display_callback(DBusGMethodInvocation *context,
 	if (entered > 0) {
 		GtkEntry *entry;
 		gunichar invisible;
+		GString *str;
+		guint i;
 
 		entry = GTK_ENTRY (gtk_entry_new ());
 		invisible = gtk_entry_get_invisible_char (entry);
-		done = g_strnfill(entered, invisible);
 		g_object_unref (entry);
+
+		str = g_string_new (NULL);
+		for (i = 0; i < entered; i++)
+			g_string_append_unichar (str, invisible);
+		if (entered < strlen (code))
+			g_string_append (str, code + entered);
+
+		done = g_string_free (str, FALSE);
 	} else {
 		done = g_strdup ("");
 	}



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