From 729c66f1e642f755103f4425be424fd378032d35 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sat, 16 Jan 2010 00:37:34 +0000 Subject: [PATCH] 2010-01-16 01:37 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/hbwin/win_prn1.c % eliminated some unnecessary HB_ISNUM( ) calls ! fixed numeric values directly assigned to HB_BOOL --- harbour/ChangeLog | 5 +++++ harbour/contrib/hbwin/win_prn1.c | 29 +++++++++++++++-------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ad355623e5..9e60d32735 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,11 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-01-16 01:37 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/contrib/hbwin/win_prn1.c + % eliminated some unnecessary HB_ISNUM( ) calls + ! fixed numeric values directly assigned to HB_BOOL + 2010-01-16 00:48 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/hbwin/win_tprn.prg + added automatic destructors to avoid resource leak diff --git a/harbour/contrib/hbwin/win_prn1.c b/harbour/contrib/hbwin/win_prn1.c index e92548ce5f..8c8fb19785 100644 --- a/harbour/contrib/hbwin/win_prn1.c +++ b/harbour/contrib/hbwin/win_prn1.c @@ -472,26 +472,27 @@ HB_FUNC( WIN_SETDOCUMENTPROPERTIES ) if( lSize > 0 ) { PDEVMODE pDevMode = ( PDEVMODE ) hb_xgrab( lSize ); + int iProp; DocumentProperties( 0, hPrinter, ( LPTSTR ) lpDeviceName, pDevMode, pDevMode, DM_OUT_BUFFER ); - if( HB_ISNUM( 3 ) && hb_parni( 3 ) ) /* [2007-02-22] don't change if 0 */ - pDevMode->dmPaperSize = ( short ) hb_parni( 3 ); + if( ( iProp = hb_parni( 3 ) ) != 0 ) /* [2007-02-22] don't change if 0 */ + pDevMode->dmPaperSize = ( short ) iProp; if( HB_ISLOG( 4 ) ) pDevMode->dmOrientation = ( short ) ( hb_parl( 4 ) ? 2 : 1 ); - if( HB_ISNUM( 5 ) && hb_parni( 5 ) > 0 ) - pDevMode->dmCopies = ( short ) hb_parni( 5 ); + if( ( iProp = hb_parni( 5 ) ) > 0 ) + pDevMode->dmCopies = ( short ) iProp; - if( HB_ISNUM( 6 ) && hb_parni( 6 ) ) /* [2007-02-22] don't change if 0 */ - pDevMode->dmDefaultSource = ( short ) hb_parni( 6 ); + if( ( iProp = hb_parni( 6 ) ) != 0 ) /* [2007-02-22] don't change if 0 */ + pDevMode->dmDefaultSource = ( short ) iProp; - if( HB_ISNUM( 7 ) && hb_parni( 7 ) ) /* [2007-02-22] don't change if 0 */ - pDevMode->dmDuplex = ( short ) hb_parni( 7 ); + if( ( iProp = hb_parni( 7 ) ) != 0 ) /* [2007-02-22] don't change if 0 */ + pDevMode->dmDuplex = ( short ) iProp; - if( HB_ISNUM( 8 ) && hb_parni( 8 ) ) /* [2007-02-22] don't change if 0 */ - pDevMode->dmPrintQuality = ( short ) hb_parni( 8 ); + if( ( iProp = hb_parni( 8 ) ) != 0 ) /* [2007-02-22] don't change if 0 */ + pDevMode->dmPrintQuality = ( short ) iProp; bResult = ( ResetDC( hDC, pDevMode ) != NULL ); @@ -608,14 +609,14 @@ HB_FUNC( WIN_DRAWBITMAP ) hb_retl( HB_FALSE ); } -static int CALLBACK FontEnumCallBack( LOGFONT * lplf, TEXTMETRIC * lpntm, DWORD dwFontType, - LPVOID pArray ) +static int CALLBACK FontEnumCallBack( LOGFONT * lplf, TEXTMETRIC * lpntm, + DWORD dwFontType, LPVOID pArray ) { PHB_ITEM pSubItems = hb_itemArrayNew( 4 ); HB_ARRAYSETSTR( pSubItems, 1, lplf->lfFaceName ); - hb_arraySetL( pSubItems, 2, lplf->lfPitchAndFamily & FIXED_PITCH ); - hb_arraySetL( pSubItems, 3, dwFontType & TRUETYPE_FONTTYPE ); + hb_arraySetL( pSubItems, 2, ( lplf->lfPitchAndFamily & FIXED_PITCH ) != 0 ); + hb_arraySetL( pSubItems, 3, ( dwFontType & TRUETYPE_FONTTYPE ) != 0 ); hb_arraySetNL( pSubItems, 4, lpntm->tmCharSet ); hb_arrayAddForward( ( PHB_ITEM ) pArray, pSubItems );