aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2014-11-07 20:46:56 +0100
committerEliseo Martínez <eliseomarmol@gmail.com>2014-11-11 01:43:10 +0100
commit9c3a3e13814c6601271288f4550d5c723ce8b4c3 (patch)
treef62c687f06c7a6824d27bb2345d6d40f6905da1c
parent3080672650b1a6583684edfdafef7e07c0c7cf56 (diff)
downloadrneovim-9c3a3e13814c6601271288f4550d5c723ce8b4c3.tar.gz
rneovim-9c3a3e13814c6601271288f4550d5c723ce8b4c3.tar.bz2
rneovim-9c3a3e13814c6601271288f4550d5c723ce8b4c3.zip
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.
-rw-r--r--src/nvim/ex_cmds.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index f5fa16a139..a71ee7a2fe 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -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;