Fix two instances of undefined behaviour in contrib/nvi.

Found by:	clang ToT
Obtained from:	NetBSD
Reviewed by:	jh
MFC after:	3 days
This commit is contained in:
Dimitry Andric 2013-02-16 12:48:06 +00:00
parent a9fb907e0b
commit d21f31a1a7
2 changed files with 6 additions and 4 deletions

View File

@ -398,8 +398,8 @@ txt_dent(sp, tp)
++scno; ++scno;
/* Get the previous shiftwidth column. */ /* Get the previous shiftwidth column. */
cno = scno; cno = scno--;
scno -= --scno % sw; scno -= scno % sw;
/* /*
* Since we don't know what comes before the character(s) being * Since we don't know what comes before the character(s) being

View File

@ -1956,8 +1956,10 @@ txt_dent(sp, tp, isindent)
target = current; target = current;
if (isindent) if (isindent)
target += COL_OFF(target, sw); target += COL_OFF(target, sw);
else else {
target -= --target % sw; --target;
target -= target % sw;
}
/* /*
* The AI characters will be turned into overwrite characters if the * The AI characters will be turned into overwrite characters if the