Make peakfile block scanning more robust.
This commit is contained in:
parent
50fa642321
commit
9b8e7569e7
|
@ -187,12 +187,15 @@ public:
|
||||||
std::list <block_descriptor> blocks;
|
std::list <block_descriptor> blocks;
|
||||||
|
|
||||||
/* scan all blocks */
|
/* scan all blocks */
|
||||||
do
|
for ( ;; )
|
||||||
{
|
{
|
||||||
peakfile_block_header bh;
|
peakfile_block_header bh;
|
||||||
|
|
||||||
fread( &bh, sizeof( bh ), 1, _fp );
|
fread( &bh, sizeof( bh ), 1, _fp );
|
||||||
|
|
||||||
|
if ( feof( _fp ) )
|
||||||
|
break;
|
||||||
|
|
||||||
// printf( "chunksize=%lu, skip=%lu\n", (unsigned long)bh.chunksize, (unsigned long) bh.skip );
|
// printf( "chunksize=%lu, skip=%lu\n", (unsigned long)bh.chunksize, (unsigned long) bh.skip );
|
||||||
|
|
||||||
ASSERT( bh.chunksize, "Invalid peak file structure!" );
|
ASSERT( bh.chunksize, "Invalid peak file structure!" );
|
||||||
|
@ -209,7 +212,6 @@ public:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ( ! feof( _fp ) );
|
|
||||||
|
|
||||||
if ( ! blocks.size() )
|
if ( ! blocks.size() )
|
||||||
FATAL( "invalid peak file?" );
|
FATAL( "invalid peak file?" );
|
||||||
|
|
Loading…
Reference in New Issue