build: fix compilation when configured with --disable-utf8

This fixes https://savannah.gnu.org/bugs/?59842.
Reported-by: Ruben van Wyk <admin@knwip.com>

Bug existed since commit 5129e718 from two days ago.
master
Benno Schulenberg 2021-01-08 12:05:55 +01:00
parent f602613a9a
commit 24e5f956d0
2 changed files with 10 additions and 3 deletions

View File

@ -286,7 +286,7 @@ int collect_char(const char *string, char *thechar)
int advance_over(const char *string, size_t *column)
{
#ifdef ENABLE_UTF8
if ((unsigned char)*string > 0xC1) {
if ((signed char)*string < 0) {
int charlen = mblen(string, MAXCHARLEN);
if (charlen > 0) {
@ -310,8 +310,10 @@ int advance_over(const char *string, size_t *column)
*column += 2;
} else if (*string == 0x7F)
*column += 2;
else if (!use_utf8 && 0x7F < (unsigned char)*string && (unsigned char)*string < 0xA0)
#ifndef ENABLE_UTF8
else if (0x7F < (unsigned char)*string && (unsigned char)*string < 0xA0)
*column += 2;
#endif
else
*column += 1;

View File

@ -2075,7 +2075,9 @@ void minibar(void)
size_t namewidth, placewidth;
size_t tallywidth = 0;
size_t padding = 2;
#ifdef ENABLE_UTF8
wchar_t widecode;
#endif
/* Draw a colored bar over the full width of the screen. */
wattron(bottomwin, interface_color_pair[TITLE_BAR]);
@ -2139,7 +2141,10 @@ void minibar(void)
if (*this_position == '\0')
sprintf(hexadecimal, openfile->current->next ?
(using_utf8() ? "U+000A" : " 0x0A") : " ----");
#ifdef ENABLE_UTF8
using_utf8() ? "U+000A" :
#endif
" 0x0A" : " ----");
else if (*this_position == '\n')
sprintf(hexadecimal, " 0x00");
#ifdef ENABLE_UTF8