File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -514,36 +514,32 @@ function base64decode(s:ansistring):ansistring;
514514
515515function validUTF8 (s:rawbytestring):boolean;
516516var
517- i, bits , len: integer;
517+ i, more , len: integer;
518518 c: byte;
519519begin
520- c:=0 ;
521- bits:=0 ;
522520len:=length(s);
523521i:=0 ;
524522while i < len do
525523 begin
526524 inc(i);
527525 c:=ord(s[i]);
528- if c < 128 then
526+ if c < $ 80 then
529527 continue;
530- if c >= 254 then
528+ if c >= $FE then
531529 exit(FALSE);
532- if c >= 252 then bits:=6
533- else if c >= 248 then bits:=5
534- else if c >= 240 then bits:=4
535- else if c >= 224 then bits:=3
536- else if c >= 192 then bits:=2
530+ if c >= $F0 then more:=3
531+ else if c >= $E0 then more:=2
532+ else if c >= $C0 then more:=1
537533 else exit(FALSE);
538- if (i+bits > len) then
534+ if i+more > len then
539535 exit(FALSE);
540- while bits > 1 do
536+ while more > 0 do
541537 begin
542538 inc(i);
543539 c:=ord(s[i]);
544- if (c < 128 ) or (c > 191 ) then
540+ if (c < $ 80 ) or (c > $C0 ) then
545541 exit(FALSE);
546- dec(bits );
542+ dec(more );
547543 end ;
548544 end ;
549545result:=TRUE;
Original file line number Diff line number Diff line change @@ -2062,7 +2062,8 @@ function getStr(from, to_:pchar):string;
20622062 end ;
20632063l:=to_-from+1 ;
20642064setLength(result, l);
2065- if l > 0 then strLcopy(@result[1 ], from, l);
2065+ if l > 0 then
2066+ strLcopy(@result[1 ], from, l);
20662067end ; // getStr
20672068
20682069function poss (chars:TcharSet; s:string; ofs:integer=1 ):integer;
You can’t perform that action at this time.
0 commit comments