From eb6d058ab93ffcfbe00878a3aba6ffc1ac7d3df6 Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Tue, 1 Nov 2016 16:03:15 +0900 Subject: [PATCH] Remove a useless branch. longLength <= LONG_MAX is always true if sizeof(long) == sizeof(long long). --- taglib/mp4/mp4atom.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/taglib/mp4/mp4atom.cpp b/taglib/mp4/mp4atom.cpp index 6ea0cb62..5758173b 100644 --- a/taglib/mp4/mp4atom.cpp +++ b/taglib/mp4/mp4atom.cpp @@ -56,20 +56,15 @@ MP4::Atom::Atom(File *file) if(length == 1) { const long long longLength = file->readBlock(8).toLongLong(); - if(sizeof(long) == sizeof(long long)) { + if(longLength <= LONG_MAX) { + // The atom has a 64-bit length, but it's actually a 31-bit value or long is 64-bit. length = static_cast(longLength); } else { - if(longLength <= LONG_MAX) { - // The atom has a 64-bit length, but it's actually a 31-bit value - length = static_cast(longLength); - } - else { - debug("MP4: 64-bit atoms are not supported"); - length = 0; - file->seek(0, File::End); - return; - } + debug("MP4: 64-bit atoms are not supported"); + length = 0; + file->seek(0, File::End); + return; } } if(length < 8) { -- 2.40.0