13
0

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<string> which already uses .val() for <<.

The same pattern is found and fixed in sndfilesource.cc and
coreaudiosource.cc .
This commit is contained in:
Mads Kiilerich 2022-01-19 16:47:54 +01:00
parent 197ec7a943
commit 7f6ce9a010
2 changed files with 3 additions and 3 deletions

View File

@ -122,7 +122,7 @@ CoreAudioSource::safe_read (Sample* dst, samplepos_t start, samplecnt_t cnt, Aud
try { try {
af.Seek (start+nread); af.Seek (start+nread);
} catch (CAXException& cax) { } 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; return -1;
} }

View File

@ -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) { if (sf_seek (_sndfile, (sf_count_t) start, SEEK_SET|SFM_READ) != (sf_count_t) start) {
char errbuf[256]; char errbuf[256];
sf_error_str (0, errbuf, sizeof (errbuf) - 1); 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; return 0;
} }
@ -545,7 +545,7 @@ SndFileSource::read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) c
if (ret != file_cnt) { if (ret != file_cnt) {
char errbuf[256]; char errbuf[256];
sf_error_str (0, errbuf, sizeof (errbuf) - 1); 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) { if (_gain != 1.f) {
for (samplecnt_t i = 0; i < ret; ++i) { for (samplecnt_t i = 0; i < ret; ++i) {