mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-28 18:49:43 +02:00
lazutils: paswstring: EnsureAnsiLen grow faster
git-svn-id: trunk@47089 -
This commit is contained in:
parent
b7d22a3843
commit
302870da38
@ -89,13 +89,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure EnsureAnsiLen(var S: AnsiString; const len: SizeInt); inline;
|
procedure EnsureAnsiLen(var S: AnsiString; const len: SizeInt); inline;
|
||||||
|
var
|
||||||
|
l: SizeUInt;
|
||||||
begin
|
begin
|
||||||
{$ifdef PASWSTRING_VERBOSE}WriteLn('EnsureAnsiLen START');{$endif}
|
{$ifdef PASWSTRING_VERBOSE}WriteLn('EnsureAnsiLen START');{$endif}
|
||||||
if (len>length(s)) then
|
l:=length(s);
|
||||||
if (length(s) < 10*256) then
|
if (len>l) then
|
||||||
setlength(s,length(s)+10)
|
if (l < 128) then
|
||||||
|
setlength(s,l+8)
|
||||||
else
|
else
|
||||||
setlength(s,length(s)+length(s) shr 8);
|
setlength(s,l+l shr 8);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -109,7 +112,7 @@ end;
|
|||||||
|
|
||||||
function LowerAnsiString(const s : AnsiString) : AnsiString;
|
function LowerAnsiString(const s : AnsiString) : AnsiString;
|
||||||
var
|
var
|
||||||
Str: utf8string;
|
Str: string;
|
||||||
begin
|
begin
|
||||||
{$ifdef PASWSTRING_VERBOSE}WriteLn('LowerAnsiString START');{$endif}
|
{$ifdef PASWSTRING_VERBOSE}WriteLn('LowerAnsiString START');{$endif}
|
||||||
Str := SysToUTF8(s);
|
Str := SysToUTF8(s);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user