Fix warnings: edit.c: ins_bs(): Garbage result: MI.

Problem    : Result of operation is garbage or undefined @ 7460.
Diagnostic : Multithreading issue.
Rationale  : Problem occurs if any of globals `enc_utf8`, `p_deco is
             modified while function is executing.
Resolution : Use local copy of globals.
This commit is contained in:
Eliseo Martínez 2014-11-05 22:34:27 +01:00
parent d0a0efaf32
commit 74817b546e

View File

@ -7455,7 +7455,9 @@ static int ins_bs(int c, int mode, int *inserted_space_p)
if (State & REPLACE_FLAG)
replace_do_bs(-1);
else {
if (enc_utf8 && p_deco)
const bool l_enc_utf8 = enc_utf8;
const int l_p_deco = p_deco;
if (l_enc_utf8 && l_p_deco)
(void)utfc_ptr2char(get_cursor_pos_ptr(), cpc);
(void)del_char(FALSE);
/*
@ -7463,7 +7465,7 @@ static int ins_bs(int c, int mode, int *inserted_space_p)
* move the cursor back. Don't back up before the base
* character.
*/
if (enc_utf8 && p_deco && cpc[0] != NUL)
if (l_enc_utf8 && l_p_deco && cpc[0] != NUL)
inc_cursor();
if (revins_chars) {
revins_chars--;