lcl: fixed UCS2LEToUTF8 for 1byte niput, issue #33296

git-svn-id: trunk@57429 -
This commit is contained in:
mattias 2018-03-02 11:47:30 +00:00
parent 632758d660
commit 9b15983c25

View File

@ -5378,11 +5378,9 @@ var
i: Integer;
c: Word;
begin
if s='' then begin
Result:=s;
exit;
end;
len:=length(s) div 2;
if len=0 then
exit('');
SetLength(Result,len*3);// UTF-8 is at most 3/2 times the size
Src:=PWord(Pointer(s));
Dest:=PChar(Result);
@ -5410,11 +5408,9 @@ var
i: Integer;
c: Word;
begin
if s='' then begin
Result:=s;
exit;
end;
len:=length(s) div 2;
if len=0 then
exit('');
SetLength(Result,len*3);// UTF-8 is at most three times the size
Src:=PWord(Pointer(s));
Dest:=PChar(Result);