]> git.tuebingen.mpg.de Git - paraslash.git/commit
gui: Fix off-by-one in add_spaces().
authorAndre Noll <maan@systemlinux.org>
Sun, 16 Jun 2013 12:22:06 +0000 (14:22 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 16 Jun 2013 12:22:06 +0000 (14:22 +0200)
commit100600d8f23b5b1ef6bb78b64f9817733eb02441
treedbd77cb2faee4536b50bc09e7e97306645c51dbb
parent58864df1c0784c58e421949b67a091fd0a60e140
gui: Fix off-by-one in add_spaces().

Commit e90c6c0a (Speed up add_spaces().) changed add_spaces() to print
space characters in chunks rather than one at a time. It introduced
space[], an array of whitespace characters, which is written entirely
if there are more spaces to print than the size of the array. However,
in the calculation of how much was printed so far, we missed the fact
that sizeof(space) includes the terminating NULL byte, so this number
is in fact the number of space characters *plus one*.

Consequently, we printed too few space characters. This resulted in
parts of the previous string still being visible in the top window
of para_gui.
gui.c