From fc7ea4f146bdd48acab7c9c295d72ed71d8fa623 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Sun, 1 Jan 2012 22:10:39 +0000 Subject: [PATCH] 2012-01-01 14:05 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/gtwvg/wvgcore.c * contrib/gtwvg/wvgcuig.c * contrib/gtwvg/wvgutils.c * contrib/gtwvg/wvgwin.c ! Removed: remaining occurances of hb_parc(x) whereever relevant. Only 4 occurances are remaining. ! Cleaned: some "//" comments. --- harbour/ChangeLog | 9 +++++++++ harbour/contrib/gtwvg/wvgcore.c | 9 ++++++--- harbour/contrib/gtwvg/wvgcuig.c | 12 +++++------- harbour/contrib/gtwvg/wvgutils.c | 13 +++++++++---- harbour/contrib/gtwvg/wvgwin.c | 1 - 5 files changed, 29 insertions(+), 15 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 315e3648c0..23239d4eb4 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,15 @@ The license applies to all entries newer than 2009-04-28. */ +2012-01-01 14:05 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/gtwvg/wvgcore.c + * contrib/gtwvg/wvgcuig.c + * contrib/gtwvg/wvgutils.c + * contrib/gtwvg/wvgwin.c + ! Removed: remaining occurances of hb_parc(x) whereever relevant. + Only 4 occurances are remaining. + ! Cleaned: some "//" comments. + 2011-12-31 21:16 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/gtwvg/gtwvg.c * contrib/gtwvg/gtwvg.h diff --git a/harbour/contrib/gtwvg/wvgcore.c b/harbour/contrib/gtwvg/wvgcore.c index 712d42c2c7..1fb8991f35 100644 --- a/harbour/contrib/gtwvg/wvgcore.c +++ b/harbour/contrib/gtwvg/wvgcore.c @@ -1198,6 +1198,7 @@ HB_FUNC( WVT_DRAWLABEL ) POINT xy = { 0, 0 }; HFONT hFont, hOldFont, hOldFontGui; LOGFONT logfont; /* = { 0 };*/ + void * hText; logfont.lfEscapement = hb_parni( 5 ) * 10; logfont.lfOrientation = 0; @@ -1213,7 +1214,8 @@ HB_FUNC( WVT_DRAWLABEL ) logfont.lfHeight = hb_parnidef( 9, _s->fontHeight ); logfont.lfWidth = hb_parnidef( 10, _s->fontWidth < 0 ? -_s->fontWidth : _s->fontWidth ); - HB_STRNCPY( logfont.lfFaceName, ( HB_ISCHAR( 8 ) ? ( LPCTSTR ) hb_parcx( 8 ) : _s->fontFace ), HB_SIZEOFARRAY( logfont.lfFaceName ) - 1 ); + HB_STRNCPY( logfont.lfFaceName, ( HB_ISCHAR( 8 ) ? HB_PARSTR( 8, &hText, NULL ) : _s->fontFace ), HB_SIZEOFARRAY( logfont.lfFaceName ) - 1 ); + hb_strfree( hText ); hFont = CreateFontIndirect( &logfont ); if( hFont ) @@ -1888,7 +1890,6 @@ HB_FUNC( WVT_DRAWBUTTON ) SetBkMode( _s->hdc, TRANSPARENT ); SetTextColor( _s->hdc, textColor ); - /*ExtTextOut( _s->hdc, xy.x, xy.y, 0, NULL, hb_parcx( 5 ), strlen( hb_parcx( 5 ) ), NULL );*/ ExtTextOut( _s->hdc, xy.x, xy.y, 0, NULL, text, lstrlen( text ), NULL ); if( _s->bGui ) { @@ -2911,6 +2912,7 @@ HB_FUNC( WVT_CREATEFONT ) PHB_GTWVT _s = hb_wvt_gtGetWVT(); LOGFONT logfont; /* = { 0,0,0 }; */ + void * hText; logfont.lfEscapement = hb_parni( 10 ) * 10; logfont.lfOrientation = 0; @@ -2926,7 +2928,8 @@ HB_FUNC( WVT_CREATEFONT ) logfont.lfHeight = hb_parnidef( 2, _s->fontHeight ); logfont.lfWidth = hb_parnidef( 3, _s->fontWidth < 0 ? -_s->fontWidth : _s->fontWidth ); - HB_STRNCPY( logfont.lfFaceName, ( ! HB_ISCHAR( 1 ) ? _s->fontFace : ( LPCTSTR ) hb_parcx( 1 ) ), HB_SIZEOFARRAY( logfont.lfFaceName ) - 1 ); + HB_STRNCPY( logfont.lfFaceName, ( ! HB_ISCHAR( 1 ) ? _s->fontFace : HB_PARSTR( 1, &hText, NULL ) ), HB_SIZEOFARRAY( logfont.lfFaceName ) - 1 ); + hb_strfree( hText ); hb_retnint( ( HB_PTRDIFF ) CreateFontIndirect( &logfont ) ); } diff --git a/harbour/contrib/gtwvg/wvgcuig.c b/harbour/contrib/gtwvg/wvgcuig.c index 8cc5c9f3a1..9a1e9f473b 100644 --- a/harbour/contrib/gtwvg/wvgcuig.c +++ b/harbour/contrib/gtwvg/wvgcuig.c @@ -590,6 +590,7 @@ HB_FUNC( WVG_LABEL ) PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); LOGFONT lf; HFONT hFont; + void * hText; lf.lfEscapement = hb_parni( 6 ) * 10; lf.lfOrientation = 0; @@ -605,7 +606,8 @@ HB_FUNC( WVG_LABEL ) lf.lfHeight = hb_parnidef( 10, pWVT->fontHeight ); lf.lfWidth = hb_parnidef( 11, pWVT->fontWidth < 0 ? -pWVT->fontWidth : pWVT->fontWidth ); - HB_STRNCPY( lf.lfFaceName, ( ! HB_ISCHAR( 9 ) ? pWVT->fontFace : ( LPCTSTR ) hb_parc( 9 ) ), HB_SIZEOFARRAY( lf.lfFaceName ) - 1 ); + HB_STRNCPY( lf.lfFaceName, ( ! HB_ISCHAR( 9 ) ? pWVT->fontFace : HB_PARSTR( 9, &hText, NULL ) ), HB_SIZEOFARRAY( lf.lfFaceName ) - 1 ); + hb_strfree( hText ); hFont = CreateFontIndirect( &lf ); if( hFont ) @@ -624,7 +626,7 @@ HB_FUNC( WVG_LABEL ) gObj->aOffset.iBottom = hb_parvni( 3, 3 ); gObj->aOffset.iRight = hb_parvni( 3, 4 ); - gObj->lpText = HB_PARSTR( 3, &gObj->hText, NULL ); + gObj->lpText = HB_PARSTR( 4, &gObj->hText, NULL ); gObj->iAlign = hb_parnidef( 5, TA_LEFT ); gObj->crRGBText = ( COLORREF ) hb_parnint( 7 ); @@ -657,11 +659,7 @@ HB_FUNC( WVG_LABELEX ) gObj->aOffset.iBottom = hb_parvni( 3, 3 ); gObj->aOffset.iRight = hb_parvni( 3, 4 ); -#if defined( UNICODE ) - gObj->lpText = hb_mbtowc( hb_parcx( 4 ) ); -#else - gObj->lpText = hb_strdup( hb_parcx( 4 ) ); -#endif + gObj->lpText = HB_PARSTR( 4, &gObj->hText, NULL ); gObj->iAlign = hb_parnidef( 5, TA_LEFT ); gObj->crRGBText = ( COLORREF ) hb_parnint( 6 ); diff --git a/harbour/contrib/gtwvg/wvgutils.c b/harbour/contrib/gtwvg/wvgutils.c index d4fe6ac099..2afd8cae8b 100644 --- a/harbour/contrib/gtwvg/wvgutils.c +++ b/harbour/contrib/gtwvg/wvgutils.c @@ -151,7 +151,9 @@ HB_FUNC( WVT_CHOOSEFONT ) lf.lfPitchAndFamily = FF_DONTCARE; if( HB_ISCHAR( 1 ) ) { - HB_STRNCPY( lf.lfFaceName, ( LPCTSTR ) hb_parc( 1 ), HB_SIZEOFARRAY( lf.lfFaceName ) - 1 ); + void * hText; + HB_STRNCPY( lf.lfFaceName, HB_PARSTR( 1, &hText, NULL ), HB_SIZEOFARRAY( lf.lfFaceName ) - 1 ); + hb_strfree( hText ); } cf.lStructSize = sizeof( CHOOSEFONT ); @@ -422,11 +424,14 @@ HB_FUNC( WVT_SETTOOLTIPTITLE ) if( HB_ISCHAR( 2 ) ) { + void * hText; + iIcon = hb_parni( 1 ); if( iIcon > 3 ) iIcon = 0; - SendMessage( _s->hWndTT, TTM_SETTITLE, ( WPARAM ) iIcon, ( LPARAM ) hb_parc( 2 ) ); + SendMessage( _s->hWndTT, TTM_SETTITLE, ( WPARAM ) iIcon, ( LPARAM ) HB_PARSTR( 2, &hText, NULL ) ); + hb_strfree( hText ); } #endif } @@ -979,7 +984,7 @@ HB_FUNC( WVT_CREATEDIALOGDYNAMIC ) break; case 2: - /* hb_parc( 1 ) is already unicode compliant, so no conversion */ + /* argument 1 is already unicode compliant, so no conversion */ hDlg = CreateDialogIndirect( ( HINSTANCE ) wvg_hInstance(), ( LPDLGTEMPLATE ) hb_parc( 1 ), hb_parl( 2 ) ? _s->hWnd : NULL, @@ -1095,7 +1100,7 @@ HB_FUNC( WVT_CREATEDIALOGMODAL ) break; case 2: - /* hb_parc( 1 ) is already unicode compliant, so no conversion */ + /* argument 1 is already unicode compliant, so no conversion */ iResult = DialogBoxIndirectParam( ( HINSTANCE ) wvg_hInstance(), ( LPDLGTEMPLATE ) hb_parc( 1 ), hParent, diff --git a/harbour/contrib/gtwvg/wvgwin.c b/harbour/contrib/gtwvg/wvgwin.c index 835c402e58..0d8c4aab1c 100644 --- a/harbour/contrib/gtwvg/wvgwin.c +++ b/harbour/contrib/gtwvg/wvgwin.c @@ -272,7 +272,6 @@ HB_FUNC( WVG_GETDLGITEMTEXT ) { int iLen = ( int ) SendMessage( GetDlgItem( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ), WM_GETTEXTLENGTH, 0, 0 ) + 1; LPTSTR cText = ( LPTSTR ) hb_xgrab( iLen * sizeof( TCHAR ) ); -// char * szText; UINT iResult; iResult = GetDlgItemText( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), /* handle of dialog box */