From dea3ae913bd72c9702a365699458dc237f58425b Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Thu, 25 Feb 2010 16:44:59 -0600 Subject: [PATCH] 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! --- timeline/src/Engine/Peak.H | 2 +- timeline/src/Engine/Peaks.C | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/timeline/src/Engine/Peak.H b/timeline/src/Engine/Peak.H index fd3ac15..8ee1529 100644 --- a/timeline/src/Engine/Peak.H +++ b/timeline/src/Engine/Peak.H @@ -24,4 +24,4 @@ struct Peak { float max; float normalization_factor ( void ) const; -}; +} __attribute__ (( packed )); diff --git a/timeline/src/Engine/Peaks.C b/timeline/src/Engine/Peaks.C index 694ffb9..a587f70 100644 --- a/timeline/src/Engine/Peaks.C +++ b/timeline/src/Engine/Peaks.C @@ -51,6 +51,8 @@ using std::min; using std::max; +#include + /* 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 ); } + struct peakfile_block_header { - unsigned long chunksize; - unsigned long skip; -}; + uint32_t chunksize; + uint32_t skip; +} __attribute__ (( packed )); class Peakfile {