AlexeyT via Lazarus
2018-05-03 19:15:31 UTC
procedure InternalUTF8ToCP(const s: string; TargetCodePage: TSystemCodePage;
SetTargetCodePage: boolean;
const UTF8CharConvFunc: TUnicodeToCharID;
out TheResult: RawByteString); inline;
begin
if not Assigned(UTF8CharConvFunc) then
begin
TheResult:=s;
SetCodePage(TheResult, TargetCodePage, True);
if not SetTargetCodePage then
SetCodePage(TheResult, CP_ACP, False);
end else begin
TheResult:=UTF8ToSingleByte(s,UTF8CharConvFunc);
if SetTargetCodePage then
SetCodePage(TheResult, TargetCodePage, False);
end;
end;
Func is complex, why it's inline?
SetTargetCodePage: boolean;
const UTF8CharConvFunc: TUnicodeToCharID;
out TheResult: RawByteString); inline;
begin
if not Assigned(UTF8CharConvFunc) then
begin
TheResult:=s;
SetCodePage(TheResult, TargetCodePage, True);
if not SetTargetCodePage then
SetCodePage(TheResult, CP_ACP, False);
end else begin
TheResult:=UTF8ToSingleByte(s,UTF8CharConvFunc);
if SetTargetCodePage then
SetCodePage(TheResult, TargetCodePage, False);
end;
end;
Func is complex, why it's inline?
--
Regards,
Alexey
--
Regards,
Alexey
--