mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 18:09:30 +02:00
* 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:
parent
791cb74f22
commit
f2260c1549
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user