[fpc-pascal] FPC 3.2fixes UTF8Decode strange place
AlexeyT
aaa5500 at ya.ru
Tue Oct 27 21:25:48 CET 2020
rtl/inc/ustrings.inc
function UTF8ToUnicode(Dest: PUnicodeChar; MaxDestChars: SizeUInt;
Source: PChar; SourceBytes: SizeUInt): SizeUInt;
a) it has "If (PreChar<>13) and FALSE then" and later some big block.
with a comment which tells that "and FALSE" is on purpose and block is
ignored. ?????
b) after I removed "that block" I got such trimmed src
while (OutputUnicode<MaxDestChars) and (InputUTF8<SourceBytes) do
begin
IBYTE:=byte(Source[InputUTF8]);
if (IBYTE and $80) = 0 then
begin
//One character US-ASCII, convert it to unicode
if IBYTE = 10 then
begin
Dest[OutputUnicode]:=WideChar(IBYTE);
inc(OutputUnicode);
PreChar:=IBYTE;
end
else
begin
Dest[OutputUnicode]:=WideChar(IBYTE);
inc(OutputUnicode);
PreChar:=IBYTE;
end;
inc(InputUTF8);
here we have 2 identical small blocks after "if IBYTE=10". ?????
Alexey Torgashin
More information about the fpc-pascal
mailing list