mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-31 12:40:36 +02:00
laz2_xml: clean up
git-svn-id: trunk@31742 -
This commit is contained in:
parent
15084b31ef
commit
4bb113358b
@ -759,8 +759,11 @@ begin
|
||||
h:=s;
|
||||
Tree.Add(Pointer(h));
|
||||
Pointer(h):=nil; // keep refcount
|
||||
end else
|
||||
//debugln(['TStringTree.ReplaceString NewString="',dbgstr(s),'"']);
|
||||
end else begin
|
||||
s:=AnsiString(Node.Data);
|
||||
//debugln(['TStringTree.ReplaceString OldString="',dbgstr(s),'"']);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TStringTree.CalcMemSize: PtrUInt;
|
||||
|
@ -166,7 +166,7 @@ const
|
||||
'-', '''', '(', ')', '+', ',', '.', '/', ':', '=', '?', ';', '!', '*',
|
||||
'#', '@', '$', '_', '%'];
|
||||
var
|
||||
{$IF SizeOf(DOMChar)<2}
|
||||
{$IFDEF UseUTF8}
|
||||
IsNameStartChar, IsNameChar: array[char] of boolean;
|
||||
{$ENDIF}
|
||||
|
||||
@ -527,6 +527,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFDEF UseUTF8}
|
||||
function WriteUTF8(u: cardinal; var OutBuf: DOMPChar; var OutCnt: Cardinal): boolean; inline;
|
||||
begin
|
||||
case u of
|
||||
@ -569,6 +570,7 @@ begin
|
||||
end;
|
||||
Result:=true;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function Decode_UCS2(Context: Pointer; InBuf: PChar; var InCnt: Cardinal; OutBuf: DOMPChar; var OutCnt: Cardinal): Integer; stdcall;
|
||||
{$IFDEF UseUTF8}
|
||||
@ -1684,7 +1686,7 @@ begin
|
||||
repeat
|
||||
if NameStartFlag then
|
||||
begin
|
||||
if {$IF SizeOf(DOMChar)=2}
|
||||
if {$IFDEF UseWideString}
|
||||
(Byte(p^) in NamingBitmap[FNamePages^[hi(Word(p^))]])
|
||||
{$ELSE}
|
||||
IsNameStartChar[p^]
|
||||
@ -1693,7 +1695,7 @@ begin
|
||||
begin
|
||||
Inc(p);
|
||||
end
|
||||
{$IF SizeOf(DOMChar)=2}
|
||||
{$IFDEF UseWideString}
|
||||
else if FXML11 and ((p^ >= #$D800) and (p^ <= #$DB7F) and
|
||||
(p[1] >= #$DC00) and (p[1] <= #$DFFF)) then
|
||||
begin
|
||||
@ -1711,7 +1713,7 @@ begin
|
||||
NameStartFlag := False;
|
||||
end;
|
||||
|
||||
{$IF SizeOf(DOMChar)=2}
|
||||
{$IFDEF UseWideString}
|
||||
if FXML11 then begin
|
||||
repeat
|
||||
if Byte(p^) in NamingBitmap[FNamePages^[$100+hi(Word(p^))]] then
|
||||
@ -3062,15 +3064,12 @@ begin
|
||||
repeat
|
||||
old := FBuf;
|
||||
repeat
|
||||
{$IF SizeOf(DOMChar)=2}
|
||||
{$IFDEF UseWideString}
|
||||
// skip common white spaces
|
||||
while FBuf^ in [' ',#9] do inc(FBuf);
|
||||
wc := FBuf^;
|
||||
//writeln('TXMLDecodingSource.SkipUntil ',ord(wc));
|
||||
if ((wc = #10) or (wc = #13)
|
||||
{$IF SizeOf(DOMChar)=2}
|
||||
or (FXML11Rules and ((wc = #$85) or (wc = #$2028)))
|
||||
{$ENDIF}
|
||||
) and (not AllowSpecialChars)
|
||||
then begin
|
||||
BufAppendChunk(ToFill, old, FBuf);
|
||||
@ -3083,17 +3082,12 @@ begin
|
||||
end
|
||||
else if (not AllowSpecialChars)
|
||||
and ( ((wc < #32) and (not ((wc = #0) and (FBuf >= FBufEnd))) and (wc <> #9))
|
||||
{$IF SizeOf(DOMChar)=2}
|
||||
or (wc > #$FFFD)
|
||||
{$ENDIF}
|
||||
or (FXML11Rules and (wc >= #$7F) and (wc <= #$9F)) )
|
||||
then
|
||||
FReader.FatalError('Invalid character')
|
||||
else if (wc=#0) and (FBuf < FBufEnd) then
|
||||
FReader.FatalError('Invalid #0 character');
|
||||
if {$IF SizeOf(DOMChar)=2}(wc < #255) and{$ENDIF}
|
||||
(Char(ord(wc)) in Delim)
|
||||
then
|
||||
if (Char(ord(wc)) in Delim) then
|
||||
Break;
|
||||
// the checks above filter away everything below #32 that isn't a whitespace
|
||||
if wc > #32 then
|
||||
@ -4219,12 +4213,12 @@ begin
|
||||
end;
|
||||
|
||||
procedure InitXMLRead;
|
||||
{$IF SizeOf(DOMChar)<2}
|
||||
{$IFDEF UseUTF8}
|
||||
var
|
||||
c: Char;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IF SizeOf(DOMChar)<2}
|
||||
{$IFDEF UseUTF8}
|
||||
for c:=low(char) to high(char) do begin
|
||||
IsNameStartChar[c]:=c in ['A'..'Z','a'..'z','_',#128..#255];
|
||||
IsNameChar[c]:=c in ['A'..'Z','a'..'z','_','0'..'9','-','.',#128..#255];
|
||||
|
Loading…
Reference in New Issue
Block a user