2008-10-22 17:45 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/bin/hbmk.bat
    * simple modification to make beginning hbmk parameters (-mt and -gui)
      position independent though they still have to be used before Harbour/
      C compiler switches and filenames

  * harbour/source/common/hbdate.c
  * harbour/source/compiler/cmdcheck.c
  * harbour/source/rtl/filesys.c
  * harbour/source/rtl/hbffind.c
    ! use MT safe localtime_r() function if it's available instead of
      localtime()
      TODO: clean the usage of this function and gmttime[_r]() probably
      by adding our own wrappers.

  * harbour/source/rtl/hbffind.c
    ! disabled calls to tzset() - this function should be executed
      automatically by CRTL only if it's necessary. It's also not MT
      safe and can cause MT applications crash.
This commit is contained in:
Przemyslaw Czerpak
2008-10-22 15:45:36 +00:00
parent cadb6c1631
commit 47ed35ee5c
6 changed files with 53 additions and 21 deletions

View File

@@ -8,6 +8,26 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2008-10-22 17:45 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/bin/hbmk.bat
* simple modification to make beginning hbmk parameters (-mt and -gui)
position independent though they still have to be used before Harbour/
C compiler switches and filenames
* harbour/source/common/hbdate.c
* harbour/source/compiler/cmdcheck.c
* harbour/source/rtl/filesys.c
* harbour/source/rtl/hbffind.c
! use MT safe localtime_r() function if it's available instead of
localtime()
TODO: clean the usage of this function and gmttime[_r]() probably
by adding our own wrappers.
* harbour/source/rtl/hbffind.c
! disabled calls to tzset() - this function should be executed
automatically by CRTL only if it's necessary. It's also not MT
safe and can cause MT applications crash.
2008-10-22 17:07 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* bin/hbmk.bat
* Minor.

View File

@@ -31,16 +31,20 @@ if "%HB_INC_INSTALL%" == "" set HB_INC_INSTALL=%HB_INSTALL_PREFIX%\include
set _HB_USR_C=
set _HB_USR_L=
:REPEAT
set _HB_MT=%HB_MT%
if not "%1" == "-mt" goto NO_MT
set _HB_MT=yes
shift
goto REPEAT
:NO_MT
set _HB_GUI=%HB_GUI%
if not "%1" == "-gui" goto NO_GUI
set _HB_GUI=yes
shift
goto REPEAT
:NO_GUI
set _HBVM_LIB=hbvm

View File

@@ -268,7 +268,7 @@ HB_EXPORT void hb_dateToday( int * piYear, int * piMonth, int * piDay )
*piMonth = st.wMonth;
*piDay = st.wDay;
#elif defined( HB_OS_LINUX ) && !defined( __WATCOMC__ )
#elif defined( HB_OS_UNIX ) && _POSIX_C_SOURCE >= 199506L && !defined( HB_OS_DARWIN_5 )
time_t t;
struct tm st;
@@ -305,7 +305,7 @@ HB_EXPORT void hb_dateTimeStr( char * pszTime )
GetLocalTime( &st );
snprintf( pszTime, 9, "%02d:%02d:%02d", st.wHour, st.wMinute, st.wSecond );
}
#elif defined( HB_OS_LINUX ) && !defined( __WATCOMC__ )
#elif defined( HB_OS_UNIX ) && _POSIX_C_SOURCE >= 199506L && !defined( HB_OS_DARWIN_5 )
{
time_t t;
struct tm st;

View File

@@ -105,14 +105,14 @@ static ULONG PackDateTime( void )
time_t t;
struct tm *oTime;
#if defined( HB_OS_LINUX ) && !defined( __WATCOMC__ )
#if !defined( HB_OS_UNIX ) || _POSIX_C_SOURCE < 199506L || defined( HB_OS_DARWIN_5 )
time( &t );
oTime = localtime( &t );
#else
struct tm tm;
time( &t );
oTime = &tm;
localtime_r( &t, oTime );
#else
time( &t );
oTime = localtime( &t );
#endif
nValue = ( BYTE ) ( ( ( oTime->tm_year + 1900 ) - 1980 ) & ( 2 ^ 6 ) ); /* 6 bits */

View File

@@ -973,13 +973,17 @@ HB_EXPORT BOOL hb_fsGetFileTime( BYTE * pszFileName, LONG * plJulian, LONG * plM
if( stat( ( char * ) pszFileName, &sStat ) == 0 )
{
time_t ftime;
struct tm * ft;
struct tm ft;
ftime = sStat.st_mtime;
ft = localtime( &ftime );
# if _POSIX_C_SOURCE < 199506L || defined( HB_OS_DARWIN_5 )
ft = *localtime( &ftime );
# else
localtime_r( &ftime, &ft );
# endif
*plJulian = hb_dateEncode( ft->tm_year + 1900, ft->tm_mon + 1, ft->tm_mday );
*plMillisec = hb_timeStampEncode( ft->tm_hour, ft->tm_min, ft->tm_sec, 0 );
*plJulian = hb_dateEncode( ft.tm_year + 1900, ft.tm_mon + 1, ft.tm_mday );
*plMillisec = hb_timeStampEncode( ft.tm_hour, ft.tm_min, ft.tm_sec, 0 );
fResult = TRUE;
}

View File

@@ -448,7 +448,7 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind )
{
ffind->bFirst = FALSE;
tzset();
/* tzset(); */
#if defined(__WATCOMC__)
bFound = ( _dos_findfirst( ffind->pszFileMask, ( USHORT ) hb_fsAttrToRaw( ffind->attrmask ), &info->entry ) == 0 );
@@ -507,7 +507,7 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind )
{
ffind->bFirst = FALSE;
tzset();
/* tzset(); */
info->hFindFile = HDIR_CREATE;
info->findCount = 1;
@@ -685,7 +685,7 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind )
dirname[ 2 ] = '\0';
}
tzset();
/* tzset(); */
info->dir = opendir( dirname );
hb_strncpy( info->path, dirname, sizeof( info->path ) - 1 );
@@ -711,7 +711,7 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind )
hb_strncat( dirname, info->entry->d_name, sizeof( dirname ) - 1 );
{
time_t ftime;
struct tm * ft;
struct tm lt;
#if defined( HB_USE_LARGEFILE64 )
struct stat64 sStat;
if( stat64( dirname, &sStat ) == 0 )
@@ -726,15 +726,19 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind )
raw_attr = sStat.st_mode;
ftime = sStat.st_mtime;
ft = localtime( &ftime );
# if _POSIX_C_SOURCE < 199506L || defined( HB_OS_DARWIN_5 )
lt = *localtime( &ftime );
# else
localtime_r( &ftime, &lt );
# endif
nYear = ft->tm_year + 1900;
nMonth = ft->tm_mon + 1;
nDay = ft->tm_mday;
nYear = lt.tm_year + 1900;
nMonth = lt.tm_mon + 1;
nDay = lt.tm_mday;
nHour = ft->tm_hour;
nMin = ft->tm_min;
nSec = ft->tm_sec;
nHour = lt.tm_hour;
nMin = lt.tm_min;
nSec = lt.tm_sec;
}
else
bFound = FALSE;