diff options
author | David Robillard <d@drobilla.net> | 2010-02-23 20:25:53 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-02-23 20:25:53 +0000 |
commit | 650c6d5824222a8879df5c5ba9645c264ed3b84f (patch) | |
tree | 7cd5aace00cb23622f07727ae4f7963c03dd05c9 /libs/ardour/audiosource.cc | |
parent | 0c20d48e7d436725396baf362368f7ce61717151 (diff) |
Fix various code quality issues found by cppcheck (e.g. uninitialized members, larger than necessary variable scope, memory leaks, etc).
git-svn-id: svn://localhost/ardour2/branches/3.0@6710 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/audiosource.cc')
-rw-r--r-- | libs/ardour/audiosource.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index 841dec1887..2657ba94ad 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -612,11 +612,8 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t int AudioSource::build_peaks_from_scratch () { - framepos_t current_frame; - framecnt_t cnt; Sample* buf = 0; - framecnt_t frames_read; - framecnt_t frames_to_read; + const framecnt_t bufsize = 65536; // 256kB per disk read for mono data is about ideal int ret = -1; @@ -630,14 +627,16 @@ AudioSource::build_peaks_from_scratch () goto out; } - current_frame = 0; - cnt = _length; + framepos_t current_frame = 0; + framecnt_t cnt = _length; + _peaks_built = false; buf = new Sample[bufsize]; while (cnt) { - frames_to_read = min (bufsize, cnt); + framecnt_t frames_to_read = min (bufsize, cnt); + framecnt_t frames_read; if ((frames_read = read_unlocked (buf, current_frame, frames_to_read)) != frames_to_read) { error << string_compose(_("%1: could not write read raw data for peak computation (%2)"), _name, strerror (errno)) << endmsg; |