mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-08 22:29:39 +01:00
* fixed fpc_WideStr_Concat in case when strings the same.
git-svn-id: trunk@5964 -
This commit is contained in:
parent
36ea8ec683
commit
4f5c8cfe1f
@ -454,6 +454,7 @@ end;
|
|||||||
procedure fpc_WideStr_Concat (var DestS:Widestring;const S1,S2 : WideString); compilerproc;
|
procedure fpc_WideStr_Concat (var DestS:Widestring;const S1,S2 : WideString); compilerproc;
|
||||||
Var
|
Var
|
||||||
Size,Location : SizeInt;
|
Size,Location : SizeInt;
|
||||||
|
same : boolean;
|
||||||
begin
|
begin
|
||||||
{ only assign if s1 or s2 is empty }
|
{ only assign if s1 or s2 is empty }
|
||||||
if (S1='') then
|
if (S1='') then
|
||||||
@ -471,7 +472,11 @@ begin
|
|||||||
{ Use Pointer() typecasts to prevent extra conversion code }
|
{ Use Pointer() typecasts to prevent extra conversion code }
|
||||||
if Pointer(DestS)=Pointer(S1) then
|
if Pointer(DestS)=Pointer(S1) then
|
||||||
begin
|
begin
|
||||||
|
same:=Pointer(S1)=Pointer(S2);
|
||||||
SetLength(DestS,Size+Location);
|
SetLength(DestS,Size+Location);
|
||||||
|
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));
|
Move(Pointer(S2)^,(Pointer(DestS)+Location*sizeof(WideChar))^,(Size+1)*sizeof(WideChar));
|
||||||
end
|
end
|
||||||
else if Pointer(DestS)=Pointer(S2) then
|
else if Pointer(DestS)=Pointer(S2) then
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user