X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/fe06d72cb3a26eba89d897098a3d22c9a9d11179..9f412caca531bde1a4e30e3970aa20a8868b4e72:/apt-pkg/tagfile.cc diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index ab3647fd8..5443b178e 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: tagfile.cc,v 1.32 2002/03/26 07:22:31 jgg Exp $ +// $Id: tagfile.cc,v 1.37 2003/05/19 17:13:57 doogie Exp $ /* ###################################################################### Fast scanner for RFC-822 type header information @@ -70,7 +70,7 @@ bool pkgTagFile::Step(pkgTagSection &Tag) if (Tag.Scan(Start,End - Start) == false) return _error->Error(_("Unable to parse package file %s (1)"), Fd.Name().c_str()); - } + } Start += Tag.size(); iOffset += Tag.size(); @@ -85,6 +85,7 @@ bool pkgTagFile::Step(pkgTagSection &Tag) bool pkgTagFile::Fill() { unsigned long EndSize = End - Start; + unsigned long Actual = 0; memmove(Buffer,Start,EndSize); Start = Buffer; @@ -93,7 +94,6 @@ bool pkgTagFile::Fill() if (Done == false) { // See if only a bit of the file is left - unsigned long Actual; if (Fd.Read(End,Size - (End - Buffer),&Actual) == false) return false; if (Actual != Size - (End - Buffer)) @@ -103,7 +103,7 @@ bool pkgTagFile::Fill() if (Done == true) { - if (EndSize <= 3) + if (EndSize <= 3 && Actual == 0) return false; if (Size - (End - Buffer) < 4) return true; @@ -197,7 +197,7 @@ bool pkgTagSection::Scan(const char *Start,unsigned long MaxLength) if (Stop == 0) return false; - for (; Stop+1 < End && Stop[1] == '\r'; Stop++); + for (; Stop+1 < End && Stop[1] == '\r'; Stop++); // Double newline marks the end of the record if (Stop+1 < End && Stop[1] == '\n')