2012-01-02 23:10 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* harbour/src/rtl/gtwvt/gtwvt.c
* harbour/contrib/gtwvg/gtwvg.c
! always set trailing 0 in the buffer containing font name set
by HB_GTI_FONTNAME - protection against too long strings.
* harbour/contrib/gtwvg/wvgwing.c
! fixed memory leak in last commit - thanks to Mindaugas.
% use HB_ITEMCOPYSTR() in WVG_FONTCREATE() to eliminate memory
allocation.
This commit is contained in:
@@ -16,6 +16,17 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-01-02 23:10 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* harbour/src/rtl/gtwvt/gtwvt.c
|
||||
* harbour/contrib/gtwvg/gtwvg.c
|
||||
! always set trailing 0 in the buffer containing font name set
|
||||
by HB_GTI_FONTNAME - protection against too long strings.
|
||||
|
||||
* harbour/contrib/gtwvg/wvgwing.c
|
||||
! fixed memory leak in last commit - thanks to Mindaugas.
|
||||
% use HB_ITEMCOPYSTR() in WVG_FONTCREATE() to eliminate memory
|
||||
allocation.
|
||||
|
||||
2012-01-02 22:29 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* harbour/contrib/gtwvg/wvgutils.c
|
||||
* harbour/contrib/gtwvg/wvgwing.c
|
||||
|
||||
@@ -3117,7 +3117,10 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
|
||||
case HB_GTI_FONTNAME:
|
||||
pInfo->pResult = HB_ITEMPUTSTR( pInfo->pResult, pWVT->fontFace );
|
||||
if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
|
||||
{
|
||||
HB_ITEMCOPYSTR( pInfo->pNewVal, pWVT->fontFace, HB_SIZEOFARRAY( pWVT->fontFace ) );
|
||||
pWVT->fontFace[ HB_SIZEOFARRAY( pWVT->fontFace ) - 1 ] = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case HB_GTI_FONTWEIGHT:
|
||||
|
||||
@@ -959,40 +959,43 @@ HB_FUNC( WVG_FONTCREATE )
|
||||
{
|
||||
LOGFONT lf;
|
||||
HFONT hFont;
|
||||
void * hText;
|
||||
PHB_ITEM aFont;
|
||||
|
||||
memset( &lf, 0, sizeof( lf ) );
|
||||
|
||||
HB_STRNCPY( lf.lfFaceName, HB_PARASTRDEF( 1, 1, &hText, NULL ),
|
||||
HB_SIZEOFARRAY( lf.lfFaceName ) - 1 );
|
||||
aFont = hb_param( 1, HB_IT_ARRAY );
|
||||
if( aFont )
|
||||
{
|
||||
HB_ITEMCOPYSTR( hb_arrayGetItemPtr( aFont, 1 ),
|
||||
lf.lfFaceName, HB_SIZEOFARRAY( lf.lfFaceName ) - 1 );
|
||||
|
||||
lf.lfHeight = ( LONG ) hb_parvnl( 1, 2 );
|
||||
lf.lfWidth = ( LONG ) hb_parvnl( 1, 3 );
|
||||
lf.lfWeight = ( LONG ) hb_parvnl( 1, 4 );
|
||||
lf.lfItalic = ( BYTE ) hb_parvl( 1, 5 );
|
||||
lf.lfUnderline = ( BYTE ) hb_parvl( 1, 6 );
|
||||
lf.lfStrikeOut = ( BYTE ) hb_parvl( 1, 7 );
|
||||
lf.lfCharSet = ( BYTE ) hb_parvni( 1, 8 );
|
||||
lf.lfEscapement = ( BYTE ) hb_parvni( 1, 9 );
|
||||
lf.lfOrientation = ( BYTE ) hb_parvni( 1, 10 );
|
||||
lf.lfOutPrecision = ( BYTE ) hb_parvni( 1, 11 );
|
||||
lf.lfClipPrecision = ( BYTE ) hb_parvni( 1, 12 );
|
||||
lf.lfQuality = ( BYTE ) hb_parvni( 1, 13 );
|
||||
lf.lfPitchAndFamily = ( BYTE ) hb_parvni( 1, 14 );
|
||||
lf.lfHeight = ( LONG ) hb_arrayGetNL( aFont, 2 );
|
||||
lf.lfWidth = ( LONG ) hb_arrayGetNL( aFont, 3 );
|
||||
lf.lfWeight = ( LONG ) hb_arrayGetNL( aFont, 4 );
|
||||
lf.lfItalic = ( BYTE ) hb_arrayGetL ( aFont, 5 );
|
||||
lf.lfUnderline = ( BYTE ) hb_arrayGetL ( aFont, 6 );
|
||||
lf.lfStrikeOut = ( BYTE ) hb_arrayGetL ( aFont, 7 );
|
||||
lf.lfCharSet = ( BYTE ) hb_arrayGetNI( aFont, 8 );
|
||||
lf.lfEscapement = ( BYTE ) hb_arrayGetNI( aFont, 9 );
|
||||
lf.lfOrientation = ( BYTE ) hb_arrayGetNI( aFont, 10 );
|
||||
lf.lfOutPrecision = ( BYTE ) hb_arrayGetNI( aFont, 11 );
|
||||
lf.lfClipPrecision = ( BYTE ) hb_arrayGetNI( aFont, 12 );
|
||||
lf.lfQuality = ( BYTE ) hb_arrayGetNI( aFont, 13 );
|
||||
lf.lfPitchAndFamily = ( BYTE ) hb_arrayGetNI( aFont, 14 );
|
||||
}
|
||||
|
||||
hFont = CreateFontIndirect( &lf );
|
||||
|
||||
if( hFont )
|
||||
{
|
||||
PHB_ITEM aFont = wvg_logfontTOarray( &lf, HB_FALSE );
|
||||
aFont = wvg_logfontTOarray( &lf, HB_FALSE );
|
||||
hb_arraySetNInt( aFont, 15, ( HB_PTRDIFF ) hFont );
|
||||
hb_itemReturnRelease( aFont );
|
||||
}
|
||||
else
|
||||
{
|
||||
PHB_ITEM aFont = wvg_logfontTOarray( &lf, HB_TRUE );
|
||||
hb_itemReturnRelease( aFont );
|
||||
aFont = wvg_logfontTOarray( &lf, HB_TRUE );
|
||||
}
|
||||
hb_itemReturnRelease( aFont );
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -2409,7 +2409,10 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
|
||||
case HB_GTI_FONTNAME:
|
||||
pInfo->pResult = HB_ITEMPUTSTR( pInfo->pResult, pWVT->fontFace );
|
||||
if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
|
||||
{
|
||||
HB_ITEMCOPYSTR( pInfo->pNewVal, pWVT->fontFace, HB_SIZEOFARRAY( pWVT->fontFace ) );
|
||||
pWVT->fontFace[ HB_SIZEOFARRAY( pWVT->fontFace ) - 1 ] = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case HB_GTI_FONTWEIGHT:
|
||||
|
||||
Reference in New Issue
Block a user