From 110879a47a554f6b664ae5ec5c8555c39030c8d5 Mon Sep 17 00:00:00 2001 From: "Alexander S.Kresin" Date: Thu, 30 Jan 2003 19:10:08 +0000 Subject: [PATCH] 2003-01-30 22:10 UTC+0300 Alexander Kresin --- harbour/ChangeLog | 4 ++++ harbour/source/vm/asort.c | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2719cb1cb5..951d024cca 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,10 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ +2003-01-30 22:10 UTC+0300 Alexander Kresin + * source/vm/asort.c + ! Some fixes, which became necessary after optimization of string operations. + 2003-01-29 22:05 UTC+0300 Alexander Kresin * include/hberrors.h * include/hbpcode.h diff --git a/harbour/source/vm/asort.c b/harbour/source/vm/asort.c index e741ccdbe6..3186e510fa 100644 --- a/harbour/source/vm/asort.c +++ b/harbour/source/vm/asort.c @@ -117,8 +117,14 @@ static LONG hb_arraySortQuickPartition( PHB_ITEM pItems, LONG lb, LONG ub, PHB_I #ifdef HB_ASORT_OPT_ITEMCOPY memcpy( &pivot, pItems + p, sizeof( HB_ITEM ) ); + if( HB_IS_STRING( &pivot ) && (&pivot)->item.asString.bStatic < 0 ) + (&pivot)->item.asString.value = (&pivot)->item.asString.u.value; if( p != lb ) + { memcpy( pItems + p, pItems + lb, sizeof( HB_ITEM ) ); + if( HB_IS_STRING( pItems + p ) && (pItems + p)->item.asString.bStatic < 0 ) + (pItems + p)->item.asString.value = (pItems + p)->item.asString.u.value; + } #else hb_itemInit( &pivot ); hb_itemCopy( &pivot, pItems + p ); @@ -184,6 +190,10 @@ static LONG hb_arraySortQuickPartition( PHB_ITEM pItems, LONG lb, LONG ub, PHB_I memcpy( &temp, pItems + j, sizeof( HB_ITEM ) ); memcpy( pItems + j, pItems + i, sizeof( HB_ITEM ) ); memcpy( pItems + i, &temp, sizeof( HB_ITEM ) ); + if( HB_IS_STRING( pItems + i ) && (pItems + i)->item.asString.bStatic < 0 ) + (pItems + i)->item.asString.value = (pItems + i)->item.asString.u.value; + if( HB_IS_STRING( pItems + j ) && (pItems + j)->item.asString.bStatic < 0 ) + (pItems + j)->item.asString.value = (pItems + j)->item.asString.u.value; #else hb_itemInit( &temp ); hb_itemCopy( &temp, pItems + j ); @@ -200,8 +210,14 @@ static LONG hb_arraySortQuickPartition( PHB_ITEM pItems, LONG lb, LONG ub, PHB_I /* pivot belongs in pItems[j] */ #ifdef HB_ASORT_OPT_ITEMCOPY if( lb != j ) + { memcpy( pItems + lb, pItems + j, sizeof( HB_ITEM ) ); + if( HB_IS_STRING( pItems + lb ) && (pItems + lb)->item.asString.bStatic < 0 ) + (pItems + lb)->item.asString.value = (pItems + lb)->item.asString.u.value; + } memcpy( pItems + j, &pivot, sizeof( HB_ITEM ) ); + if( HB_IS_STRING( pItems + j ) && (pItems + j)->item.asString.bStatic < 0 ) + (pItems + j)->item.asString.value = (pItems + j)->item.asString.u.value; #else if( lb != j ) hb_itemCopy( pItems + lb, pItems + j );