Fix 64-bit bug in peakfile handling.

Use 'packed' attribute on structs used to represent individual peaks and peak headers.
This is a quick, if not ideal, solution.

Broken peakfiles generated on 64-bit platforms must be deleted!
This commit is contained in:
Jonathan Moore Liles 2010-02-25 16:44:59 -06:00
parent 9f87bbd020
commit dea3ae913b
2 changed files with 7 additions and 4 deletions

View File

@ -24,4 +24,4 @@ struct Peak {
float max; float max;
float normalization_factor ( void ) const; float normalization_factor ( void ) const;
}; } __attribute__ (( packed ));

View File

@ -51,6 +51,8 @@
using std::min; using std::min;
using std::max; using std::max;
#include <stdint.h>
/* whether to cache peaks at multiple resolutions on disk to /* whether to cache peaks at multiple resolutions on disk to
@ -102,11 +104,12 @@ Peaks::fill_buffer ( float fpp, nframes_t s, nframes_t e ) const
return read_peaks( s, (e - s) / fpp, fpp ); return read_peaks( s, (e - s) / fpp, fpp );
} }
struct peakfile_block_header struct peakfile_block_header
{ {
unsigned long chunksize; uint32_t chunksize;
unsigned long skip; uint32_t skip;
}; } __attribute__ (( packed ));
class Peakfile class Peakfile
{ {