From ebdf73a077013a6afa19ef5bf5ef84c0db39fe69 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 13 Jul 2013 17:43:00 -0400 Subject: [PATCH] Remove use of goto in AudioSource::read_peaks --- libs/ardour/audiosource.cc | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index f3b6926c00..c9b80e7a5c 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -323,7 +323,6 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t int32_t to_read; uint32_t nread; framecnt_t zero_fill = 0; - int ret = -1; boost::scoped_ptr peakfile_descriptor(new FdFileDescriptor (peakpath, false, 0664)); int peakfile_fd = -1; @@ -461,7 +460,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t DEBUG_TRACE (DEBUG::Peaks, string_compose ("[%1]: cannot read peak data from peakfile (%2 peaks instead of %3) (%4) at start_byte = %5 _length = %6 versus len = %7 expected maxpeaks = %8 npeaks was %9" , _name, (nread / sizeof(PeakData)), to_read, g_strerror (errno), start_byte, _length, fend, ((_length - current_frame)/samples_per_file_peak), npeaks)); - goto out; + return -1; } #endif i = 0; @@ -494,8 +493,6 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t memset (&peaks[npeaks], 0, sizeof (PeakData) * zero_fill); } - ret = 0; - } else { DEBUG_TRACE (DEBUG::Peaks, "UPSAMPLE\n"); @@ -550,7 +547,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t error << string_compose(_("AudioSource[%1]: peak read - cannot read %2 samples at offset %3 of %4 (%5)"), _name, to_read, current_frame, _length, strerror (errno)) << endmsg; - goto out; + return -1; } } @@ -578,15 +575,10 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t if (zero_fill) { memset (&peaks[npeaks], 0, sizeof (PeakData) * zero_fill); } - - ret = 0; } - out: - DEBUG_TRACE (DEBUG::Peaks, "READPEAKS DONE\n"); - - return ret; + return 0; } int