diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 8de3d5123f..16553214ce 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,12 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-08-09 11:07 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * source/rtl/rat.c + ! HB_RAT() fixed to not ignore nEnd parameter if it's out of bound. + In such case it will now return zero ("not found"). + Mindaugas, please verify if this is what you proposed. + 2009-08-09 10:26 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/gtwvg/gtwvg.hbc ! Fixed missing incpaths= line. diff --git a/harbour/source/rtl/rat.c b/harbour/source/rtl/rat.c index d6ca9cc1e6..dcbe392126 100644 --- a/harbour/source/rtl/rat.c +++ b/harbour/source/rtl/rat.c @@ -76,11 +76,11 @@ HB_FUNC( RAT ) hb_retnl( bFound ? lPos + 2 : 0 ); } else - hb_retni( 0 ); + hb_retnl( 0 ); } else /* This function never seems to raise an error */ - hb_retni( 0 ); + hb_retnl( 0 ); } HB_FUNC( HB_RAT ) @@ -111,15 +111,10 @@ HB_FUNC( HB_RAT ) if( HB_ISNUM( 4 ) ) { - long lEnd = hb_parnl( 4 ); + long lEnd = hb_parnl( 4 ) - 1; - if( lEnd >= 1 ) - { - --lEnd; - - if( lEnd < lPos ) - lPos = lEnd; - } + if( lEnd < lPos ) + lPos = lEnd; } while( lPos >= lStart && !bFound ) @@ -132,9 +127,9 @@ HB_FUNC( HB_RAT ) hb_retnl( bFound ? lPos + 2 : 0 ); } else - hb_retni( 0 ); + hb_retnl( 0 ); } else /* This function never seems to raise an error */ - hb_retni( 0 ); + hb_retnl( 0 ); }