* DefaultUnicode2AnsiMove, DefaultAnsi2UnicodeMove: replaced indexed access to destination string by pointer access, this eliminates numerous unnecessary calls to fpc_xxxstring_unique.

git-svn-id: trunk@16233 -
This commit is contained in:
sergei 2010-10-27 18:49:52 +00:00
parent 791cb74f22
commit f2260c1549

View File

@ -48,7 +48,7 @@ Const
{
Default UnicodeChar <-> Char conversion is to only convert the
lower 127 chars, all others are translated to spaces.
lower 127 chars, all others are translated to '?'.
These routines can be overwritten for the Current Locale
}
@ -56,15 +56,18 @@ Const
procedure DefaultUnicode2AnsiMove(source:punicodechar;var dest:ansistring;len:SizeInt);
var
i : SizeInt;
p : PAnsiChar;
begin
setlength(dest,len);
p:=pointer(dest); {SetLength guarantees that dest is unique}
for i:=1 to len do
begin
if word(source^)<256 then
dest[i]:=char(word(source^))
p^:=char(word(source^))
else
dest[i]:='?';
p^:='?';
inc(source);
inc(p);
end;
end;
@ -72,12 +75,15 @@ end;
procedure DefaultAnsi2UnicodeMove(source:pchar;var dest:unicodestring;len:SizeInt);
var
i : SizeInt;
p : PUnicodeChar;
begin
setlength(dest,len);
p:=pointer(dest); {SetLength guarantees that dest is unique}
for i:=1 to len do
begin
dest[i]:=unicodechar(byte(source^));
p^:=unicodechar(byte(source^));
inc(source);
inc(p);
end;
end;