mirror of
https://github.com/taglib/taglib.git
synced 2026-07-12 14:21:10 -04:00
Fix overflow for large Apple Music cnID values (#1373)
cnID must be longlong instead of int as Apple Music cnID values can now exceed the range of a 32-bit integer and require 64-bit aka longlong. --------- Co-authored-by: Urs Fleisch <ufleisch@users.sourceforge.net>
This commit is contained in:
@@ -172,7 +172,7 @@ std::pair<ByteVector, Item> ItemFactory::itemFromProperty(
|
||||
case ItemHandlerType::UInt:
|
||||
return {name, Item(static_cast<unsigned int>(values.front().toInt()))};
|
||||
case ItemHandlerType::LongLong:
|
||||
return {name, Item(static_cast<long long>(values.front().toInt()))};
|
||||
return {name, Item(values.front().toLongLong())};
|
||||
case ItemHandlerType::Byte:
|
||||
return {name, Item(static_cast<unsigned char>(values.front().toInt()))};
|
||||
case ItemHandlerType::Bool:
|
||||
@@ -299,7 +299,7 @@ ItemFactory::NameHandlerMap ItemFactory::nameHandlerMap() const
|
||||
{"rate", ItemHandlerType::TextOrInt},
|
||||
{"tvsn", ItemHandlerType::UInt},
|
||||
{"tves", ItemHandlerType::UInt},
|
||||
{"cnID", ItemHandlerType::UInt},
|
||||
{"cnID", ItemHandlerType::LongLong},
|
||||
{"sfID", ItemHandlerType::UInt},
|
||||
{"atID", ItemHandlerType::UInt},
|
||||
{"geID", ItemHandlerType::UInt},
|
||||
|
||||
@@ -883,6 +883,7 @@ public:
|
||||
tag->setItem("trkn", MP4::Item(2, 10));
|
||||
tag->setItem("rate", MP4::Item(80));
|
||||
tag->setItem("plID", MP4::Item(1540934238LL));
|
||||
tag->setItem("cnID", MP4::Item(9876543210LL));
|
||||
tag->setItem("rtng", MP4::Item(static_cast<unsigned char>(2)));
|
||||
f.save();
|
||||
}
|
||||
@@ -904,6 +905,7 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(10, item.toIntPair().second);
|
||||
CPPUNIT_ASSERT_EQUAL(80, tag->item("rate").toInt());
|
||||
CPPUNIT_ASSERT_EQUAL(1540934238LL, tag->item("plID").toLongLong());
|
||||
CPPUNIT_ASSERT_EQUAL(9876543210LL, tag->item("cnID").toLongLong());
|
||||
CPPUNIT_ASSERT_EQUAL(static_cast<unsigned char>(2), tag->item("rtng").toByte());
|
||||
PropertyMap properties = tag->properties();
|
||||
CPPUNIT_ASSERT_EQUAL(StringList("123"), properties.value("TESTINTEGER"));
|
||||
|
||||
Reference in New Issue
Block a user