mirror of
https://github.com/taglib/taglib.git
synced 2026-03-20 05:39:59 -04:00
clang-tidy: don't use else after return
Found with readability-else-after-return Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
@ -135,8 +135,7 @@ unsigned int APE::Footer::completeTagSize() const
|
||||
{
|
||||
if(d->headerPresent)
|
||||
return d->tagSize + size();
|
||||
else
|
||||
return d->tagSize;
|
||||
return d->tagSize;
|
||||
}
|
||||
|
||||
void APE::Footer::setTagSize(unsigned int s)
|
||||
@ -158,8 +157,7 @@ ByteVector APE::Footer::renderHeader() const
|
||||
{
|
||||
if(!d->headerPresent)
|
||||
return ByteVector();
|
||||
else
|
||||
return render(true);
|
||||
return render(true);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -219,8 +219,7 @@ String APE::Item::toString() const
|
||||
{
|
||||
if(d->type == Text && !isEmpty())
|
||||
return d->text.front();
|
||||
else
|
||||
return String();
|
||||
return String();
|
||||
}
|
||||
|
||||
bool APE::Item::isEmpty() const
|
||||
|
||||
@ -94,8 +94,7 @@ unsigned int ASF::Tag::track() const
|
||||
const ASF::Attribute attr = d->attributeListMap["WM/TrackNumber"][0];
|
||||
if(attr.type() == ASF::Attribute::DWordType)
|
||||
return attr.toUInt();
|
||||
else
|
||||
return attr.toString().toInt();
|
||||
return attr.toString().toInt();
|
||||
}
|
||||
if(d->attributeListMap.contains("WM/Track"))
|
||||
return d->attributeListMap["WM/Track"][0].toUInt();
|
||||
|
||||
@ -49,32 +49,31 @@ using namespace TagLib;
|
||||
#define VIRTUAL_FUNCTION_WORKAROUND(function_name, default_value) \
|
||||
if(dynamic_cast<const APE::Properties*>(this)) \
|
||||
return dynamic_cast<const APE::Properties*>(this)->function_name(); \
|
||||
else if(dynamic_cast<const ASF::Properties*>(this)) \
|
||||
if(dynamic_cast<const ASF::Properties*>(this)) \
|
||||
return dynamic_cast<const ASF::Properties*>(this)->function_name(); \
|
||||
else if(dynamic_cast<const FLAC::Properties*>(this)) \
|
||||
if(dynamic_cast<const FLAC::Properties*>(this)) \
|
||||
return dynamic_cast<const FLAC::Properties*>(this)->function_name(); \
|
||||
else if(dynamic_cast<const MP4::Properties*>(this)) \
|
||||
if(dynamic_cast<const MP4::Properties*>(this)) \
|
||||
return dynamic_cast<const MP4::Properties*>(this)->function_name(); \
|
||||
else if(dynamic_cast<const MPC::Properties*>(this)) \
|
||||
if(dynamic_cast<const MPC::Properties*>(this)) \
|
||||
return dynamic_cast<const MPC::Properties*>(this)->function_name(); \
|
||||
else if(dynamic_cast<const MPEG::Properties*>(this)) \
|
||||
if(dynamic_cast<const MPEG::Properties*>(this)) \
|
||||
return dynamic_cast<const MPEG::Properties*>(this)->function_name(); \
|
||||
else if(dynamic_cast<const Ogg::Opus::Properties*>(this)) \
|
||||
if(dynamic_cast<const Ogg::Opus::Properties*>(this)) \
|
||||
return dynamic_cast<const Ogg::Opus::Properties*>(this)->function_name(); \
|
||||
else if(dynamic_cast<const Ogg::Speex::Properties*>(this)) \
|
||||
if(dynamic_cast<const Ogg::Speex::Properties*>(this)) \
|
||||
return dynamic_cast<const Ogg::Speex::Properties*>(this)->function_name(); \
|
||||
else if(dynamic_cast<const TrueAudio::Properties*>(this)) \
|
||||
if(dynamic_cast<const TrueAudio::Properties*>(this)) \
|
||||
return dynamic_cast<const TrueAudio::Properties*>(this)->function_name(); \
|
||||
else if(dynamic_cast<const RIFF::AIFF::Properties*>(this)) \
|
||||
if(dynamic_cast<const RIFF::AIFF::Properties*>(this)) \
|
||||
return dynamic_cast<const RIFF::AIFF::Properties*>(this)->function_name(); \
|
||||
else if(dynamic_cast<const RIFF::WAV::Properties*>(this)) \
|
||||
if(dynamic_cast<const RIFF::WAV::Properties*>(this)) \
|
||||
return dynamic_cast<const RIFF::WAV::Properties*>(this)->function_name(); \
|
||||
else if(dynamic_cast<const Vorbis::Properties*>(this)) \
|
||||
if(dynamic_cast<const Vorbis::Properties*>(this)) \
|
||||
return dynamic_cast<const Vorbis::Properties*>(this)->function_name(); \
|
||||
else if(dynamic_cast<const WavPack::Properties*>(this)) \
|
||||
if(dynamic_cast<const WavPack::Properties*>(this)) \
|
||||
return dynamic_cast<const WavPack::Properties*>(this)->function_name(); \
|
||||
else \
|
||||
return (default_value);
|
||||
return (default_value);
|
||||
|
||||
class AudioProperties::AudioPropertiesPrivate
|
||||
{
|
||||
|
||||
@ -152,8 +152,7 @@ namespace
|
||||
if(file) {
|
||||
if(file->isValid())
|
||||
return file;
|
||||
else
|
||||
delete file;
|
||||
delete file;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -200,8 +199,7 @@ namespace
|
||||
if(file) {
|
||||
if(file->isValid())
|
||||
return file;
|
||||
else
|
||||
delete file;
|
||||
delete file;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@ -140,7 +140,7 @@ MP4::Tag::parseData2(const MP4::Atom *atom, int expectedFlags, bool freeForm)
|
||||
debug("MP4: Unexpected atom \"" + name + "\", expecting \"mean\"");
|
||||
return result;
|
||||
}
|
||||
else if(i == 1 && name != "name") {
|
||||
if(i == 1 && name != "name") {
|
||||
debug("MP4: Unexpected atom \"" + name + "\", expecting \"name\"");
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -250,8 +250,7 @@ String ID3v1::genre(int i)
|
||||
{
|
||||
if(i >= 0 && i < genresSize)
|
||||
return String(genres[i]); // always make a copy
|
||||
else
|
||||
return String();
|
||||
return String();
|
||||
}
|
||||
|
||||
int ID3v1::genreIndex(const String &name)
|
||||
|
||||
@ -76,8 +76,7 @@ ByteVector ID3v1::StringHandler::render(const String &s) const
|
||||
{
|
||||
if(s.isLatin1())
|
||||
return s.data(String::Latin1);
|
||||
else
|
||||
return ByteVector();
|
||||
return ByteVector();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -274,7 +274,7 @@ TableOfContentsFrame *TableOfContentsFrame::findTopLevel(const ID3v2::Tag *tag)
|
||||
++it)
|
||||
{
|
||||
TableOfContentsFrame *frame = dynamic_cast<TableOfContentsFrame *>(*it);
|
||||
if(frame && frame->isTopLevel() == true)
|
||||
if(frame && frame->isTopLevel())
|
||||
return frame;
|
||||
}
|
||||
|
||||
|
||||
@ -94,8 +94,7 @@ ByteVector Frame::textDelimiter(String::Type t)
|
||||
{
|
||||
if(t == String::UTF16 || t == String::UTF16BE || t == String::UTF16LE)
|
||||
return ByteVector(2, '\0');
|
||||
else
|
||||
return ByteVector(1, '\0');
|
||||
return ByteVector(1, '\0');
|
||||
}
|
||||
|
||||
const String Frame::instrumentPrefix("PERFORMER:");
|
||||
@ -117,11 +116,11 @@ Frame *Frame::createTextualFrame(const String &key, const StringList &values) //
|
||||
TextIdentificationFrame *frame = new TextIdentificationFrame(frameID, String::UTF8);
|
||||
frame->setText(values);
|
||||
return frame;
|
||||
} else if((frameID[0] == 'W') && (values.size() == 1)){ // URL frame (not WXXX); support only one value
|
||||
} if((frameID[0] == 'W') && (values.size() == 1)){ // URL frame (not WXXX); support only one value
|
||||
UrlLinkFrame* frame = new UrlLinkFrame(frameID);
|
||||
frame->setUrl(values.front());
|
||||
return frame;
|
||||
} else if(frameID == "PCST") {
|
||||
} if(frameID == "PCST") {
|
||||
return new PodcastFrame();
|
||||
}
|
||||
}
|
||||
@ -166,16 +165,14 @@ ByteVector Frame::frameID() const
|
||||
{
|
||||
if(d->header)
|
||||
return d->header->frameID();
|
||||
else
|
||||
return ByteVector();
|
||||
return ByteVector();
|
||||
}
|
||||
|
||||
unsigned int Frame::size() const
|
||||
{
|
||||
if(d->header)
|
||||
return d->header->frameSize();
|
||||
else
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Frame::setData(const ByteVector &data)
|
||||
@ -309,10 +306,8 @@ String::Type Frame::checkEncoding(const StringList &fields, String::Type encodin
|
||||
debug("Frame::checkEncoding() -- Rendering using UTF8.");
|
||||
return String::UTF8;
|
||||
}
|
||||
else {
|
||||
debug("Frame::checkEncoding() -- Rendering using UTF16.");
|
||||
return String::UTF16;
|
||||
}
|
||||
debug("Frame::checkEncoding() -- Rendering using UTF16.");
|
||||
return String::UTF16;
|
||||
}
|
||||
}
|
||||
|
||||
@ -486,19 +481,19 @@ PropertyMap Frame::asProperties() const
|
||||
if(id == "TXXX")
|
||||
return dynamic_cast< const UserTextIdentificationFrame* >(this)->asProperties();
|
||||
// Apple proprietary WFED (Podcast URL), MVNM (Movement Name), MVIN (Movement Number), GRP1 (Grouping) are in fact text frames.
|
||||
else if(id[0] == 'T' || id == "WFED" || id == "MVNM" || id == "MVIN" || id == "GRP1")
|
||||
if(id[0] == 'T' || id == "WFED" || id == "MVNM" || id == "MVIN" || id == "GRP1")
|
||||
return dynamic_cast< const TextIdentificationFrame* >(this)->asProperties();
|
||||
else if(id == "WXXX")
|
||||
if(id == "WXXX")
|
||||
return dynamic_cast< const UserUrlLinkFrame* >(this)->asProperties();
|
||||
else if(id[0] == 'W')
|
||||
if(id[0] == 'W')
|
||||
return dynamic_cast< const UrlLinkFrame* >(this)->asProperties();
|
||||
else if(id == "COMM")
|
||||
if(id == "COMM")
|
||||
return dynamic_cast< const CommentsFrame* >(this)->asProperties();
|
||||
else if(id == "USLT")
|
||||
if(id == "USLT")
|
||||
return dynamic_cast< const UnsynchronizedLyricsFrame* >(this)->asProperties();
|
||||
else if(id == "UFID")
|
||||
if(id == "UFID")
|
||||
return dynamic_cast< const UniqueFileIdentifierFrame* >(this)->asProperties();
|
||||
else if(id == "PCST")
|
||||
if(id == "PCST")
|
||||
return dynamic_cast< const PodcastFrame* >(this)->asProperties();
|
||||
PropertyMap m;
|
||||
m.unsupportedData().append(id);
|
||||
|
||||
@ -268,11 +268,9 @@ Frame *FrameFactory::createFrame(const ByteVector &origData, const Header *tagHe
|
||||
if(frameID != "WXXX") {
|
||||
return new UrlLinkFrame(data, header);
|
||||
}
|
||||
else {
|
||||
UserUrlLinkFrame *f = new UserUrlLinkFrame(data, header);
|
||||
d->setTextEncoding(f);
|
||||
return f;
|
||||
}
|
||||
UserUrlLinkFrame *f = new UserUrlLinkFrame(data, header);
|
||||
d->setTextEncoding(f);
|
||||
return f;
|
||||
}
|
||||
|
||||
// Unsynchronized lyric/text transcription (frames 4.8)
|
||||
|
||||
@ -137,8 +137,7 @@ unsigned int Header::completeTagSize() const
|
||||
{
|
||||
if(d->footerPresent)
|
||||
return d->tagSize + size() + Footer::size();
|
||||
else
|
||||
return d->tagSize + size();
|
||||
return d->tagSize + size();
|
||||
}
|
||||
|
||||
void Header::setTagSize(unsigned int s)
|
||||
|
||||
@ -41,8 +41,7 @@ namespace
|
||||
{
|
||||
if(page->header()->lastPacketCompleted())
|
||||
return page->firstPacketIndex() + page->packetCount();
|
||||
else
|
||||
return page->firstPacketIndex() + page->packetCount() - 1;
|
||||
return page->firstPacketIndex() + page->packetCount() - 1;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
||||
@ -176,8 +176,7 @@ String RIFF::Info::Tag::fieldText(const ByteVector &id) const
|
||||
{
|
||||
if(d->fieldListMap.contains(id))
|
||||
return String(d->fieldListMap[id]);
|
||||
else
|
||||
return String();
|
||||
return String();
|
||||
}
|
||||
|
||||
void RIFF::Info::Tag::setFieldText(const ByteVector &id, const String &s)
|
||||
@ -219,8 +218,7 @@ ByteVector RIFF::Info::Tag::render() const
|
||||
|
||||
if(data.size() == 4)
|
||||
return ByteVector();
|
||||
else
|
||||
return data;
|
||||
return data;
|
||||
}
|
||||
|
||||
void RIFF::Info::Tag::setStringHandler(const StringHandler *handler)
|
||||
|
||||
@ -120,16 +120,16 @@ PropertyMap TagUnion::properties() const
|
||||
if(dynamic_cast<const ID3v1::Tag *>(d->tags[i]))
|
||||
return dynamic_cast<const ID3v1::Tag *>(d->tags[i])->properties();
|
||||
|
||||
else if(dynamic_cast<const ID3v2::Tag *>(d->tags[i]))
|
||||
if(dynamic_cast<const ID3v2::Tag *>(d->tags[i]))
|
||||
return dynamic_cast<const ID3v2::Tag *>(d->tags[i])->properties();
|
||||
|
||||
else if(dynamic_cast<const APE::Tag *>(d->tags[i]))
|
||||
if(dynamic_cast<const APE::Tag *>(d->tags[i]))
|
||||
return dynamic_cast<const APE::Tag *>(d->tags[i])->properties();
|
||||
|
||||
else if(dynamic_cast<const Ogg::XiphComment *>(d->tags[i]))
|
||||
if(dynamic_cast<const Ogg::XiphComment *>(d->tags[i]))
|
||||
return dynamic_cast<const Ogg::XiphComment *>(d->tags[i])->properties();
|
||||
|
||||
else if(dynamic_cast<const RIFF::Info::Tag *>(d->tags[i]))
|
||||
if(dynamic_cast<const RIFF::Info::Tag *>(d->tags[i]))
|
||||
return dynamic_cast<const RIFF::Info::Tag *>(d->tags[i])->properties();
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,8 +145,7 @@ T toNumber(const ByteVector &v, size_t offset, bool mostSignificantByteFirst)
|
||||
|
||||
if(swap)
|
||||
return Utils::byteSwap(tmp);
|
||||
else
|
||||
return tmp;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@ -242,14 +241,12 @@ long double toFloat80(const ByteVector &v, size_t offset)
|
||||
debug("toFloat80() - can't handle the infinity or NaN. Returning 0.");
|
||||
return 0.0;
|
||||
}
|
||||
else
|
||||
val = ::ldexp(static_cast<long double>(fraction), exponent - 16383 - 63);
|
||||
val = ::ldexp(static_cast<long double>(fraction), exponent - 16383 - 63);
|
||||
}
|
||||
|
||||
if(negative)
|
||||
return -val;
|
||||
else
|
||||
return val;
|
||||
return val;
|
||||
}
|
||||
|
||||
class ByteVector::ByteVectorPrivate
|
||||
@ -300,8 +297,7 @@ ByteVector ByteVector::fromCString(const char *s, unsigned int length)
|
||||
{
|
||||
if(length == 0xffffffff)
|
||||
return ByteVector(s, static_cast<unsigned int>(::strlen(s)));
|
||||
else
|
||||
return ByteVector(s, length);
|
||||
return ByteVector(s, length);
|
||||
}
|
||||
|
||||
ByteVector ByteVector::fromUInt(unsigned int value, bool mostSignificantByteFirst)
|
||||
@ -443,8 +439,7 @@ int ByteVector::rfind(const ByteVector &pattern, unsigned int offset, int byteAl
|
||||
|
||||
if(pos == -1)
|
||||
return -1;
|
||||
else
|
||||
return size() - pos - pattern.size();
|
||||
return size() - pos - pattern.size();
|
||||
}
|
||||
|
||||
bool ByteVector::containsAt(const ByteVector &pattern, unsigned int offset, unsigned int patternOffset, unsigned int patternLength) const
|
||||
@ -843,8 +838,7 @@ bool ByteVector::operator<(const ByteVector &v) const
|
||||
const int result = ::memcmp(data(), v.data(), std::min(size(), v.size()));
|
||||
if(result != 0)
|
||||
return result < 0;
|
||||
else
|
||||
return size() < v.size();
|
||||
return size() < v.size();
|
||||
}
|
||||
|
||||
bool ByteVector::operator>(const ByteVector &v) const
|
||||
|
||||
@ -185,42 +185,41 @@ PropertyMap File::setProperties(const PropertyMap &properties)
|
||||
{
|
||||
if(dynamic_cast<APE::File* >(this))
|
||||
return dynamic_cast<APE::File* >(this)->setProperties(properties);
|
||||
else if(dynamic_cast<FLAC::File* >(this))
|
||||
if(dynamic_cast<FLAC::File* >(this))
|
||||
return dynamic_cast<FLAC::File* >(this)->setProperties(properties);
|
||||
else if(dynamic_cast<IT::File* >(this))
|
||||
if(dynamic_cast<IT::File* >(this))
|
||||
return dynamic_cast<IT::File* >(this)->setProperties(properties);
|
||||
else if(dynamic_cast<Mod::File* >(this))
|
||||
if(dynamic_cast<Mod::File* >(this))
|
||||
return dynamic_cast<Mod::File* >(this)->setProperties(properties);
|
||||
else if(dynamic_cast<MPC::File* >(this))
|
||||
if(dynamic_cast<MPC::File* >(this))
|
||||
return dynamic_cast<MPC::File* >(this)->setProperties(properties);
|
||||
else if(dynamic_cast<MPEG::File* >(this))
|
||||
if(dynamic_cast<MPEG::File* >(this))
|
||||
return dynamic_cast<MPEG::File* >(this)->setProperties(properties);
|
||||
else if(dynamic_cast<Ogg::FLAC::File* >(this))
|
||||
if(dynamic_cast<Ogg::FLAC::File* >(this))
|
||||
return dynamic_cast<Ogg::FLAC::File* >(this)->setProperties(properties);
|
||||
else if(dynamic_cast<Ogg::Speex::File* >(this))
|
||||
if(dynamic_cast<Ogg::Speex::File* >(this))
|
||||
return dynamic_cast<Ogg::Speex::File* >(this)->setProperties(properties);
|
||||
else if(dynamic_cast<Ogg::Opus::File* >(this))
|
||||
if(dynamic_cast<Ogg::Opus::File* >(this))
|
||||
return dynamic_cast<Ogg::Opus::File* >(this)->setProperties(properties);
|
||||
else if(dynamic_cast<Ogg::Vorbis::File* >(this))
|
||||
if(dynamic_cast<Ogg::Vorbis::File* >(this))
|
||||
return dynamic_cast<Ogg::Vorbis::File* >(this)->setProperties(properties);
|
||||
else if(dynamic_cast<RIFF::AIFF::File* >(this))
|
||||
if(dynamic_cast<RIFF::AIFF::File* >(this))
|
||||
return dynamic_cast<RIFF::AIFF::File* >(this)->setProperties(properties);
|
||||
else if(dynamic_cast<RIFF::WAV::File* >(this))
|
||||
if(dynamic_cast<RIFF::WAV::File* >(this))
|
||||
return dynamic_cast<RIFF::WAV::File* >(this)->setProperties(properties);
|
||||
else if(dynamic_cast<S3M::File* >(this))
|
||||
if(dynamic_cast<S3M::File* >(this))
|
||||
return dynamic_cast<S3M::File* >(this)->setProperties(properties);
|
||||
else if(dynamic_cast<TrueAudio::File* >(this))
|
||||
if(dynamic_cast<TrueAudio::File* >(this))
|
||||
return dynamic_cast<TrueAudio::File* >(this)->setProperties(properties);
|
||||
else if(dynamic_cast<WavPack::File* >(this))
|
||||
if(dynamic_cast<WavPack::File* >(this))
|
||||
return dynamic_cast<WavPack::File* >(this)->setProperties(properties);
|
||||
else if(dynamic_cast<XM::File* >(this))
|
||||
if(dynamic_cast<XM::File* >(this))
|
||||
return dynamic_cast<XM::File* >(this)->setProperties(properties);
|
||||
else if(dynamic_cast<MP4::File* >(this))
|
||||
if(dynamic_cast<MP4::File* >(this))
|
||||
return dynamic_cast<MP4::File* >(this)->setProperties(properties);
|
||||
else if(dynamic_cast<ASF::File* >(this))
|
||||
if(dynamic_cast<ASF::File* >(this))
|
||||
return dynamic_cast<ASF::File* >(this)->setProperties(properties);
|
||||
else
|
||||
return tag()->setProperties(properties);
|
||||
return tag()->setProperties(properties);
|
||||
}
|
||||
|
||||
ByteVector File::readBlock(unsigned long length)
|
||||
|
||||
@ -250,7 +250,7 @@ void FileStream::insert(const ByteVector &data, unsigned long start, unsigned lo
|
||||
writeBlock(data);
|
||||
return;
|
||||
}
|
||||
else if(data.size() < replace) {
|
||||
if(data.size() < replace) {
|
||||
seek(start);
|
||||
writeBlock(data);
|
||||
removeBlock(start + data.size(), replace - data.size());
|
||||
|
||||
@ -44,8 +44,7 @@ namespace
|
||||
{
|
||||
if(Utils::systemByteOrder() == Utils::LittleEndian)
|
||||
return String::UTF16LE;
|
||||
else
|
||||
return String::UTF16BE;
|
||||
return String::UTF16BE;
|
||||
}
|
||||
|
||||
// Converts a Latin-1 string into UTF-16(without BOM/CPU byte order)
|
||||
@ -342,10 +341,8 @@ StringList String::split(const String &separator) const
|
||||
list.append(substr(index, size() - index));
|
||||
break;
|
||||
}
|
||||
else {
|
||||
list.append(substr(index, sep - index));
|
||||
index = sep + separator.size();
|
||||
}
|
||||
list.append(substr(index, sep - index));
|
||||
index = sep + separator.size();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@ -362,8 +359,7 @@ String String::substr(unsigned int position, unsigned int n) const
|
||||
{
|
||||
if(position == 0 && n >= size())
|
||||
return *this;
|
||||
else
|
||||
return String(d->data.substr(position, n));
|
||||
return String(d->data.substr(position, n));
|
||||
}
|
||||
|
||||
String &String::append(const String &s)
|
||||
|
||||
Reference in New Issue
Block a user