mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Fix warnings: ex_cmds.c: do_ascii(): Garbage value (2): MI.
Problems : Assigned value is garbage or undefined @ 127. Assigned value is garbage or undefined @ 152. Diagnostic : Multithreading issues. Rationale : Error could only occurr if global `enc_utf8` changed while the function is executing. Resolution : Use local copy of global var.
This commit is contained in:
parent
3080672650
commit
9c3a3e1381
@ -90,8 +90,9 @@ void do_ascii(exarg_T *eap)
|
||||
int cc[MAX_MCO];
|
||||
int ci = 0;
|
||||
int len;
|
||||
const bool l_enc_utf8 = enc_utf8;
|
||||
|
||||
if (enc_utf8)
|
||||
if (l_enc_utf8)
|
||||
c = utfc_ptr2char(get_cursor_pos_ptr(), cc);
|
||||
else
|
||||
c = gchar_cursor();
|
||||
@ -123,20 +124,20 @@ void do_ascii(exarg_T *eap)
|
||||
vim_snprintf((char *)IObuff, IOSIZE,
|
||||
_("<%s>%s%s %d, Hex %02x, Octal %03o"),
|
||||
transchar(c), buf1, buf2, cval, cval, cval);
|
||||
if (enc_utf8)
|
||||
if (l_enc_utf8)
|
||||
c = cc[ci++];
|
||||
else
|
||||
c = 0;
|
||||
}
|
||||
|
||||
/* Repeat for combining characters. */
|
||||
while (has_mbyte && (c >= 0x100 || (enc_utf8 && c >= 0x80))) {
|
||||
while (has_mbyte && (c >= 0x100 || (l_enc_utf8 && c >= 0x80))) {
|
||||
len = (int)STRLEN(IObuff);
|
||||
/* This assumes every multi-byte char is printable... */
|
||||
if (len > 0)
|
||||
IObuff[len++] = ' ';
|
||||
IObuff[len++] = '<';
|
||||
if (enc_utf8 && utf_iscomposing(c)
|
||||
if (l_enc_utf8 && utf_iscomposing(c)
|
||||
# ifdef USE_GUI
|
||||
&& !gui.in_use
|
||||
# endif
|
||||
@ -148,7 +149,7 @@ void do_ascii(exarg_T *eap)
|
||||
: _("> %d, Hex %08x, Octal %o"), c, c, c);
|
||||
if (ci == MAX_MCO)
|
||||
break;
|
||||
if (enc_utf8)
|
||||
if (l_enc_utf8)
|
||||
c = cc[ci++];
|
||||
else
|
||||
c = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user