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.
This commit is contained in:
Przemyslaw Czerpak
2010-02-24 11:22:45 +00:00
parent 61de922b9c
commit c9d2435ba8
4 changed files with 47 additions and 21 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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;