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( <n> ) calls
    ! fixed numeric values directly assigned to HB_BOOL
This commit is contained in:
Przemyslaw Czerpak
2010-01-16 00:37:34 +00:00
parent 3db2d99644
commit 729c66f1e6
2 changed files with 20 additions and 14 deletions

View File

@@ -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( <n> ) 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

View File

@@ -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 );