From 90d2236c45acf29e2ff71871a0550ce63e8122f7 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Tue, 13 Nov 2012 12:03:26 +0000 Subject: [PATCH] 2012-11-13 13:03 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * harbour/extras/gtwvw/gtwvwd.c ! eliminated hb_wcntomb() --- harbour/ChangeLog | 4 ++++ harbour/extras/gtwvw/gtwvwd.c | 25 +++++++------------------ 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 124792bd3b..c48e8efe9b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,10 @@ The license applies to all entries newer than 2009-04-28. */ +2012-11-13 13:03 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * harbour/extras/gtwvw/gtwvwd.c + ! eliminated hb_wcntomb() + 2012-11-13 12:34 UTC+0100 Viktor Szakats (harbour syenar.net) * contrib/hbwin/win_reg.prg ! fixed WIN_REGGET() for WIN_REG_DWORD_BIG_ENDIAN and diff --git a/harbour/extras/gtwvw/gtwvwd.c b/harbour/extras/gtwvw/gtwvwd.c index 3060d81a8a..ea0322d307 100644 --- a/harbour/extras/gtwvw/gtwvwd.c +++ b/harbour/extras/gtwvw/gtwvwd.c @@ -212,7 +212,7 @@ static LRESULT CALLBACK hb_gt_wvwWndProc( HWND hWnd, UINT message, WPARAM wParam static BOOL hb_gt_wvwAllocSpBuffer( WIN_DATA * pWindowData, USHORT col, USHORT row ); static void hb_gt_wvwSetWindowTitle( UINT usWinNum, LPCTSTR title ); -static BOOL hb_gt_wvw_GetWindowTitle( UINT usWinNum, char ** title ); +static PHB_ITEM hb_gt_wvw_GetWindowTitle( UINT usWinNum, PHB_ITEM pItem ); static HICON hb_gt_wvwSetWindowIcon( UINT usWinNum, int icon, const char * lpIconName ); static HICON hb_gt_wvwSetWindowIconFromFile( UINT usWinNum, LPCTSTR icon ); @@ -1597,11 +1597,7 @@ static BOOL hb_gt_wvw_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) } case HB_GTI_WINTITLE: { - char * szTitle = NULL; - if( hb_gt_wvw_GetWindowTitle( s_pWvwData->s_usCurWindow, &szTitle ) ) - pInfo->pResult = hb_itemPutCPtr( pInfo->pResult, szTitle ); - else - pInfo->pResult = hb_itemPutC( pInfo->pResult, NULL ); + pInfo->pResult = hb_gt_wvw_GetWindowTitle( s_pWvwData->s_usCurWindow, pInfo->pResult ); if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) { void * hWindowTitle; @@ -6221,24 +6217,17 @@ static void hb_gt_wvwSetWindowTitle( UINT usWinNum, LPCSTR title ) SetWindowText( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, title ); } -static BOOL hb_gt_wvw_GetWindowTitle( UINT usWinNum, char ** title ) +static PHB_ITEM hb_gt_wvw_GetWindowTitle( UINT usWinNum, PHB_ITEM pItem ) { TCHAR buffer[ WVW_MAX_TITLE_SIZE ]; int iResult; iResult = GetWindowText( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, buffer, WVW_MAX_TITLE_SIZE ); + buffer[ HB_SIZEOFARRAY( buffer ) - 1 ] = TEXT( '\0' ); if( iResult > 0 ) - { -#ifdef UNICODE - *title = hb_wcntomb( buffer, iResult ); -#else - *title = hb_strndup( buffer, iResult ); -#endif - return TRUE; - } - - *title = NULL; - return FALSE; + return HB_ITEMPUTSTR( pItem, buffer ); + else + return hb_itemPutC( pItem, NULL ); }