* view.c (view_update_bytes_per_line): Use a local variable to

do the computation. Update view->bytes_per_line only once, after
	all computations have finished.
This commit is contained in:
Roland Illig 2005-07-11 07:39:04 +00:00
parent 35b218fc69
commit 8bbf0d25fe
2 changed files with 13 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2005-07-11 Roland Illig <roland.illig@gmx.de>
* view.c (view_update_bytes_per_line): Use a local variable to
do the computation. Update view->bytes_per_line only once, after
all computations have finished.
2005-07-09 Pavel Tsekov <ptsekov@gmx.net>
* info.c (info_show_info): Properly calculate the length of the

View File

@ -1414,19 +1414,20 @@ static void
view_update_bytes_per_line (WView *view)
{
const screen_dimen cols = view->data_area.width;
int bytes;
if (cols < 8)
view->bytes_per_line = 0;
bytes = 1;
else if (cols < 80)
view->bytes_per_line = ((cols - 8) / 17) * 4;
bytes = ((cols - 8) / 17) * 4;
else
view->bytes_per_line = ((cols - 8) / 18) * 4;
bytes = ((cols - 8) / 18) * 4;
if (view->bytes_per_line == 0)
view->bytes_per_line++; /* To avoid division by 0 */
if (bytes == 0)
bytes = 1; /* To avoid division by 0 */
view->bytes_per_line = bytes;
view->dirty = max_dirt_limit + 1; /* To force refresh */
assert (view->bytes_per_line != 0);
}
static void