summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorsergei <sergei@3ad0048d-3df7-0310-abae-a5850022a9f2>2012-04-06 16:31:48 +0000
committersergei <sergei@3ad0048d-3df7-0310-abae-a5850022a9f2>2012-04-06 16:31:48 +0000
commit38e76bd5c8a7811083f99085c65c0dc14a531bd7 (patch)
tree40544c190576f40dadf5852b97aa09e3e083677c /packages
parent7dbf0e141a7f9bd5f6124f18b2f0974cea8a4aa4 (diff)
downloadfpc-38e76bd5c8a7811083f99085c65c0dc14a531bd7.tar.gz
* Small improvement to parameter entity nesting checks.
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@20722 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages')
-rw-r--r--packages/fcl-xml/src/xmlread.pp22
1 files changed, 9 insertions, 13 deletions
diff --git a/packages/fcl-xml/src/xmlread.pp b/packages/fcl-xml/src/xmlread.pp
index 6184f1a259..871e904128 100644
--- a/packages/fcl-xml/src/xmlread.pp
+++ b/packages/fcl-xml/src/xmlread.pp
@@ -439,7 +439,7 @@ type
function ParseExternalID(out SysID, PubID: XMLString; // [75]
SysIdOptional: Boolean): Boolean;
- procedure BadPENesting(S: TErrorSeverity = esError);
+ procedure CheckPENesting(aExpected: TObject);
procedure ParseEntityDecl;
procedure ParseAttlistDecl;
procedure ExpectChoiceOrSeq(CP: TContentParticle; MustEndIn: TObject);
@@ -1929,7 +1929,7 @@ begin
FSource := Src;
// correct position of this error is after PE reference
if Error then
- BadPENesting(esFatal);
+ FatalError('Parameter entities must be properly nested');
end;
end;
@@ -2331,10 +2331,10 @@ end;
{ DTD stuff }
-procedure TXMLTextReader.BadPENesting(S: TErrorSeverity);
+procedure TXMLTextReader.CheckPENesting(aExpected: TObject);
begin
- if (S = esFatal) or FValidate then
- DoError(S, 'Parameter entities must be properly nested');
+ if FSource.FEntity <> aExpected then
+ ValidationError('Parameter entities must be properly nested', [], 0);
end;
function TXMLTextReader.ParseQuantity: TCPQuant;
@@ -2394,8 +2394,7 @@ begin
FatalError(Delim);
FSource.NextChar; // skip delimiter
until False;
- if MustEndIn <> FSource.FEntity then
- BadPENesting;
+ CheckPENesting(MustEndIn);
FSource.NextChar;
if Delim = '|' then
@@ -2451,8 +2450,7 @@ begin
end;
SkipWhitespace;
end;
- if CurrentEntity <> FSource.FEntity then
- BadPENesting;
+ CheckPENesting(CurrentEntity);
FSource.NextChar;
if (not CheckForChar('*')) and (CP.ChildCount > 0) then
FatalError(WideChar('*'));
@@ -2813,8 +2811,7 @@ begin
FatalError('Expected "INCLUDE" or "IGNORE"');
SkipWhitespace;
- if CurrentEntity <> FSource.FEntity then
- BadPENesting;
+ CheckPENesting(CurrentEntity);
ExpectChar('[');
if CondType = ctInclude then
begin
@@ -2841,8 +2838,7 @@ begin
SkipWhitespace;
- if CurrentEntity <> FSource.FEntity then
- BadPENesting;
+ CheckPENesting(CurrentEntity);
ExpectChar('>');
FInsideDecl := False;
end;