diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b67a520115..ab6bb7de44 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,25 @@ The license applies to all entries newer than 2009-04-28. */ +2010-10-14 08:45 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/rtl/gtstd/gtstd.c + * updated to compile with WinCE + + * harbour/package/harbour.spec + * modified to work with new HBMK2 translations + + * harbour/contrib/hbmzip/hbmzip.c + ! fixed function order + + * harbour/contrib/hbwin/axcore.c + * include + ! fixed buffer sizes in debug function + * removed trailing spaces and tabs + + * harbour/contrib/hbwin/hbolesrv.c + * include - for some compilers which do not make it + with OLE header files + 2010-10-14 05:45 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) * harbour/contrib/hbwin/axcore.c + added support for obtaining default callback event interface. diff --git a/harbour/contrib/hbmzip/hbmzip.c b/harbour/contrib/hbmzip/hbmzip.c index b2798f7bfd..fe164026c1 100644 --- a/harbour/contrib/hbmzip/hbmzip.c +++ b/harbour/contrib/hbmzip/hbmzip.c @@ -144,6 +144,36 @@ static unzFile hb_unzipfileParam( int iParam ) } +static HB_FATTR hb_translateExtAttr( const char* szFileName, HB_FATTR ulExtAttr ) +{ + int iLen; + + iLen = ( int ) strlen( szFileName ); + if( iLen > 4 ) + { + if( hb_stricmp( szFileName + iLen - 4, ".exe" ) == 0 || + hb_stricmp( szFileName + iLen - 4, ".com" ) == 0 || + hb_stricmp( szFileName + iLen - 4, ".bat" ) == 0 || + hb_stricmp( szFileName + iLen - 4, ".cmd" ) == 0 || + hb_stricmp( szFileName + iLen - 3, ".sh" ) == 0 ) + { + ulExtAttr |= 0x00490000; /* --x--x--x */ + } + } + + if( ulExtAttr | HB_FA_READONLY ) + ulExtAttr |= 0x01240000; /* r--r--r-- */ + else + ulExtAttr |= 0x01B60000; /* rw-rw-rw- */ + + if( ulExtAttr & HB_FA_DIRECTORY ) + ulExtAttr |= 0x40000000; + else + ulExtAttr |= 0x80000000; + + return ulExtAttr; +} + /* HB_ZipOpen( cFileName, [ iMode = HB_ZIP_CREATE ], [ @cGlobalComment ] ) --> hZip */ HB_FUNC( HB_ZIPOPEN ) @@ -624,36 +654,6 @@ HB_FUNC( HB_ZIPFILECRC32 ) hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -static HB_FATTR hb_translateExtAttr( const char* szFileName, HB_FATTR ulExtAttr ) -{ - int iLen; - - iLen = ( int ) strlen( szFileName ); - if( iLen > 4 ) - { - if( hb_stricmp( szFileName + iLen - 4, ".exe" ) == 0 || - hb_stricmp( szFileName + iLen - 4, ".com" ) == 0 || - hb_stricmp( szFileName + iLen - 4, ".bat" ) == 0 || - hb_stricmp( szFileName + iLen - 4, ".cmd" ) == 0 || - hb_stricmp( szFileName + iLen - 3, ".sh" ) == 0 ) - { - ulExtAttr |= 0x00490000; /* --x--x--x */ - } - } - - if( ulExtAttr | HB_FA_READONLY ) - ulExtAttr |= 0x01240000; /* r--r--r-- */ - else - ulExtAttr |= 0x01B60000; /* rw-rw-rw- */ - - if( ulExtAttr & HB_FA_DIRECTORY ) - ulExtAttr |= 0x40000000; - else - ulExtAttr |= 0x80000000; - - return ulExtAttr; -} - static int hb_zipStoreFile( zipFile hZip, const char* szFileName, const char* szName, const char* szPassword, const char* szComment ) { char * szZipName, * pString; diff --git a/harbour/contrib/hbwin/axcore.c b/harbour/contrib/hbwin/axcore.c index fca7001ca0..582d3b4e81 100644 --- a/harbour/contrib/hbwin/axcore.c +++ b/harbour/contrib/hbwin/axcore.c @@ -51,6 +51,8 @@ */ #include "hbwinole.h" +#include + #include "hbapistr.h" #if defined( HB_OS_WIN_CE ) #include "hbwince.h" @@ -381,9 +383,10 @@ static char * GUID2String( GUID * pID ) wchar_t olestr[ 128 ]; int iLen; - StringFromGUID2( pID, olestr, 256 ); - iLen = WideCharToMultiByte( CP_ACP, 0, olestr, -1, strguid, 256, NULL, NULL ); - strguid[ iLen - 1 ] = 0; + StringFromGUID2( pID, olestr, HB_SIZEOFARRAY( olestr ) ); + iLen = WideCharToMultiByte( CP_ACP, 0, olestr, -1, strguid, sizeof( strguid ), NULL, NULL ); + if( iLen ) + strguid[ iLen - 1 ] = 0; return strguid; } #endif @@ -401,7 +404,7 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID * { IProvideClassInfo2 * iPCI2; IProvideClassInfo * iPCI; - + /* Method 1: using IProvideClassInfo2 */ hr = iDisp->lpVtbl->QueryInterface( iDisp, &IID_IProvideClassInfo2, ( void** ) ( void* ) &iPCI2 ); @@ -415,34 +418,36 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID * return 0; } else + { HB_TRACE( HB_TR_DEBUG, ("_get_default_sink IProvideClassInfo2 obtain error %08X", hr) ); - - + } + + /* Method 2: using IProvideClassInfo and searching for default source in ITypeInfo */ - + hr = iDisp->lpVtbl->QueryInterface( iDisp, &IID_IProvideClassInfo, ( void** ) ( void* ) &iPCI ); if( hr == 0 ) { HB_TRACE( HB_TR_DEBUG, ("_get_default_sink IProvideClassInfo OK") ); - + hr = iPCI->lpVtbl->GetClassInfo( iPCI, &iTI ); if( hr == 0 ) { hr = iTI->lpVtbl->GetTypeAttr( iTI, &pTypeAttr ); - if( hr == 0 ) + if( hr == 0 ) { for( i = 0; i < pTypeAttr->cImplTypes; i++ ) { hr = iTI->lpVtbl->GetImplTypeFlags( iTI, i, &iFlags ); if( hr == 0 && ( iFlags & IMPLTYPEFLAG_FDEFAULT ) && ( iFlags & IMPLTYPEFLAG_FSOURCE ) ) { - if( iTI->lpVtbl->GetRefTypeOfImplType( iTI, i, &hRefType ) == S_OK && + if( iTI->lpVtbl->GetRefTypeOfImplType( iTI, i, &hRefType ) == S_OK && iTI->lpVtbl->GetRefTypeInfo( iTI, hRefType, &iTISink ) == S_OK ) { HB_TRACE( HB_TR_DEBUG, ("_get_default_sink Method 2: default source is found") ); hr = iTISink->lpVtbl->GetTypeAttr( iTISink, &pTypeAttr ); - if( hr == 0 ) + if( hr == 0 ) { * piid = pTypeAttr->guid; iTISink->lpVtbl->ReleaseTypeAttr( iTISink, pTypeAttr ); @@ -460,7 +465,9 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID * iPCI->lpVtbl->Release( iPCI ); } else + { HB_TRACE( HB_TR_DEBUG, ("_get_default_sink IProvideClassInfo obtain error %08X", hr) ); + } } @@ -471,7 +478,7 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID * { ITypeLib * iTL; TYPEATTR * pTypeAttr2; - + hr = iTI->lpVtbl->GetContainingTypeLib( iTI, &iTL, NULL ); iTI->lpVtbl->Release( iTI ); @@ -484,7 +491,7 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID * if( hr == S_OK ) { hr = iTI->lpVtbl->GetTypeAttr( iTI, &pTypeAttr ); - if( hr == S_OK ) + if( hr == S_OK ) { if( pTypeAttr->typekind == TKIND_COCLASS ) { @@ -492,17 +499,17 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID * { if( szEvent ) { - if( iTI->lpVtbl->GetRefTypeOfImplType( iTI, j, &hRefType ) == S_OK && + if( iTI->lpVtbl->GetRefTypeOfImplType( iTI, j, &hRefType ) == S_OK && iTI->lpVtbl->GetRefTypeInfo( iTI, hRefType, &iTISink ) == S_OK ) { BSTR bstr; - + hr = iTISink->lpVtbl->GetDocumentation( iTISink, -1, &bstr, NULL, NULL, NULL ); if( hr == S_OK ) { char str[ 256 ]; int iLen; - + iLen = WideCharToMultiByte( CP_ACP, 0, bstr, -1, str, sizeof( str ), NULL, NULL ); str[ iLen - 1 ] = '\0'; if( ! strcmp( szEvent, str ) ) @@ -512,7 +519,7 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID * { * piid = pTypeAttr2->guid; iTISink->lpVtbl->ReleaseTypeAttr( iTISink, pTypeAttr2 ); - + iTISink->lpVtbl->Release( iTISink ); iTI->lpVtbl->ReleaseTypeAttr( iTI, pTypeAttr ); iTI->lpVtbl->Release( iTI ); @@ -520,28 +527,28 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID * return 0; } } - + } iTISink->lpVtbl->Release( iTISink ); } } else /* szEvent == NULL */ { - hr = iTI->lpVtbl->GetImplTypeFlags( iTI, j, &iFlags ); - if( hr == S_OK && ( iFlags & IMPLTYPEFLAG_FDEFAULT ) && ( iFlags & IMPLTYPEFLAG_FSOURCE ) ) - { - if( iTI->lpVtbl->GetRefTypeOfImplType( iTI, j, &hRefType ) == S_OK && + hr = iTI->lpVtbl->GetImplTypeFlags( iTI, j, &iFlags ); + if( hr == S_OK && ( iFlags & IMPLTYPEFLAG_FDEFAULT ) && ( iFlags & IMPLTYPEFLAG_FSOURCE ) ) + { + if( iTI->lpVtbl->GetRefTypeOfImplType( iTI, j, &hRefType ) == S_OK && iTI->lpVtbl->GetRefTypeInfo( iTI, hRefType, &iTISink ) == S_OK ) { hr = iTISink->lpVtbl->GetTypeAttr( iTISink, &pTypeAttr2 ); if( hr == S_OK ) { -#if 0 +#if 0 /* Debug code. You can also comment out iFlags condition, to list more interfaces [Mindaugas] */ BSTR bstr; char str[ 256 ]; int iLen; - + iTISink->lpVtbl->GetDocumentation( iTISink, -1, &bstr, NULL, NULL, NULL ); iLen = WideCharToMultiByte( CP_ACP, 0, bstr, -1, str, sizeof( str ), NULL, NULL ); str[ iLen - 1 ] = '\0'; @@ -556,7 +563,7 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID * return 0; } } - } + } } } } diff --git a/harbour/contrib/hbwin/hbolesrv.c b/harbour/contrib/hbwin/hbolesrv.c index 296266186f..fe862916b4 100644 --- a/harbour/contrib/hbwin/hbolesrv.c +++ b/harbour/contrib/hbwin/hbolesrv.c @@ -54,6 +54,7 @@ #include "hbwinole.h" #include +#include #define MAX_CLSID_SIZE 64 #define MAX_CLSNAME_SIZE 256 diff --git a/harbour/package/harbour.spec b/harbour/package/harbour.spec index bf4cfbf69a..6d08b0ef8a 100644 --- a/harbour/package/harbour.spec +++ b/harbour/package/harbour.spec @@ -457,8 +457,7 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/hbi18n %{_bindir}/hbformat %{_bindir}/hbmk2 -%{_bindir}/hbmk2.hu_HU.hbl -%{_bindir}/hbmk2.pt_BR.hbl +%{_bindir}/hbmk2.*.hbl %{_bindir}/hbxpatch.hbs %{_bindir}/hbmk2l2d.hbs %{_mandir}/man1/*.1* diff --git a/harbour/src/rtl/gtstd/gtstd.c b/harbour/src/rtl/gtstd/gtstd.c index f4eb02df1e..4abde5033c 100644 --- a/harbour/src/rtl/gtstd/gtstd.c +++ b/harbour/src/rtl/gtstd/gtstd.c @@ -391,6 +391,11 @@ static int hb_gt_std_ReadKey( PHB_GT pGT, int iEventMask ) } else if( WaitForSingleObject( ( HANDLE ) hb_fsGetOsHandle( pGTSTD->hStdin ), 0 ) == WAIT_OBJECT_0 ) { +#if defined( HB_OS_WIN_CE ) + HB_BYTE bChar; + if( hb_fsRead( pGTSTD->hStdin, &bChar, 1 ) == 1 ) + ch = pGTSTD->keyTransTbl[ bChar ]; +#else INPUT_RECORD ir; DWORD dwEvents; while( PeekConsoleInput( ( HANDLE ) hb_fsGetOsHandle( pGTSTD->hStdin ), &ir, 1, &dwEvents ) && dwEvents == 1 ) @@ -404,6 +409,7 @@ static int hb_gt_std_ReadKey( PHB_GT pGT, int iEventMask ) else /* Remove from the input queue */ ReadConsoleInput( ( HANDLE ) hb_fsGetOsHandle( pGTSTD->hStdin ), &ir, 1, &dwEvents ); } +#endif } #elif defined( __WATCOMC__ ) if( pGTSTD->fStdinConsole )