Made parameter const

This commit is contained in:
dmdmdm 2020-05-23 15:49:48 -04:00 committed by John Maguire
parent 86b48c22ae
commit 0f2e8946d6
1 changed files with 6 additions and 4 deletions

View File

@ -137,8 +137,10 @@ QString WithoutExtension(const QString& s) {
return s.left(i);
}
void ReplaceUnderscoresWithSpaces(QString &s) {
s.replace('_', ' ');
QString ReplaceUnderscoresWithSpaces(const QString &s) {
QString ret(s);
ret.replace('_', ' ');
return ret;
}
} // namespace
@ -159,8 +161,8 @@ void TagReader::GuessArtistAndTitle(pb::tagreader::SongMetadata *song) const {
title = WithoutExtension(bn);
}
ReplaceUnderscoresWithSpaces(artist);
ReplaceUnderscoresWithSpaces(title);
artist = ReplaceUnderscoresWithSpaces(artist);
title = ReplaceUnderscoresWithSpaces(title);
artist = artist.trimmed();
title = title.trimmed();
if (!artist.isEmpty()) { song->set_artist(artist.toUtf8().data()); }