diff --git a/harbour/ChangeLog b/harbour/ChangeLog index af29f3635c..a0b7cbd2ee 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,14 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-05-29 20:38 UTC+0100 Viktor Szakats (harbour.01 syenar hu) + * source/rtl/dateshb.c + * source/rtl/datesx.c + % Reworked to be a bit faster than non-HB_FAST_STOD. + - Removed HB_FAST_STOD build time option, because it wasn't + safe. It caused reaching into undefined buffers when + passed string was shorter than 8 chars. + 2008-05-29 20:20 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * source/vm/hvm.c * Minor formatting. diff --git a/harbour/source/rtl/dateshb.c b/harbour/source/rtl/dateshb.c index ad3954ffeb..7a42c887d3 100644 --- a/harbour/source/rtl/dateshb.c +++ b/harbour/source/rtl/dateshb.c @@ -204,11 +204,9 @@ HB_FUNC( DTOS ) HB_FUNC( HB_STOD ) { -#ifdef HB_FAST_STOD - hb_retds( hb_parc( 1 ) ); -#else - hb_retds( hb_parclen( 1 ) >= 7 ? hb_parc( 1 ) : NULL ); -#endif + PHB_ITEM pDateString = hb_param( 1, HB_IT_STRING ); + + hb_retds( hb_itemGetCLen( pDateString ) >= 7 ? hb_itemGetCPtr( pDateString ) : NULL ); } HB_FUNC( YEAR ) diff --git a/harbour/source/rtl/datesx.c b/harbour/source/rtl/datesx.c index 2076d36295..1c8439862b 100644 --- a/harbour/source/rtl/datesx.c +++ b/harbour/source/rtl/datesx.c @@ -51,6 +51,7 @@ */ #include "hbapi.h" +#include "hbapiitm.h" #ifdef HB_COMPAT_XPP @@ -59,12 +60,9 @@ HB_FUNC( STOD ) { -#ifdef HB_FAST_STOD - hb_retds( hb_parc( 1 ) ); -#else - hb_retds( hb_parclen( 1 ) >= 7 ? hb_parc( 1 ) : NULL ); -#endif + PHB_ITEM pDateString = hb_param( 1, HB_IT_STRING ); + + hb_retds( hb_itemGetCLen( pDateString ) >= 7 ? hb_itemGetCPtr( pDateString ) : NULL ); } #endif -