[glib: 1/3] Handling U+0000 explicitely to avoid collision with other cases



commit 48d65634a55b72cf5b5cc4324448bee56814999e
Author: Emmanuel Fleury <emmanuel fleury u-bordeaux fr>
Date:   Tue May 14 13:35:49 2019 +0200

    Handling U+0000 explicitely to avoid collision with other cases
    
    Fix issue #135

 glib/guniprop.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/glib/guniprop.c b/glib/guniprop.c
index cd3675fbf..9a79e4316 100644
--- a/glib/guniprop.c
+++ b/glib/guniprop.c
@@ -623,13 +623,19 @@ gunichar
 g_unichar_totitle (gunichar c)
 {
   unsigned int i;
+
+  /* We handle U+0000 explicitely because some elements in
+   * title_table[i][1] may be null. */
+  if (c == 0)
+    return c;
+
   for (i = 0; i < G_N_ELEMENTS (title_table); ++i)
     {
       if (title_table[i][0] == c || title_table[i][1] == c
          || title_table[i][2] == c)
        return title_table[i][0];
     }
-    
+
   if (TYPE (c) == G_UNICODE_LOWERCASE_LETTER)
     return g_unichar_toupper (c);
 


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