diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1cf73f1481..15f0a6af46 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,14 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-07-10 00:24 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * include/hbgtcore.h + * source/rtl/gtapi.c + * source/rtl/hbgtcore.c + * Changed low level GT SAVE/REST method buffer parameter type + to void * from BYTE *. Some explicit casts removed. + * Few more BYTE *s to char *. + 2009-07-09 23:14 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * include/hbvmpub.h * include/extend.api diff --git a/harbour/include/hbgtcore.h b/harbour/include/hbgtcore.h index 25812bbb70..14f95f20ff 100644 --- a/harbour/include/hbgtcore.h +++ b/harbour/include/hbgtcore.h @@ -158,8 +158,8 @@ typedef struct BOOL (* GetChar) ( HB_GT_PTR, int, int, BYTE *, BYTE *, USHORT * ); BOOL (* PutChar) ( HB_GT_PTR, int, int, BYTE, BYTE, USHORT ); long (* RectSize) ( HB_GT_PTR, int, int, int, int ); - void (* Save) ( HB_GT_PTR, int, int, int, int, BYTE * ); - void (* Rest) ( HB_GT_PTR, int, int, int, int, const BYTE * ); + void (* Save) ( HB_GT_PTR, int, int, int, int, void * ); + void (* Rest) ( HB_GT_PTR, int, int, int, int, const void * ); void (* PutText) ( HB_GT_PTR, int, int, BYTE, const char *, ULONG ); void (* Replicate) ( HB_GT_PTR, int, int, BYTE, BYTE, USHORT, ULONG ); void (* WriteAt) ( HB_GT_PTR, int, int, const char *, ULONG ); diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index 7f5a7e4bd7..ebf95ff1ef 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -614,7 +614,7 @@ HB_ERRCODE hb_gtSave( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRig pGT = hb_gt_Base(); if( pGT ) { - HB_GTSELF_SAVE( pGT, uiTop, uiLeft, uiBottom, uiRight, ( BYTE * ) pScrBuff ); + HB_GTSELF_SAVE( pGT, uiTop, uiLeft, uiBottom, uiRight, pScrBuff ); hb_gt_BaseFree( pGT ); return HB_SUCCESS; } @@ -630,7 +630,7 @@ HB_ERRCODE hb_gtRest( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRig pGT = hb_gt_Base(); if( pGT ) { - HB_GTSELF_REST( pGT, uiTop, uiLeft, uiBottom, uiRight, ( const BYTE * ) pScrBuff ); + HB_GTSELF_REST( pGT, uiTop, uiLeft, uiBottom, uiRight, pScrBuff ); HB_GTSELF_FLUSH( pGT ); hb_gt_BaseFree( pGT ); return HB_SUCCESS; diff --git a/harbour/source/rtl/hbgtcore.c b/harbour/source/rtl/hbgtcore.c index 5db2a7d1b5..84e699978b 100644 --- a/harbour/source/rtl/hbgtcore.c +++ b/harbour/source/rtl/hbgtcore.c @@ -965,13 +965,14 @@ 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, - BYTE * pBuffer ) + void * pBuffer ) { while( iTop <= iBottom ) { BYTE bColor, bAttr; USHORT usChar; int iCol; + BYTE * pbyBuffer = ( BYTE * ) pBuffer; for( iCol = iLeft; iCol <= iRight; ++iCol ) { @@ -983,15 +984,15 @@ static void hb_gt_def_Save( PHB_GT pGT, int iTop, int iLeft, int iBottom, int iR } if( pGT->fVgaCell ) { - *pBuffer++ = ( BYTE ) usChar; - *pBuffer++ = bColor; + *pbyBuffer++ = ( BYTE ) usChar; + *pbyBuffer++ = bColor; } else { - HB_PUT_LE_UINT16( pBuffer, usChar ); - pBuffer += 2; - *pBuffer++ = bColor; - *pBuffer++ = bAttr; + HB_PUT_LE_UINT16( pbyBuffer, usChar ); + pbyBuffer += 2; + *pbyBuffer++ = bColor; + *pbyBuffer++ = bAttr; } } ++iTop; @@ -999,28 +1000,29 @@ 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 BYTE * pBuffer ) + const void * pBuffer ) { while( iTop <= iBottom ) { BYTE bColor, bAttr; USHORT usChar; int iCol; + BYTE * pbyBuffer = ( BYTE * ) pBuffer; for( iCol = iLeft; iCol <= iRight; ++iCol ) { if( pGT->fVgaCell ) { - usChar = *pBuffer++; - bColor = *pBuffer++; + usChar = *pbyBuffer++; + bColor = *pbyBuffer++; bAttr = 0; } else { - usChar = HB_GET_LE_UINT16( pBuffer ); - pBuffer += 2; - bColor = *pBuffer++; - bAttr = *pBuffer++; + usChar = HB_GET_LE_UINT16( pbyBuffer ); + pbyBuffer += 2; + bColor = *pbyBuffer++; + bAttr = *pbyBuffer++; } HB_GTSELF_PUTCHAR( pGT, iTop, iCol, bColor, bAttr, usChar ); } @@ -1109,14 +1111,14 @@ static void hb_gt_def_Scroll( PHB_GT pGT, int iTop, int iLeft, int iBottom, int if( iLength > 0 && iTop <= iBottom ) { - BYTE * pBuffer = NULL; + void * pBuffer = NULL; if( ( iRows || iCols ) && iColSize >= 0 && ( iBottom - iTop >= iRows ) ) { ULONG ulSize = HB_GTSELF_RECTSIZE( pGT, iTop, iColOld, iTop, iColOld + iColSize ); if( ulSize ) - pBuffer = ( BYTE * ) hb_xgrab( ulSize ); + pBuffer = hb_xgrab( ulSize ); } while( iTop <= iBottom ) @@ -1287,7 +1289,7 @@ static void hb_gt_def_Box( PHB_GT pGT, int iTop, int iLeft, int iBottom, int iRi if( iTop <= iMaxRow && iLeft <= iMaxCol && iBottom >= 0 && iRight >= 0 ) { - BYTE szBox[ 10 ]; + char szBox[ 10 ]; BYTE bPadCh = HB_GTSELF_GETCLEARCHAR( pGT ); if( szFrame ) @@ -1519,7 +1521,7 @@ static BOOL hb_gt_def_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) ulSize = HB_GTSELF_RECTSIZE( pGT, 0, 0, iRow, iCol ); if( ulSize ) { - BYTE * pBuffer = ( BYTE * ) hb_xgrab( ulSize + 1 ); + void * pBuffer = hb_xgrab( ulSize + 1 ); HB_GTSELF_SAVE( pGT, 0, 0, iRow, iCol, pBuffer ); hb_arraySetCPtr( pInfo->pResult, 7, ( char * ) pBuffer, ulSize ); } @@ -1533,7 +1535,7 @@ static BOOL hb_gt_def_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { HB_GTSELF_REST( pGT, 0, 0, hb_arrayGetNI( pInfo->pNewVal, 5 ), hb_arrayGetNI( pInfo->pNewVal, 6 ), - ( const BYTE * ) hb_arrayGetCPtr( pInfo->pNewVal, 7 ) ); + hb_arrayGetCPtr( pInfo->pNewVal, 7 ) ); } HB_GTSELF_SETPOS( pGT, hb_arrayGetNI( pInfo->pNewVal, 1 ), hb_arrayGetNI( pInfo->pNewVal, 2 ) ); @@ -1627,7 +1629,7 @@ static int hb_gt_def_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions, BOOL fScreen = FALSE, fKeyBoard = FALSE; int iKey = 0, i, iDspCount, iStyle, iRows, iCols, iRow, iCol, iTop, iLeft, iBottom, iRight, iMnuCol, iPos, iClr; - BYTE * pBuffer = NULL; + void * pBuffer = NULL; HB_GT_INFO gtInfo; memset( >Info, 0, sizeof( gtInfo ) ); @@ -1767,7 +1769,7 @@ static int hb_gt_def_Alert( PHB_GT pGT, PHB_ITEM pMessage, PHB_ITEM pOptions, ulLen = HB_GTSELF_RECTSIZE( pGT, iTop, iLeft, iBottom, iRight ); if( ulLen ) { - pBuffer = ( BYTE * ) hb_xgrab( ulLen ); + pBuffer = hb_xgrab( ulLen ); HB_GTSELF_SAVE( pGT, iTop, iLeft, iBottom, iRight, pBuffer ); } HB_GTSELF_BOXS( pGT, iTop, iLeft, iBottom, iRight, NULL, iClrNorm ); @@ -1983,7 +1985,7 @@ static BOOL hb_gt_def_Resize( PHB_GT pGT, int iRows, int iCols ) { if( pGT->iHeight != iRows || pGT->iWidth != iCols ) { - BYTE * pBuffer = NULL; + void * pBuffer = NULL; ULONG ulLen = ( ULONG ) iRows * iCols, ulIndex; ULONG ulSize; int i; @@ -1991,7 +1993,7 @@ static BOOL hb_gt_def_Resize( PHB_GT pGT, int iRows, int iCols ) ulSize = HB_GTSELF_RECTSIZE( pGT, 0, 0, iRows - 1, iCols - 1 ); if( ulSize ) { - pBuffer = ( BYTE * ) hb_xgrab( ulSize ); + pBuffer = hb_xgrab( ulSize ); HB_GTSELF_SAVE( pGT, 0, 0, iRows - 1, iCols - 1, pBuffer ); }