From 4f5c8cfe1f5fe825cfdb220d7fd8bed4727a985f Mon Sep 17 00:00:00 2001 From: yury Date: Sun, 14 Jan 2007 01:20:16 +0000 Subject: [PATCH] * fixed fpc_WideStr_Concat in case when strings the same. git-svn-id: trunk@5964 - --- rtl/inc/wstrings.inc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rtl/inc/wstrings.inc b/rtl/inc/wstrings.inc index 0352bbb737..d302cd066e 100644 --- a/rtl/inc/wstrings.inc +++ b/rtl/inc/wstrings.inc @@ -454,6 +454,7 @@ end; procedure fpc_WideStr_Concat (var DestS:Widestring;const S1,S2 : WideString); compilerproc; Var Size,Location : SizeInt; + same : boolean; begin { only assign if s1 or s2 is empty } if (S1='') then @@ -471,8 +472,12 @@ begin { Use Pointer() typecasts to prevent extra conversion code } if Pointer(DestS)=Pointer(S1) then begin + same:=Pointer(S1)=Pointer(S2); SetLength(DestS,Size+Location); - Move(Pointer(S2)^,(Pointer(DestS)+Location*sizeof(WideChar))^,(Size+1)*sizeof(WideChar)); + if same then + Move(Pointer(DestS)^,(Pointer(DestS)+Location*sizeof(WideChar))^,(Size)*sizeof(WideChar)) + else + Move(Pointer(S2)^,(Pointer(DestS)+Location*sizeof(WideChar))^,(Size+1)*sizeof(WideChar)); end else if Pointer(DestS)=Pointer(S2) then begin