From f26d65e22a157dea38b8e5c1ddc47353452bc590 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Mon, 21 Dec 2009 13:38:40 +0000 Subject: [PATCH] 2009-12-21 14:38 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbwince.h + added hack for missing GetEnvironmentVariable?() declarations in POCC header files for WinCE. * harbour/src/common/hbwince.c * minor simplification * harbour/src/pp/pplib.c * workaround for MSVC6 errors --- harbour/ChangeLog | 11 +++++++++++ harbour/include/hbwince.h | 6 ++++++ harbour/src/common/hbwince.c | 10 +++------- harbour/src/pp/pplib.c | 12 ++---------- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e07d97c9aa..c8117c871e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,17 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-12-21 14:38 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbwince.h + + added hack for missing GetEnvironmentVariable?() declarations in + POCC header files for WinCE. + + * harbour/src/common/hbwince.c + * minor simplification + + * harbour/src/pp/pplib.c + * workaround for MSVC6 errors + 2009-12-21 13:33 UTC+0500 April White (april users.sourceforge.net) * contrib/hbbtree/hb_btree.c * formatting diff --git a/harbour/include/hbwince.h b/harbour/include/hbwince.h index 96f7e243df..2e1449249f 100644 --- a/harbour/include/hbwince.h +++ b/harbour/include/hbwince.h @@ -183,6 +183,12 @@ extern char * strerror( int errnum ); #endif #endif /* HB_OS_WIN_USED && _MSC_VER */ +#if !defined( GetEnvironmentVariable ) + DWORD WINAPI GetEnvironmentVariableW( LPCWSTR name, LPWSTR value, DWORD size ); + DWORD WINAPI GetEnvironmentVariableA( LPCSTR name, LPSTR value, DWORD size ); + #define GetEnvironmentVariable GetEnvironmentVariableW +#endif + #endif /* HB_OS_WIN_CE */ extern HB_EXPORT wchar_t * hb_mbtowc( const char *srcA ); diff --git a/harbour/src/common/hbwince.c b/harbour/src/common/hbwince.c index 06efd17d46..db564f89f7 100644 --- a/harbour/src/common/hbwince.c +++ b/harbour/src/common/hbwince.c @@ -187,7 +187,6 @@ DWORD WINAPI GetEnvironmentVariableA( LPCSTR name, LPSTR value, DWORD size ) /* use registry instead of "environment variable". */ HKEY hk; LONG lret; - LPBYTE lpData; DWORD dwType = REG_SZ, cbData; TCHAR buf[ MAX_PATH ] = { 0 }; LPWSTR wname; @@ -202,28 +201,25 @@ DWORD WINAPI GetEnvironmentVariableA( LPCSTR name, LPSTR value, DWORD size ) return 0; } - lpData = ( LPBYTE ) buf; cbData = MAX_PATH * sizeof( *buf ); wname = hb_mbtowc( name ); - - lret = RegQueryValueExW( hk, wname, NULL, &dwType, lpData, &cbData ); + lret = RegQueryValueExW( hk, wname, NULL, &dwType, ( LPBYTE ) buf, &cbData ); + hb_xfree( wname ); RegCloseKey( hk ); if( lret != ERROR_SUCCESS ) { if( value && size ) value[ 0 ] = '\0'; - hb_xfree( wname ); return 0; } - avalue = hb_wctomb( ( LPCWSTR ) lpData ); + avalue = hb_wctomb( buf ); if( value && size ) hb_strncpy( value, avalue, size - 1 ); size = strlen( avalue ); hb_xfree( avalue ); - hb_xfree( wname ); return size; } diff --git a/harbour/src/pp/pplib.c b/harbour/src/pp/pplib.c index e21e8f8ca3..97f7f1ef0f 100644 --- a/harbour/src/pp/pplib.c +++ b/harbour/src/pp/pplib.c @@ -60,16 +60,6 @@ HB_EXTERN_BEGIN -static HB_GARBAGE_FUNC( hb_pp_Destructor ); -static void hb_pp_ErrorMessage( void * cargo, const char * szMsgTable[], - char cPrefix, int iCode, - const char * szParam1, const char * szParam2 ); -static void hb_pp_Disp( void * cargo, const char * szMessage ); -static BOOL hb_pp_CompilerSwitch( void * cargo, const char * szSwitch, - int iValue ); - -HB_EXTERN_END - static void hb_pp_ErrorMessage( void * cargo, const char * szMsgTable[], char cPrefix, int iCode, const char * szParam1, const char * szParam2 ) @@ -122,6 +112,8 @@ static HB_GARBAGE_FUNC( hb_pp_Destructor ) } } +HB_EXTERN_END + static const HB_GC_FUNCS s_gcPPFuncs = { hb_pp_Destructor,