Make peakfile block scanning more robust.
This commit is contained in:
parent
50fa642321
commit
9b8e7569e7
|
@ -49,9 +49,9 @@
|
||||||
* drastically improve performance */
|
* drastically improve performance */
|
||||||
bool Peaks::mipmapped_peakfiles = true;
|
bool Peaks::mipmapped_peakfiles = true;
|
||||||
|
|
||||||
const int Peaks::cache_minimum = 256; /* minimum chunksize to build peakfiles for */
|
const int Peaks::cache_minimum = 256; /* minimum chunksize to build peakfiles for */
|
||||||
const int Peaks::cache_levels = 8; /* number of sampling levels in peak cache */
|
const int Peaks::cache_levels = 8; /* number of sampling levels in peak cache */
|
||||||
const int Peaks::cache_step = 1; /* powers of two between each level. 4 == 256, 2048, 16384, ... */
|
const int Peaks::cache_step = 1; /* powers of two between each level. 4 == 256, 2048, 16384, ... */
|
||||||
|
|
||||||
|
|
||||||
Peaks::peakbuffer Peaks::_peakbuf;
|
Peaks::peakbuffer Peaks::_peakbuf;
|
||||||
|
@ -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