diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6b05ff6cde..d55aae7a01 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,23 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-02-24 12:22 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/bin/hb-func.sh + * updated new contrib libraries + + * harbour/contrib/xhb/regexrpl.prg + ! fixed hb_RegexReplace() to respect lCaseSensitive and lNewLine flags + + * harbour/src/rtl/filesys.c + % use in OS2 builds system API functions instead of CRTL ones + to get/set current drive + % use in OS2 builds system API function DosQueryCurrentDisk() to + check if disk drives are available in hb_fsIsDrv() function + ! use in OS2 builds system API function DosQCurDir() to extract current + directory. It fixed buffer overflow due to ignored buffer size in + GCC OS2 builds and makes MT safe getting current directory for non + current drive. + 2010-02-24 10:32 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) - include/hbzlib.h - Deleted hbzlib.h (missed from commit: 2010-02-23 09:27 UTC+0100) diff --git a/harbour/bin/hb-func.sh b/harbour/bin/hb-func.sh index 78d8a96ef3..0d7d07d0fb 100755 --- a/harbour/bin/hb-func.sh +++ b/harbour/bin/hb-func.sh @@ -129,8 +129,8 @@ mk_hbgetlibsctb() then libs="$libs gtwin" fi - echo "$libs hbct hbnf hbmzip hbnetio hbtip xhb hbgd hbfimage rddsql sddfb sddmy sddpg hbodbc hbpgsql hbmysql hbfbird rddads rddado hbhpdf hbvpdf hbcurl hbwin gtwvg gtalleg hbsqlit3 hbbtree $CC_HB_USER_LIBS" - #"hbgf hbgt hbbmcdx hbmisc hbsms hbtpathy hbwhat hbziparc hbmsql" + echo "$libs hbct hbnf hbmzip hbnetio hbtip xhb hbxpp hbfship hbgd hbfimage rddsql sddfb sddmy sddpg hbodbc hbpgsql hbmysql hbfbird rddads rddado hbhpdf hbvpdf hbcurl hbwin gtwvg gtalleg hbsqlit3 hbbtree $CC_HB_USER_LIBS" + #"hbgf hbgt rddbmcdx hbmisc hbsms hbtpathy hbwhat hbziparc hbmsql" else echo "$@" fi diff --git a/harbour/contrib/xhb/regexrpl.prg b/harbour/contrib/xhb/regexrpl.prg index d608c60419..fe73cae49a 100644 --- a/harbour/contrib/xhb/regexrpl.prg +++ b/harbour/contrib/xhb/regexrpl.prg @@ -57,20 +57,13 @@ FUNCTION hb_RegexReplace( cRegex, cString, cReplace, lCaseSensitive, lNewLine, nMaxMatches, nGetMatch ) - LOCAL pRegex LOCAL aMatches, aMatch LOCAL cReturn LOCAL nOffSet := 0 LOCAL cSearch, nStart, nLenSearch, nLenReplace //LOCAL nEnd - IF !HB_ISREGEX( cRegex ) - pRegex := HB_RegExComp( cRegEx ) - ELSE - pRegex := cRegEx - ENDIF - - aMatches := HB_RegExAll( pRegEx, cString, lCaseSensitive, lNewLine, nMaxMatches, nGetMatch, .F. ) + aMatches := HB_RegExAll( cRegEx, cString, lCaseSensitive, lNewLine, nMaxMatches, nGetMatch, .F. ) IF aMatches != NIL cReturn := cString diff --git a/harbour/src/rtl/filesys.c b/harbour/src/rtl/filesys.c index 5f404f6756..3e31441749 100644 --- a/harbour/src/rtl/filesys.c +++ b/harbour/src/rtl/filesys.c @@ -233,12 +233,24 @@ to refer to current disk */ -#if defined( __DJGPP__ ) || defined( __BORLANDC__ ) || defined( __DMC__ ) +#if defined( HB_OS_OS2 ) + /* 1 based version */ + + #define HB_FS_GETDRIVE(n) do { \ + ULONG ulDrive, ulLogical; \ + DosQueryCurrentDisk( &ulDrive, &ulLogical ); \ + ( n ) == ( int ) ulDrive - 1; \ + } while( 0 ) + #define HB_FS_SETDRIVE(n) do { DosSetDefaultDisk( ( n ) + 1 ); } while( 0 ) + +#elif defined( __DJGPP__ ) || defined( __BORLANDC__ ) || defined( __DMC__ ) + /* 0 based version */ #define HB_FS_GETDRIVE(n) do { n = getdisk(); } while( 0 ) #define HB_FS_SETDRIVE(n) setdisk( n ) #elif defined( __WATCOMC__ ) + /* 1 based version */ #define HB_FS_GETDRIVE(n) do { \ unsigned _u = 0; \ @@ -249,12 +261,6 @@ _dos_setdrive( ( n ) + 1, &_u ); \ } while( 0 ) -#elif defined( HB_OS_OS2 ) && defined( __GNUC__ ) - /* 'A' based version */ - - #define HB_FS_GETDRIVE(n) do { n = _getdrive() - 'A'; } while( 0 ) - #define HB_FS_SETDRIVE(n) _chdrive( ( n ) + 'A' ) - #else /* _MSC_VER, __POCC__, __XCC__, MINGW, __BORLANDC__, __DMC__ */ /* 1 based version */ @@ -2746,8 +2752,8 @@ HB_ERRCODE hb_fsCurDirBuff( int iDrive, char * pszBuffer, HB_SIZE ulSize ) * and hb_fsNameConv() */ #if defined( HB_OS_WIN ) || \ - ( !( defined( HB_OS_OS2 ) && defined( __GNUC__ ) ) && \ - !defined( __MINGW32__ ) && defined( HAVE_POSIX_IO ) ) + ( !defined( HB_OS_OS2 ) && !defined( __MINGW32__ ) && \ + defined( HAVE_POSIX_IO ) ) if( iDrive > 0 ) { iCurDrv = hb_fsCurDrv() + 1; @@ -2771,12 +2777,15 @@ HB_ERRCODE hb_fsCurDirBuff( int iDrive, char * pszBuffer, HB_SIZE ulSize ) hb_vmLock(); #endif } -#elif defined( HB_OS_OS2 ) && defined( __GNUC__ ) +#elif defined( HB_OS_OS2 ) if( iDrive >= 0 ) { + USHORT uiLen = ( USHORT ) ulSize; + hb_vmUnlock(); - hb_fsSetIOError( ( _getcwd1( pszBuffer, iDrive + 'A' - 1 ) == 0 ), 0 ); + hb_fsSetIOError( DosQCurDir( ( USHORT ) iDrive, ( PBYTE ) pszBuffer, + &uiLen ) == NO_ERROR, 0 ); hb_vmLock(); } else @@ -2954,6 +2963,13 @@ HB_ERRCODE hb_fsIsDrv( int iDrive ) hb_vmLock(); hb_fsSetError( 0 ); } +#elif defined( HB_OS_OS2 ) + { + ULONG ulDrive, ulLogical; + + DosQueryCurrentDisk( &ulDrive, &ulLogical ); + nResult = ( ( ulLogical >> iDrive ) & 1 ) ? 0 : ( HB_ERRCODE ) F_ERROR; + } #elif defined( HB_OS_HAS_DRIVE_LETTER ) { int iSave, iNewDrive;