From e0533fd35398d33719613e8ad2a660dec02b56f3 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Wed, 27 Jun 2007 17:00:34 +0000 Subject: [PATCH] 2007-06-27 19:00 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/common.mak ! removed double quotas from files extension definitions Neither Borland make nor NMake can accept them, sorry my fault but I used to work with GNU make * harbour/makefile.vc - removed recently added by J. Lefebvre Mafact alternative verion of file extnesions. Thank you for your help but it was my mistake and the default definitions in common.mak should not use quotas * harbour/source/rtl/datesx.c * harbour/source/common/hbdate.c * accept date strings longer then 8 characters in STOD() just like in CT3 * changed casting in date decoding code to be strict Clipper compatible and cover date string validation by HB_C52_STRICT macro. Now STOD() can give _EXACTLY_ the same results as Clipper for wrong date strings if you disable code covered by #ifndef HB_C52_STRICT in hb_dateStrGet(). It fixes errors reported by hbtest in: stod("19 90905") -> "17490905" stod("199 0905") -> "19740905" but I do not know if you want to have it as default. * harbour/source/rtl/gtsln/gtsln.c ! fixed variable declaration to be ANSI C compatible --- harbour/ChangeLog | 28 ++++++++++++++++++++++++++-- harbour/common.mak | 10 +++++----- harbour/makefile.vc | 23 ----------------------- harbour/source/common/hbdate.c | 21 ++++++++++++++++----- harbour/source/rtl/datesx.c | 2 +- harbour/source/rtl/gtsln/gtsln.c | 18 ++++++++++-------- 6 files changed, 58 insertions(+), 44 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2d06139763..eb53fa7f8f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,13 +8,37 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ -2007-06-27 16:00 UTC+0200 J. Lefebvre Mafact (jfl/at/mafact.com) +2007-06-27 19:00 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/common.mak + ! removed double quotas from files extension definitions + Neither Borland make nor NMake can accept them, sorry my + fault but I used to work with GNU make + * harbour/makefile.vc + - removed recently added by J. Lefebvre Mafact alternative verion + of file extnesions. Thank you for your help but it was my mistake + and the default definitions in common.mak should not use quotas + * harbour/source/rtl/datesx.c + * harbour/source/common/hbdate.c + * accept date strings longer then 8 characters in STOD() just like + in CT3 + * changed casting in date decoding code to be strict Clipper compatible + and cover date string validation by HB_C52_STRICT macro. + Now STOD() can give _EXACTLY_ the same results as Clipper for wrong + date strings if you disable code covered by #ifndef HB_C52_STRICT + in hb_dateStrGet(). It fixes errors reported by hbtest in: + stod("19 90905") -> "17490905" + stod("199 0905") -> "19740905" + but I do not know if you want to have it as default. + + * harbour/source/rtl/gtsln/gtsln.c + ! fixed variable declaration to be ANSI C compatible + +2007-06-27 16:00 UTC+0200 J. Lefebvre Mafact (jfl/at/mafact.com) * harbour/makefile.vc * Setting file extensions variables without double quotes for nmake Will overide those in common.mak - 2007-06-27 10:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/rtl/hbgtcore.c * harbour/source/rtl/gtdos/gtdos.c diff --git a/harbour/common.mak b/harbour/common.mak index ab3bddc654..28c31c86c0 100644 --- a/harbour/common.mak +++ b/harbour/common.mak @@ -21,23 +21,23 @@ # binary file suffixes and prefixes # !ifndef OBJEXT -OBJEXT=".obj" +OBJEXT=.obj !endif !ifndef EXEEXT -EXEEXT=".exe" +EXEEXT=.exe !endif !ifndef DLLEXT -DLLEXT=".dll" +DLLEXT=.dll !endif !ifndef LIBEXT -LIBEXT=".lib" +LIBEXT=.lib !endif !ifndef LIBPREF -LIBPREF="" +LIBPREF= !endif #********************************************************** diff --git a/harbour/makefile.vc b/harbour/makefile.vc index 8acafdad8b..7c0ce6fa3f 100644 --- a/harbour/makefile.vc +++ b/harbour/makefile.vc @@ -149,29 +149,6 @@ LDFLAGSDLL = /DEBUG $(LDFLAGSDLL) # Include Common Object list files # shared between Msvc and Borland -# -# binary file suffixes and prefixes for nMake !!! -# -!ifndef OBJEXT -OBJEXT=.obj -!endif - -!ifndef EXEEXT -EXEEXT=.exe -!endif - -!ifndef DLLEXT -DLLEXT=.dll -!endif - -!ifndef LIBEXT -LIBEXT=.lib -!endif - -!ifndef LIBPREF -LIBPREF= -!endif - !include common.mak #********************************************************** diff --git a/harbour/source/common/hbdate.c b/harbour/source/common/hbdate.c index b74d877bfa..d21b97cf68 100644 --- a/harbour/source/common/hbdate.c +++ b/harbour/source/common/hbdate.c @@ -166,16 +166,26 @@ HB_EXPORT void hb_dateStrGet( const char * szDate, int * piYear, int * piMonth, { HB_TRACE(HB_TR_DEBUG, ("hb_dateStrGet(%s, %p, %p, %p)", szDate, piYear, piMonth, piDay)); - if( szDate && szDate[ 8 ] == '\0' ) +#if !defined( HB_C52_STRICT ) + if( szDate[ 0 ] >= '0' && szDate[ 0 ] <= '9' && + szDate[ 1 ] >= '0' && szDate[ 1 ] <= '9' && + szDate[ 2 ] >= '0' && szDate[ 2 ] <= '9' && + szDate[ 3 ] >= '0' && szDate[ 3 ] <= '9' && + szDate[ 4 ] >= '0' && szDate[ 4 ] <= '9' && + szDate[ 5 ] >= '0' && szDate[ 5 ] <= '9' && + szDate[ 6 ] >= '0' && szDate[ 6 ] <= '9' && + szDate[ 7 ] >= '0' && szDate[ 7 ] <= '9' ) +#endif { /* Date string has correct length, so attempt to convert */ - *piYear = ( ( USHORT ) ( szDate[ 0 ] - '0' ) * 1000 ) + - ( ( USHORT ) ( szDate[ 1 ] - '0' ) * 100 ) + - ( ( USHORT ) ( szDate[ 2 ] - '0' ) * 10 ) + - ( USHORT ) ( szDate[ 3 ] - '0' ); + *piYear = ( ( int ) ( szDate[ 0 ] - '0' ) * 1000 ) + + ( ( int ) ( szDate[ 1 ] - '0' ) * 100 ) + + ( ( int ) ( szDate[ 2 ] - '0' ) * 10 ) + + ( int ) ( szDate[ 3 ] - '0' ); *piMonth = ( ( szDate[ 4 ] - '0' ) * 10 ) + ( szDate[ 5 ] - '0' ); *piDay = ( ( szDate[ 6 ] - '0' ) * 10 ) + ( szDate[ 7 ] - '0' ); } +#if !defined( HB_C52_STRICT ) else { /* Date string missing or bad length, so force an empty date */ @@ -183,6 +193,7 @@ HB_EXPORT void hb_dateStrGet( const char * szDate, int * piYear, int * piMonth, *piMonth = *piDay = 0; } +#endif } /* This function always closes the date with a zero byte, so it needs a diff --git a/harbour/source/rtl/datesx.c b/harbour/source/rtl/datesx.c index a1f5d1f8f4..deb97e9681 100644 --- a/harbour/source/rtl/datesx.c +++ b/harbour/source/rtl/datesx.c @@ -62,7 +62,7 @@ HB_FUNC( STOD ) #ifdef HB_FAST_STOD hb_retds( hb_parc( 1 ) ); #else - hb_retds( hb_parclen( 1 ) == 8 ? hb_parc( 1 ) : " " ); + hb_retds( hb_parclen( 1 ) >= 8 ? hb_parc( 1 ) : " " ); #endif } diff --git a/harbour/source/rtl/gtsln/gtsln.c b/harbour/source/rtl/gtsln/gtsln.c index 37b2725a17..5b4e42b4c1 100644 --- a/harbour/source/rtl/gtsln/gtsln.c +++ b/harbour/source/rtl/gtsln/gtsln.c @@ -910,18 +910,20 @@ static BOOL hb_gt_sln_SetDispCP( char * pszTermCDP, char * pszHostCDP, BOOL fBox HB_GTSUPER_SETDISPCP( pszTermCDP, pszHostCDP, fBox ); #ifndef HB_CDP_SUPPORT_OFF - PHB_CODEPAGE cdpTerm = NULL, cdpHost = NULL; + { + PHB_CODEPAGE cdpTerm = NULL, cdpHost = NULL; - cdpHost = hb_cdpFind( pszHostCDP ); - if ( pszHostCDP && *pszHostCDP ) cdpHost = hb_cdpFind( pszHostCDP ); - if ( ! cdpHost ) - cdpHost = hb_cdp_page; + if ( pszHostCDP && *pszHostCDP ) + cdpHost = hb_cdpFind( pszHostCDP ); + if ( ! cdpHost ) + cdpHost = hb_cdp_page; - if ( pszTermCDP && *pszTermCDP ) - cdpTerm = hb_cdpFind( pszTermCDP ); + if ( pszTermCDP && *pszTermCDP ) + cdpTerm = hb_cdpFind( pszTermCDP ); - hb_sln_setCharTrans( cdpHost, cdpTerm, fBox ); + hb_sln_setCharTrans( cdpHost, cdpTerm, fBox ); + } #endif return TRUE; }