Browse Source

--- Merging r14919 into '.':
U packages/fcl-xml/src/xmlread.pp

# revisions: 14919
------------------------------------------------------------------------
r14919 | sergei | 2010-02-15 20:40:26 +0100 (Mon, 15 Feb 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-xml/src/xmlread.pp

xmlread.pp, TXMLFileSource.FetchData, don't lose the data that remains in the input buffer. Fixes Mantis #15776.
------------------------------------------------------------------------

git-svn-id: branches/fixes_2_4@14985 -

marco 15 years ago
parent
commit
8cf2b299f9
1 changed files with 8 additions and 0 deletions
  1. 8 0
      packages/fcl-xml/src/xmlread.pp

+ 8 - 0
packages/fcl-xml/src/xmlread.pp

@@ -255,6 +255,7 @@ type
   private
     FFile: ^Text;
     FString: string;
+    FTmp: string;
   public
     constructor Create(var AFile: Text);
     procedure FetchData; override;
@@ -1148,11 +1149,18 @@ begin
 end;
 
 procedure TXMLFileInputSource.FetchData;
+var
+  Remainder: Integer;
 begin
   if not Eof(FFile^) then
   begin
+    Remainder := FCharBufEnd - FCharBuf;
+    if Remainder > 0 then
+      SetString(FTmp, FCharBuf, Remainder);
     ReadLn(FFile^, FString);
     FString := FString + #10;    // bad solution...
+    if Remainder > 0 then
+      Insert(FTmp, FString, 1);
     FCharBuf := PChar(FString);
     FCharBufEnd := FCharBuf + Length(FString);
   end;