X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-text-utils.c;h=62bd6bb5c8c38d295989a1c794af9b2dd6999c08;hp=d3805a1be115610f72c46ff2ee95d441937ae68e;hb=e45958deaf9701399c552ea0d84c2447efacd4ca;hpb=eda5076af8a5e224d63f560f50ab445de1287a72 diff --git a/src/modest-text-utils.c b/src/modest-text-utils.c index d3805a1..62bd6bb 100644 --- a/src/modest-text-utils.c +++ b/src/modest-text-utils.c @@ -1269,7 +1269,7 @@ modest_text_utils_get_subject_prefix_len (const gchar *sub) int c = prefix_len + 1; while (sub[c] && sub[c] != ']') ++c; - if (sub[c]) + if (!sub[c]) return 0; /* no end to the ']' found */ else prefix_len = c + 1; @@ -1304,7 +1304,8 @@ modest_text_utils_utf8_strcmp (const gchar* s1, const gchar *s2, gboolean insens if (!insensitive) { /* optimization: shortcut if first char is ascii */ - if (((s1[0] & 0xf0)== 0) && ((s2[0] & 0xf0) == 0)) + if (((s1[0] & 0x80)== 0) && ((s2[0] & 0x80) == 0) && + (s1[0] != s2[0])) return s1[0] - s2[0]; return g_utf8_collate (s1, s2); @@ -1313,8 +1314,9 @@ modest_text_utils_utf8_strcmp (const gchar* s1, const gchar *s2, gboolean insens gint result; gchar *n1, *n2; - /* optimization: short cut iif first char is ascii */ - if (((s1[0] & 0xf0) == 0) && ((s2[0] & 0xf0) == 0)) + /* optimization: shortcut if first char is ascii */ + if (((s1[0] & 0x80) == 0) && ((s2[0] & 0x80) == 0) && + (s1[0] != s2[0])) return tolower(s1[0]) - tolower(s2[0]); n1 = g_utf8_strdown (s1, -1);