From 66de9d307791de3557e9066adb2fce4375311996 Mon Sep 17 00:00:00 2001 From: Eddie Runia Date: Sun, 16 May 1999 00:03:13 +0000 Subject: [PATCH] arraySize and arrayLen bug fixed --- harbour/ChangeLog | 5 +++++ harbour/include/extend.h | 2 +- harbour/source/rtl/arrays.c | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 8054521ef6..0a8ef3f01a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,8 @@ +19990516-01:00 CET Eddie Runia + * source/rtl/arrays.c, source/rtl/extend.h + ULONG instead of int hb_arrayLen() + Reallocation bug in arrayAdd fixed + 19990515-19:40 CET Eddie Runia * source/rtl/classes.c, source/rtl/arrays.c oClone added (actually : aClone can handle both :-) diff --git a/harbour/include/extend.h b/harbour/include/extend.h index e21dd309ac..8bd39b316a 100644 --- a/harbour/include/extend.h +++ b/harbour/include/extend.h @@ -143,7 +143,7 @@ void ItemRelease( PITEM pItem ); void hb_arrayNew( PITEM pItem, ULONG ulLen ); /* creates a new array */ void hb_arrayGet( PITEM pArray, ULONG ulIndex, PITEM pItem ); /* retrieves an item */ -int hb_arrayLen( PITEM pArray ); /* retrives the array len */ +ULONG hb_arrayLen( PITEM pArray ); /* retrives the array len */ void hb_arraySet( PITEM pArray, ULONG ulIndex, PITEM pItem ); /* sets an array element */ void hb_arraySize( PITEM pArray, ULONG ulLen ); /* sets the array total length */ void hb_arrayRelease( PITEM pArray ); /* releases an array - don't call it - use ItemRelease() !!! */ diff --git a/harbour/source/rtl/arrays.c b/harbour/source/rtl/arrays.c index fcd4c48f2f..a21265f14d 100644 --- a/harbour/source/rtl/arrays.c +++ b/harbour/source/rtl/arrays.c @@ -45,6 +45,7 @@ void hb_arrayAdd( PITEM pArray, PITEM pValue ) { PBASEARRAY pBaseArray = ( PBASEARRAY ) pArray->value.pBaseArray; hb_arraySize( pArray, pBaseArray->ulLen + 1 ); + pBaseArray = ( PBASEARRAY ) pArray->value.pBaseArray; ItemCopy( pBaseArray->pItems + ( pBaseArray->ulLen - 1 ), pValue ); } @@ -162,7 +163,7 @@ void hb_arrayLast( PITEM pArray, PITEM pResult ) ItemRelease( pResult ); } -int hb_arrayLen( PITEM pArray ) +ULONG hb_arrayLen( PITEM pArray ) { if( IS_ARRAY( pArray ) ) return ( ( PBASEARRAY ) pArray->value.pBaseArray )->ulLen;