lazutils: optimized UTF8CStringToUTF8String

git-svn-id: trunk@34216 -
This commit is contained in:
mattias 2011-12-16 00:59:31 +00:00
parent a5cfbd31e2
commit 4b8a579110

View File

@ -538,7 +538,6 @@ var
Source: PChar;
Dest: PChar;
SourceEnd: PChar;
CharLen: integer;
SourceCopied: PChar;
// Copies from SourceStart till Source to Dest and updates Dest
@ -561,8 +560,7 @@ begin
Dest:=PChar(Result);
SourceEnd := Source + SourceLen;
while Source<SourceEnd do begin
CharLen := UTF8CharacterLength(Source);
if (CharLen=1) and (Source^='\') then begin
if (Source^='\') then begin
CopyPart;
inc(Source);
if Source^ in ['t', 'n', '"', '\'] then begin
@ -589,7 +587,7 @@ begin
SourceCopied := Source;
end
else
Inc(Source, CharLen);
Inc(Source, UTF8CharacterLength(Source));
end;
CopyPart;
SetLength(Result, Dest - PChar(Result));