From: Richard Russon Date: Tue, 6 Mar 2018 16:49:30 +0000 (+0000) Subject: fix odd case of Charset_is_utf8 X-Git-Tag: neomutt-20180323~17^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0735bdd693dacbcae13056d12555b2d6f634cccf;p=neomutt fix odd case of Charset_is_utf8 --- diff --git a/hcache/hcache.c b/hcache/hcache.c index 1d289332e..4b0a46960 100644 --- a/hcache/hcache.c +++ b/hcache/hcache.c @@ -627,7 +627,7 @@ static void *hcache_dump(header_cache_t *h, struct Header *header, int *off, { unsigned char *d = NULL; struct Header nh; - bool convert = !Charset_is_utf8; + bool convert = !CharsetIsUtf8; *off = 0; d = lazy_malloc(sizeof(union Validate)); @@ -685,7 +685,7 @@ struct Header *mutt_hcache_restore(const unsigned char *d) { int off = 0; struct Header *h = mutt_new_header(); - bool convert = !Charset_is_utf8; + bool convert = !CharsetIsUtf8; /* skip validate */ off += sizeof(union Validate); diff --git a/menu.c b/menu.c index e55ad7af4..05d77f135 100644 --- a/menu.c +++ b/menu.c @@ -132,7 +132,7 @@ static void print_enriched_string(int index, int attr, unsigned char *s, int do_ else add_wch(WACS_LLCORNER); #else - else if (Charset_is_utf8) + else if (CharsetIsUtf8) addstr("\342\224\224"); /* WACS_LLCORNER */ else addch(ACS_LLCORNER); @@ -145,7 +145,7 @@ static void print_enriched_string(int index, int attr, unsigned char *s, int do_ else add_wch(WACS_ULCORNER); #else - else if (Charset_is_utf8) + else if (CharsetIsUtf8) addstr("\342\224\214"); /* WACS_ULCORNER */ else addch(ACS_ULCORNER); @@ -158,7 +158,7 @@ static void print_enriched_string(int index, int attr, unsigned char *s, int do_ else add_wch(WACS_LTEE); #else - else if (Charset_is_utf8) + else if (CharsetIsUtf8) addstr("\342\224\234"); /* WACS_LTEE */ else addch(ACS_LTEE); @@ -171,7 +171,7 @@ static void print_enriched_string(int index, int attr, unsigned char *s, int do_ else add_wch(WACS_HLINE); #else - else if (Charset_is_utf8) + else if (CharsetIsUtf8) addstr("\342\224\200"); /* WACS_HLINE */ else addch(ACS_HLINE); @@ -184,7 +184,7 @@ static void print_enriched_string(int index, int attr, unsigned char *s, int do_ else add_wch(WACS_VLINE); #else - else if (Charset_is_utf8) + else if (CharsetIsUtf8) addstr("\342\224\202"); /* WACS_VLINE */ else addch(ACS_VLINE); @@ -197,7 +197,7 @@ static void print_enriched_string(int index, int attr, unsigned char *s, int do_ else add_wch(WACS_TTEE); #else - else if (Charset_is_utf8) + else if (CharsetIsUtf8) addstr("\342\224\254"); /* WACS_TTEE */ else addch(ACS_TTEE); @@ -210,7 +210,7 @@ static void print_enriched_string(int index, int attr, unsigned char *s, int do_ else add_wch(WACS_BTEE); #else - else if (Charset_is_utf8) + else if (CharsetIsUtf8) addstr("\342\224\264"); /* WACS_BTEE */ else addch(ACS_BTEE); diff --git a/mutt/charset.c b/mutt/charset.c index a448e37b3..730834e21 100644 --- a/mutt/charset.c +++ b/mutt/charset.c @@ -57,9 +57,9 @@ char *Charset; /**< Config: User's choice of character set */ wchar_t ReplacementChar = '?'; /** - * Charset_is_utf8 - Is the user's current character set utf-8? + * CharsetIsUtf8 - Is the user's current character set utf-8? */ -bool Charset_is_utf8 = false; +bool CharsetIsUtf8 = false; /** * struct Lookup - Regex to String lookup table @@ -906,12 +906,12 @@ void mutt_ch_set_charset(char *charset) if (mutt_ch_is_utf8(buffer)) { - Charset_is_utf8 = true; + CharsetIsUtf8 = true; ReplacementChar = 0xfffd; /* replacement character */ } else { - Charset_is_utf8 = false; + CharsetIsUtf8 = false; ReplacementChar = '?'; } diff --git a/mutt/charset.h b/mutt/charset.h index 3447e6d5c..13c44a8c6 100644 --- a/mutt/charset.h +++ b/mutt/charset.h @@ -32,7 +32,7 @@ struct Buffer; extern char *AssumedCharset; extern char *Charset; -extern bool Charset_is_utf8; +extern bool CharsetIsUtf8; extern wchar_t ReplacementChar; /** diff --git a/mutt/mbyte.c b/mutt/mbyte.c index 1806dbe10..a9cc43021 100644 --- a/mutt/mbyte.c +++ b/mutt/mbyte.c @@ -432,7 +432,7 @@ int mutt_mb_filter_unprintable(char **s) } if (!IsWPrint(wc)) wc = '?'; - else if (Charset_is_utf8 && mutt_mb_is_display_corrupting_utf8(wc)) + else if (CharsetIsUtf8 && mutt_mb_is_display_corrupting_utf8(wc)) continue; k2 = wcrtomb(scratch, wc, &mbstate2); scratch[k2] = '\0'; diff --git a/pager.c b/pager.c index 335cf33dd..56375c43c 100644 --- a/pager.c +++ b/pager.c @@ -1255,7 +1255,7 @@ static int format_line(struct Line **line_info, int n, unsigned char *buf, int f if (k == 0) k = 1; - if (Charset_is_utf8) + if (CharsetIsUtf8) { /* zero width space, zero width no-break space */ if (wc == 0x200B || wc == 0xFEFF) @@ -1314,14 +1314,14 @@ static int format_line(struct Line **line_info, int n, unsigned char *buf, int f } /* no-break space, narrow no-break space */ - if (IsWPrint(wc) || (Charset_is_utf8 && (wc == 0x00A0 || wc == 0x202F))) + if (IsWPrint(wc) || (CharsetIsUtf8 && (wc == 0x00A0 || wc == 0x202F))) { if (wc == ' ') { space = ch; } /* no-break space, narrow no-break space */ - else if (Charset_is_utf8 && (wc == 0x00A0 || wc == 0x202F)) + else if (CharsetIsUtf8 && (wc == 0x00A0 || wc == 0x202F)) { /* Convert non-breaking space to normal space. The local variable * `space' is not set here so that the caller of this function won't