From 7f6ce9a0109ef4e811757a48d0de5c6bd8c22911 Mon Sep 17 00:00:00 2001 From: Mads Kiilerich Date: Wed, 19 Jan 2022 16:47:54 +0100 Subject: [PATCH] sndfile: Fix skipping of first character of file names in error logging. Logs for a file named ABCDEF.flac showed up as 2022-01-19T16:31:55 [ERROR]: SndFileSource: could not seek to sample 90059776 within BCDEF.flac (No Error.) So, evidently, there is no need for the substr(1). _name is a PBD::Property which already uses .val() for <<. The same pattern is found and fixed in sndfilesource.cc and coreaudiosource.cc . --- libs/ardour/coreaudiosource.cc | 2 +- libs/ardour/sndfilesource.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/ardour/coreaudiosource.cc b/libs/ardour/coreaudiosource.cc index b7cedf50d9..5c37e7ca9d 100644 --- a/libs/ardour/coreaudiosource.cc +++ b/libs/ardour/coreaudiosource.cc @@ -122,7 +122,7 @@ CoreAudioSource::safe_read (Sample* dst, samplepos_t start, samplecnt_t cnt, Aud try { af.Seek (start+nread); } catch (CAXException& cax) { - error << string_compose("CoreAudioSource: %1 to %2 [%3] (%4)", cax.mOperation, start+nread, cax.mError, _name.val().substr (1)) << endmsg; + error << string_compose("CoreAudioSource: %1 to %2 [%3] (%4)", cax.mOperation, start+nread, cax.mError, _name) << endmsg; return -1; } diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index e8bc5d33ae..f731ba8926 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -536,7 +536,7 @@ SndFileSource::read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) c if (sf_seek (_sndfile, (sf_count_t) start, SEEK_SET|SFM_READ) != (sf_count_t) start) { char errbuf[256]; sf_error_str (0, errbuf, sizeof (errbuf) - 1); - error << string_compose(_("SndFileSource: could not seek to sample %1 within %2 (%3)"), start, _name.val().substr (1), errbuf) << endmsg; + error << string_compose(_("SndFileSource: could not seek to sample %1 within %2 (%3)"), start, _name, errbuf) << endmsg; return 0; } @@ -545,7 +545,7 @@ SndFileSource::read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) c if (ret != file_cnt) { char errbuf[256]; sf_error_str (0, errbuf, sizeof (errbuf) - 1); - error << string_compose(_("SndFileSource: @ %1 could not read %2 within %3 (%4) (len = %5, ret was %6)"), start, file_cnt, _name.val().substr (1), errbuf, _length, ret) << endl; + error << string_compose(_("SndFileSource: @ %1 could not read %2 within %3 (%4) (len = %5, ret was %6)"), start, file_cnt, _name, errbuf, _length, ret) << endl; } if (_gain != 1.f) { for (samplecnt_t i = 0; i < ret; ++i) {