[gtk/im-context-work] composetable: Fix algorithmic matching



commit ef053ebb4a33fe315aeb4137d3266f3aeeb3033b
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Feb 1 21:51:51 2021 -0500

    composetable: Fix algorithmic matching
    
    The code wasn't paying attention to (lack of) nul-termination
    in one place, causing it to not match when it should.

 gtk/gtkcomposetable.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcomposetable.c b/gtk/gtkcomposetable.c
index 783fb00e31..033155840d 100644
--- a/gtk/gtkcomposetable.c
+++ b/gtk/gtkcomposetable.c
@@ -1096,7 +1096,7 @@ check_normalize_nfc (gunichar *combination_buffer,
 
   n_combinations = 1;
 
-  for (i = 1; i < n_compose; i++ )
+  for (i = 1; i < n_compose; i++)
      n_combinations *= i;
 
   /* Xorg reuses dead_tilde for the perispomeni diacritic mark.
@@ -1112,10 +1112,10 @@ check_normalize_nfc (gunichar *combination_buffer,
 
   memcpy (combination_buffer_temp, combination_buffer, n_compose * sizeof (gunichar) );
 
-  for (i = 0; i < n_combinations; i++ )
+  for (i = 0; i < n_combinations; i++)
     {
       g_unicode_canonical_ordering (combination_buffer_temp, n_compose);
-      combination_utf8_temp = g_ucs4_to_utf8 (combination_buffer_temp, -1, NULL, NULL, NULL);
+      combination_utf8_temp = g_ucs4_to_utf8 (combination_buffer_temp, n_compose, NULL, NULL, NULL);
       nfc_temp = g_utf8_normalize (combination_utf8_temp, -1, G_NORMALIZE_NFC);
 
       if (g_utf8_strlen (nfc_temp, -1) == 1)


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