console_set_cursor() now clips to screen size. This actually works around a

possible compiler bug that exposes with -O2 only.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12203 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-03-31 20:06:31 +00:00
parent 207fb0b1ea
commit 29150acff7

View File

@ -1,7 +1,7 @@
/*
** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
** Distributed under the terms of the Haiku License.
*/
* Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include "console.h"
@ -118,6 +118,15 @@ console_height(void)
void
console_set_cursor(int32 x, int32 y)
{
if (y >= (int32)sScreenHeight)
y = sScreenHeight - 1;
else if (y < 0)
y = 0;
if (x >= (int32)sScreenWidth)
x = sScreenWidth - 1;
else if (x < 0)
x = 0;
sScreenOffset = x + y * sScreenWidth;
}