Skip to content

Commit

Permalink
fix odd case of Charset_is_utf8
Browse files Browse the repository at this point in the history
  • Loading branch information
flatcap committed Mar 13, 2018
1 parent abc39ce commit 0735bdd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions hcache/hcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions mutt/charset.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = '?';
}

Expand Down
2 changes: 1 addition & 1 deletion mutt/charset.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct Buffer;

extern char *AssumedCharset;
extern char *Charset;
extern bool Charset_is_utf8;
extern bool CharsetIsUtf8;
extern wchar_t ReplacementChar;

/**
Expand Down
2 changes: 1 addition & 1 deletion mutt/mbyte.c
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
6 changes: 3 additions & 3 deletions pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0735bdd

Please sign in to comment.