diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 31b47023a3..6e131a6a0d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,54 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-07-10 03:17 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbapigt.h + * harbour/source/rtl/gtapi.c + * changed last parameter of hb_gtRepChar() from USHORT uiCount to + ULONG ulCount + * removed basic parameter validation from hb_gtScroll() - such + things should be done by GT driver + * minor cleanup + + * harbour/source/rtl/hbgtcore.c + % moved pbyBuffer initialization outside the loop in Rest/Save methods + * minor cleanup in casting + + * harbour/source/rtl/mouse53.c + % minor optimization + + * harbour/source/rtl/gtdos/gtdos.c + * changed buffer type in Mouse{Save,Restore}State methods from char * + to void * + + * harbour/source/rtl/gtxwc/gtxwc.c + * harbour/source/rtl/gtcrs/gtcrs.c + ! fixed casting + + * harbour/source/rtl/xhelp.c + * harbour/source/rtl/console.c + % use 'int' instead of 'USHORT' + + * harbour/source/rtl/saverest.c + * removed explicit casting + + * harbour/source/rtl/scroll.c + * harbour/source/rtl/console.c + * harbour/contrib/hbct/screen1.c + * harbour/contrib/hbct/screen2.c + ! fixed casting from 'char *' items which was wrongly changing + the results. + + * harbour/contrib/hbct/screen1.c + * harbour/contrib/hbct/screen2.c + % eliminated not longer necessary intermediate variables used for + passing by reference in previous version with [U]SHORT casting + + * harbour/contrib/hbnf/dispc.c + * harbour/contrib/hbnf/ftattr.c + * harbour/contrib/hbnf/ftshadow.c + * changed screen coordinates from [U]SHORT to int + 2009-07-10 02:33 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbclipsm/gauge.c % Minor cleanup. diff --git a/harbour/contrib/hbct/screen1.c b/harbour/contrib/hbct/screen1.c index 52feee3a01..bf8db9808c 100644 --- a/harbour/contrib/hbct/screen1.c +++ b/harbour/contrib/hbct/screen1.c @@ -101,14 +101,15 @@ HB_FUNC( SCREENATTR ) { - int sRow, sCol; int iRow, iCol; BYTE bColor, bAttr; USHORT usChar; - hb_gtGetPos( &sRow, &sCol ); - iRow = HB_ISNUM( 1 ) ? hb_parni( 1 ) : sRow; - iCol = HB_ISNUM( 2 ) ? hb_parni( 2 ) : sCol; + hb_gtGetPos( &iRow, &iCol ); + if( HB_ISNUM( 1 ) ) + iRow = hb_parni( 1 ); + if( HB_ISNUM( 2 ) ) + iCol = hb_parni( 2 ); if( hb_gtGetChar( iRow, iCol, &bColor, &bAttr, &usChar ) != HB_SUCCESS ) bColor = 0; @@ -151,7 +152,6 @@ HB_FUNC( SCREENMIX ) const char * szText = hb_parc( 1 ); const char * szAttr; ULONG ulAttr = hb_parclen( 2 ), ul = 0; - int sRow, sCol; int iRow, iCol, i; if( ulAttr == 0 ) @@ -162,9 +162,11 @@ HB_FUNC( SCREENMIX ) else szAttr = hb_parc( 2 ); - hb_gtGetPos( &sRow, &sCol ); - iRow = HB_ISNUM( 3 ) ? hb_parni( 3 ) : sRow; - iCol = HB_ISNUM( 4 ) ? hb_parni( 4 ) : sCol; + hb_gtGetPos( &iRow, &iCol ); + if( HB_ISNUM( 3 ) ) + iRow = hb_parni( 3 ); + if( HB_ISNUM( 4 ) ) + iCol = hb_parni( 4 ); if( iRow >= 0 && iCol >= 0 && iRow <= hb_gtMaxRow() && iCol <= hb_gtMaxCol() ) @@ -173,7 +175,7 @@ HB_FUNC( SCREENMIX ) i = iCol; do { - if( hb_gtPutChar( iRow, i++, szAttr[ ul ], 0, *szText++ ) != HB_SUCCESS ) + if( hb_gtPutChar( iRow, i++, szAttr[ ul ], 0, ( UCHAR ) *szText++ ) != HB_SUCCESS ) { if( ++iRow > hb_gtMaxRow() ) break; @@ -231,12 +233,13 @@ HB_FUNC( SAYSCREEN ) if( ulLen ) { const char * szText = hb_parc( 1 ); - int sRow, sCol; int iRow, iCol, i; - hb_gtGetPos( &sRow, &sCol ); - iRow = HB_ISNUM( 2 ) ? hb_parni( 2 ) : sRow; - iCol = HB_ISNUM( 3 ) ? hb_parni( 3 ) : sCol; + hb_gtGetPos( &iRow, &iCol ); + if( HB_ISNUM( 2 ) ) + iRow = hb_parni( 2 ); + if( HB_ISNUM( 3 ) ) + iCol = hb_parni( 3 ); if( iRow >= 0 && iCol >= 0 && iRow <= hb_gtMaxRow() && iCol <= hb_gtMaxCol() ) @@ -255,7 +258,7 @@ HB_FUNC( SAYSCREEN ) i = iCol; } else - hb_gtPutChar( iRow, i++, bColor, bAttr, *szText++ ); + hb_gtPutChar( iRow, i++, bColor, bAttr, ( UCHAR ) *szText++ ); } while( --ulLen ); hb_gtEndWrite(); diff --git a/harbour/contrib/hbct/screen2.c b/harbour/contrib/hbct/screen2.c index 35a4a70a02..3ccd443b27 100644 --- a/harbour/contrib/hbct/screen2.c +++ b/harbour/contrib/hbct/screen2.c @@ -63,15 +63,16 @@ HB_FUNC( SAYDOWN ) if( ulLen ) { const char * szText = hb_parc( 1 ); - int sRow, sCol; int iRow, iCol, iMaxRow, iMaxCol; long lDelay; lDelay = HB_ISNUM( 2 ) ? hb_parnl( 2 ) : 4; - hb_gtGetPos( &sRow, &sCol ); - iRow = HB_ISNUM( 3 ) ? hb_parni( 3 ) : sRow; - iCol = HB_ISNUM( 4 ) ? hb_parni( 4 ) : sCol; + hb_gtGetPos( &iRow, &iCol ); + if( HB_ISNUM( 3 ) ) + iRow = hb_parni( 3 ); + if( HB_ISNUM( 4 ) ) + iCol = hb_parni( 4 ); iMaxRow = hb_gtMaxRow(); iMaxCol = hb_gtMaxCol(); @@ -85,7 +86,7 @@ HB_FUNC( SAYDOWN ) hb_gtBeginWrite(); while( ulLen-- ) { - hb_gtPutChar( iRow++, iCol, bColor, 0, *szText++ ); + hb_gtPutChar( iRow++, iCol, bColor, 0, ( UCHAR ) *szText++ ); if( lDelay ) { hb_gtEndWrite(); @@ -108,7 +109,6 @@ HB_FUNC( SAYSPREAD ) { const char * szText = hb_parc( 1 ); ULONG ulPos, ul; - int sRow, sCol; int iRow, iCol, iMaxRow, iMaxCol; long lDelay; @@ -116,8 +116,11 @@ HB_FUNC( SAYSPREAD ) iMaxRow = hb_gtMaxRow(); iMaxCol = hb_gtMaxCol(); - hb_gtGetPos( &sRow, &sCol ); - iRow = HB_ISNUM( 3 ) ? hb_parni( 3 ) : sRow; + hb_gtGetPos( &iRow, &iCol ); + if( HB_ISNUM( 3 ) ) + iRow = hb_parni( 3 ); + else + hb_gtGetPos( &iRow, &iCol ); iCol = HB_ISNUM( 4 ) ? hb_parni( 4 ) : ( iMaxCol >> 1 ); if( iRow >= 0 && iCol >= 0 && iRow <= iMaxRow && iCol <= iMaxCol ) @@ -136,7 +139,7 @@ HB_FUNC( SAYSPREAD ) do { for( ul = 0; ul < ulLen && iCol + ( int ) ul <= iMaxCol; ++ul ) - hb_gtPutChar( iRow, iCol + ( int ) ul, bColor, 0, szText[ulPos + ul] ); + hb_gtPutChar( iRow, iCol + ( int ) ul, bColor, 0, ( UCHAR ) szText[ulPos + ul] ); ulLen += 2; if( lDelay ) { @@ -162,8 +165,7 @@ HB_FUNC( SAYMOVEIN ) { const char * szText = hb_parc( 1 ); ULONG ulChars, ul; - int sRow, sCol; - int iRow, iCol, iMaxRow, iMaxCol; + int iRow, iCol, iMaxRow, iMaxCol, iNewCol; long lDelay; BOOL fBack; @@ -172,16 +174,16 @@ HB_FUNC( SAYMOVEIN ) iMaxRow = hb_gtMaxRow(); iMaxCol = hb_gtMaxCol(); - hb_gtGetPos( &sRow, &sCol ); - iRow = HB_ISNUM( 3 ) ? hb_parni( 3 ) : ( int ) sRow; - iCol = HB_ISNUM( 4 ) ? hb_parni( 4 ) : ( int ) sCol; - + hb_gtGetPos( &iRow, &iCol ); + if( HB_ISNUM( 3 ) ) + iRow = hb_parni( 3 ); + if( HB_ISNUM( 4 ) ) + iCol = hb_parni( 4 ); if( iRow >= 0 && iCol >= 0 && iRow <= iMaxRow && iCol <= iMaxCol ) { BYTE bColor = hb_gtGetCurrColor(); - sRow = iRow; - sCol = iCol + ( int ) ulLen; + iNewCol = iCol + ( int ) ulLen; if( fBack ) iCol += ulLen - 1; else @@ -196,14 +198,14 @@ HB_FUNC( SAYMOVEIN ) if( iCol <= iMaxCol ) { for( ul = 0; ul < ulChars; ++ul ) - hb_gtPutChar( iRow, iCol + ( int ) ul, bColor, 0, szText[ul] ); + hb_gtPutChar( iRow, iCol + ( int ) ul, bColor, 0, ( UCHAR ) szText[ul] ); } --iCol; } else { for( ul = 0; ul < ulChars; ++ul ) - hb_gtPutChar( iRow, iCol + ( int ) ul, bColor, 0, szText[ul] ); + hb_gtPutChar( iRow, iCol + ( int ) ul, bColor, 0, ( UCHAR ) szText[ul] ); --szText; } if( ( int ) ulChars + iCol <= iMaxCol ) @@ -217,7 +219,7 @@ HB_FUNC( SAYMOVEIN ) } } while( --ulLen ); - hb_gtSetPos( sRow, sCol ); + hb_gtSetPos( iRow, iNewCol ); hb_gtEndWrite(); } } @@ -311,23 +313,23 @@ HB_FUNC( CLEARSLOW ) HB_FUNC( SCREENSTR ) { - int sRow, sCol, sMaxRow, sMaxCol, sC; + int iRow, iCol, iMaxRow, iMaxCol, iC; char * pBuffer, * szText; ULONG ulSize, ulCount = ULONG_MAX; - hb_gtGetPos( &sRow, &sCol ); + hb_gtGetPos( &iRow, &iCol ); if( HB_ISNUM( 1 ) ) - sRow = hb_parni( 1 ); + iRow = hb_parni( 1 ); if( HB_ISNUM( 2 ) ) - sCol = hb_parni( 2 ); + iCol = hb_parni( 2 ); if( HB_ISNUM( 3 ) ) ulCount = hb_parnl( 3 ); - sMaxRow = hb_gtMaxRow(); - sMaxCol = hb_gtMaxCol(); + iMaxRow = hb_gtMaxRow(); + iMaxCol = hb_gtMaxCol(); - if( sRow >= 0 && sRow <= sMaxRow && sCol >= 0 && sCol <= sMaxCol && ulCount ) + if( iRow >= 0 && iRow <= iMaxRow && iCol >= 0 && iCol <= iMaxCol && ulCount ) { - ulSize = ( ULONG ) ( sMaxRow - sRow + 1 ) * ( sMaxCol - sCol + 1 ); + ulSize = ( ULONG ) ( iMaxRow - iRow + 1 ) * ( iMaxCol - iCol + 1 ); if( ulSize > ulCount ) ulSize = ulCount; ulCount = ulSize; @@ -335,18 +337,18 @@ HB_FUNC( SCREENSTR ) szText = pBuffer = ( char * ) hb_xgrab( ulSize + 1 ); do { - sC = sCol; + iC = iCol; do { BYTE bColor, bAttr; USHORT usChar; - hb_gtGetChar( sRow, sC, &bColor, &bAttr, &usChar ); + hb_gtGetChar( iRow, iC, &bColor, &bAttr, &usChar ); *szText++ = ( char ) usChar; *szText++ = ( char ) bColor; } - while( --ulCount && ++sC <= sMaxCol ); + while( --ulCount && ++iC <= iMaxCol ); } - while( ulCount && ++sRow <= sMaxRow ); + while( ulCount && ++iRow <= iMaxRow ); hb_retclen_buffer( pBuffer, ulSize ); } @@ -364,32 +366,32 @@ HB_FUNC( STRSCREEN ) if( ulLen ) { const char * szText = hb_parc( 1 ); - int sRow, sCol, sMaxRow, sMaxCol, sC; + int iRow, iCol, iMaxRow, iMaxCol, iC; - hb_gtGetPos( &sRow, &sCol ); + hb_gtGetPos( &iRow, &iCol ); if( HB_ISNUM( 2 ) ) - sRow = hb_parni( 2 ); + iRow = hb_parni( 2 ); if( HB_ISNUM( 3 ) ) - sCol = hb_parni( 3 ); - sMaxRow = hb_gtMaxRow(); - sMaxCol = hb_gtMaxCol(); + iCol = hb_parni( 3 ); + iMaxRow = hb_gtMaxRow(); + iMaxCol = hb_gtMaxCol(); - if( sRow >= 0 && sRow <= sMaxRow && sCol >= 0 && sCol <= sMaxCol ) + if( iRow >= 0 && iRow <= iMaxRow && iCol >= 0 && iCol <= iMaxCol ) { hb_gtBeginWrite(); do { - sC = sCol; + iC = iCol; do { - USHORT usChar = *szText++; + USHORT usChar = ( UCHAR ) *szText++; BYTE bColor = *szText++; - hb_gtPutChar( sRow, sC, bColor, 0, usChar ); + hb_gtPutChar( iRow, iC, bColor, 0, usChar ); ulLen -= 2; } - while( ulLen && ++sC <= sMaxCol ); + while( ulLen && ++iC <= iMaxCol ); } - while( ulLen && ++sRow <= sMaxRow ); + while( ulLen && ++iRow <= iMaxRow ); hb_gtEndWrite(); } } @@ -402,12 +404,12 @@ HB_FUNC( STRSCREEN ) */ HB_FUNC( _HB_CTDSPTIME ) { - int sRow, sCol; + int iRow, iCol; int iColor, iLen; char szTime[ 10 ]; - sRow = hb_parni( 1 ); - sCol = hb_parni( 2 ); + iRow = hb_parni( 1 ); + iCol = hb_parni( 2 ); if( HB_ISNUM( 4 ) ) iColor = hb_parni( 4 ); else if( HB_ISCHAR( 4 ) ) @@ -442,5 +444,5 @@ HB_FUNC( _HB_CTDSPTIME ) if( szTime[0] == '0' ) szTime[0] = ' '; - hb_gtPutText( sRow, sCol, szTime, iLen, iColor ); + hb_gtPutText( iRow, iCol, szTime, iLen, iColor ); } diff --git a/harbour/contrib/hbnf/dispc.c b/harbour/contrib/hbnf/dispc.c index 4404d17065..97317091d5 100644 --- a/harbour/contrib/hbnf/dispc.c +++ b/harbour/contrib/hbnf/dispc.c @@ -357,7 +357,7 @@ static void disp_update(int offset) line += 1; offset += 2; } - hb_gtRest( ( SHORT ) sline, ( SHORT ) scol, ( SHORT ) eline, ( SHORT ) ecol, vseg ); + hb_gtRest( sline, scol, eline, ecol, vseg ); } @@ -557,7 +557,7 @@ HB_FUNC( _FT_DFINIT ) hb_gtRectSize( sline, scol, eline, ecol, &ulSize ); vseg = (char * ) hb_xalloc( ulSize ); if (vseg != NULL) - hb_gtSave( ( SHORT ) sline, ( SHORT ) scol, ( SHORT ) eline, ( SHORT ) ecol, vseg ); + hb_gtSave( sline, scol, eline, ecol, vseg ); maxlin = hb_parni(12); buffsize = hb_parni(13); /* yes - load value */ @@ -643,7 +643,7 @@ HB_FUNC( _FT_DFINIT ) for (i = 1; i < j; i++) linedown(); - hb_gtRest( ( SHORT ) sline, ( SHORT ) scol, ( SHORT ) eline, ( SHORT ) ecol, vseg ); + hb_gtRest( sline, scol, eline, ecol, vseg ); } @@ -740,7 +740,7 @@ HB_FUNC( FT_DISPFILE ) for (i = 0; i < height; i++) chattr(0, i, width, norm); - hb_gtRest( ( SHORT ) sline, ( SHORT ) scol, ( SHORT ) eline, ( SHORT ) ecol, vseg ); + hb_gtRest( sline, scol, eline, ecol, vseg ); /* main processing loop -- terminated by user key press */ @@ -749,16 +749,16 @@ HB_FUNC( FT_DISPFILE ) if ( refresh == YES ) /* redraw window contents? */ disp_update(wintop); - hb_gtRest( ( SHORT ) sline, ( SHORT ) scol, ( SHORT ) eline, ( SHORT ) ecol, vseg ); + hb_gtRest( sline, scol, eline, ecol, vseg ); /* if not browse, highlight the current line */ if ( brows == NO ) chattr(0, winrow - sline, width, hlight); - hb_gtRest( ( SHORT ) sline, ( SHORT ) scol, ( SHORT ) eline, ( SHORT ) ecol, vseg ); + hb_gtRest( sline, scol, eline, ecol, vseg ); - hb_gtSetPos( ( SHORT ) winrow, ( SHORT ) scol ); + hb_gtSetPos( winrow, scol ); ch = keyin(); /* get user key press */ @@ -767,7 +767,7 @@ HB_FUNC( FT_DISPFILE ) if ( brows == NO ) chattr(0, winrow - sline, width, norm); - hb_gtRest( ( SHORT ) sline, ( SHORT ) scol, ( SHORT ) eline, ( SHORT ) ecol, vseg ); + hb_gtRest( sline, scol, eline, ecol, vseg ); /* figure out what the user wants to do */ diff --git a/harbour/contrib/hbnf/ftattr.c b/harbour/contrib/hbnf/ftattr.c index 99533d27ac..89e65d8c80 100644 --- a/harbour/contrib/hbnf/ftattr.c +++ b/harbour/contrib/hbnf/ftattr.c @@ -173,38 +173,42 @@ End HB_FUNC( FT_SAVEATT ) { - USHORT uiTop = ( USHORT ) hb_parni( 1 ); /* Defaults to zero on bad type */ - USHORT uiLeft = ( USHORT ) hb_parni( 2 ); /* Defaults to zero on bad type */ - USHORT uiMaxRow = hb_gtMaxRow(); - USHORT uiMaxCol = hb_gtMaxCol(); - USHORT uiBottom = HB_ISNUM( 3 ) ? ( USHORT ) hb_parni( 3 ) : uiMaxRow; - USHORT uiRight = HB_ISNUM( 4 ) ? ( USHORT ) hb_parni( 4 ) : uiMaxRow; + int iTop = hb_parni( 1 ); /* Defaults to zero on bad type */ + int iLeft = hb_parni( 2 ); /* Defaults to zero on bad type */ + int iMaxRow = hb_gtMaxRow(); + int iMaxCol = hb_gtMaxCol(); + int iBottom = HB_ISNUM( 3 ) ? hb_parni( 3 ) : iMaxRow; + int iRight = HB_ISNUM( 4 ) ? hb_parni( 4 ) : iMaxRow; ULONG ulSize; char * pBuffer; char * pAttrib; - if( uiBottom > uiMaxRow ) - uiBottom = uiMaxRow; - if( uiRight > uiMaxCol ) - uiRight = uiMaxCol; + if( iTop < 0 ) + iTop = 0; + if( iLeft < 0 ) + iLeft = 0; + if( iBottom > iMaxRow ) + iBottom = iMaxRow; + if( iRight > iMaxCol ) + iRight = iMaxCol; - if( uiTop <= uiBottom && uiLeft <= uiRight ) + if( iTop <= iBottom && iLeft <= iRight ) { - ulSize = ( uiBottom - uiTop + 1 ) * ( uiRight - uiLeft + 1 ); + ulSize = ( iBottom - iTop + 1 ) * ( iRight - iLeft + 1 ); pBuffer = pAttrib = ( char * ) hb_xgrab( ulSize + 1 ); - while( uiTop <= uiBottom ) + while( iTop <= iBottom ) { - USHORT uiCol = uiLeft; - while( uiCol <= uiRight ) + int iCol = iLeft; + while( iCol <= iRight ) { BYTE bColor, bAttr; USHORT usChar; - hb_gtGetChar( uiTop, uiCol, &bColor, &bAttr, &usChar ); + hb_gtGetChar( iTop, iCol, &bColor, &bAttr, &usChar ); *pBuffer++ = ( char ) bColor; - ++uiCol; + ++iCol; } - ++uiTop; + ++iTop; } hb_retclen_buffer( pAttrib, ulSize ); } @@ -386,35 +390,39 @@ HB_FUNC( FT_RESTATT ) ULONG ulLen = hb_parclen( 5 ); if( ulLen ) { - USHORT uiTop = ( USHORT ) hb_parni( 1 ); /* Defaults to zero on bad type */ - USHORT uiLeft = ( USHORT ) hb_parni( 2 ); /* Defaults to zero on bad type */ - USHORT uiMaxRow = hb_gtMaxRow(); - USHORT uiMaxCol = hb_gtMaxCol(); - USHORT uiBottom = HB_ISNUM( 3 ) ? ( USHORT ) hb_parni( 3 ) : hb_gtMaxRow(); - USHORT uiRight = HB_ISNUM( 4 ) ? ( USHORT ) hb_parni( 4 ) : hb_gtMaxCol(); + int iTop = hb_parni( 1 ); /* Defaults to zero on bad type */ + int iLeft = hb_parni( 2 ); /* Defaults to zero on bad type */ + int iMaxRow = hb_gtMaxRow(); + int iMaxCol = hb_gtMaxCol(); + int iBottom = HB_ISNUM( 3 ) ? hb_parni( 3 ) : iMaxRow; + int iRight = HB_ISNUM( 4 ) ? hb_parni( 4 ) : iMaxCol; const char * pAttrib = hb_parc( 5 ); - if( uiBottom > uiMaxRow ) - uiBottom = uiMaxRow; - if( uiRight > uiMaxCol ) - uiRight = uiMaxCol; + if( iTop < 0 ) + iTop = 0; + if( iLeft < 0 ) + iLeft = 0; + if( iBottom > iMaxRow ) + iBottom = iMaxRow; + if( iRight > iMaxCol ) + iRight = iMaxCol; - if( uiTop <= uiBottom && uiLeft <= uiRight ) + if( iTop <= iBottom && iLeft <= iRight ) { - while( ulLen && uiTop <= uiBottom) + while( ulLen && iTop <= iBottom) { - USHORT uiCol = uiLeft; - while( ulLen && uiCol <= uiRight ) + int iCol = iLeft; + while( ulLen && iCol <= iRight ) { BYTE bColor, bAttr; USHORT usChar; - hb_gtGetChar( uiTop, uiCol, &bColor, &bAttr, &usChar ); + hb_gtGetChar( iTop, iCol, &bColor, &bAttr, &usChar ); bColor = *pAttrib++; - hb_gtPutChar( uiTop, uiCol, bColor, bAttr, usChar ); - ++uiCol; + hb_gtPutChar( iTop, iCol, bColor, bAttr, usChar ); + ++iCol; --ulLen; } - ++uiTop; + ++iTop; } } } diff --git a/harbour/contrib/hbnf/ftshadow.c b/harbour/contrib/hbnf/ftshadow.c index d002a9afd0..dbd0ef8eff 100644 --- a/harbour/contrib/hbnf/ftshadow.c +++ b/harbour/contrib/hbnf/ftshadow.c @@ -63,9 +63,9 @@ HB_FUNC( FT_SHADOW ) HB_FUNC( FT_SETATTR ) { - hb_gtSetAttribute( ( SHORT ) hb_parni( 1 ), - ( SHORT ) hb_parni( 2 ), - ( SHORT ) hb_parni( 3 ), - ( SHORT ) hb_parni( 4 ), + hb_gtSetAttribute( hb_parni( 1 ), + hb_parni( 2 ), + hb_parni( 3 ), + hb_parni( 4 ), ( BYTE ) hb_parni( 5 ) ); } diff --git a/harbour/include/hbapigt.h b/harbour/include/hbapigt.h index f34f201bd3..69080f3485 100644 --- a/harbour/include/hbapigt.h +++ b/harbour/include/hbapigt.h @@ -194,8 +194,8 @@ extern HB_EXPORT HB_ERRCODE hb_gtPreExt( void ); extern HB_EXPORT HB_ERRCODE hb_gtSuspend( void ); /* prepare the reminal for shell output */ extern HB_EXPORT HB_ERRCODE hb_gtResume( void ); /* resume the terminal after the shell output */ extern HB_EXPORT int hb_gtReadKey( int iEventMask ); -extern HB_EXPORT HB_ERRCODE hb_gtRectSize( int iTop, int iLeft, int iBottom, int iRight, ULONG * puiBuffSize ); -extern HB_EXPORT HB_ERRCODE hb_gtRepChar( int iRow, int iCol, USHORT usChar, USHORT uiCount ); +extern HB_EXPORT HB_ERRCODE hb_gtRectSize( int iTop, int iLeft, int iBottom, int iRight, ULONG * pulBuffSize ); +extern HB_EXPORT HB_ERRCODE hb_gtRepChar( int iRow, int iCol, USHORT usChar, ULONG ulCount ); extern HB_EXPORT HB_ERRCODE hb_gtSave( int iTop, int iLeft, int iBottom, int iRight, void * pScrBuff ); extern HB_EXPORT HB_ERRCODE hb_gtRest( int iTop, int iLeft, int iBottom, int iRight, const void * pScrBuff ); extern HB_EXPORT HB_ERRCODE hb_gtGetChar( int iRow, int iCol, BYTE * pbColor, BYTE * pbAttr, USHORT * pusChar ); @@ -204,7 +204,7 @@ extern HB_EXPORT HB_ERRCODE hb_gtBeginWrite( void ); extern HB_EXPORT HB_ERRCODE hb_gtEndWrite( void ); extern HB_EXPORT HB_ERRCODE hb_gtScrDim( int * piHeight, int * piWidth ); extern HB_EXPORT HB_ERRCODE hb_gtScroll( int iTop, int iLeft, int iBottom, int iRight, int iRows, int iCols ); -extern HB_EXPORT HB_ERRCODE hb_gtScrollUp( int uiRows ); +extern HB_EXPORT HB_ERRCODE hb_gtScrollUp( int iRows ); extern HB_EXPORT HB_ERRCODE hb_gtSetAttribute( int iTop, int iLeft, int iBottom, int iRight, BYTE byAttr ); extern HB_EXPORT HB_ERRCODE hb_gtSetBlink( BOOL bBlink ); extern HB_EXPORT HB_ERRCODE hb_gtSetColorStr( const char * pszColorString ); diff --git a/harbour/source/rtl/console.c b/harbour/source/rtl/console.c index 8cb09b92a5..86bca4089a 100644 --- a/harbour/source/rtl/console.c +++ b/harbour/source/rtl/console.c @@ -286,61 +286,58 @@ static char * hb_itemStringCon( PHB_ITEM pItem, ULONG * pulLen, BOOL * pfFreeReq HB_FUNC( OUTSTD ) /* writes a list of values to the standard output device */ { - USHORT uiPCount = ( USHORT ) hb_pcount(); - USHORT uiParam; + int iPCount = hb_pcount(), iParam; char * pszString; ULONG ulLen; BOOL fFree; - for( uiParam = 1; uiParam <= uiPCount; uiParam++ ) + for( iParam = 1; iParam <= iPCount; iParam++ ) { - pszString = hb_itemString( hb_param( uiParam, HB_IT_ANY ), &ulLen, &fFree ); + if( iParam > 1 ) + hb_conOutAlt( " ", 1 ); + pszString = hb_itemString( hb_param( iParam, HB_IT_ANY ), &ulLen, &fFree ); if( ulLen ) hb_conOutStd( pszString, ulLen ); if( fFree ) hb_xfree( pszString ); - if( uiParam < uiPCount ) - hb_conOutStd( " ", 1 ); } } HB_FUNC( OUTERR ) /* writes a list of values to the standard error device */ { - USHORT uiPCount = ( USHORT ) hb_pcount(); - USHORT uiParam; + int iPCount = hb_pcount(), iParam; char * pszString; ULONG ulLen; BOOL fFree; - for( uiParam = 1; uiParam <= uiPCount; uiParam++ ) + for( iParam = 1; iParam <= iPCount; iParam++ ) { - pszString = hb_itemString( hb_param( uiParam, HB_IT_ANY ), &ulLen, &fFree ); + if( iParam > 1 ) + hb_conOutAlt( " ", 1 ); + pszString = hb_itemString( hb_param( iParam, HB_IT_ANY ), &ulLen, &fFree ); if( ulLen ) hb_conOutErr( pszString, ulLen ); if( fFree ) hb_xfree( pszString ); - if( uiParam < uiPCount ) - hb_conOutErr( " ", 1 ); } } HB_FUNC( QQOUT ) /* writes a list of values to the current device (screen or printer) and is affected by SET ALTERNATE */ { - USHORT uiPCount = ( USHORT ) hb_pcount(); - USHORT uiParam; + int iPCount = hb_pcount(), iParam; char * pszString; ULONG ulLen; BOOL fFree; - for( uiParam = 1; uiParam <= uiPCount; uiParam++ ) + for( iParam = 1; iParam <= iPCount; iParam++ ) { - pszString = hb_itemString( hb_param( uiParam, HB_IT_ANY ), &ulLen, &fFree ); + if( iParam > 1 ) + hb_conOutAlt( " ", 1 ); + pszString = hb_itemString( hb_param( iParam, HB_IT_ANY ), &ulLen, &fFree ); if( ulLen ) hb_conOutAlt( pszString, ulLen ); if( fFree ) hb_xfree( pszString ); - if( uiParam < uiPCount ) - hb_conOutAlt( " ", 1 ); } } @@ -468,7 +465,7 @@ static void hb_conDevPos( int iRow, int iCol ) } if( iPtr ) - hb_fsWrite( hFile, buf, ( SHORT ) iPtr ); + hb_fsWrite( hFile, buf, ( USHORT ) iPtr ); } } else @@ -625,8 +622,8 @@ HB_FUNC( HB_DISPOUTAT ) so we can use it to draw graphical elements. */ HB_FUNC( HB_DISPOUTATBOX ) { - int nRow = hb_parni( 1 ); - int nCol = hb_parni( 2 ); + int iRow = hb_parni( 1 ); + int iCol = hb_parni( 2 ); const char * pszString = hb_parcx( 3 ); ULONG nStringLen = hb_parclen( 3 ); int iColor; @@ -639,7 +636,7 @@ HB_FUNC( HB_DISPOUTATBOX ) iColor = hb_gtGetCurrColor(); while( nStringLen-- ) - hb_gtPutChar( nRow, nCol++, ( BYTE ) iColor, HB_GT_ATTR_BOX, ( USHORT ) *pszString++ ); + hb_gtPutChar( iRow, iCol++, ( BYTE ) iColor, HB_GT_ATTR_BOX, ( unsigned char ) *pszString++ ); } HB_FUNC( HB_GETSTDIN ) /* Return handle for STDIN */ diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index 6b2bcbfcd4..be247c2631 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -453,11 +453,7 @@ HB_ERRCODE hb_gtGetPos( int * piRow, int * piCol ) pGT = hb_gt_Base(); if( pGT ) { - int iRow, iCol; - - HB_GTSELF_GETPOS( pGT, &iRow, &iCol ); - *piRow = iRow; - *piCol = iCol; + HB_GTSELF_GETPOS( pGT, piRow, piCol ); hb_gt_BaseFree( pGT ); return HB_SUCCESS; } @@ -589,17 +585,17 @@ BOOL hb_gtIsColor( void ) return fColor; } -HB_ERRCODE hb_gtRepChar( int iRow, int iCol, USHORT usChar, USHORT uiCount ) +HB_ERRCODE hb_gtRepChar( int iRow, int iCol, USHORT usChar, ULONG ulCount ) { PHB_GT pGT; - HB_TRACE(HB_TR_DEBUG, ("hb_gtRepChar(%d, %d, %hu, %hu)", iRow, iCol, usChar, uiCount)); + HB_TRACE(HB_TR_DEBUG, ("hb_gtRepChar(%d, %d, %hu, %lu)", iRow, iCol, usChar, ulCount)); pGT = hb_gt_Base(); if( pGT ) { HB_GTSELF_REPLICATE( pGT, iRow, iCol, HB_GTSELF_GETCOLOR( pGT ), 0, - usChar, uiCount ); + usChar, ulCount ); HB_GTSELF_FLUSH( pGT ); hb_gt_BaseFree( pGT ); return HB_SUCCESS; @@ -760,8 +756,7 @@ HB_ERRCODE hb_gtSetMode( int iRows, int iCols ) } HB_ERRCODE hb_gtPutText( int iRow, int iCol, - const char * szStr, ULONG ulLength, - int iColor ) + const char * szStr, ULONG ulLength, int iColor ) { PHB_GT pGT; @@ -835,19 +830,17 @@ HB_ERRCODE hb_gtWriteCon( const char * szStr, ULONG ulLength ) HB_ERRCODE hb_gtScroll( int iTop, int iLeft, int iBottom, int iRight, int iRows, int iCols ) { + PHB_GT pGT; HB_TRACE(HB_TR_DEBUG, ("hb_gtScroll(%d, %d, %d, %d, %d, %d)", iTop, iLeft, iBottom, iRight, iRows, iCols)); - if( iTop <= iBottom && iLeft <= iRight ) + pGT = hb_gt_Base(); + if( pGT ) { - PHB_GT pGT = hb_gt_Base(); - if( pGT ) - { - HB_GTSELF_SCROLL( pGT, iTop, iLeft, iBottom, iRight, - HB_GTSELF_GETCOLOR( pGT ), ' ', iRows, iCols ); - HB_GTSELF_FLUSH( pGT ); - hb_gt_BaseFree( pGT ); - return HB_SUCCESS; - } + HB_GTSELF_SCROLL( pGT, iTop, iLeft, iBottom, iRight, + HB_GTSELF_GETCOLOR( pGT ), ' ', iRows, iCols ); + HB_GTSELF_FLUSH( pGT ); + hb_gt_BaseFree( pGT ); + return HB_SUCCESS; } return HB_FAILURE; } @@ -1241,7 +1234,7 @@ HB_ERRCODE hb_gtGetPosEx( int * piRow, int * piCol ) HB_ERRCODE hb_gtScrollEx( int iTop, int iLeft, int iBottom, int iRight, int iColor, int iChar, int iRows, int iCols ) { - HB_TRACE(HB_TR_DEBUG, ("hb_gtScrollEx(%d, %d, %d, %d, %d, %hd, %d, %d)", iTop, iLeft, iBottom, iRight, iColor, iChar, iRows, iCols)); + HB_TRACE(HB_TR_DEBUG, ("hb_gtScrollEx(%d, %d, %d, %d, %d, %d, %d, %d)", iTop, iLeft, iBottom, iRight, iColor, iChar, iRows, iCols)); if( iTop <= iBottom && iLeft <= iRight ) { diff --git a/harbour/source/rtl/gtcrs/gtcrs.c b/harbour/source/rtl/gtcrs/gtcrs.c index 623a8b2176..1faf8c6b3f 100644 --- a/harbour/source/rtl/gtcrs/gtcrs.c +++ b/harbour/source/rtl/gtcrs/gtcrs.c @@ -1374,7 +1374,7 @@ static void gt_ttyrestore( InOutBase * ioBase ) tcsetattr( ioBase->base_infd, TCSANOW, &ioBase->saved_TIO ); } -static void gt_outstr( InOutBase * ioBase, int fd, const unsigned char *str, +static void gt_outstr( InOutBase * ioBase, int fd, const char *str, int len ) { unsigned char *buf, c; @@ -1398,14 +1398,14 @@ static void gt_outstr( InOutBase * ioBase, int fd, const unsigned char *str, write( fd, str, len ); } -static void gt_outstd( InOutBase * ioBase, unsigned const char *str, int len ) +static void gt_outstd( InOutBase * ioBase, const char *str, int len ) { gt_outstr( ioBase, ioBase->stdoutfd, str, len ); } static void gt_outerr( InOutBase * ioBase, const char *str, int len ) { - gt_outstr( ioBase, ioBase->stderrfd, ( unsigned char * ) str, len ); + gt_outstr( ioBase, ioBase->stderrfd, str, len ); } static char *tiGetS( const char *capname ) @@ -2572,7 +2572,7 @@ static void hb_gt_crs_OutStd( PHB_GT pGT, const char * szStr, ULONG ulLen ) if( s_ioBase->stdoutfd == -1 ) HB_GTSELF_WRITECON( pGT, szStr, ulLen ); else - gt_outstd( s_ioBase, ( const unsigned char * ) szStr, ulLen ); + gt_outstd( s_ioBase, szStr, ulLen ); } else HB_GTSUPER_OUTSTD( pGT, szStr, ulLen ); @@ -2588,7 +2588,7 @@ static void hb_gt_crs_OutErr( PHB_GT pGT, const char * szStr, ULONG ulLen ) if( s_ioBase->stderrfd == -1 ) HB_GTSELF_WRITECON( pGT, szStr, ulLen ); else - gt_outerr( s_ioBase, ( const unsigned char * ) szStr, ulLen ); + gt_outerr( s_ioBase, szStr, ulLen ); } else HB_GTSUPER_OUTERR( pGT, szStr, ulLen ); diff --git a/harbour/source/rtl/gtdos/gtdos.c b/harbour/source/rtl/gtdos/gtdos.c index 06a3424ac1..2f3d08b69c 100644 --- a/harbour/source/rtl/gtdos/gtdos.c +++ b/harbour/source/rtl/gtdos/gtdos.c @@ -643,7 +643,7 @@ static int hb_gt_dos_mouse_StorageSize( PHB_GT pGT ) return iSize; } -static void hb_gt_dos_mouse_SaveState( PHB_GT pGT, char * pBuffer ) +static void hb_gt_dos_mouse_SaveState( PHB_GT pGT, void * pBuffer ) { if( s_fMousePresent ) { @@ -676,11 +676,11 @@ static void hb_gt_dos_mouse_SaveState( PHB_GT pGT, char * pBuffer ) sregs.es = FP_SEG( pBuffer ); HB_DOS_INT86X( 0x33, ®s, ®s, &sregs ); #endif - pBuffer[ s_iMouseStorageSize ] = HB_GTSELF_MOUSEGETCURSOR( pGT ) ? 1 : 0; + ( ( BYTE * ) pBuffer )[ s_iMouseStorageSize ] = HB_GTSELF_MOUSEGETCURSOR( pGT ) ? 1 : 0; } } -static void hb_gt_dos_mouse_RestoreState( PHB_GT pGT, const char * pBuffer ) +static void hb_gt_dos_mouse_RestoreState( PHB_GT pGT, const void * pBuffer ) { if( s_fMousePresent ) { @@ -695,7 +695,7 @@ static void hb_gt_dos_mouse_RestoreState( PHB_GT pGT, const char * pBuffer ) * because the real mouse cursor state will be also recovered * by status restoring */ - HB_GTSELF_MOUSESETCURSOR( pGT, pBuffer[ s_iMouseStorageSize ] ); + HB_GTSELF_MOUSESETCURSOR( pGT, ( ( BYTE * ) pBuffer )[ s_iMouseStorageSize ] ); #if defined( __DJGPP__ ) { diff --git a/harbour/source/rtl/gtxwc/gtxwc.c b/harbour/source/rtl/gtxwc/gtxwc.c index 95ea892970..dd74dc5585 100644 --- a/harbour/source/rtl/gtxwc/gtxwc.c +++ b/harbour/source/rtl/gtxwc/gtxwc.c @@ -3408,7 +3408,7 @@ static void hb_gt_xwc_SetSelection( PXWND_DEF wnd, const char *szData, ULONG ulS else { const char * cMsg = "Cannot set primary selection\r\n"; - HB_GTSELF_OUTERR( wnd->pGT, ( BYTE * ) cMsg, strlen( cMsg ) ); + HB_GTSELF_OUTERR( wnd->pGT, cMsg, strlen( cMsg ) ); } } diff --git a/harbour/source/rtl/hbgtcore.c b/harbour/source/rtl/hbgtcore.c index dd93b8f286..66a792f294 100644 --- a/harbour/source/rtl/hbgtcore.c +++ b/harbour/source/rtl/hbgtcore.c @@ -967,12 +967,13 @@ static long hb_gt_def_RectSize( PHB_GT pGT, int iTop, int iLeft, int iBottom, in static void hb_gt_def_Save( PHB_GT pGT, int iTop, int iLeft, int iBottom, int iRight, void * pBuffer ) { + BYTE * pbyBuffer = ( BYTE * ) pBuffer; + while( iTop <= iBottom ) { BYTE bColor, bAttr; USHORT usChar; int iCol; - BYTE * pbyBuffer = ( BYTE * ) pBuffer; for( iCol = iLeft; iCol <= iRight; ++iCol ) { @@ -1002,12 +1003,13 @@ static void hb_gt_def_Save( PHB_GT pGT, int iTop, int iLeft, int iBottom, int iR static void hb_gt_def_Rest( PHB_GT pGT, int iTop, int iLeft, int iBottom, int iRight, const void * pBuffer ) { + const BYTE * pbyBuffer = ( const BYTE * ) pBuffer; + while( iTop <= iBottom ) { BYTE bColor, bAttr; USHORT usChar; int iCol; - BYTE * pbyBuffer = ( BYTE * ) pBuffer; for( iCol = iLeft; iCol <= iRight; ++iCol ) { @@ -2705,7 +2707,7 @@ static void hb_gt_def_mouseSaveState( PHB_GT pGT, void * pBuffer ) static void hb_gt_def_mouseRestoreState( PHB_GT pGT, const void * pBuffer ) { - _HB_MOUSE_STORAGE * pStore = ( _HB_MOUSE_STORAGE * ) pBuffer; + const _HB_MOUSE_STORAGE * pStore = ( const _HB_MOUSE_STORAGE * ) pBuffer; HB_GTSELF_MOUSESETBOUNDS( pGT, pStore->iTop, pStore->iLeft, pStore->iBottom, pStore->iRight ); HB_GTSELF_MOUSESETPOS( pGT, pStore->iRow, pStore->iCol ); diff --git a/harbour/source/rtl/mouse53.c b/harbour/source/rtl/mouse53.c index 69f42a10bf..f203f8f160 100644 --- a/harbour/source/rtl/mouse53.c +++ b/harbour/source/rtl/mouse53.c @@ -150,7 +150,7 @@ HB_FUNC( MSAVESTATE ) HB_FUNC( MRESTSTATE ) { - if( HB_ISCHAR( 1 ) && hb_parclen( 1 ) == ( ULONG ) hb_mouseStorageSize() ) + if( hb_parclen( 1 ) == ( ULONG ) hb_mouseStorageSize() ) hb_mouseRestoreState( hb_parc( 1 ) ); } diff --git a/harbour/source/rtl/saverest.c b/harbour/source/rtl/saverest.c index 123cd332be..7a8644968d 100644 --- a/harbour/source/rtl/saverest.c +++ b/harbour/source/rtl/saverest.c @@ -120,6 +120,6 @@ HB_FUNC( RESTSCREEN ) hb_getScreenRange( &iTop, &iBottom, fNoCheck, TRUE ); hb_getScreenRange( &iLeft, &iRight, fNoCheck, FALSE ); - hb_gtRest( iTop, iLeft, iBottom, iRight, ( const void * ) hb_parc( 5 ) ); + hb_gtRest( iTop, iLeft, iBottom, iRight, hb_parc( 5 ) ); } } diff --git a/harbour/source/rtl/scroll.c b/harbour/source/rtl/scroll.c index e087914265..83e49e4157 100644 --- a/harbour/source/rtl/scroll.c +++ b/harbour/source/rtl/scroll.c @@ -167,7 +167,7 @@ HB_FUNC( HB_SCROLL ) if( HB_ISNUM( 8 ) ) iChar = hb_parni( 8 ); else if( HB_ISCHAR( 8 ) ) - iChar = ( int ) hb_parc( 8 )[0]; + iChar = ( UCHAR ) hb_parc( 8 )[0]; else iChar = -1; diff --git a/harbour/source/rtl/xhelp.c b/harbour/source/rtl/xhelp.c index 894d5fea2f..19d7651989 100644 --- a/harbour/source/rtl/xhelp.c +++ b/harbour/source/rtl/xhelp.c @@ -65,18 +65,18 @@ HB_FUNC( __XHELP ) { /* NOTE: push the existing params after the dyn symbol. [awhite] */ - USHORT uiPCount = ( USHORT ) hb_pcount(); - USHORT uiParam; + int iPCount = hb_pcount(); + int iParam; hb_vmPushDynSym( s_pDynSym ); hb_vmPushNil(); /* CA-Cl*pper respects references so hb_stackItemFromBase() is * used instead of hb_param() [druzus] */ - for( uiParam = 1; uiParam <= uiPCount; uiParam++ ) - hb_vmPush( hb_stackItemFromBase( uiParam ) ); + for( iParam = 1; iParam <= iPCount; iParam++ ) + hb_vmPush( hb_stackItemFromBase( iParam ) ); - hb_vmProc( uiPCount ); + hb_vmProc( iPCount ); /* NOTE: Leave the return value as it is. */ } }