From 9ecfab59a4f59046edbd533c4ec906d930c83a67 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 8 Sep 1999 01:27:51 +0000 Subject: [PATCH] 19990908-03:14 GMT+1 --- harbour/ChangeLog | 8 ++++++++ harbour/source/rtl/arrays.c | 4 +++- harbour/source/rtl/transfrm.c | 2 ++ harbour/tests/working/rtl_test.prg | 33 ++++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 7c02b20ae6..dee0787cc4 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,11 @@ +19990908-03:14 GMT+1 Victor Szel + * tests/working/rtl_test.prg + + Some ==/= tests added for strings. + * source/rtl/arrays.c + ! hb_arrayScan(). Fixed a string comparison bug. + * source/rtl/transform.c + + TOFIX added about a directly modified item string buffer. + 19990908-02:30 GMT+1 Victor Szel * source/rtl/math.c source/rtl/strings.c diff --git a/harbour/source/rtl/arrays.c b/harbour/source/rtl/arrays.c index a8e7c87652..56b9993aca 100644 --- a/harbour/source/rtl/arrays.c +++ b/harbour/source/rtl/arrays.c @@ -415,7 +415,9 @@ ULONG hb_arrayScan( PHB_ITEM pArray, PHB_ITEM pValue, ULONG ulStart, ULONG ulCou { PHB_ITEM pItem = pBaseArray->pItems + ulStart; - if( IS_STRING( pItem ) && hb_itemStrCmp( pValue, pItem, FALSE ) == 0 ) + /* NOTE: The order of the pItem and pValue parameters passed to + hb_itemStrCmp() is significant, please don't change it. */ + if( IS_STRING( pItem ) && hb_itemStrCmp( pItem, pValue, FALSE ) == 0 ) return ulStart + 1; } } diff --git a/harbour/source/rtl/transfrm.c b/harbour/source/rtl/transfrm.c index 8ccc63fc3a..b4c98f1415 100644 --- a/harbour/source/rtl/transfrm.c +++ b/harbour/source/rtl/transfrm.c @@ -36,6 +36,8 @@ /* TODO: Getting rid of calling back HARBOUR HB_STR() function */ /* and #include "ctoharb.h" */ +/* TOFIX: TRANSFORM() is directly modifying an item string buffer. + This is dangerous, and should be fixed. */ #include #include "extend.h" diff --git a/harbour/tests/working/rtl_test.prg b/harbour/tests/working/rtl_test.prg index 41324b9b08..d125c679a4 100644 --- a/harbour/tests/working/rtl_test.prg +++ b/harbour/tests/working/rtl_test.prg @@ -454,6 +454,39 @@ STATIC FUNCTION Main_HVM() TEST_LINE( scString > 1 , "E BASE 1075 Argument error > F:S" ) TEST_LINE( scString >= 1 , "E BASE 1076 Argument error >= F:S" ) TEST_LINE( scString <> 1 , "E BASE 1072 Argument error <> F:S" ) + + SET EXACT ON + TEST_LINE( "123" = "123 " , .T. ) + TEST_LINE( " 123" = "123" , .F. ) + TEST_LINE( "123" = "12345" , .F. ) + TEST_LINE( "12345" = "123" , .F. ) + TEST_LINE( "123" = "" , .F. ) + TEST_LINE( "" = "123" , .F. ) + TEST_LINE( "A" == "A" , .T. ) + TEST_LINE( "Z" == "A" , .F. ) + TEST_LINE( "A" == "A " , .F. ) + TEST_LINE( "AA" == "A" , .F. ) + SET EXACT OFF + TEST_LINE( "123" = "123 " , .F. ) + TEST_LINE( " 123" = "123" , .F. ) + TEST_LINE( "123" = "12345" , .F. ) + TEST_LINE( "12345" = "123" , .T. ) + TEST_LINE( "123" = "" , .T. ) + TEST_LINE( "" = "123" , .F. ) + TEST_LINE( "A" == "A" , .T. ) + TEST_LINE( "Z" == "A" , .F. ) + TEST_LINE( "A" == "A " , .F. ) + TEST_LINE( "AA" == "A" , .F. ) + TEST_LINE( scString = scString , .T. ) + TEST_LINE( scString = scStringE , .T. ) + TEST_LINE( scString = scStringZ , .F. ) + TEST_LINE( scStringE = scString , .F. ) + TEST_LINE( scStringE = scStringE , .T. ) + TEST_LINE( scStringE = scStringZ , .F. ) + TEST_LINE( scStringZ = scString , .F. ) + TEST_LINE( scStringZ = scStringE , .T. ) + TEST_LINE( scStringZ = scStringZ , .T. ) + TEST_LINE( scString == 1 , "E BASE 1070 Argument error == F:S" ) TEST_LINE( soObject == soObject , .T. ) TEST_LINE( soObject = soObject , "E BASE 1071 Argument error = F:S" )