From 99aa308fdbf1b99bfa9ce6fcaa4c857973754561 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Tue, 29 May 2007 08:32:47 +0000 Subject: [PATCH] 2007-05-29 10:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/makefile.vc * synced with BETA branch * harbour/contrib/Makefile * disable BMDBFCDX for DOS builds due to long names which do not pass 8.3 convention * use OLE2 instead of OLE * harbour/contrib/ole2/w32ole.c * warning fixes * harbour/include/hbregex.h + added REGEX support for DJGPP build * harbour/source/rtl/net.c * warning cleanup --- harbour/ChangeLog | 14 +++++ harbour/contrib/Makefile | 8 ++- harbour/contrib/ole2/w32ole.c | 7 ++- harbour/include/hbregex.h | 6 +- harbour/makefile.vc | 2 +- harbour/source/rtl/net.c | 105 ++++++++++++++++------------------ 6 files changed, 78 insertions(+), 64 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 0146fbd269..3fc98b090d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,20 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-05-29 10:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/makefile.vc + * synced with BETA branch + * harbour/contrib/Makefile + * disable BMDBFCDX for DOS builds due to long names which do not + pass 8.3 convention + * use OLE2 instead of OLE + * harbour/contrib/ole2/w32ole.c + * warning fixes + * harbour/include/hbregex.h + + added REGEX support for DJGPP build + * harbour/source/rtl/net.c + * warning cleanup + 2007-05-28 20:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/Makefile + harbour/contrib/adordd/Makefile diff --git a/harbour/contrib/Makefile b/harbour/contrib/Makefile index ab01805531..748da61f11 100644 --- a/harbour/contrib/Makefile +++ b/harbour/contrib/Makefile @@ -12,8 +12,14 @@ DIRS=\ libmisc \ libnf \ samples \ + + +ifneq ($(HB_ARCHITECTURE),dos) + +DIRS +=\ bmdbfcdx \ +endif ifeq ($(HB_ARCHITECTURE),w32) @@ -31,7 +37,7 @@ ifeq ($(HB_COMPILER),rsxnt) else DIRS +=\ - ole \ + ole2 \ odbc \ adordd \ diff --git a/harbour/contrib/ole2/w32ole.c b/harbour/contrib/ole2/w32ole.c index ba612780be..e21107b6e5 100644 --- a/harbour/contrib/ole2/w32ole.c +++ b/harbour/contrib/ole2/w32ole.c @@ -1110,7 +1110,8 @@ HB_FUNC( __HB_OLE_EXIT ) if( pUnk ) { - pUnk->lpVtbl->QueryInterface( pUnk, (REFIID) &IID_IDispatch, (void **) &pDisp ); + IDispatch ** pDispPtr = &pDisp; + pUnk->lpVtbl->QueryInterface( pUnk, (REFIID) &IID_IDispatch, (void **) pDispPtr ); } // Intentionally fall through @@ -1926,7 +1927,7 @@ HB_FUNC( __HB_OLE_EXIT ) } else*/ if( hb_itemGetSymbol( hb_stackBaseItem() )->szName[0] == '_' && hb_itemGetSymbol( hb_stackBaseItem() )->szName[1] && hb_pcount() >= 1 ) { - bstrMessage = hb_oleAnsiToSysString( hb_itemGetSymbol( hb_stackBaseItem() )->szName + 1 ); + bstrMessage = hb_oleAnsiToSysString( ( LPSTR ) hb_itemGetSymbol( hb_stackBaseItem() )->szName + 1 ); s_nOleError = pDisp->lpVtbl->GetIDsOfNames( pDisp, (REFIID) &IID_NULL, (wchar_t **) &bstrMessage, 1, LOCALE_SYSTEM_DEFAULT, &DispID ); SysFreeString( bstrMessage ); //TraceLog( NULL, "1. ID of: '%s' -> %i Result: %p\n", hb_itemGetSymbol( hb_stackBaseItem() )->szName + 1, DispID, s_nOleError ); @@ -1944,7 +1945,7 @@ HB_FUNC( __HB_OLE_EXIT ) if( FAILED( s_nOleError ) ) { // Try again without removing the assign prefix (_). - bstrMessage = hb_oleAnsiToSysString( hb_itemGetSymbol( hb_stackBaseItem() )->szName ); + bstrMessage = hb_oleAnsiToSysString( ( LPSTR ) hb_itemGetSymbol( hb_stackBaseItem() )->szName ); s_nOleError = pDisp->lpVtbl->GetIDsOfNames( pDisp, (REFIID) &IID_NULL, (wchar_t **) &bstrMessage, 1, 0, &DispID ); SysFreeString( bstrMessage ); //TraceLog( NULL, "2. ID of: '%s' -> %i Result: %p\n", hb_itemGetSymbol( hb_stackBaseItem() )->szName, DispID, s_nOleError ); diff --git a/harbour/include/hbregex.h b/harbour/include/hbregex.h index fdeec4cf9f..b62a7e0bc8 100644 --- a/harbour/include/hbregex.h +++ b/harbour/include/hbregex.h @@ -61,8 +61,9 @@ # if __BORLANDC__ >= 0x550 && !defined( HB_PCRE_REGEX_BCC ) # define HB_PCRE_REGEX_BCC # endif -#elif defined( OS_UNIX_COMPATIBLE ) && !defined( __WATCOMC__ ) -# if !defined( HB_POSIX_REGEX ) +#elif ( defined( OS_UNIX_COMPATIBLE ) && !defined( __WATCOMC__ ) ) || \ + defined( __DJGPP__ ) +# if !defined( HB_POSIX_REGEX ) && !defined( HB_PCRE_REGEX ) # define HB_POSIX_REGEX # endif #endif @@ -77,6 +78,7 @@ # include # include #elif defined( HB_POSIX_REGEX ) +# include # include #else # undef _HB_REGEX_INTERNAL_ diff --git a/harbour/makefile.vc b/harbour/makefile.vc index eb91f274f9..3832ae0057 100644 --- a/harbour/makefile.vc +++ b/harbour/makefile.vc @@ -870,7 +870,7 @@ $(LDFLAGS) $(**: = ^ ) $(STANDARD_STATIC_HBLIBS) -user32.lib winspool.lib +user32.lib winspool.lib wsock32.lib advapi32.lib << #********************************************************** # diff --git a/harbour/source/rtl/net.c b/harbour/source/rtl/net.c index d30e0acf37..ff6f53711d 100644 --- a/harbour/source/rtl/net.c +++ b/harbour/source/rtl/net.c @@ -107,80 +107,71 @@ HB_FUNC( NETNAME ) { - BOOL fGetUser = hb_parni( 1 ) == 1; - #if defined(HB_OS_UNIX) || ( defined(HB_OS_OS2) && defined(__GNUC__) ) + BOOL fGetUser = hb_parni( 1 ) == 1; +# if defined(__WATCOMC__) + char * pszValue = hb_getenv( fGetUser ? "USER" : "HOSTNAME" ); + hb_retc_buffer( pszValue ); +# else + if( fGetUser ) { -#if defined(__WATCOMC__) - char * pszValue = hb_getenv( fGetUser ? "USER" : "HOSTNAME" ); - hb_retc_buffer( pszValue ); -#else - if( fGetUser ) - { - struct passwd * pwd; - pwd = getpwuid( getuid() ); - if( pwd ) - hb_retc( pwd->pw_name ); - else - hb_retc_buffer( hb_getenv( "USER" ) ); - } + struct passwd * pwd; + pwd = getpwuid( getuid() ); + if( pwd ) + hb_retc( pwd->pw_name ); else - { - char szValue[ MAXGETHOSTNAME + 1 ]; - szValue[ 0 ] = '\0'; - gethostname( szValue, MAXGETHOSTNAME ); - hb_retc( szValue ); - } -#endif + hb_retc_buffer( hb_getenv( "USER" ) ); } + else + { + char szValue[ MAXGETHOSTNAME + 1 ]; + szValue[ 0 ] = '\0'; + gethostname( szValue, MAXGETHOSTNAME ); + hb_retc( szValue ); + } +# endif #elif defined(HB_OS_DOS) - #if defined(__DJGPP__) || defined(__RSX32__) || defined(__GNUC__) +# if defined(__DJGPP__) || defined(__RSX32__) || defined(__GNUC__) + char szValue[ MAXGETHOSTNAME + 1 ]; + szValue[ 0 ] = '\0'; + + gethostname( szValue, MAXGETHOSTNAME ); + + hb_retc( szValue ); +# else + union REGS regs; + char szValue[ 16 ]; + szValue[ 0 ] = '\0'; + + regs.HB_XREGS.ax = 0x5E00; + { - char szValue[ MAXGETHOSTNAME + 1 ]; - szValue[ 0 ] = '\0'; + struct SREGS sregs; - gethostname( szValue, MAXGETHOSTNAME ); + regs.HB_XREGS.dx = FP_OFF( szValue ); + sregs.ds = FP_SEG( szValue ); - hb_retc( szValue ); + HB_DOS_INT86X( 0x21, ®s, ®s, &sregs ); } - #else - { - union REGS regs; - char szValue[ 16 ]; - szValue[ 0 ] = '\0'; - regs.HB_XREGS.ax = 0x5E00; - - { - struct SREGS sregs; - - regs.HB_XREGS.dx = FP_OFF( szValue ); - sregs.ds = FP_SEG( szValue ); - - HB_DOS_INT86X( 0x21, ®s, ®s, &sregs ); - } - - hb_retc( regs.h.ch == 0 ? "" : szValue ); - } - #endif + hb_retc( regs.h.ch == 0 ? "" : szValue ); +# endif #elif defined(HB_OS_WIN_32) - { - DWORD ulLen = MAX_COMPUTERNAME_LENGTH + 1; - char szValue[ MAX_COMPUTERNAME_LENGTH + 1 ]; - szValue[ 0 ] = '\0'; + BOOL fGetUser = hb_parni( 1 ) == 1; + DWORD ulLen = MAX_COMPUTERNAME_LENGTH + 1; + char szValue[ MAX_COMPUTERNAME_LENGTH + 1 ]; - if( fGetUser ) - GetUserName( szValue, &ulLen ); - else - GetComputerName( szValue, &ulLen ); - - hb_retc( szValue ); - } + szValue[ 0 ] = '\0'; + if( fGetUser ) + GetUserName( szValue, &ulLen ); + else + GetComputerName( szValue, &ulLen ); + hb_retc( szValue ); #else