mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-23 20:19:42 +01:00
lcl: fixed UCS2LEToUTF8 for 1byte niput, issue #33296
git-svn-id: branches/fixes_1_8@57430 -
This commit is contained in:
parent
ab12f46cb0
commit
4c3a1761da
@ -5378,11 +5378,9 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
c: Word;
|
c: Word;
|
||||||
begin
|
begin
|
||||||
if s='' then begin
|
|
||||||
Result:=s;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
len:=length(s) div 2;
|
len:=length(s) div 2;
|
||||||
|
if len=0 then
|
||||||
|
exit('');
|
||||||
SetLength(Result,len*3);// UTF-8 is at most 3/2 times the size
|
SetLength(Result,len*3);// UTF-8 is at most 3/2 times the size
|
||||||
Src:=PWord(Pointer(s));
|
Src:=PWord(Pointer(s));
|
||||||
Dest:=PChar(Result);
|
Dest:=PChar(Result);
|
||||||
@ -5410,11 +5408,9 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
c: Word;
|
c: Word;
|
||||||
begin
|
begin
|
||||||
if s='' then begin
|
|
||||||
Result:=s;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
len:=length(s) div 2;
|
len:=length(s) div 2;
|
||||||
|
if len=0 then
|
||||||
|
exit('');
|
||||||
SetLength(Result,len*3);// UTF-8 is at most three times the size
|
SetLength(Result,len*3);// UTF-8 is at most three times the size
|
||||||
Src:=PWord(Pointer(s));
|
Src:=PWord(Pointer(s));
|
||||||
Dest:=PChar(Result);
|
Dest:=PChar(Result);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user