[gcompris/gcomprixogoo] Fixed long standing bug in missing letter configuration for 2 bytes utf8 char.



commit 7f0acc904f65a9df8804ecc41e073d842ed6e675
Author: Bruno Coudoin <bruno coudoin free fr>
Date:   Thu Nov 4 22:06:24 2010 +0100

    Fixed long standing bug in missing letter configuration for 2 bytes utf8 char.
    
    fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=633978

 src/missing_letter-activity/missingletter.h        |    2 +-
 src/missing_letter-activity/missingletter_config.c |    5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/src/missing_letter-activity/missingletter.h b/src/missing_letter-activity/missingletter.h
index c56d779..e00260c 100644
--- a/src/missing_letter-activity/missingletter.h
+++ b/src/missing_letter-activity/missingletter.h
@@ -24,7 +24,7 @@ extern GcomprisBoard *gcomprisBoard_missing;
 gboolean              missing_read_xml_file(char *fname, GList**);
 void                  missing_destroy_board_list(GList *);
 
-#define MAX_PROPOSAL 6
+#define MAX_PROPOSAL 6 * 2 /* Counting UTF-8 char */
 typedef struct _Board {
   gchar *pixmapfile;
   gchar *question;
diff --git a/src/missing_letter-activity/missingletter_config.c b/src/missing_letter-activity/missingletter_config.c
index 6bfe3d9..5145799 100644
--- a/src/missing_letter-activity/missingletter_config.c
+++ b/src/missing_letter-activity/missingletter_config.c
@@ -284,13 +284,12 @@ static void level_changed(GtkComboBox *combo, gpointer data)
 	gdk_pixbuf_new_from_file_at_size(pixfile, ICON_SIZE, ICON_SIZE,
 					 NULL);
 
+      tmp[0] = '\0';
       while(b->text[i])
 	{
-	  tmp[i] = b->text[i][0];
+	  g_strlcat(tmp, b->text[i], MAX_PROPOSAL);
 	  i++;
 	}
-      tmp[i] = '\0';
-
       gtk_list_store_append(ls, &iter);
       gtk_list_store_set(ls, &iter,
                          QUESTION_COLUMN, b->question,



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