]> git.tdb.fi Git - libs/datafile.git/commitdiff
Detect eof from the parser, not input file
authorMikko Rasa <tdb@tdb.fi>
Tue, 17 Dec 2013 01:01:06 +0000 (03:01 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 17 Dec 2013 01:01:06 +0000 (03:01 +0200)
Some files have an embedded logical eof, so waiting for the end of the
physical file would (and did) cause an infinite loop.

tool/packer.cpp

index ff69912fe40124fe4d64e37f5d13330b521782c0..3576472e57b07baa7f2755e9c8012f5b60d0110e 100644 (file)
@@ -79,7 +79,7 @@ bool Packer::detect_raw(IO::Seekable &in)
        IO::SeekOffset offset = in.tell();
        bool raw = false;
        DataFile::Parser parser(in, "-");
-       while(!raw && !in.eof() && in.tell()<10240)
+       while(!raw && parser && in.tell()<10240)
        {
                try
                {