X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmodest-text-utils.c;h=5aa886044fc2d3ca220a6c1337636b4f0658c2f8;hb=54468304d70281e5847f1d92acd70c4a758e97a1;hp=85df268d6be6532e54628e03c6170d943531df4c;hpb=0f332c6c834094611227374422ba0afccd560cf8;p=modest diff --git a/src/modest-text-utils.c b/src/modest-text-utils.c index 85df268..5aa8860 100644 --- a/src/modest-text-utils.c +++ b/src/modest-text-utils.c @@ -278,6 +278,11 @@ modest_text_utils_strftime(char *s, gsize max, const char *fmt, time_t timet) { struct tm tm; + /* To prevent possible problems in strftime that could leave + garbage in the s variable */ + if (s) + s[0] = '\0'; + /* does not work on old maemo glib: * g_date_set_time_t (&date, timet); */ @@ -995,7 +1000,7 @@ cmp_offsets_reverse (const url_match_t *match1, const url_match_t *match2) return match2->offset - match1->offset; } -static gboolean url_matches_block = 0; +static gint url_matches_block = 0; static url_match_pattern_t patterns[] = MAIL_VIEWER_URL_MATCH_PATTERNS; @@ -1304,7 +1309,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 +1319,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);