From 2ce75a37bcca6a5c960c1fb56b530c24de5a8492 Mon Sep 17 00:00:00 2001 From: hiro Date: Fri, 10 Jun 2005 09:28:05 +0000 Subject: fixed Turkish locale problem. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@333 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 6 +++++ ChangeLog.ja | 6 +++++ src/addressbook.c | 6 ++--- src/codeconv.c | 18 ++++++++------- src/compose.c | 57 +++++++++++++++++++++++----------------------- src/customheader.c | 2 +- src/editaddress.c | 6 ++--- src/editgroup.c | 4 ++-- src/filter.c | 7 +++--- src/folder.c | 24 +++++++++---------- src/folderview.c | 3 ++- src/grouplistdialog.c | 7 +++--- src/html.c | 4 ++-- src/imap.c | 36 +++++++++++++++++------------ src/jpilot.c | 15 ++++-------- src/ldif.c | 24 +++++++++---------- src/mimeview.c | 8 +++---- src/news.c | 5 ++-- src/nntp.c | 2 +- src/pop.c | 2 +- src/prefs.c | 10 ++++---- src/prefs_common.c | 16 ++++++------- src/prefs_display_header.c | 2 +- src/prefs_filter.c | 6 ++--- src/prefs_filter_edit.c | 4 ++-- src/procheader.c | 14 ++++++------ src/procmime.c | 52 ++++++++++++++++++++++-------------------- src/procmsg.c | 5 ++-- src/rfc2015.c | 16 +++++++------ src/select-keys.c | 4 ++-- src/smtp.c | 2 +- src/summaryview.c | 3 ++- src/syldap.c | 20 ++++++++-------- src/template.c | 8 +++---- src/textview.c | 18 +++++++-------- src/utils.c | 41 +++++++++++++++++---------------- src/vcard.c | 32 +++++++++++++------------- 37 files changed, 259 insertions(+), 236 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f7b35df..43daa404 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-06-10 + + * replaced every strcasecmp/g_strcasecmp with g_ascii_strcasecmp, + and strncasecmp/g_strncasecmp with g_ascii_strncasecmp + (fixes Turkish locale problem) (thanks to Doruk Fisek). + 2005-06-10 * src/prefs.h diff --git a/ChangeLog.ja b/ChangeLog.ja index 2912d6a5..f9ea407c 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,3 +1,9 @@ +2005-06-10 + + * すべての strcasecmp/g_strcasecmp を g_ascii_strcasecmp で、 + strncasecmp/g_strncasecmp を g_ascii_strncasecmp で置き換えた + (トルコ語 locale の問題を修正) (Doruk Fisek さん thanks)。 + 2005-06-10 * src/prefs.h diff --git a/src/addressbook.c b/src/addressbook.c index 6c62b3ad..6175abab 100644 --- a/src/addressbook.c +++ b/src/addressbook.c @@ -2766,7 +2766,7 @@ static gint addressbook_list_compare_func(GtkCList *clist, if( obj2 ) name2 = obj2->name; if( ! name1 ) return ( name2 != NULL ); if( ! name2 ) return -1; - return strcasecmp(name1, name2); + return g_ascii_strcasecmp(name1, name2); } */ @@ -2781,7 +2781,7 @@ static gint addressbook_list_compare_func( GtkCList *clist, gconstpointer ptr1, if( cell2 ) name2 = cell2->u.text; if( ! name1 ) return ( name2 != NULL ); if( ! name2 ) return -1; - return strcasecmp( name1, name2 ); + return g_ascii_strcasecmp( name1, name2 ); } /* static */ @@ -2796,7 +2796,7 @@ gint addressbook_obj_name_compare(gconstpointer a, gconstpointer b) atci = addrbookctl_lookup( obj->type ); if( ! atci ) return -1; if( ! obj->name ) return -1; - return strcasecmp(obj->name, name); + return g_ascii_strcasecmp(obj->name, name); } #if 0 diff --git a/src/codeconv.c b/src/codeconv.c index aff5711a..9ad84724 100644 --- a/src/codeconv.c +++ b/src/codeconv.c @@ -890,7 +890,7 @@ conv_get_fallback_for_private_encoding(const gchar *encoding) { if (encoding && (encoding[0] == 'X' || encoding[0] == 'x') && encoding[1] == '-') { - if (!g_strcasecmp(encoding, CS_X_GBK)) + if (!g_ascii_strcasecmp(encoding, CS_X_GBK)) return CS_GBK; } @@ -1472,14 +1472,15 @@ CharSet conv_get_locale_charset(void) /* "ja_JP.EUC" matches with "ja_JP.eucJP", "ja_JP.EUC" and "ja_JP". "ja_JP" matches with "ja_JP.xxxx" and "ja" */ - if (!strncasecmp(cur_locale, locale_table[i].locale, - strlen(locale_table[i].locale))) { + if (!g_ascii_strncasecmp(cur_locale, locale_table[i].locale, + strlen(locale_table[i].locale))) { cur_charset = locale_table[i].charset; return cur_charset; } else if ((p = strchr(locale_table[i].locale, '_')) && !strchr(p + 1, '.')) { if (strlen(cur_locale) == 2 && - !strncasecmp(cur_locale, locale_table[i].locale, 2)) { + !g_ascii_strncasecmp(cur_locale, + locale_table[i].locale, 2)) { cur_charset = locale_table[i].charset; return cur_charset; } @@ -1534,14 +1535,15 @@ CharSet conv_get_outgoing_charset(void) for (i = 0; i < sizeof(locale_table) / sizeof(locale_table[0]); i++) { const gchar *p; - if (!strncasecmp(cur_locale, locale_table[i].locale, - strlen(locale_table[i].locale))) { + if (!g_ascii_strncasecmp(cur_locale, locale_table[i].locale, + strlen(locale_table[i].locale))) { out_charset = locale_table[i].out_charset; break; } else if ((p = strchr(locale_table[i].locale, '_')) && !strchr(p + 1, '.')) { if (strlen(cur_locale) == 2 && - !strncasecmp(cur_locale, locale_table[i].locale, 2)) { + !g_ascii_strncasecmp(cur_locale, + locale_table[i].locale, 2)) { out_charset = locale_table[i].out_charset; break; } @@ -1615,7 +1617,7 @@ gboolean conv_is_ja_locale(void) is_ja_locale = 0; cur_locale = conv_get_current_locale(); if (cur_locale) { - if (g_strncasecmp(cur_locale, "ja", 2) == 0) + if (g_ascii_strncasecmp(cur_locale, "ja", 2) == 0) is_ja_locale = 1; } diff --git a/src/compose.c b/src/compose.c index d0b3b879..503f8434 100644 --- a/src/compose.c +++ b/src/compose.c @@ -1478,7 +1478,7 @@ static void compose_reply_set_entry(Compose *compose, MsgInfo *msginfo, if (msginfo->folder && msginfo->folder->trim_compose_subject) trim_subject(buf); - while (!strncasecmp(buf, "Re:", 3)) { + while (!g_ascii_strncasecmp(buf, "Re:", 3)) { p = buf + 3; while (isspace(*p)) p++; memmove(buf, p, strlen(p) + 1); @@ -1745,7 +1745,7 @@ static void compose_attach_append(Compose *compose, const gchar *file, if (content_type) { ainfo->content_type = g_strdup(content_type); - if (!strcasecmp(content_type, "message/rfc822")) { + if (!g_ascii_strcasecmp(content_type, "message/rfc822")) { MsgInfo *msginfo; MsgFlags flags = {0, 0}; const gchar *name; @@ -1765,7 +1765,7 @@ static void compose_attach_append(Compose *compose, const gchar *file, procmsg_msginfo_free(msginfo); } else { - if (!g_strncasecmp(content_type, "text", 4)) + if (!g_ascii_strncasecmp(content_type, "text", 4)) ainfo->encoding = procmime_get_encoding_for_text_file(file); else ainfo->encoding = ENC_BASE64; @@ -1778,7 +1778,7 @@ static void compose_attach_append(Compose *compose, const gchar *file, ainfo->content_type = g_strdup("application/octet-stream"); ainfo->encoding = ENC_BASE64; - } else if (!g_strncasecmp(ainfo->content_type, "text", 4)) + } else if (!g_ascii_strncasecmp(ainfo->content_type, "text", 4)) ainfo->encoding = procmime_get_encoding_for_text_file(file); else @@ -1799,7 +1799,7 @@ static void compose_attach_append(Compose *compose, const gchar *file, #define IS_FIRST_PART_TEXT(info) \ ((info->mime_type == MIME_TEXT || info->mime_type == MIME_TEXT_HTML) || \ (info->mime_type == MIME_MULTIPART && info->content_type && \ - !strcasecmp(info->content_type, "multipart/alternative") && \ + !g_ascii_strcasecmp(info->content_type, "multipart/alternative") && \ (info->children && \ (info->children->mime_type == MIME_TEXT || \ info->children->mime_type == MIME_TEXT_HTML)))) @@ -2620,7 +2620,7 @@ static gint compose_write_to_file(Compose *compose, const gchar *file, out_charset = conv_get_charset_str(compose->out_encoding); if (!out_charset) out_charset = conv_get_outgoing_charset_str(); - if (!g_strcasecmp(out_charset, CS_US_ASCII)) + if (!g_ascii_strcasecmp(out_charset, CS_US_ASCII)) out_charset = CS_ISO_8859_1; body_charset = out_charset; @@ -2909,23 +2909,23 @@ static gint compose_redirect_write_to_file(Compose *compose, const gchar *file) } while (procheader_get_one_field(buf, sizeof(buf), fp, NULL) == 0) { - if (g_strncasecmp(buf, "Return-Path:", - strlen("Return-Path:")) == 0 || - g_strncasecmp(buf, "Delivered-To:", - strlen("Delivered-To:")) == 0 || - g_strncasecmp(buf, "Received:", - strlen("Received:")) == 0 || - g_strncasecmp(buf, "Subject:", - strlen("Subject:")) == 0 || - g_strncasecmp(buf, "X-UIDL:", - strlen("X-UIDL:")) == 0) + if (g_ascii_strncasecmp(buf, "Return-Path:", + strlen("Return-Path:")) == 0 || + g_ascii_strncasecmp(buf, "Delivered-To:", + strlen("Delivered-To:")) == 0 || + g_ascii_strncasecmp(buf, "Received:", + strlen("Received:")) == 0 || + g_ascii_strncasecmp(buf, "Subject:", + strlen("Subject:")) == 0 || + g_ascii_strncasecmp(buf, "X-UIDL:", + strlen("X-UIDL:")) == 0) continue; if (fputs(buf, fdest) == EOF) goto error; #if 0 - if (g_strncasecmp(buf, "From:", strlen("From:")) == 0) { + if (g_ascii_strncasecmp(buf, "From:", strlen("From:")) == 0) { fputs("\n (by way of ", fdest); if (compose->account->name) { compose_convert_header(compose, @@ -3136,7 +3136,7 @@ static void compose_write_attach(Compose *compose, FILE *fp, fprintf(fp, "\n--%s\n", compose->boundary); - if (!g_strcasecmp(ainfo->content_type, "message/rfc822")) { + if (!g_ascii_strcasecmp(ainfo->content_type, "message/rfc822")) { fprintf(fp, "Content-Type: %s\n", ainfo->content_type); fprintf(fp, "Content-Disposition: inline\n"); } else { @@ -3448,17 +3448,16 @@ static gint compose_write_headers(Compose *compose, FILE *fp, cur = cur->next) { CustomHeader *chdr = (CustomHeader *)cur->data; - if (strcasecmp(chdr->name, "Date") != 0 && - strcasecmp(chdr->name, "From") != 0 && - strcasecmp(chdr->name, "To") != 0 && - /* strcasecmp(chdr->name, "Sender") != 0 && */ - strcasecmp(chdr->name, "Message-Id") != 0 && - strcasecmp(chdr->name, "In-Reply-To") != 0 && - strcasecmp(chdr->name, "References") != 0 && - strcasecmp(chdr->name, "Mime-Version") != 0 && - strcasecmp(chdr->name, "Content-Type") != 0 && - strcasecmp(chdr->name, "Content-Transfer-Encoding") - != 0) { + if (g_ascii_strcasecmp(chdr->name, "Date") != 0 && + g_ascii_strcasecmp(chdr->name, "From") != 0 && + g_ascii_strcasecmp(chdr->name, "To") != 0 && + /* g_ascii_strcasecmp(chdr->name, "Sender") != 0 && */ + g_ascii_strcasecmp(chdr->name, "Message-Id") != 0 && + g_ascii_strcasecmp(chdr->name, "In-Reply-To") != 0 && + g_ascii_strcasecmp(chdr->name, "References") != 0 && + g_ascii_strcasecmp(chdr->name, "Mime-Version") != 0 && + g_ascii_strcasecmp(chdr->name, "Content-Type") != 0 && + g_ascii_strcasecmp(chdr->name, "Content-Transfer-Encoding") != 0) { compose_convert_header (compose, buf, sizeof(buf), chdr->value ? chdr->value : "", diff --git a/src/customheader.c b/src/customheader.c index 2bcb0357..535c7407 100644 --- a/src/customheader.c +++ b/src/customheader.c @@ -83,7 +83,7 @@ CustomHeader *custom_header_find(GSList *header_list, const gchar *header) for (cur = header_list; cur != NULL; cur = cur->next) { chdr = (CustomHeader *)cur->data; - if (!strcasecmp(chdr->name, header)) + if (!g_ascii_strcasecmp(chdr->name, header)) return chdr; } diff --git a/src/editaddress.c b/src/editaddress.c index 68096822..cda595bd 100644 --- a/src/editaddress.c +++ b/src/editaddress.c @@ -742,9 +742,9 @@ void addressbook_edit_person_page_basic( gint pageNum, gchar *pageLbl ) { ATTACH_ROW(_("Display Name"), entry_name); locale = conv_get_current_locale(); if (locale && - (!g_strncasecmp(locale, "ja", 2) || - !g_strncasecmp(locale, "ko", 2) || - !g_strncasecmp(locale, "zh", 2))) { + (!g_ascii_strncasecmp(locale, "ja", 2) || + !g_ascii_strncasecmp(locale, "ko", 2) || + !g_ascii_strncasecmp(locale, "zh", 2))) { ATTACH_ROW(_("Last Name"), entry_ln); ATTACH_ROW(_("First Name"), entry_fn); } else { diff --git a/src/editgroup.c b/src/editgroup.c index 3cd9e9a5..328d6c29 100644 --- a/src/editgroup.c +++ b/src/editgroup.c @@ -230,7 +230,7 @@ static gint edit_group_list_compare_func( GtkCList *clist, gconstpointer ptr1, g if( cell2 ) name2 = cell2->u.text; if( ! name1 ) return ( name2 != NULL ); if( ! name2 ) return -1; - return strcasecmp( name1, name2 ); + return g_ascii_strcasecmp( name1, name2 ); } static void addressbook_edit_group_create( gboolean *cancelled ) { @@ -528,7 +528,7 @@ ItemFolder *addressbook_edit_folder( AddressBookFile *abf, ItemFolder *parent, I return NULL; } if( folder ) { - if( strcasecmp( name, ADDRITEM_NAME(folder) ) == 0 ) { + if( g_ascii_strcasecmp( name, ADDRITEM_NAME(folder) ) == 0 ) { g_free( name ); return NULL; } diff --git a/src/filter.c b/src/filter.c index 983cee34..bc11a824 100644 --- a/src/filter.c +++ b/src/filter.c @@ -397,7 +397,8 @@ static gboolean filter_match_header_cond(FilterCond *cond, GSList *hlist) switch (cond->type) { case FLT_COND_HEADER: - if (!strcasecmp(header->name, cond->header_name)) { + if (!g_ascii_strcasecmp + (header->name, cond->header_name)) { if (!cond->str_value || cond->match_func(header->body, cond->str_value)) @@ -410,8 +411,8 @@ static gboolean filter_match_header_cond(FilterCond *cond, GSList *hlist) matched = TRUE; break; case FLT_COND_TO_OR_CC: - if (!strcasecmp(header->name, "To") || - !strcasecmp(header->name, "Cc")) { + if (!g_ascii_strcasecmp(header->name, "To") || + !g_ascii_strcasecmp(header->name, "Cc")) { if (!cond->str_value || cond->match_func(header->body, cond->str_value)) diff --git a/src/folder.c b/src/folder.c index 7dadc35a..00c43c6a 100644 --- a/src/folder.c +++ b/src/folder.c @@ -636,7 +636,7 @@ static FolderType folder_get_type_from_string(const gchar *str) for (i = 0; i < sizeof(type_str_table) / sizeof(type_str_table[0]); i++) { - if (g_strcasecmp(type_str_table[i].str, str) == 0) + if (g_ascii_strcasecmp(type_str_table[i].str, str) == 0) return type_str_table[i].type; } @@ -1234,17 +1234,17 @@ static gboolean folder_build_tree(GNode *node, gpointer data) if (!attr || !attr->name || !attr->value) continue; if (!strcmp(attr->name, "type")) { - if (!strcasecmp(attr->value, "normal")) + if (!g_ascii_strcasecmp(attr->value, "normal")) stype = F_NORMAL; - else if (!strcasecmp(attr->value, "inbox")) + else if (!g_ascii_strcasecmp(attr->value, "inbox")) stype = F_INBOX; - else if (!strcasecmp(attr->value, "outbox")) + else if (!g_ascii_strcasecmp(attr->value, "outbox")) stype = F_OUTBOX; - else if (!strcasecmp(attr->value, "draft")) + else if (!g_ascii_strcasecmp(attr->value, "draft")) stype = F_DRAFT; - else if (!strcasecmp(attr->value, "queue")) + else if (!g_ascii_strcasecmp(attr->value, "queue")) stype = F_QUEUE; - else if (!strcasecmp(attr->value, "trash")) + else if (!g_ascii_strcasecmp(attr->value, "trash")) stype = F_TRASH; } else if (!strcmp(attr->name, "name")) name = attr->value; @@ -1387,15 +1387,15 @@ static gboolean folder_read_folder_func(GNode *node, gpointer data) if (!attr || !attr->name || !attr->value) continue; if (!strcmp(attr->name, "type")) { - if (!strcasecmp(attr->value, "mh")) + if (!g_ascii_strcasecmp(attr->value, "mh")) type = F_MH; - else if (!strcasecmp(attr->value, "mbox")) + else if (!g_ascii_strcasecmp(attr->value, "mbox")) type = F_MBOX; - else if (!strcasecmp(attr->value, "maildir")) + else if (!g_ascii_strcasecmp(attr->value, "maildir")) type = F_MAILDIR; - else if (!strcasecmp(attr->value, "imap")) + else if (!g_ascii_strcasecmp(attr->value, "imap")) type = F_IMAP; - else if (!strcasecmp(attr->value, "news")) + else if (!g_ascii_strcasecmp(attr->value, "news")) type = F_NEWS; } else if (!strcmp(attr->name, "name")) name = attr->value; diff --git a/src/folderview.c b/src/folderview.c index d9487b25..53c072dc 100644 --- a/src/folderview.c +++ b/src/folderview.c @@ -2246,7 +2246,8 @@ static void folderview_new_news_group_cb(FolderView *folderview, guint action, item = FOLDER_ITEM(gnode->data); if (g_slist_find_custom(new_subscr, item->path, - (GCompareFunc)g_strcasecmp) != NULL) { + (GCompareFunc)g_ascii_strcasecmp) + != NULL) { gnode = next; continue; } diff --git a/src/grouplistdialog.c b/src/grouplistdialog.c index 779e8bd3..b5271fd1 100644 --- a/src/grouplistdialog.c +++ b/src/grouplistdialog.c @@ -430,8 +430,9 @@ static void grouplist_dialog_set_list(const gchar *pattern, gboolean refresh) if (g_pattern_match_string(pspec, ginfo->name)) { node = grouplist_create_branch(ginfo, pattern); - if (g_slist_find_custom(subscribed, ginfo->name, - (GCompareFunc)g_strcasecmp) + if (g_slist_find_custom + (subscribed, ginfo->name, + (GCompareFunc)g_ascii_strcasecmp) != NULL) gtk_ctree_select(GTK_CTREE(ctree), node); } @@ -555,7 +556,7 @@ static void ctree_unselected(GtkCTree *ctree, GtkCTreeNode *node, gint column, if (!ginfo) return; list = g_slist_find_custom(subscribed, ginfo->name, - (GCompareFunc)g_strcasecmp); + (GCompareFunc)g_ascii_strcasecmp); if (list) { g_free(list->data); subscribed = g_slist_remove(subscribed, list->data); diff --git a/src/html.c b/src/html.c index 33378bf6..7ba2acd3 100644 --- a/src/html.c +++ b/src/html.c @@ -541,14 +541,14 @@ static void html_get_parenthesis(HTMLParser *parser, gchar *buf, gint len) parser->bufp = p + 3; return; } - if (!g_strncasecmp(parser->bufp, "bufp, "bufp += 6; while ((p = strcasestr(parser->bufp, "")) == NULL) if (html_read_line(parser) == HTML_EOF) return; parser->bufp = p + 8; return; } - if (!g_strncasecmp(parser->bufp, "bufp, "bufp += 7; while ((p = strcasestr(parser->bufp, "")) == NULL) if (html_read_line(parser) == HTML_EOF) return; diff --git a/src/imap.c b/src/imap.c index 4b1abc36..9da5e70d 100644 --- a/src/imap.c +++ b/src/imap.c @@ -1757,16 +1757,20 @@ static gint imap_scan_tree_recursive(IMAPSession *session, FolderItem *item) base = g_basename(new_item->path); - if (!folder->outbox && !strcasecmp(base, "Sent")) { + if (!folder->outbox && + !g_ascii_strcasecmp(base, "Sent")) { new_item->stype = F_OUTBOX; folder->outbox = new_item; - } else if (!folder->draft && !strcasecmp(base, "Drafts")) { + } else if (!folder->draft && + !g_ascii_strcasecmp(base, "Drafts")) { new_item->stype = F_DRAFT; folder->draft = new_item; - } else if (!folder->queue && !strcasecmp(base, "Queue")) { + } else if (!folder->queue && + !g_ascii_strcasecmp(base, "Queue")) { new_item->stype = F_QUEUE; folder->queue = new_item; - } else if (!folder->trash && !strcasecmp(base, "Trash")) { + } else if (!folder->trash && + !g_ascii_strcasecmp(base, "Trash")) { new_item->stype = F_TRASH; folder->trash = new_item; } @@ -2656,15 +2660,16 @@ static MsgFlags imap_parse_flags(const gchar *flag_str) while ((p = strchr(p, '\\')) != NULL) { p++; - if (g_strncasecmp(p, "Recent", 6) == 0 && MSG_IS_UNREAD(flags)) { + if (g_ascii_strncasecmp(p, "Recent", 6) == 0 && + MSG_IS_UNREAD(flags)) { MSG_SET_PERM_FLAGS(flags, MSG_NEW); - } else if (g_strncasecmp(p, "Seen", 4) == 0) { + } else if (g_ascii_strncasecmp(p, "Seen", 4) == 0) { MSG_UNSET_PERM_FLAGS(flags, MSG_NEW|MSG_UNREAD); - } else if (g_strncasecmp(p, "Deleted", 7) == 0) { + } else if (g_ascii_strncasecmp(p, "Deleted", 7) == 0) { MSG_SET_PERM_FLAGS(flags, MSG_DELETED); - } else if (g_strncasecmp(p, "Flagged", 7) == 0) { + } else if (g_ascii_strncasecmp(p, "Flagged", 7) == 0) { MSG_SET_PERM_FLAGS(flags, MSG_MARKED); - } else if (g_strncasecmp(p, "Answered", 8) == 0) { + } else if (g_ascii_strncasecmp(p, "Answered", 8) == 0) { MSG_SET_PERM_FLAGS(flags, MSG_REPLIED); } } @@ -2680,13 +2685,13 @@ static IMAPFlags imap_parse_imap_flags(const gchar *flag_str) while ((p = strchr(p, '\\')) != NULL) { p++; - if (g_strncasecmp(p, "Seen", 4) == 0) { + if (g_ascii_strncasecmp(p, "Seen", 4) == 0) { flags |= IMAP_FLAG_SEEN; - } else if (g_strncasecmp(p, "Deleted", 7) == 0) { + } else if (g_ascii_strncasecmp(p, "Deleted", 7) == 0) { flags |= IMAP_FLAG_DELETED; - } else if (g_strncasecmp(p, "Flagged", 7) == 0) { + } else if (g_ascii_strncasecmp(p, "Flagged", 7) == 0) { flags |= IMAP_FLAG_FLAGGED; - } else if (g_strncasecmp(p, "Answered", 8) == 0) { + } else if (g_ascii_strncasecmp(p, "Answered", 8) == 0) { flags |= IMAP_FLAG_ANSWERED; } } @@ -3019,7 +3024,7 @@ static gboolean imap_has_capability(IMAPSession *session, gchar **p; for (p = session->capability; *p != NULL; ++p) { - if (!g_strcasecmp(*p, capability)) + if (!g_ascii_strcasecmp(*p, capability)) return TRUE; } @@ -3622,7 +3627,8 @@ static void imap_cmd_gen_send(IMAPSession *session, const gchar *format, ...) session->cmd_count++; g_snprintf(buf, sizeof(buf), "%d %s\r\n", session->cmd_count, tmp); - if (!strncasecmp(tmp, "LOGIN ", 6) && (p = strchr(tmp + 6, ' '))) { + if (!g_ascii_strncasecmp(tmp, "LOGIN ", 6) && + (p = strchr(tmp + 6, ' '))) { *p = '\0'; log_print("IMAP4> %d %s ********\n", session->cmd_count, tmp); } else diff --git a/src/jpilot.c b/src/jpilot.c index 624d0f4f..826491b6 100644 --- a/src/jpilot.c +++ b/src/jpilot.c @@ -1291,7 +1291,7 @@ static gboolean jpilot_setup_labels( JPilotFile *pilotFile ) { labelName = convertBuff; } - if( g_strcasecmp( labelName, lbl ) == 0 ) { + if( g_ascii_strcasecmp( labelName, lbl ) == 0 ) { ind = i; break; } @@ -1507,18 +1507,11 @@ static void jpilot_remove_empty( JPilotFile *pilotFile ) { * ============================================================================================ */ gint jpilot_read_data( JPilotFile *pilotFile ) { - const gchar *cur_locale; - name_order = FAMILY_LAST; convert_charcode = FALSE; - cur_locale = conv_get_current_locale(); - - if( g_strncasecmp( cur_locale, "ja", 2 ) == 0 ) { + if( conv_is_ja_locale() ) { name_order = FAMILY_FIRST; - } - - if( conv_get_locale_charset() == C_EUC_JP ) { convert_charcode = TRUE; } @@ -1587,7 +1580,7 @@ gint jpilot_check_label( struct AddressAppInfo *ai, gchar *lblCheck ) { lblName = ai->labels[i]; if( lblName ) { if( strlen( lblName ) ) { - if( g_strcasecmp( lblName, lblCheck ) == 0 ) return i; + if( g_ascii_strcasecmp( lblName, lblCheck ) == 0 ) return i; } } } @@ -1692,7 +1685,7 @@ gboolean jpilot_test_custom_label( JPilotFile *pilotFile, const gchar *labelName if( labelName ) { node = pilotFile->customLabels; while( node ) { - if( g_strcasecmp( labelName, node->data ) == 0 ) { + if( g_ascii_strcasecmp( labelName, node->data ) == 0 ) { retVal = TRUE; break; } diff --git a/src/ldif.c b/src/ldif.c index cae15b10..39a4055a 100644 --- a/src/ldif.c +++ b/src/ldif.c @@ -498,19 +498,19 @@ static void ldif_add_value( Ldif_ParsedRec *rec, gchar *tagName, gchar *tagValue val = g_strdup( "" ); } g_strstrip( val ); - if( g_strcasecmp( nm, LDIF_TAG_COMMONNAME ) == 0 ) { + if( g_ascii_strcasecmp( nm, LDIF_TAG_COMMONNAME ) == 0 ) { rec->listCName = g_slist_append( rec->listCName, val ); } - else if( g_strcasecmp( nm, LDIF_TAG_FIRSTNAME ) == 0 ) { + else if( g_ascii_strcasecmp( nm, LDIF_TAG_FIRSTNAME ) == 0 ) { rec->listFName = g_slist_append( rec->listFName, val ); } - else if( g_strcasecmp( nm, LDIF_TAG_LASTNAME ) == 0 ) { + else if( g_ascii_strcasecmp( nm, LDIF_TAG_LASTNAME ) == 0 ) { rec->listLName = g_slist_append( rec->listLName, val ); } - else if( g_strcasecmp( nm, LDIF_TAG_NICKNAME ) == 0 ) { + else if( g_ascii_strcasecmp( nm, LDIF_TAG_NICKNAME ) == 0 ) { rec->listNName = g_slist_append( rec->listNName, val ); } - else if( g_strcasecmp( nm, LDIF_TAG_EMAIL ) == 0 ) { + else if( g_ascii_strcasecmp( nm, LDIF_TAG_EMAIL ) == 0 ) { rec->listAddress = g_slist_append( rec->listAddress, val ); } else { @@ -743,19 +743,19 @@ static void ldif_hash_add_list( GHashTable *table, GSList *list ) { gchar *key = g_strdup( tag ); rec = ldif_create_fieldrec( tag ); - if( g_strcasecmp( tag, LDIF_TAG_COMMONNAME ) == 0 ) { + if( g_ascii_strcasecmp( tag, LDIF_TAG_COMMONNAME ) == 0 ) { rec->reserved = TRUE; } - else if( g_strcasecmp( tag, LDIF_TAG_FIRSTNAME ) == 0 ) { + else if( g_ascii_strcasecmp( tag, LDIF_TAG_FIRSTNAME ) == 0 ) { rec->reserved = TRUE; } - else if( g_strcasecmp( tag, LDIF_TAG_LASTNAME ) == 0 ) { + else if( g_ascii_strcasecmp( tag, LDIF_TAG_LASTNAME ) == 0 ) { rec->reserved = TRUE; } - else if( g_strcasecmp( tag, LDIF_TAG_NICKNAME ) == 0 ) { + else if( g_ascii_strcasecmp( tag, LDIF_TAG_NICKNAME ) == 0 ) { rec->reserved = TRUE; } - else if( g_strcasecmp( tag, LDIF_TAG_EMAIL ) == 0 ) { + else if( g_ascii_strcasecmp( tag, LDIF_TAG_EMAIL ) == 0 ) { rec->reserved = TRUE; } g_hash_table_insert( table, key, rec ); @@ -770,7 +770,7 @@ static void ldif_hash_add_list( GHashTable *table, GSList *list ) { static int ldif_field_compare( gconstpointer ptr1, gconstpointer ptr2 ) { const Ldif_FieldRec *rec1 = ptr1; const Ldif_FieldRec *rec2 = ptr2; - return g_strcasecmp( rec1->tagName, rec2->tagName ); + return g_ascii_strcasecmp( rec1->tagName, rec2->tagName ); } /* @@ -842,7 +842,7 @@ static void ldif_read_tag_list( LdifFile *ldifFile ) { if( tagName ) { /* Add tag to list */ listTags = g_slist_append( listTags, tagName ); - if( g_strcasecmp( tagName, LDIF_TAG_EMAIL ) == 0 ) { + if( g_ascii_strcasecmp( tagName, LDIF_TAG_EMAIL ) == 0 ) { flagMail = TRUE; } } diff --git a/src/mimeview.c b/src/mimeview.c index b847e117..5b0621bf 100644 --- a/src/mimeview.c +++ b/src/mimeview.c @@ -783,8 +783,8 @@ static void mimeview_selection_changed(GtkTreeSelection *selection, default: mimeview_change_view_type(mimeview, MIMEVIEW_TEXT); #if USE_GPGME - if (g_strcasecmp(partinfo->content_type, - "application/pgp-signature") == 0) + if (g_ascii_strcasecmp(partinfo->content_type, + "application/pgp-signature") == 0) mimeview_show_signature_part(mimeview, partinfo); else #endif @@ -1169,8 +1169,8 @@ static void mimeview_update_signature_info(MimeView *mimeview) partinfo = mimeview_get_selected_part(mimeview); if (!partinfo) return; - if (g_strcasecmp(partinfo->content_type, - "application/pgp-signature") == 0) { + if (g_ascii_strcasecmp(partinfo->content_type, + "application/pgp-signature") == 0) { mimeview_change_view_type(mimeview, MIMEVIEW_TEXT); mimeview_show_signature_part(mimeview, partinfo); } diff --git a/src/news.c b/src/news.c index 2c045ca9..6091d693 100644 --- a/src/news.c +++ b/src/news.c @@ -504,7 +504,7 @@ static void news_group_info_free(NewsGroupInfo *ginfo) static gint news_group_info_compare(NewsGroupInfo *ginfo1, NewsGroupInfo *ginfo2) { - return g_strcasecmp(ginfo1->name, ginfo2->name); + return g_ascii_strcasecmp(ginfo1->name, ginfo2->name); } GSList *news_get_group_list(Folder *folder) @@ -725,7 +725,8 @@ static gint news_select_group(NNTPSession *session, const gchar *group, gint num_, first_, last_; if (!num || !first || !last) { - if (session->group && g_strcasecmp(session->group, group) == 0) + if (session->group && + g_ascii_strcasecmp(session->group, group) == 0) return NN_SUCCESS; num = &num_; first = &first_; diff --git a/src/nntp.c b/src/nntp.c index 173f605e..7e36baaa 100644 --- a/src/nntp.c +++ b/src/nntp.c @@ -352,7 +352,7 @@ static gint nntp_gen_send(SockInfo *sock, const gchar *format, ...) va_end(args); if (verbose) { - if (!g_strncasecmp(buf, "AUTHINFO PASS", 13)) + if (!g_ascii_strncasecmp(buf, "AUTHINFO PASS", 13)) log_print("NNTP> AUTHINFO PASS ********\n"); else log_print("NNTP> %s\n", buf); diff --git a/src/pop.c b/src/pop.c index 3f618613..78c41d29 100644 --- a/src/pop.c +++ b/src/pop.c @@ -385,7 +385,7 @@ static void pop3_gen_send(Pop3Session *session, const gchar *format, ...) g_vsnprintf(buf, sizeof(buf) - 2, format, args); va_end(args); - if (!strncasecmp(buf, "PASS ", 5)) + if (!g_ascii_strncasecmp(buf, "PASS ", 5)) log_print("POP3> PASS ********\n"); else log_print("POP3> %s\n", buf); diff --git a/src/prefs.c b/src/prefs.c index af394679..2b0630c9 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -116,7 +116,7 @@ void prefs_config_parse_one_line(PrefParam *param, const gchar *buf) for (i = 0; param[i].name != NULL; i++) { name_len = strlen(param[i].name); - if (strncasecmp(buf, param[i].name, name_len)) + if (g_ascii_strncasecmp(buf, param[i].name, name_len)) continue; if (buf[name_len] != '=') continue; @@ -381,7 +381,7 @@ void prefs_set_default(PrefParam *param) switch (param[i].type) { case P_STRING: if (param[i].defval != NULL) { - if (!strncasecmp(param[i].defval, "ENV_", 4)) { + if (!g_ascii_strncasecmp(param[i].defval, "ENV_", 4)) { const gchar *envstr; gchar *tmp = NULL; @@ -419,7 +419,7 @@ void prefs_set_default(PrefParam *param) break; case P_BOOL: if (param[i].defval != NULL) { - if (!strcasecmp(param[i].defval, "TRUE")) + if (!g_ascii_strcasecmp(param[i].defval, "TRUE")) *((gboolean *)param[i].data) = TRUE; else *((gboolean *)param[i].data) = @@ -568,7 +568,7 @@ void prefs_set_dialog_to_default(PrefParam *param) case P_STRING: #warning FIXME_GTK2 if (tmpparam.defval) { - if (!strncasecmp(tmpparam.defval, "ENV_", 4)) { + if (!g_ascii_strncasecmp(tmpparam.defval, "ENV_", 4)) { str_data = g_strdup(g_getenv(param[i].defval + 4)); tmpparam.data = &str_data; break; @@ -599,7 +599,7 @@ void prefs_set_dialog_to_default(PrefParam *param) break; case P_BOOL: if (tmpparam.defval) { - if (!strcasecmp(tmpparam.defval, "TRUE")) + if (!g_ascii_strcasecmp(tmpparam.defval, "TRUE")) bool_data = TRUE; else bool_data = atoi(tmpparam.defval) diff --git a/src/prefs_common.c b/src/prefs_common.c index 988f3203..a84c5ab2 100644 --- a/src/prefs_common.c +++ b/src/prefs_common.c @@ -2877,16 +2877,16 @@ static void quote_color_set_dialog(GtkWidget *widget, gpointer data) gint rgbvalue = 0; GtkColorSelectionDialog *dialog; - if(g_strcasecmp(type, "LEVEL1") == 0) { + if(g_ascii_strcasecmp(type, "LEVEL1") == 0) { title = _("Pick color for quotation level 1"); rgbvalue = prefs_common.quote_level1_col; - } else if(g_strcasecmp(type, "LEVEL2") == 0) { + } else if(g_ascii_strcasecmp(type, "LEVEL2") == 0) { title = _("Pick color for quotation level 2"); rgbvalue = prefs_common.quote_level2_col; - } else if(g_strcasecmp(type, "LEVEL3") == 0) { + } else if(g_ascii_strcasecmp(type, "LEVEL3") == 0) { title = _("Pick color for quotation level 3"); rgbvalue = prefs_common.quote_level3_col; - } else if(g_strcasecmp(type, "URI") == 0) { + } else if(g_ascii_strcasecmp(type, "URI") == 0) { title = _("Pick color for URI"); rgbvalue = prefs_common.uri_col; } else { /* Should never be called */ @@ -2939,16 +2939,16 @@ static void quote_colors_set_dialog_ok(GtkWidget *widget, gpointer data) fprintf(stderr, "Color is %x\n", rgbvalue); #endif - if (g_strcasecmp(type, "LEVEL1") == 0) { + if (g_ascii_strcasecmp(type, "LEVEL1") == 0) { prefs_common.quote_level1_col = rgbvalue; set_button_bg_color(color_buttons.quote_level1_btn, rgbvalue); - } else if (g_strcasecmp(type, "LEVEL2") == 0) { + } else if (g_ascii_strcasecmp(type, "LEVEL2") == 0) { prefs_common.quote_level2_col = rgbvalue; set_button_bg_color(color_buttons.quote_level2_btn, rgbvalue); - } else if (g_strcasecmp(type, "LEVEL3") == 0) { + } else if (g_ascii_strcasecmp(type, "LEVEL3") == 0) { prefs_common.quote_level3_col = rgbvalue; set_button_bg_color(color_buttons.quote_level3_btn, rgbvalue); - } else if (g_strcasecmp(type, "URI") == 0) { + } else if (g_ascii_strcasecmp(type, "URI") == 0) { prefs_common.uri_col = rgbvalue; set_button_bg_color(color_buttons.uri_btn, rgbvalue); } else diff --git a/src/prefs_display_header.c b/src/prefs_display_header.c index ec0d51c9..ff508ae1 100644 --- a/src/prefs_display_header.c +++ b/src/prefs_display_header.c @@ -502,7 +502,7 @@ static gint prefs_display_header_find_header(GtkCList *clist, DisplayHeaderProp *dp; while ((dp = gtk_clist_get_row_data(clist, row)) != NULL) { - if (g_strcasecmp(dp->name, header) == 0) + if (g_ascii_strcasecmp(dp->name, header) == 0) return row; row++; } diff --git a/src/prefs_filter.c b/src/prefs_filter.c index 9fe29aab..cd8abe1a 100644 --- a/src/prefs_filter.c +++ b/src/prefs_filter.c @@ -586,9 +586,9 @@ void prefs_filter_set_msg_header_list(MsgInfo *msginfo) cur = next) { next = cur->next; header = (Header *)cur->data; - if (!g_strcasecmp(header->name, "Received") || - !g_strcasecmp(header->name, "Mime-Version") || - !g_strcasecmp(header->name, "X-UIDL")) { + if (!g_ascii_strcasecmp(header->name, "Received") || + !g_ascii_strcasecmp(header->name, "Mime-Version") || + !g_ascii_strcasecmp(header->name, "X-UIDL")) { procheader_header_free(header); rule_list_window.msg_hdr_list = g_slist_remove(rule_list_window.msg_hdr_list, diff --git a/src/prefs_filter_edit.c b/src/prefs_filter_edit.c index dab17a12..f2fa832e 100644 --- a/src/prefs_filter_edit.c +++ b/src/prefs_filter_edit.c @@ -1429,7 +1429,7 @@ static void prefs_filter_edit_activate_cond_header(const gchar *header) "header_str"); if (!menu_header) break; - if (!g_strcasecmp(menu_header, header)) { + if (!g_ascii_strcasecmp(menu_header, header)) { gtk_option_menu_set_history (GTK_OPTION_MENU(hbox->cond_type_optmenu), index); @@ -1468,7 +1468,7 @@ static void edit_header_list_dialog_add(void) for (row = 0; gtk_clist_get_text(clist, row, 0, &row_text) != 0; row++) { - if (g_strcasecmp(row_text, text) == 0) return; + if (g_ascii_strcasecmp(row_text, text) == 0) return; } ctext[0] = (gchar *)text; diff --git a/src/procheader.c b/src/procheader.c index 415bc59c..fc60836d 100644 --- a/src/procheader.c +++ b/src/procheader.c @@ -56,8 +56,8 @@ gint procheader_get_one_field(gchar *buf, size_t len, FILE *fp, for (hp = hentry, hnum = 0; hp->name != NULL; hp++, hnum++) { - if (!strncasecmp(hp->name, buf, - strlen(hp->name))) + if (!g_ascii_strncasecmp(hp->name, buf, + strlen(hp->name))) break; } } while (hp->name == NULL); @@ -288,7 +288,7 @@ gint procheader_find_header_list(GSList *hlist, const gchar *header_name) for (cur = hlist; cur != NULL; cur = cur->next, index++) { header = (Header *)cur->data; - if (g_strcasecmp(header->name, header_name) == 0) + if (g_ascii_strcasecmp(header->name, header_name) == 0) return index; } @@ -405,8 +405,8 @@ void procheader_get_header_fields(FILE *fp, HeaderEntry hentry[]) if (hp->body == NULL) hp->body = g_strdup(p); - else if (!strcasecmp(hp->name, "To:") || - !strcasecmp(hp->name, "Cc:")) { + else if (!g_ascii_strcasecmp(hp->name, "To:") || + !g_ascii_strcasecmp(hp->name, "Cc:")) { gchar *tp = hp->body; hp->body = g_strconcat(tp, ", ", p, NULL); g_free(tp); @@ -584,7 +584,7 @@ MsgInfo *procheader_parse_stream(FILE *fp, MsgFlags flags, gboolean full) } break; case H_CONTENT_TYPE: - if (!g_strncasecmp(hp, "multipart", 9)) { + if (!g_ascii_strncasecmp(hp, "multipart", 9)) { MSG_SET_TMP_FLAGS(msginfo->flags, MSG_MIME); } else if (!charset) { procmime_scan_content_type_str @@ -752,7 +752,7 @@ time_t procheader_date_parse(gchar *dest, const gchar *src, gint len) month[3] = '\0'; for (p = monthstr; *p != '\0'; p += 3) { - if (!strncasecmp(p, month, 3)) { + if (!g_ascii_strncasecmp(p, month, 3)) { dmonth = (gint)(p - monthstr) / 3 + 1; break; } diff --git a/src/procmime.c b/src/procmime.c index 22e00de3..b94bdeef 100644 --- a/src/procmime.c +++ b/src/procmime.c @@ -328,15 +328,15 @@ void procmime_scan_encoding(MimeInfo *mimeinfo, const gchar *encoding) g_free(mimeinfo->encoding); mimeinfo->encoding = g_strdup(g_strstrip(buf)); - if (!strcasecmp(buf, "7bit")) + if (!g_ascii_strcasecmp(buf, "7bit")) mimeinfo->encoding_type = ENC_7BIT; - else if (!strcasecmp(buf, "8bit")) + else if (!g_ascii_strcasecmp(buf, "8bit")) mimeinfo->encoding_type = ENC_8BIT; - else if (!strcasecmp(buf, "quoted-printable")) + else if (!g_ascii_strcasecmp(buf, "quoted-printable")) mimeinfo->encoding_type = ENC_QUOTED_PRINTABLE; - else if (!strcasecmp(buf, "base64")) + else if (!g_ascii_strcasecmp(buf, "base64")) mimeinfo->encoding_type = ENC_BASE64; - else if (!strcasecmp(buf, "x-uuencode")) + else if (!g_ascii_strcasecmp(buf, "x-uuencode")) mimeinfo->encoding_type = ENC_X_UUENCODE; else mimeinfo->encoding_type = ENC_UNKNOWN; @@ -401,11 +401,12 @@ void procmime_scan_content_type_str(const gchar *content_type, } if (*value) { - if (charset && !g_strcasecmp(attr, "charset")) + if (charset && !g_ascii_strcasecmp(attr, "charset")) *charset = g_strdup(value); - else if (name && !g_strcasecmp(attr, "name")) + else if (name && !g_ascii_strcasecmp(attr, "name")) *name = conv_unmime_header(value, NULL); - else if (boundary && !g_strcasecmp(attr, "boundary")) + else if (boundary && + !g_ascii_strcasecmp(attr, "boundary")) *boundary = g_strdup(value); } @@ -450,7 +451,7 @@ void procmime_scan_content_disposition(MimeInfo *mimeinfo, } if (*value) { - if (!strcasecmp(attr, "filename")) { + if (!g_ascii_strcasecmp(attr, "filename")) { g_free(mimeinfo->filename); mimeinfo->filename = conv_unmime_header(value, NULL); @@ -896,25 +897,26 @@ ContentType procmime_scan_mime_type(const gchar *mime_type) { ContentType type; - if (!strncasecmp(mime_type, "text/html", 9)) + if (!g_ascii_strncasecmp(mime_type, "text/html", 9)) type = MIME_TEXT_HTML; - else if (!strncasecmp(mime_type, "text/", 5)) + else if (!g_ascii_strncasecmp(mime_type, "text/", 5)) type = MIME_TEXT; - else if (!strncasecmp(mime_type, "message/rfc822", 14)) + else if (!g_ascii_strncasecmp(mime_type, "message/rfc822", 14)) type = MIME_MESSAGE_RFC822; - else if (!strncasecmp(mime_type, "message/", 8)) + else if (!g_ascii_strncasecmp(mime_type, "message/", 8)) type = MIME_TEXT; - else if (!strncasecmp(mime_type, "application/octet-stream", 24)) + else if (!g_ascii_strncasecmp(mime_type, "application/octet-stream", + 24)) type = MIME_APPLICATION_OCTET_STREAM; - else if (!strncasecmp(mime_type, "application/", 12)) + else if (!g_ascii_strncasecmp(mime_type, "application/", 12)) type = MIME_APPLICATION; - else if (!strncasecmp(mime_type, "multipart/", 10)) + else if (!g_ascii_strncasecmp(mime_type, "multipart/", 10)) type = MIME_MULTIPART; - else if (!strncasecmp(mime_type, "image/", 6)) + else if (!g_ascii_strncasecmp(mime_type, "image/", 6)) type = MIME_IMAGE; - else if (!strncasecmp(mime_type, "audio/", 6)) + else if (!g_ascii_strncasecmp(mime_type, "audio/", 6)) type = MIME_AUDIO; - else if (!strcasecmp(mime_type, "text")) + else if (!g_ascii_strcasecmp(mime_type, "text")) type = MIME_TEXT; else type = MIME_UNKNOWN; @@ -1063,14 +1065,14 @@ EncodingType procmime_get_encoding_for_charset(const gchar *charset) { if (!charset) return ENC_8BIT; - else if (!strncasecmp(charset, "ISO-2022-", 9) || - !strcasecmp(charset, "US-ASCII")) + else if (!g_ascii_strncasecmp(charset, "ISO-2022-", 9) || + !g_ascii_strcasecmp(charset, "US-ASCII")) return ENC_7BIT; - else if (!strcasecmp(charset, "ISO-8859-5") || - !strncasecmp(charset, "KOI8-", 5) || - !strcasecmp(charset, "Windows-1251")) + else if (!g_ascii_strcasecmp(charset, "ISO-8859-5") || + !g_ascii_strncasecmp(charset, "KOI8-", 5) || + !g_ascii_strcasecmp(charset, "Windows-1251")) return ENC_8BIT; - else if (!strncasecmp(charset, "ISO-8859-", 9)) + else if (!g_ascii_strncasecmp(charset, "ISO-8859-", 9)) return ENC_QUOTED_PRINTABLE; else return ENC_8BIT; diff --git a/src/procmsg.c b/src/procmsg.c index b852b3ce..24453368 100644 --- a/src/procmsg.c +++ b/src/procmsg.c @@ -1539,8 +1539,9 @@ static gint func_name(gconstpointer a, gconstpointer b) \ if (!msginfo2->var_name) \ return -1; \ \ - return strcasecmp(msginfo1->var_name, msginfo2->var_name) * \ - (cmp_func_sort_type == SORT_ASCENDING ? 1 : -1); \ + return g_ascii_strcasecmp \ + (msginfo1->var_name, msginfo2->var_name) * \ + (cmp_func_sort_type == SORT_ASCENDING ? 1 : -1);\ } CMP_FUNC_DEF(procmsg_cmp_by_from, fromname) diff --git a/src/rfc2015.c b/src/rfc2015.c index 4560e67d..5f007964 100644 --- a/src/rfc2015.c +++ b/src/rfc2015.c @@ -396,7 +396,7 @@ MimeInfo ** rfc2015_find_signature (MimeInfo *mimeinfo) /* We could have a signature nested within multipart/mixed so * recurse to find it. */ - if (!g_strcasecmp (mimeinfo->content_type, "multipart/mixed")) { + if (!g_ascii_strcasecmp (mimeinfo->content_type, "multipart/mixed")) { for (partinfo = mimeinfo->children; partinfo != NULL; partinfo = partinfo->next) { signedinfo = rfc2015_find_signature (partinfo); @@ -406,7 +406,7 @@ MimeInfo ** rfc2015_find_signature (MimeInfo *mimeinfo) } return NULL; } - if (g_strcasecmp (mimeinfo->content_type, "multipart/signed")) + if (g_ascii_strcasecmp (mimeinfo->content_type, "multipart/signed")) return NULL; debug_print ("** multipart/signed encountered\n"); @@ -414,8 +414,8 @@ MimeInfo ** rfc2015_find_signature (MimeInfo *mimeinfo) /* check that we have at least 2 parts of the correct type */ for (partinfo = mimeinfo->children; partinfo != NULL; partinfo = partinfo->next) { - if (++n > 1 && !g_strcasecmp (partinfo->content_type, - "application/pgp-signature")) + if (++n > 1 && !g_ascii_strcasecmp (partinfo->content_type, + "application/pgp-signature")) break; } @@ -457,7 +457,7 @@ int rfc2015_is_encrypted (MimeInfo *mimeinfo) { if (!mimeinfo || mimeinfo->mime_type != MIME_MULTIPART) return 0; - if (g_strcasecmp (mimeinfo->content_type, "multipart/encrypted")) + if (g_ascii_strcasecmp (mimeinfo->content_type, "multipart/encrypted")) return 0; /* fixme: we should check the protocol parameter */ return 1; @@ -566,13 +566,15 @@ void rfc2015_decrypt_message (MsgInfo *msginfo, MimeInfo *mimeinfo, FILE *fp) if (!partinfo || !partinfo->next) { DECRYPTION_ABORT(); } - if (!g_strcasecmp (partinfo->content_type, "application/pgp-encrypted")) { + if (!g_ascii_strcasecmp (partinfo->content_type, + "application/pgp-encrypted")) { /* Fixme: check that the version is 1 */ ver_ok = 1; } partinfo = partinfo->next; if (ver_ok && - !g_strcasecmp (partinfo->content_type, "application/octet-stream")) { + !g_ascii_strcasecmp (partinfo->content_type, + "application/octet-stream")) { if (partinfo->next) g_warning ("oops: pgp_encrypted with more than 2 parts"); } diff --git a/src/select-keys.c b/src/select-keys.c index a1483e8e..439aff4a 100644 --- a/src/select-keys.c +++ b/src/select-keys.c @@ -508,7 +508,7 @@ cmp_name (GtkCList *clist, gconstpointer pa, gconstpointer pb) return !!sb; if (!sb) return -1; - return strcasecmp(sa, sb); + return g_ascii_strcasecmp(sa, sb); } static gint @@ -524,7 +524,7 @@ cmp_email (GtkCList *clist, gconstpointer pa, gconstpointer pb) return !!sb; if (!sb) return -1; - return strcasecmp(sa, sb); + return g_ascii_strcasecmp(sa, sb); } static void diff --git a/src/smtp.c b/src/smtp.c index 57a3abbf..25a0f71a 100644 --- a/src/smtp.c +++ b/src/smtp.c @@ -271,7 +271,7 @@ static gint smtp_ehlo_recv(SMTPSession *session, const gchar *msg) const gchar *p = msg; p += 3; if (*p == '-' || *p == ' ') p++; - if (g_strncasecmp(p, "AUTH", 4) == 0 && p[4] != '\0') { + if (g_ascii_strncasecmp(p, "AUTH", 4) == 0 && p[4] != '\0') { p += 5; if (strcasestr(p, "PLAIN")) session->avail_auth_type |= SMTPAUTH_PLAIN; diff --git a/src/summaryview.c b/src/summaryview.c index c8ed68ae..fab8ede7 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -4774,7 +4774,8 @@ static gint func_name(GtkTreeModel *model, \ if (msginfo_b->var_name == NULL) \ return (msginfo_a->var_name != NULL); \ \ - return g_strcasecmp(msginfo_a->var_name, msginfo_b->var_name); \ + return g_ascii_strcasecmp \ + (msginfo_a->var_name, msginfo_b->var_name); \ } CMP_FUNC_DEF(summary_cmp_by_from, fromname) diff --git a/src/syldap.c b/src/syldap.c index 2646dbf3..0cef9c3b 100644 --- a/src/syldap.c +++ b/src/syldap.c @@ -584,22 +584,22 @@ gint syldap_search( SyldapServer *ldapServer ) { /* Process all attributes */ for( attribute = ldap_first_attribute( ld, e, &ber ); attribute != NULL; attribute = ldap_next_attribute( ld, e, ber ) ) { - if( strcasecmp( attribute, SYLDAP_ATTR_COMMONNAME ) == 0 ) { + if( g_ascii_strcasecmp( attribute, SYLDAP_ATTR_COMMONNAME ) == 0 ) { listName = syldap_add_list_values( ld, e, attribute ); } - if( strcasecmp( attribute, SYLDAP_ATTR_EMAIL ) == 0 ) { + if( g_ascii_strcasecmp( attribute, SYLDAP_ATTR_EMAIL ) == 0 ) { listAddress = syldap_add_list_values( ld, e, attribute ); } - if( strcasecmp( attribute, SYLDAP_ATTR_UID ) == 0 ) { + if( g_ascii_strcasecmp( attribute, SYLDAP_ATTR_UID ) == 0 ) { listID = syldap_add_single_value( ld, e, attribute ); } - if( strcasecmp( attribute, SYLDAP_ATTR_GIVENNAME ) == 0 ) { + if( g_ascii_strcasecmp( attribute, SYLDAP_ATTR_GIVENNAME ) == 0 ) { listFirst = syldap_add_list_values( ld, e, attribute ); } - if( strcasecmp( attribute, SYLDAP_ATTR_SURNAME ) == 0 ) { + if( g_ascii_strcasecmp( attribute, SYLDAP_ATTR_SURNAME ) == 0 ) { listLast = syldap_add_single_value( ld, e, attribute ); } - if( strcasecmp( attribute, SYLDAP_ATTR_DN ) == 0 ) { + if( g_ascii_strcasecmp( attribute, SYLDAP_ATTR_DN ) == 0 ) { listDN = syldap_add_single_value( ld, e, attribute ); } } @@ -812,7 +812,7 @@ GList *syldap_read_basedn_s( const gchar *host, const gint port, const gchar *bi /* Process attributes */ for( attribute = ldap_first_attribute( ld, e, &ber ); attribute != NULL; attribute = ldap_next_attribute( ld, e, ber ) ) { - if( strcasecmp( attribute, SYLDAP_V3_TEST_ATTR ) == 0 ) { + if( g_ascii_strcasecmp( attribute, SYLDAP_V3_TEST_ATTR ) == 0 ) { if( ( vals = ldap_get_values( ld, e, attribute ) ) != NULL ) { for( i = 0; vals[i] != NULL; i++ ) { /* printf( "\t%s: %s\n", attribute, vals[i] ); */ @@ -847,7 +847,7 @@ GList *syldap_read_basedn_s( const gchar *host, const gint port, const gchar *bi for( attribute = ldap_first_attribute( ld, e, &ber ); attribute != NULL; attribute = ldap_next_attribute( ld, e, ber ) ) { /* if( baseDN ) break; */ - if( strcasecmp( attribute, SYLDAP_V2_TEST_ATTR ) == 0 ) { + if( g_ascii_strcasecmp( attribute, SYLDAP_V2_TEST_ATTR ) == 0 ) { if( ( vals = ldap_get_values( ld, e, attribute ) ) != NULL ) { for( i = 0; vals[i] != NULL; i++ ) { char *ch; @@ -941,7 +941,7 @@ GList *syldap_read_basedn( SyldapServer *ldapServer ) { /* Process attributes */ for( attribute = ldap_first_attribute( ld, e, &ber ); attribute != NULL; attribute = ldap_next_attribute( ld, e, ber ) ) { - if( strcasecmp( attribute, SYLDAP_V3_TEST_ATTR ) == 0 ) { + if( g_ascii_strcasecmp( attribute, SYLDAP_V3_TEST_ATTR ) == 0 ) { if( ( vals = ldap_get_values( ld, e, attribute ) ) != NULL ) { for( i = 0; vals[i] != NULL; i++ ) { /* printf( "\t%s: %s\n", attribute, vals[i] ); */ @@ -978,7 +978,7 @@ GList *syldap_read_basedn( SyldapServer *ldapServer ) { for( attribute = ldap_first_attribute( ld, e, &ber ); attribute != NULL; attribute = ldap_next_attribute( ld, e, ber ) ) { /* if( baseDN ) break; */ - if( strcasecmp( attribute, SYLDAP_V2_TEST_ATTR ) == 0 ) { + if( g_ascii_strcasecmp( attribute, SYLDAP_V2_TEST_ATTR ) == 0 ) { if( ( vals = ldap_get_values( ld, e, attribute ) ) != NULL ) { for( i = 0; vals[i] != NULL; i++ ) { char *ch; diff --git a/src/template.c b/src/template.c index e7fa1bdf..9aafa09d 100644 --- a/src/template.c +++ b/src/template.c @@ -55,13 +55,13 @@ static Template *template_load(gchar *filename) while (fgets(buf, sizeof(buf), fp) != NULL) { if (buf[0] == '\n') break; - else if (!g_strncasecmp(buf, "Name:", 5)) + else if (!g_ascii_strncasecmp(buf, "Name:", 5)) tmpl->name = g_strdup(g_strstrip(buf + 5)); - else if (!g_strncasecmp(buf, "To:", 3)) + else if (!g_ascii_strncasecmp(buf, "To:", 3)) tmpl->to = g_strdup(g_strstrip(buf + 3)); - else if (!g_strncasecmp(buf, "Cc:", 3)) + else if (!g_ascii_strncasecmp(buf, "Cc:", 3)) tmpl->cc = g_strdup(g_strstrip(buf + 3)); - else if (!g_strncasecmp(buf, "Subject:", 8)) + else if (!g_ascii_strncasecmp(buf, "Subject:", 8)) tmpl->subject = g_strdup(g_strstrip(buf + 8)); } diff --git a/src/textview.c b/src/textview.c index e86499f3..c476b215 100644 --- a/src/textview.c +++ b/src/textview.c @@ -689,8 +689,8 @@ static void textview_add_parts(TextView *textview, MimeInfo *mimeinfo, FILE *fp) for (;;) { textview_add_part(textview, mimeinfo, fp); if (mimeinfo->parent && mimeinfo->parent->content_type && - !strcasecmp(mimeinfo->parent->content_type, - "multipart/alternative")) + !g_ascii_strcasecmp(mimeinfo->parent->content_type, + "multipart/alternative")) mimeinfo = mimeinfo->parent->next; else mimeinfo = procmime_mimeinfo_next(mimeinfo); @@ -1213,7 +1213,7 @@ static GPtrArray *textview_scan_header(TextView *textview, FILE *fp, for (i = 0; i < headers->len; i++) { header = g_ptr_array_index(headers, i); - if (!g_strcasecmp(header->name, dp->name)) { + if (!g_ascii_strcasecmp(header->name, dp->name)) { if (dp->hidden) procheader_header_free(header); else @@ -1262,10 +1262,10 @@ static void textview_show_header(TextView *textview, GPtrArray *headers) (buffer, &iter, ":", 1, "header_title", "header", NULL); - if (!g_strcasecmp(header->name, "Subject") || - !g_strcasecmp(header->name, "From") || - !g_strcasecmp(header->name, "To") || - !g_strcasecmp(header->name, "Cc")) + if (!g_ascii_strcasecmp(header->name, "Subject") || + !g_ascii_strcasecmp(header->name, "From") || + !g_ascii_strcasecmp(header->name, "To") || + !g_ascii_strcasecmp(header->name, "Cc")) unfold_line(header->body); if (prefs_common.enable_color && @@ -1704,7 +1704,7 @@ static gboolean textview_event_after(GtkWidget *widget, GdkEvent *event, if (!uri) return FALSE; - if (!g_strncasecmp(uri->uri, "mailto:", 7)) { + if (!g_ascii_strncasecmp(uri->uri, "mailto:", 7)) { PrefsAccount *ac = NULL; MsgInfo *msginfo = textview->messageview->msginfo; @@ -1906,7 +1906,7 @@ static void textview_popup_menu_activate_copy_cb(GtkMenuItem *menuitem, if (!uri->uri) return; - if (!g_strncasecmp(uri->uri, "mailto:", 7)) + if (!g_ascii_strncasecmp(uri->uri, "mailto:", 7)) uri_string = uri->uri + 7; else uri_string = uri->uri; diff --git a/src/utils.c b/src/utils.c index e69a9fe2..901ec67c 100644 --- a/src/utils.c +++ b/src/utils.c @@ -95,7 +95,7 @@ void hash_free_value_mem(GHashTable *table) gint str_case_equal(gconstpointer v, gconstpointer v2) { - return strcasecmp((const gchar *)v, (const gchar *)v2) == 0; + return g_ascii_strcasecmp((const gchar *)v, (const gchar *)v2) == 0; } guint str_case_hash(gconstpointer key) @@ -142,7 +142,7 @@ gboolean str_find_equal(const gchar *haystack, const gchar *needle) gboolean str_case_find_equal(const gchar *haystack, const gchar *needle) { - return strcasecmp(haystack, needle) == 0; + return g_ascii_strcasecmp(haystack, needle) == 0; } gint to_number(const gchar *nstr) @@ -272,7 +272,7 @@ gchar *strcasestr(const gchar *haystack, const gchar *needle) return NULL; while (haystack_len >= needle_len) { - if (!strncasecmp(haystack, needle, needle_len)) + if (!g_ascii_strncasecmp(haystack, needle, needle_len)) return (gchar *)haystack; else { haystack++; @@ -581,7 +581,7 @@ gint subject_compare_for_sort(const gchar *s1, const gchar *s2) trim_subject_for_sort(str1); trim_subject_for_sort(str2); - return strcasecmp(str1, str2); + return g_ascii_strcasecmp(str1, str2); } void trim_subject_for_compare(gchar *str) @@ -592,7 +592,7 @@ void trim_subject_for_compare(gchar *str) eliminate_parenthesis(str, '(', ')'); g_strstrip(str); - while (!strncasecmp(str, "Re:", 3)) { + while (!g_ascii_strncasecmp(str, "Re:", 3)) { srcp = str + 3; while (isspace(*srcp)) srcp++; memmove(str, srcp, strlen(srcp) + 1); @@ -605,7 +605,7 @@ void trim_subject_for_sort(gchar *str) g_strstrip(str); - while (!strncasecmp(str, "Re:", 3)) { + while (!g_ascii_strncasecmp(str, "Re:", 3)) { srcp = str + 3; while (isspace(*srcp)) srcp++; memmove(str, srcp, strlen(srcp) + 1); @@ -619,7 +619,7 @@ void trim_subject(gchar *str) gint in_brace; destp = str; - while (!strncasecmp(destp, "Re:", 3)) { + while (!g_ascii_strncasecmp(destp, "Re:", 3)) { destp += 3; while (isspace(*destp)) destp++; } @@ -1453,19 +1453,19 @@ static gint axtoi(const gchar *hex_str) gboolean is_uri_string(const gchar *str) { - return (g_strncasecmp(str, "http://", 7) == 0 || - g_strncasecmp(str, "https://", 8) == 0 || - g_strncasecmp(str, "ftp://", 6) == 0 || - g_strncasecmp(str, "www.", 4) == 0); + return (g_ascii_strncasecmp(str, "http://", 7) == 0 || + g_ascii_strncasecmp(str, "https://", 8) == 0 || + g_ascii_strncasecmp(str, "ftp://", 6) == 0 || + g_ascii_strncasecmp(str, "www.", 4) == 0); } gchar *get_uri_path(const gchar *uri) { - if (g_strncasecmp(uri, "http://", 7) == 0) + if (g_ascii_strncasecmp(uri, "http://", 7) == 0) return (gchar *)(uri + 7); - else if (g_strncasecmp(uri, "https://", 8) == 0) + else if (g_ascii_strncasecmp(uri, "https://", 8) == 0) return (gchar *)(uri + 8); - else if (g_strncasecmp(uri, "ftp://", 6) == 0) + else if (g_ascii_strncasecmp(uri, "ftp://", 6) == 0) return (gchar *)(uri + 6); else return (gchar *)uri; @@ -1568,15 +1568,16 @@ gint scan_mailto_url(const gchar *mailto, gchar **to, gchar **cc, gchar **bcc, if (*value == '\0') continue; - if (cc && !*cc && !g_strcasecmp(field, "cc")) { + if (cc && !*cc && !g_ascii_strcasecmp(field, "cc")) { *cc = g_strdup(value); - } else if (bcc && !*bcc && !g_strcasecmp(field, "bcc")) { + } else if (bcc && !*bcc && !g_ascii_strcasecmp(field, "bcc")) { *bcc = g_strdup(value); } else if (subject && !*subject && - !g_strcasecmp(field, "subject")) { + !g_ascii_strcasecmp(field, "subject")) { *subject = g_malloc(strlen(value) + 1); decode_uri(*subject, value); - } else if (body && !*body && !g_strcasecmp(field, "body")) { + } else if (body && !*body && + !g_ascii_strcasecmp(field, "body")) { *body = g_malloc(strlen(value) + 1); decode_uri(*body, value); } @@ -2627,7 +2628,7 @@ gchar *get_outgoing_rfc2822_str(FILE *fp) /* output header part */ while (fgets(buf, sizeof(buf), fp) != NULL) { strretchomp(buf); - if (!g_strncasecmp(buf, "Bcc:", 4)) { + if (!g_ascii_strncasecmp(buf, "Bcc:", 4)) { gint next; for (;;) { @@ -3017,7 +3018,7 @@ time_t remote_tzoffset_sec(const gchar *zone) remoteoffset = 0; } else if (strlen(zone3) == 3) { for (p = ustzstr; *p != '\0'; p += 3) { - if (!strncasecmp(p, zone3, 3)) { + if (!g_ascii_strncasecmp(p, zone3, 3)) { iustz = ((gint)(p - ustzstr) / 3 + 1) / 2 - 8; remoteoffset = iustz * 3600; break; diff --git a/src/vcard.c b/src/vcard.c index 55fe6fd4..80440ee9 100644 --- a/src/vcard.c +++ b/src/vcard.c @@ -386,7 +386,7 @@ static void vcard_build_items( VCardFile *cardFile, GSList *listName, GSList *li str = nodeRemarks->data; if( nodeRemarks ) { if( str ) { - if( g_strcasecmp( str, "internet" ) != 0 ) { + if( g_ascii_strcasecmp( str, "internet" ) != 0 ) { if( *str != '\0' ) addritem_email_set_remarks( email, str ); } } @@ -505,34 +505,34 @@ static void vcard_read_file( VCardFile *cardFile ) { /* fprintf( stdout, "\ttype: %s\n", tagtype ); */ /* fprintf( stdout, "\tvalue: %s\n", tagvalue ); */ - if( g_strcasecmp( tagtype, VCARD_TYPE_QP ) == 0 ) { + if( g_ascii_strcasecmp( tagtype, VCARD_TYPE_QP ) == 0 ) { /* Quoted-Printable: could span multiple lines */ tagvalue = vcard_read_qp( cardFile, tagvalue ); vcard_unescape_qp( tagvalue ); /* fprintf( stdout, "QUOTED-PRINTABLE !!! final\n>%s<\n", tagvalue ); */ } - if( g_strcasecmp( tagname, VCARD_TAG_START ) == 0 && - g_strcasecmp( tagvalue, VCARD_NAME ) == 0 ) { + if( g_ascii_strcasecmp( tagname, VCARD_TAG_START ) == 0 && + g_ascii_strcasecmp( tagvalue, VCARD_NAME ) == 0 ) { /* fprintf( stdout, "start card\n" ); */ vcard_free_lists( listName, listAddress, listRemarks, listID ); listName = listAddress = listRemarks = listID = NULL; } - if( g_strcasecmp( tagname, VCARD_TAG_FULLNAME ) == 0 ) { + if( g_ascii_strcasecmp( tagname, VCARD_TAG_FULLNAME ) == 0 ) { /* fprintf( stdout, "- full name: %s\n", tagvalue ); */ listName = g_slist_append( listName, g_strdup( tagvalue ) ); } - if( g_strcasecmp( tagname, VCARD_TAG_EMAIL ) == 0 ) { + if( g_ascii_strcasecmp( tagname, VCARD_TAG_EMAIL ) == 0 ) { /* fprintf( stdout, "- address: %s\n", tagvalue ); */ listAddress = g_slist_append( listAddress, g_strdup( tagvalue ) ); listRemarks = g_slist_append( listRemarks, g_strdup( tagtype ) ); } - if( g_strcasecmp( tagname, VCARD_TAG_UID ) == 0 ) { + if( g_ascii_strcasecmp( tagname, VCARD_TAG_UID ) == 0 ) { /* fprintf( stdout, "- id: %s\n", tagvalue ); */ listID = g_slist_append( listID, g_strdup( tagvalue ) ); } - if( g_strcasecmp( tagname, VCARD_TAG_END ) == 0 && - g_strcasecmp( tagvalue, VCARD_NAME ) == 0 ) { + if( g_ascii_strcasecmp( tagname, VCARD_TAG_END ) == 0 && + g_ascii_strcasecmp( tagvalue, VCARD_NAME ) == 0 ) { /* vCard is complete */ /* fprintf( stdout, "end card\n--\n" ); */ /* vcard_dump_lists( listName, listAddress, listRemarks, listID, stdout ); */ @@ -670,7 +670,7 @@ gchar *vcard_find_gnomecard( void ) { /* Read configuration file */ lenlbl = strlen( GNOMECARD_SECTION ); while( fgets( buf, sizeof( buf ), fp ) != NULL ) { - if( 0 == g_strncasecmp( buf, GNOMECARD_SECTION, lenlbl ) ) { + if( 0 == g_ascii_strncasecmp( buf, GNOMECARD_SECTION, lenlbl ) ) { break; } } @@ -680,7 +680,7 @@ gchar *vcard_find_gnomecard( void ) { if( buf[0] == '[' ) break; for( i = 0; i < lenlbl; i++ ) { if( buf[i] == '=' ) { - if( 0 == g_strncasecmp( buf, GNOMECARD_PARAM, i ) ) { + if( 0 == g_ascii_strncasecmp( buf, GNOMECARD_PARAM, i ) ) { fileSpec = g_strdup( buf + i + 1 ); g_strstrip( fileSpec ); } @@ -743,17 +743,17 @@ gint vcard_test_read_file( const gchar *fileSpec ) { tagtemp = NULL; } - if( g_strcasecmp( tagtype, VCARD_TYPE_QP ) == 0 ) { + if( g_ascii_strcasecmp( tagtype, VCARD_TYPE_QP ) == 0 ) { /* Quoted-Printable: could span multiple lines */ tagvalue = vcard_read_qp( cardFile, tagvalue ); vcard_unescape_qp( tagvalue ); } - if( g_strcasecmp( tagname, VCARD_TAG_START ) == 0 && - g_strcasecmp( tagvalue, VCARD_NAME ) == 0 ) { + if( g_ascii_strcasecmp( tagname, VCARD_TAG_START ) == 0 && + g_ascii_strcasecmp( tagvalue, VCARD_NAME ) == 0 ) { haveStart = TRUE; } - if( g_strcasecmp( tagname, VCARD_TAG_END ) == 0 && - g_strcasecmp( tagvalue, VCARD_NAME ) == 0 ) { + if( g_ascii_strcasecmp( tagname, VCARD_TAG_END ) == 0 && + g_ascii_strcasecmp( tagvalue, VCARD_NAME ) == 0 ) { /* vCard is complete */ if( haveStart ) cardFile->retVal = MGU_SUCCESS; } -- cgit v1.2.3