Remove `< 0` check on unsigned

This commit is contained in:
Jonas Kvinge 2023-07-21 07:17:58 +02:00
parent 4b4c5fc0ab
commit d3352e476f
2 changed files with 4 additions and 5 deletions

View File

@ -98,9 +98,8 @@ void GME::SPC::Read(const QFileInfo &file_info, spb::tagreader::SongMetadata *so
file.seek(INTRO_LENGTH_OFFSET);
QByteArray length_bytes = file.read(INTRO_LENGTH_SIZE);
quint64 length_in_sec = 0;
if (length_bytes.size() >= INTRO_LENGTH_SIZE) {
length_in_sec = ConvertSPCStringToNum(length_bytes);
quint64 length_in_sec = ConvertSPCStringToNum(length_bytes);
if (!length_in_sec || length_in_sec >= 0x1FFF) {
// This means that parsing the length as a string failed, so get value LE.
@ -250,11 +249,11 @@ bool GME::VGM::GetPlaybackLength(const QByteArray &sample_count_bytes, const QBy
quint64 sample_count = GME::UnpackBytes32(sample_count_bytes.constData(), sample_count_bytes.size());
if (sample_count <= 0) return false;
if (sample_count == 0) return false;
quint64 loop_sample_count = GME::UnpackBytes32(loop_count_bytes.constData(), loop_count_bytes.size());
if (loop_sample_count <= 0) {
if (loop_sample_count == 0) {
out_length = sample_count * 1000 / SAMPLE_TIMEBASE;
return true;
}

View File

@ -143,7 +143,7 @@ void ScrobblerCache::ReadCache() {
metadata.albumartist = json_obj_track["albumartist"].toString();
metadata.length_nanosec = json_obj_track["length_nanosec"].toVariant().toLongLong();
if (timestamp <= 0 || metadata.artist.isEmpty() || metadata.title.isEmpty() || metadata.length_nanosec <= 0) {
if (timestamp == 0 || metadata.artist.isEmpty() || metadata.title.isEmpty() || metadata.length_nanosec <= 0) {
qLog(Error) << "Invalid cache data" << "for song" << metadata.title;
continue;
}