From 6ed7c1f6b2b9d4128f8c748d19b173a00c656bd2 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Fri, 3 Aug 2007 11:30:22 +0000 Subject: [PATCH] 2007-08-03 13:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/libct/ctwin.c * added protection against overwriting right and bottom WBOX border directly inside GTCTW so now other screen functions does not have to check maximum window coordinates. Please remeber that CTWIN from CT3 has a bug which allows to damage top and left border which I partialy replicated because peope used it to set window title. --- harbour/ChangeLog | 8 ++++++++ harbour/contrib/libct/ctwin.c | 12 +++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ae53c1c103..54bc2e9c91 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,14 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-08-03 13:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/contrib/libct/ctwin.c + * added protection against overwriting right and bottom WBOX border + directly inside GTCTW so now other screen functions does not have + to check maximum window coordinates. Please remeber that CTWIN from + CT3 has a bug which allows to damage top and left border which I + partialy replicated because peope used it to set window title. + 2007-08-03 04:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/libct/screen2.c + added SCREENSTR(), STRSCREEN() diff --git a/harbour/contrib/libct/ctwin.c b/harbour/contrib/libct/ctwin.c index 12b1340b4c..956d7bf008 100644 --- a/harbour/contrib/libct/ctwin.c +++ b/harbour/contrib/libct/ctwin.c @@ -1293,12 +1293,14 @@ static BOOL hb_ctw_gt_PutChar( int iRow, int iCol, if( iWindow > 0 ) { - int iWndRow, iWndCol; + int iWndRow, iWndCol, iWndHeight, iWndWidth; if( s_iCurrWindow == 0 ) { iWndRow = iRow - s_windows[ iWindow ]->iFirstRow; iWndCol = iCol - s_windows[ iWindow ]->iFirstCol; + iWndHeight = s_windows[ iWindow ]->iWidth; + iWndWidth = s_windows[ iWindow ]->iWidth; } else { @@ -1306,10 +1308,14 @@ static BOOL hb_ctw_gt_PutChar( int iRow, int iCol, iWndCol = iCol + s_windows[ iWindow ]->iLeftMargin; iRow = iWndRow + s_windows[ iWindow ]->iFirstRow; iCol = iWndCol + s_windows[ iWindow ]->iFirstCol; + iWndHeight = s_windows[ iWindow ]->iHeight - + s_windows[ iWindow ]->iBottomMargin; + iWndWidth = s_windows[ iWindow ]->iWidth - + s_windows[ iWindow ]->iRightMargin; } if( iWndCol >= 0 && iWndRow >= 0 && - iWndRow < s_windows[ iWindow ]->iHeight && - iWndCol < s_windows[ iWindow ]->iWidth ) + iWndRow < iWndHeight && + iWndCol < iWndWidth ) { long lIndex = ( long ) iWndRow * s_windows[ iWindow ]->iWidth + iWndCol;