From 872abe845b62da021e79e878dd4ab75298a02e1c Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 27 Oct 2010 03:23:49 +0000 Subject: [PATCH] 2010-10-27 05:21 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/gete.c % Optimization to GETENV()/HB_GETENV(). Patch by Tamas Tevesz. + Added more details to comment on why it's needed to strip '=' part from envvar name. * contrib/hbqt/tests/demoqt.prg * contrib/hbqt/tests/dialogqt.prg * contrib/hbqt/tests/testqaim.prg ! Fixed external files' references to use executable's directory as a base, instead of current dir. * contrib/hbhpdf/harupdf.c ! HPDF_Page_CreateStampAnnot(): Fixed wrongly passed 3rd parameter. * contrib/hbssl/evpmd.c ! EVP_SIGNFINAL(): Fixed wrong returned buffer size. * config/postinst.hbs * Implemented GetEnv() caching, based on patch sent by Tamas Tevesz and further optimized. --- harbour/ChangeLog | 22 ++++ harbour/config/postinst.hbs | 147 +++++++++++++----------- harbour/contrib/hbhpdf/harupdf.c | 2 +- harbour/contrib/hbqt/tests/demoqt.prg | 20 ++-- harbour/contrib/hbqt/tests/dialogqt.prg | 20 ++-- harbour/contrib/hbqt/tests/testqaim.prg | 2 +- harbour/contrib/hbssl/evpmd.c | 2 +- harbour/src/rtl/gete.c | 36 ++---- 8 files changed, 135 insertions(+), 116 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2608d6fb10..f90a3bbea8 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,28 @@ The license applies to all entries newer than 2009-04-28. */ +2010-10-27 05:21 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * src/rtl/gete.c + % Optimization to GETENV()/HB_GETENV(). Patch by Tamas Tevesz. + + Added more details to comment on why it's needed to strip '=' + part from envvar name. + + * contrib/hbqt/tests/demoqt.prg + * contrib/hbqt/tests/dialogqt.prg + * contrib/hbqt/tests/testqaim.prg + ! Fixed external files' references to use executable's + directory as a base, instead of current dir. + + * contrib/hbhpdf/harupdf.c + ! HPDF_Page_CreateStampAnnot(): Fixed wrongly passed 3rd parameter. + + * contrib/hbssl/evpmd.c + ! EVP_SIGNFINAL(): Fixed wrong returned buffer size. + + * config/postinst.hbs + * Implemented GetEnv() caching, based on patch sent by + Tamas Tevesz and further optimized. + 2010-10-25 17:20 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rtl/hbjson.c * modified the if() condition to pacify some compiler warnings diff --git a/harbour/config/postinst.hbs b/harbour/config/postinst.hbs index 6ddc0b191f..f5c45c4191 100644 --- a/harbour/config/postinst.hbs +++ b/harbour/config/postinst.hbs @@ -55,9 +55,9 @@ PROCEDURE Main( ... ) LOCAL cMT_Versioned LOCAL cMT_Versionless - IF Empty( GetEnv( "HB_PLATFORM" ) ) .OR. ; - Empty( GetEnv( "HB_COMPILER" ) ) .OR. ; - Empty( GetEnv( "HB_HOST_BIN_DIR" ) ) + IF Empty( GetEnvC( "HB_PLATFORM" ) ) .OR. ; + Empty( GetEnvC( "HB_COMPILER" ) ) .OR. ; + Empty( GetEnvC( "HB_HOST_BIN_DIR" ) ) OutStd( "! Error: This program has to be called from the GNU Make process." + hb_eol() ) ErrorLevel( 1 ) @@ -69,10 +69,10 @@ PROCEDURE Main( ... ) IF AScan( hb_AParams(), {| tmp | Lower( tmp ) == "install" } ) > 0 /* Installing some misc files */ - tmp := GetEnv( "HB_INSTALL_DOC" ) + tmp := GetEnvC( "HB_INSTALL_DOC" ) IF ! tmp == "no" - IF GetEnv( "HB_PLATFORM" ) $ "win|wce|os2|dos" - tmp := GetEnv( "HB_INSTALL_PREFIX" ) + IF GetEnvC( "HB_PLATFORM" ) $ "win|wce|os2|dos" + tmp := GetEnvC( "HB_INSTALL_PREFIX" ) ENDIF IF ! Empty( tmp ) @@ -80,7 +80,7 @@ PROCEDURE Main( ... ) IF DirBuild( tmp ) FOR EACH aFile IN Directory( "Change*" ) - mk_hb_FCopy( aFile[ F_NAME ], tmp + hb_ps() + iif( GetEnv( "HB_PLATFORM" ) == "dos", "CHANGES", "" ) ) + mk_hb_FCopy( aFile[ F_NAME ], tmp + hb_ps() + iif( GetEnvC( "HB_PLATFORM" ) == "dos", "CHANGES", "" ) ) NEXT mk_hb_FCopy( "COPYING", tmp + hb_ps() ) @@ -93,37 +93,37 @@ PROCEDURE Main( ... ) ENDIF ENDIF - IF ! Empty( GetEnv( "HB_INSTALL_BIN" ) ) .AND. ; - ! GetEnv( "HB_BUILD_PARTS" ) == "lib" + IF ! Empty( GetEnvC( "HB_INSTALL_BIN" ) ) .AND. ; + ! GetEnvC( "HB_BUILD_PARTS" ) == "lib" OutStd( "! Copying Harbour script (.hbs) files..." + hb_eol() ) /* public Harbour scripts */ FOR EACH tmp IN { "bin/hbmk2l2d.hbs" ,; "bin/hbxpatch.hbs" } - mk_hb_FCopy( tmp, GetEnv( "HB_INSTALL_BIN" ) + hb_ps() ) + mk_hb_FCopy( tmp, GetEnvC( "HB_INSTALL_BIN" ) + hb_ps() ) NEXT ENDIF - IF ! Empty( GetEnv( "HB_INSTALL_ETC" ) ) + IF ! Empty( GetEnvC( "HB_INSTALL_ETC" ) ) OutStd( "! Copying *nix config files..." + hb_eol() ) - IF DirBuild( GetEnv( "HB_INSTALL_ETC" ) ) - mk_hb_FCopy( "src/rtl/gtcrs/hb-charmap.def", GetEnv( "HB_INSTALL_ETC" ) + hb_ps(), .T. ) + IF DirBuild( GetEnvC( "HB_INSTALL_ETC" ) ) + mk_hb_FCopy( "src/rtl/gtcrs/hb-charmap.def", GetEnvC( "HB_INSTALL_ETC" ) + hb_ps(), .T. ) ELSE - OutStd( hb_StrFormat( "! Error: Cannot create directory '%1$s'", GetEnv( "HB_INSTALL_ETC" ) ) + hb_eol() ) + OutStd( hb_StrFormat( "! Error: Cannot create directory '%1$s'", GetEnvC( "HB_INSTALL_ETC" ) ) + hb_eol() ) ENDIF - IF ! Empty( GetEnv( "HB_INSTALL_DYN" ) ) + IF ! Empty( GetEnvC( "HB_INSTALL_DYN" ) ) OutStd( "! Creating *nix ld config file..." + hb_eol() ) - tmp := GetEnv( "HB_INSTALL_ETC" ) + hb_ps() + ".." + hb_ps() + "ld.so.conf.d" + tmp := GetEnvC( "HB_INSTALL_ETC" ) + hb_ps() + ".." + hb_ps() + "ld.so.conf.d" IF DirBuild( tmp ) - tmp1 := GetEnv( "HB_INSTALL_DYN" ) - IF Left( tmp1, Len( GetEnv( "HB_INSTALL_PKG_ROOT" ) ) ) == GetEnv( "HB_INSTALL_PKG_ROOT" ) - tmp1 := SubStr( tmp1, Len( GetEnv( "HB_INSTALL_PKG_ROOT" ) ) + 1 ) + tmp1 := GetEnvC( "HB_INSTALL_DYN" ) + IF Left( tmp1, Len( GetEnvC( "HB_INSTALL_PKG_ROOT" ) ) ) == GetEnvC( "HB_INSTALL_PKG_ROOT" ) + tmp1 := SubStr( tmp1, Len( GetEnvC( "HB_INSTALL_PKG_ROOT" ) ) + 1 ) ENDIF hb_MemoWrit( tmp + hb_ps() + "harbour.conf", tmp1 + hb_eol() ) ELSE @@ -132,48 +132,48 @@ PROCEDURE Main( ... ) ENDIF ENDIF - IF ! Empty( GetEnv( "HB_INSTALL_MAN" ) ) + IF ! Empty( GetEnvC( "HB_INSTALL_MAN" ) ) OutStd( "! Copying *nix man files..." + hb_eol() ) - IF DirBuild( GetEnv( "HB_INSTALL_MAN" ) + hb_ps() + "man1" ) + IF DirBuild( GetEnvC( "HB_INSTALL_MAN" ) + hb_ps() + "man1" ) FOR EACH tmp IN { "src/main/harbour.1" ,; "src/pp/hbpp.1" ,; "utils/hbmk2/hbmk2.1" ,; "utils/hbrun/hbrun.1" ,; "utils/hbtest/hbtest.1" } - mk_hb_FCopy( tmp, GetEnv( "HB_INSTALL_MAN" ) + hb_ps() + "man1" + hb_ps(), .T. ) + mk_hb_FCopy( tmp, GetEnvC( "HB_INSTALL_MAN" ) + hb_ps() + "man1" + hb_ps(), .T. ) NEXT ELSE - OutStd( hb_StrFormat( "! Error: Cannot create directory '%1$s'", GetEnv( "HB_INSTALL_MAN" ) ) + hb_eol() ) + OutStd( hb_StrFormat( "! Error: Cannot create directory '%1$s'", GetEnvC( "HB_INSTALL_MAN" ) ) + hb_eol() ) ENDIF ENDIF - IF !( GetEnv( "HB_PLATFORM" ) $ "win|wce|os2|dos" ) .AND. ; - ! Empty( GetEnv( "HB_INSTALL_DYN" ) ) + IF !( GetEnvC( "HB_PLATFORM" ) $ "win|wce|os2|dos" ) .AND. ; + ! Empty( GetEnvC( "HB_INSTALL_DYN" ) ) OutStd( "! Creating dynamic lib symlinks..." + hb_eol() ) - cST_Versioned := GetEnv( "HB_DYNLIB_PREF" ) + GetEnv( "HB_DYNLIB_ST" ) + GetEnv( "HB_DYNLIB_EXT" ) - cST_Versionless := GetEnv( "HB_DYNLIB_PREF" ) + GetEnv( "HB_DYNLIB_BASE_ST" ) + GetEnv( "HB_DYNLIB_EXT" ) - cMT_Versioned := GetEnv( "HB_DYNLIB_PREF" ) + GetEnv( "HB_DYNLIB_MT" ) + GetEnv( "HB_DYNLIB_EXT" ) - cMT_Versionless := GetEnv( "HB_DYNLIB_PREF" ) + GetEnv( "HB_DYNLIB_BASE_MT" ) + GetEnv( "HB_DYNLIB_EXT" ) + cST_Versioned := GetEnvC( "HB_DYNLIB_PREF" ) + GetEnvC( "HB_DYNLIB_ST" ) + GetEnvC( "HB_DYNLIB_EXT" ) + cST_Versionless := GetEnvC( "HB_DYNLIB_PREF" ) + GetEnvC( "HB_DYNLIB_BASE_ST" ) + GetEnvC( "HB_DYNLIB_EXT" ) + cMT_Versioned := GetEnvC( "HB_DYNLIB_PREF" ) + GetEnvC( "HB_DYNLIB_MT" ) + GetEnvC( "HB_DYNLIB_EXT" ) + cMT_Versionless := GetEnvC( "HB_DYNLIB_PREF" ) + GetEnvC( "HB_DYNLIB_BASE_MT" ) + GetEnvC( "HB_DYNLIB_EXT" ) - mk_hb_FLinkSym( cST_Versioned, PathSepToSelf( GetEnv( "HB_INSTALL_DYN" ) ) + hb_ps() + cST_Versionless ) - mk_hb_FLinkSym( cMT_Versioned, PathSepToSelf( GetEnv( "HB_INSTALL_DYN" ) ) + hb_ps() + cMT_Versionless ) + mk_hb_FLinkSym( cST_Versioned, PathSepToSelf( GetEnvC( "HB_INSTALL_DYN" ) ) + hb_ps() + cST_Versionless ) + mk_hb_FLinkSym( cMT_Versioned, PathSepToSelf( GetEnvC( "HB_INSTALL_DYN" ) ) + hb_ps() + cMT_Versionless ) DO CASE - CASE EndsWith( GetEnv( "HB_INSTALL_DYN" ), "/usr/lib/harbour" ) .OR. ; - EndsWith( GetEnv( "HB_INSTALL_DYN" ), "/usr/lib64/harbour" ) .OR. ; - EndsWith( GetEnv( "HB_INSTALL_DYN" ), "/usr/local/lib/harbour" ) .OR. ; - EndsWith( GetEnv( "HB_INSTALL_DYN" ), "/usr/local/lib64/harbour" ) + CASE EndsWith( GetEnvC( "HB_INSTALL_DYN" ), "/usr/lib/harbour" ) .OR. ; + EndsWith( GetEnvC( "HB_INSTALL_DYN" ), "/usr/lib64/harbour" ) .OR. ; + EndsWith( GetEnvC( "HB_INSTALL_DYN" ), "/usr/local/lib/harbour" ) .OR. ; + EndsWith( GetEnvC( "HB_INSTALL_DYN" ), "/usr/local/lib64/harbour" ) - mk_hb_FLinkSym( "harbour" + hb_ps() + cST_Versioned, PathSepToSelf( GetEnv( "HB_INSTALL_DYN" ) ) + hb_ps() + ".." + hb_ps() + cST_Versionless ) - mk_hb_FLinkSym( "harbour" + hb_ps() + cST_Versioned, PathSepToSelf( GetEnv( "HB_INSTALL_DYN" ) ) + hb_ps() + ".." + hb_ps() + cST_Versioned ) - mk_hb_FLinkSym( "harbour" + hb_ps() + cMT_Versioned, PathSepToSelf( GetEnv( "HB_INSTALL_DYN" ) ) + hb_ps() + ".." + hb_ps() + cMT_Versionless ) - mk_hb_FLinkSym( "harbour" + hb_ps() + cMT_Versioned, PathSepToSelf( GetEnv( "HB_INSTALL_DYN" ) ) + hb_ps() + ".." + hb_ps() + cMT_Versioned ) + mk_hb_FLinkSym( "harbour" + hb_ps() + cST_Versioned, PathSepToSelf( GetEnvC( "HB_INSTALL_DYN" ) ) + hb_ps() + ".." + hb_ps() + cST_Versionless ) + mk_hb_FLinkSym( "harbour" + hb_ps() + cST_Versioned, PathSepToSelf( GetEnvC( "HB_INSTALL_DYN" ) ) + hb_ps() + ".." + hb_ps() + cST_Versioned ) + mk_hb_FLinkSym( "harbour" + hb_ps() + cMT_Versioned, PathSepToSelf( GetEnvC( "HB_INSTALL_DYN" ) ) + hb_ps() + ".." + hb_ps() + cMT_Versionless ) + mk_hb_FLinkSym( "harbour" + hb_ps() + cMT_Versioned, PathSepToSelf( GetEnvC( "HB_INSTALL_DYN" ) ) + hb_ps() + ".." + hb_ps() + cMT_Versioned ) - CASE GetEnv( "HB_INSTALL_DYN" ) == "/usr/local/harbour/lib" + CASE GetEnvC( "HB_INSTALL_DYN" ) == "/usr/local/harbour/lib" /* TOFIX: Rewrite this in .prg */ #if 0 ld="/usr/lib" @@ -189,8 +189,8 @@ PROCEDURE Main( ... ) /* Creating language files */ - IF ! Empty( GetEnv( "HB_INSTALL_BIN" ) ) .AND. ; - ! GetEnv( "HB_BUILD_PARTS" ) == "lib" + IF ! Empty( GetEnvC( "HB_INSTALL_BIN" ) ) .AND. ; + ! GetEnvC( "HB_BUILD_PARTS" ) == "lib" OutStd( "! Making core translation (.hbl) files..." + hb_eol() ) @@ -198,7 +198,7 @@ PROCEDURE Main( ... ) IF "D" $ tmp[ F_ATTR ] .AND. !( tmp[ F_NAME ] == "." ) .AND. !( tmp[ F_NAME ] == ".." ) FOR EACH aFile IN Directory( "utils" + hb_ps() + tmp[ F_NAME ] + hb_ps() + "*.po" ) mk_hbl( "utils" + hb_ps() + tmp[ F_NAME ] + hb_ps() + aFile[ F_NAME ],; - PathSepToSelf( GetEnv( "HB_INSTALL_BIN" ) ) + hb_ps() + FNameExtSet( aFile[ F_NAME ], ".hbl" ) ) + PathSepToSelf( GetEnvC( "HB_INSTALL_BIN" ) ) + hb_ps() + FNameExtSet( aFile[ F_NAME ], ".hbl" ) ) NEXT ENDIF NEXT @@ -206,7 +206,7 @@ PROCEDURE Main( ... ) /* Creating docs for core */ - IF ! Empty( tmp := GetEnv( "HB_INSTALL_DOC" ) ) .AND. ! tmp == "no" + IF ! Empty( tmp := GetEnvC( "HB_INSTALL_DOC" ) ) .AND. ! tmp == "no" OutStd( "! Compiling core documentation (.hbd)..." + hb_eol() ) @@ -215,12 +215,12 @@ PROCEDURE Main( ... ) /* Creating install packages */ - IF GetEnv( "HB_BUILD_PKG" ) == "yes" .AND. ; - ! Empty( GetEnv( "HB_TOP" ) ) + IF GetEnvC( "HB_BUILD_PKG" ) == "yes" .AND. ; + ! Empty( GetEnvC( "HB_TOP" ) ) - IF GetEnv( "HB_PLATFORM" ) $ "win|wce|os2|dos" + IF GetEnvC( "HB_PLATFORM" ) $ "win|wce|os2|dos" - tmp := GetEnv( "HB_TOP" ) + hb_ps() + GetEnv( "HB_PKGNAME" ) + ".zip" + tmp := GetEnvC( "HB_TOP" ) + hb_ps() + GetEnvC( "HB_PKGNAME" ) + ".zip" OutStd( "! Making Harbour .zip install package: '" + tmp + "'" + hb_eol() ) @@ -233,23 +233,23 @@ PROCEDURE Main( ... ) first to avoid mixing in an existing .zip file. [vszakats] */ cOldDir := hb_ps() + CurDir() - DirChange( GetEnv( "HB_INSTALL_PKG_ROOT" ) ) + DirChange( GetEnvC( "HB_INSTALL_PKG_ROOT" ) ) - mk_hb_processRun( PathSepToSelf( GetEnv( "HB_DIR_ZIP" ) ) + "zip" +; + mk_hb_processRun( PathSepToSelf( GetEnvC( "HB_DIR_ZIP" ) ) + "zip" +; " -q -9 -X -r -o" +; " " + FNameEscape( tmp ) +; - " . -i " + FNameEscape( GetEnv( "HB_PKGNAME" ) + hb_ps() + "*" ) +; + " . -i " + FNameEscape( GetEnvC( "HB_PKGNAME" ) + hb_ps() + "*" ) +; " -x *.tds -x *.exp" ) DirChange( cOldDir ) - IF GetEnv( "HB_PLATFORM" ) $ "win|wce" + IF GetEnvC( "HB_PLATFORM" ) $ "win|wce" - tmp := GetEnv( "HB_TOP" ) + hb_ps() + GetEnv( "HB_PKGNAME" ) + ".exe" + tmp := GetEnvC( "HB_TOP" ) + hb_ps() + GetEnvC( "HB_PKGNAME" ) + ".exe" OutStd( "! Making Harbour .exe install package: '" + tmp + "'" + hb_eol() ) - mk_hb_processRun( PathSepToSelf( GetEnv( "HB_DIR_NSIS" ) ) + "makensis.exe" +; + mk_hb_processRun( PathSepToSelf( GetEnvC( "HB_DIR_NSIS" ) ) + "makensis.exe" +; " -V2" +; " " + FNameEscape( StrTran( "package/mpkg_win.nsi", "/", hb_ps() ) ) ) ENDIF @@ -267,23 +267,23 @@ PROCEDURE Main( ... ) IF ! Empty( cBin_Tar ) - cTar_Name := GetEnv( "HB_PKGNAME" ) + cTar_Name := GetEnvC( "HB_PKGNAME" ) IF ! Empty( tmp := unix_name() ) cTar_Name += "-" + tmp ENDIF - cTar_NameExt := cTar_Name + iif( GetEnv( "HB_PLATFORM" ) == "dos", ".tgz", ".bin.tar.gz" ) - cTar_Path := GetEnv( "HB_TOP" ) + hb_ps() + cTar_NameExt + cTar_NameExt := cTar_Name + iif( GetEnvC( "HB_PLATFORM" ) == "dos", ".tgz", ".bin.tar.gz" ) + cTar_Path := GetEnvC( "HB_TOP" ) + hb_ps() + cTar_NameExt OutStd( "! Making Harbour tar install package: '" + cTar_Path + "'" + hb_eol() ) FErase( cTar_Path ) cOwner := "root" - cGroup := iif( GetEnv( "HB_PLATFORM" ) == "darwin" .OR. ; - GetEnv( "HB_PLATFORM" ) == "bsd", "wheel", "root" ) + cGroup := iif( GetEnvC( "HB_PLATFORM" ) == "darwin" .OR. ; + GetEnvC( "HB_PLATFORM" ) == "bsd", "wheel", "root" ) cOldDir := hb_ps() + CurDir() - DirChange( GetEnv( "HB_INSTALL_PKG_ROOT" ) ) + DirChange( GetEnvC( "HB_INSTALL_PKG_ROOT" ) ) /* TODO: Add support for non-GNU non-BSD tar (which gets the data from stdio) */ @@ -295,9 +295,9 @@ PROCEDURE Main( ... ) DirChange( cOldDir ) - IF !( GetEnv( "HB_PLATFORM" ) == "dos" ) + IF !( GetEnvC( "HB_PLATFORM" ) == "dos" ) - tmp := GetEnv( "HB_TOP" ) + hb_ps() + cTar_Name + ".inst.sh" + tmp := GetEnvC( "HB_TOP" ) + hb_ps() + cTar_Name + ".inst.sh" OutStd( "! Making Harbour tar installer package: '" + tmp + "'" + hb_eol() ) @@ -317,7 +317,7 @@ PROCEDURE Main( ... ) cSH_Script += 'if [ "\${ASK}" != "y" ] && [ "\${ASK}" != "Y" ]; then' + Chr( 10 ) cSH_Script += ' exit 1' + Chr( 10 ) cSH_Script += 'fi' + Chr( 10 ) - cSH_Script += '(tail -c ' + hb_ntos( hb_FSize( cTar_Path ) ) + ' "\$0" | gzip -cd | (cd /;tar xvpf -)) ' + iif( GetEnv( "HB_PLATFORM" ) == "linux", "&& ldconfig", "" ) + Chr( 10 ) + cSH_Script += '(tail -c ' + hb_ntos( hb_FSize( cTar_Path ) ) + ' "\$0" | gzip -cd | (cd /;tar xvpf -)) ' + iif( GetEnvC( "HB_PLATFORM" ) == "linux", "&& ldconfig", "" ) + Chr( 10 ) cSH_Script += 'exit \$?' + Chr( 10 ) cSH_Script += 'HB_INST_EOF' + Chr( 10 ) @@ -334,7 +334,7 @@ PROCEDURE Main( ... ) /* Executing user postinst configuration script */ - IF ! Empty( tmp := GetEnv( "HB_INSTALL_SCRIPT" ) ) + IF ! Empty( tmp := GetEnvC( "HB_INSTALL_SCRIPT" ) ) mk_hb_processRun( tmp ) ENDIF @@ -564,8 +564,8 @@ STATIC FUNCTION unix_name() LOCAL tmp DO CASE - CASE GetEnv( "HB_PLATFORM" ) == "dos" ; RETURN "djgpp" - CASE GetEnv( "HB_PLATFORM" ) == "win" ; RETURN GetEnv( "HB_COMPILER" ) + CASE GetEnvC( "HB_PLATFORM" ) == "dos" ; RETURN "djgpp" + CASE GetEnvC( "HB_PLATFORM" ) == "win" ; RETURN GetEnvC( "HB_COMPILER" ) CASE ! Empty( tmp := query_rpm( "mandriva-release-One", "mdv" ) ) ; RETURN tmp CASE ! Empty( tmp := query_rpm( "mandriva-release" , "mdv" ) ) ; RETURN tmp CASE ! Empty( tmp := query_rpm( "redhat-release" , "rh" ) ) ; RETURN tmp @@ -582,11 +582,11 @@ STATIC FUNCTION unix_name() STATIC FUNCTION mk_extern_core() LOCAL aExtern - IF GetEnv( "HB_REBUILD_EXTERN" ) == "yes" .AND. ; - ! Empty( GetEnv( "HB_DYNLIB_ST" ) ) + IF GetEnvC( "HB_REBUILD_EXTERN" ) == "yes" .AND. ; + ! Empty( GetEnvC( "HB_DYNLIB_ST" ) ) /* TOFIX: Use list of libs instead of dynamic lib */ - IF ( aExtern := __hb_extern_get_list( PathSepToSelf( GetEnv( "HB_DYNLIB_DIR" ) ) + hb_ps() + GetEnv( "HB_DYNLIB_PREF" ) + GetEnv( "HB_DYNLIB_ST" ) + GetEnv( "HB_DYNLIB_EXT" ) ) ) != NIL + IF ( aExtern := __hb_extern_get_list( PathSepToSelf( GetEnvC( "HB_DYNLIB_DIR" ) ) + hb_ps() + GetEnvC( "HB_DYNLIB_PREF" ) + GetEnvC( "HB_DYNLIB_ST" ) + GetEnvC( "HB_DYNLIB_EXT" ) ) ) != NIL OutStd( "! Generating core extern headers..." + hb_eol() ) @@ -602,4 +602,13 @@ STATIC FUNCTION mk_extern_core() RETURN .F. +STATIC FUNCTION GetEnvC( cEnvVar ) + STATIC s_hEnvCache := { => } + + IF cEnvVar $ s_hEnvCache + RETURN s_hEnvCache[ cEnvVar ] + ENDIF + + RETURN s_hEnvCache[ cEnvVar ] := GetEnv( cEnvVar ) + #include "hbextern.hbs" diff --git a/harbour/contrib/hbhpdf/harupdf.c b/harbour/contrib/hbhpdf/harupdf.c index 0753f88110..226128fc25 100644 --- a/harbour/contrib/hbhpdf/harupdf.c +++ b/harbour/contrib/hbhpdf/harupdf.c @@ -2084,7 +2084,7 @@ HB_FUNC( HPDF_Page_CreateStampAnnot ) rc.right = ( HPDF_REAL ) hb_parvnd( 2, 3 ); rc.bottom = ( HPDF_REAL ) hb_parvnd( 2, 4 ); - hb_retptr( HPDF_Page_CreateStampAnnot( ( HPDF_Page ) hb_parptr( 1 ), rc, ( HPDF_StampAnnotName ) hb_parc( 3 ), hb_parc( 4 ), ( HPDF_Encoder ) hb_parptr( 5 ) ) ); + hb_retptr( HPDF_Page_CreateStampAnnot( ( HPDF_Page ) hb_parptr( 1 ), rc, ( HPDF_StampAnnotName ) hb_parni( 3 ), hb_parc( 4 ), ( HPDF_Encoder ) hb_parptr( 5 ) ) ); #else hb_retptr( NULL ); #endif diff --git a/harbour/contrib/hbqt/tests/demoqt.prg b/harbour/contrib/hbqt/tests/demoqt.prg index 4ea44c8aac..c913c38871 100644 --- a/harbour/contrib/hbqt/tests/demoqt.prg +++ b/harbour/contrib/hbqt/tests/demoqt.prg @@ -236,16 +236,16 @@ STATIC FUNCTION Build_MenuBar( oWnd ) oActNew := QAction( oMenu1 ) oActNew:setText( "&New" ) - oActNew:setIcon( "new.png" ) + oActNew:setIcon( hb_dirBase() + "new.png" ) oActNew:connect( "triggered(bool)", {|w,l| FileDialog( "New" , w, l ) } ) oMenu1:addAction( oActNew ) - oActOpen := oMenu1:addAction( "open.png", "&Open" ) + oActOpen := oMenu1:addAction( hb_dirBase() + "open.png", "&Open" ) oActOpen:connect( QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Open" , w, l ) } ) oMenu1:addSeparator() - oActSave := oMenu1:addAction( "save.png", "&Save" ) + oActSave := oMenu1:addAction( hb_dirBase() + "save.png", "&Save" ) oActSave:connect( QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Save" , w, l ) } ) oMenu1:addSeparator() @@ -303,7 +303,7 @@ STATIC FUNCTION Build_ToolBar( oWnd ) /* Create an action */ oActNew := QAction( oWnd ) oActNew:setText( "&New" ) - oActNew:setIcon( "new.png" ) + oActNew:setIcon( hb_dirBase() + "new.png" ) oActNew:setToolTip( "A New File" ) oActNew:connect( QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "New" , w, l ) } ) @@ -313,7 +313,7 @@ STATIC FUNCTION Build_ToolBar( oWnd ) /* Create another action */ oActOpen := QAction( oWnd ) oActOpen:setText( "&Open" ) - oActOpen:setIcon( "open.png" ) + oActOpen:setIcon( hb_dirBase() + "open.png" ) oActOpen:setToolTip( "Select a file to be opened!" ) oActOpen:connect( QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Open" , w, l ) } ) /* Attach Action with Toolbar */ @@ -324,7 +324,7 @@ STATIC FUNCTION Build_ToolBar( oWnd ) /* Create another action */ oActSave := QAction( oWnd ) oActSave:setText( "&Save" ) - oActSave:setIcon( "save.png" ) + oActSave:setIcon( hb_dirBase() + "save.png" ) oActSave:setToolTip( "Save this file!" ) oActSave:connect( oActSave, QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Save" , w, l ) } ) /* Attach Action with Toolbar */ @@ -611,7 +611,7 @@ STATIC FUNCTION Dialogs( cType ) ENDCASE oDlg := NIL - HB_GCALL( .T.) + HB_GCALL( .T. ) RETURN nil @@ -630,16 +630,16 @@ FUNCTION ShowInSystemTray( oWnd ) oMenuSys := QMenu( oWnd ) oMenuSys:setTitle( "&File" ) - oActShow := oMenuSys:addAction( "new.png" , "&Show" ) + oActShow := oMenuSys:addAction( hb_dirBase() + "new.png" , "&Show" ) oActShow:connect( QT_EVE_TRIGGERED_B, {|| oWnd:show() } ) oMenuSys:addSeparator() - oActHide := oMenuSys:addAction( "new.png" , "&Show" ) + oActHide := oMenuSys:addAction( hb_dirBase() + "new.png" , "&Show" ) oActHide:connect( QT_EVE_TRIGGERED_B, {|| oWnd:hide() } ) oSys := QSystemTrayIcon( oWnd ) - oSys:setIcon( 'new.png' ) + oSys:setIcon( hb_dirBase() + "new.png" ) oSys:setContextMenu( oMenuSys ) oSys:showMessage( "Harbour-QT", "This is Harbour-QT System Tray" ) oSys:show() diff --git a/harbour/contrib/hbqt/tests/dialogqt.prg b/harbour/contrib/hbqt/tests/dialogqt.prg index 639058908d..065b4ef364 100644 --- a/harbour/contrib/hbqt/tests/dialogqt.prg +++ b/harbour/contrib/hbqt/tests/dialogqt.prg @@ -149,10 +149,10 @@ STATIC FUNCTION Build_MenuBar( oWnd ) oMenu1 := QMenu() oMenu1:setTitle( "&File" ) - __HBQT_SLOTS_CONNECT( s_slots, oMenu1:addAction_1( "new.png" , "&New" ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "New" , w, l ) } ) - __HBQT_SLOTS_CONNECT( s_slots, oMenu1:addAction_1( "open.png", "&Open" ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Open", w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oMenu1:addAction_1( hb_dirBase() + "new.png" , "&New" ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "New" , w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oMenu1:addAction_1( hb_dirBase() + "open.png", "&Open" ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Open", w, l ) } ) oMenu1:addSeparator() - __HBQT_SLOTS_CONNECT( s_slots, oMenu1:addAction_1( "save.png", "&Save" ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Save", w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oMenu1:addAction_1( hb_dirBase() + "save.png", "&Save" ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Save", w, l ) } ) oMenu1:addSeparator() __HBQT_SLOTS_CONNECT( s_slots, oMenu1:addAction( "E&xit" ), QT_EVE_TRIGGERED_B, {|w,l| w := w, l := l, MsgInfo( "Exit ?" ) } ) oMenuBar:addMenu( oMenu1 ) @@ -186,7 +186,7 @@ STATIC FUNCTION Build_ToolBar( oWnd ) /* Create an action */ oActNew := QAction( oWnd ) oActNew:setText( "&New" ) - oActNew:setIcon( "new.png" ) + oActNew:setIcon( hb_dirBase() + "new.png" ) oActNew:setToolTip( "A New File" ) /* Attach codeblock to be triggered */ __HBQT_SLOTS_CONNECT( s_slots, oActNew, QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "New" , w, l ) } ) @@ -196,7 +196,7 @@ STATIC FUNCTION Build_ToolBar( oWnd ) /* Create another action */ oActOpen := QAction( oWnd ) oActOpen:setText( "&Open" ) - oActOpen:setIcon( "open.png" ) + oActOpen:setIcon( hb_dirBase() + "open.png" ) oActOpen:setToolTip( "Select a file to be opened!" ) /* Attach codeblock to be triggered */ __HBQT_SLOTS_CONNECT( s_slots, oActOpen, QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Open" , w, l ) } ) @@ -208,7 +208,7 @@ STATIC FUNCTION Build_ToolBar( oWnd ) /* Create another action */ oActSave := QAction( oWnd ) oActSave:setText( "&Save" ) - oActSave:setIcon( "save.png" ) + oActSave:setIcon( hb_dirBase() + "save.png" ) oActSave:setToolTip( "Save this file!" ) /* Attach codeblock to be triggered */ __HBQT_SLOTS_CONNECT( s_slots, oActSave, QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Save" , w, l ) } ) @@ -551,7 +551,7 @@ STATIC FUNCTION Dialogs( cType ) ENDCASE oDlg := NIL - HB_GCALL( .T.) + HB_GCALL( .T. ) RETURN nil @@ -573,12 +573,12 @@ FUNCTION ShowInSystemTray( oWnd ) oMenu := QMenu( oWnd ) oMenu:setTitle( "&File" ) - __HBQT_SLOTS_CONNECT( s_slots, oMenu:addAction_1( "new.png" , "&Show" ), QT_EVE_TRIGGERED_B, {|| oWnd:show() } ) + __HBQT_SLOTS_CONNECT( s_slots, oMenu:addAction_1( hb_dirBase() + "new.png" , "&Show" ), QT_EVE_TRIGGERED_B, {|| oWnd:show() } ) oMenu:addSeparator() - __HBQT_SLOTS_CONNECT( s_slots, oMenu:addAction_1( "save.png", "&Hide" ), QT_EVE_TRIGGERED_B, {|| oWnd:hide() } ) + __HBQT_SLOTS_CONNECT( s_slots, oMenu:addAction_1( hb_dirBase() + "save.png", "&Hide" ), QT_EVE_TRIGGERED_B, {|| oWnd:hide() } ) oSys := QSystemTrayIcon( oWnd ) - oSys:setIcon( 'new.png' ) + oSys:setIcon( hb_dirBase() + "new.png" ) oSys:setContextMenu( oMenu ) oSys:showMessage( "Harbour-QT", "This is Harbour-QT System Tray" ) oSys:show() diff --git a/harbour/contrib/hbqt/tests/testqaim.prg b/harbour/contrib/hbqt/tests/testqaim.prg index 8c471c056a..1535278a9d 100644 --- a/harbour/contrib/hbqt/tests/testqaim.prg +++ b/harbour/contrib/hbqt/tests/testqaim.prg @@ -48,7 +48,7 @@ PROCEDURE Main() oAlphaColor:setAlpha( 128 ) oBackBrush := QBrush( QColor( 255, 255, 100 ), Qt_BDiagPattern ) // Yellow Diagonal lines oSize := QSize( 80, 30 ) // Default header sizes - oPixmap := QPixMap( "harbour-icon.png" ) // Image + oPixmap := QPixMap( hb_dirBase() + "harbour-icon.png" ) // Image oIcon := QIcon( oPixMap ) // Icon (reusing the image) oFont := QFont() // Bold Italic font oFont:setBold( .T. ) diff --git a/harbour/contrib/hbssl/evpmd.c b/harbour/contrib/hbssl/evpmd.c index ba8ef65721..037f2afeb3 100644 --- a/harbour/contrib/hbssl/evpmd.c +++ b/harbour/contrib/hbssl/evpmd.c @@ -472,7 +472,7 @@ HB_FUNC( EVP_SIGNFINAL ) if( ctx ) { - unsigned char * buffer = ( unsigned char * ) hb_xgrab( EVP_MAX_MD_SIZE + 1 ); + unsigned char * buffer = ( unsigned char * ) hb_xgrab( EVP_PKEY_size( hb_EVP_PKEY_par( 3 ) ) + 1 ); unsigned int size = 0; hb_retni( EVP_SignFinal( ctx, buffer, &size, hb_EVP_PKEY_par( 3 ) ) ); diff --git a/harbour/src/rtl/gete.c b/harbour/src/rtl/gete.c index dc41fc81eb..628b07b823 100644 --- a/harbour/src/rtl/gete.c +++ b/harbour/src/rtl/gete.c @@ -71,19 +71,13 @@ HB_FUNC( GETENV ) if( pName && hb_pcount() == 1 ) { char * pszName = hb_itemGetC( pName ); - HB_SIZE nName = strlen( pszName ); - HB_SIZE nPos; + char * ptr; - /* strip the '=' or else it will clear the variable! */ - - for( nPos = 0; nPos < nName; nPos++ ) - { - if( pszName[ nPos ] == '=' ) - { - pszName[ nPos ] = '\0'; - break; - } - } + /* strip the '=' or else some C RTLs (f.e. Borland C++ + and watcom) will clear the variable! */ + ptr = strchr( pszName, '=' ); + if( ptr ) + *ptr = '\0'; if( pszName[ 0 ] != '\0' ) { @@ -140,19 +134,13 @@ HB_FUNC( HB_GETENV ) if( pName ) { char * pszName = hb_itemGetC( pName ); - HB_SIZE nName = strlen( pszName ); - HB_SIZE nPos; + char * ptr; - /* strip the '=' or else it will clear the variable! */ - - for( nPos = 0; nPos < nName; nPos++ ) - { - if( pszName[ nPos ] == '=' ) - { - pszName[ nPos ] = '\0'; - break; - } - } + /* strip the '=' or else some C RTLs (f.e. Borland C++ + and watcom) will clear the variable! */ + ptr = strchr( pszName, '=' ); + if( ptr ) + *ptr = '\0'; if( pszName[ 0 ] != '\0' ) {