Avoid useless cases when assigning tag size (which is now std::uint64_t)
This commit is contained in:
parent
62e32f085e
commit
f39e8b4d8c
|
@ -110,13 +110,13 @@ KnownField MatroskaTag::internallyGetKnownField(const IdentifierType &id) const
|
|||
void MatroskaTag::parse(EbmlElement &tagElement, Diagnostics &diag)
|
||||
{
|
||||
static const string context("parsing Matroska tag");
|
||||
m_size = tagElement.totalSize();
|
||||
tagElement.parse(diag);
|
||||
if (tagElement.totalSize() > numeric_limits<std::uint32_t>::max()) {
|
||||
// FIXME: Support this? Likely not very useful in practise.
|
||||
diag.emplace_back(DiagLevel::Critical, "Matroska tag is too big.", context);
|
||||
throw NotImplementedException();
|
||||
}
|
||||
m_size = static_cast<std::uint32_t>(tagElement.totalSize());
|
||||
for (EbmlElement *child = tagElement.firstChild(); child; child = child->nextSibling()) {
|
||||
child->parse(diag);
|
||||
switch (child->id()) {
|
||||
|
|
|
@ -328,13 +328,13 @@ bool Mp4Tag::hasField(KnownField field) const
|
|||
void Mp4Tag::parse(Mp4Atom &metaAtom, Diagnostics &diag)
|
||||
{
|
||||
static const string context("parsing MP4 tag");
|
||||
m_size = metaAtom.totalSize();
|
||||
istream &stream = metaAtom.container().stream();
|
||||
BinaryReader &reader = metaAtom.container().reader();
|
||||
if (metaAtom.totalSize() > numeric_limits<std::uint32_t>::max()) {
|
||||
diag.emplace_back(DiagLevel::Critical, "Can't handle such big \"meta\" atoms.", context);
|
||||
throw NotImplementedException();
|
||||
}
|
||||
m_size = static_cast<std::uint32_t>(metaAtom.totalSize());
|
||||
Mp4Atom *subAtom = nullptr;
|
||||
try {
|
||||
metaAtom.childById(Mp4AtomIds::HandlerReference, diag);
|
||||
|
|
|
@ -134,7 +134,7 @@ template <class StreamType> void VorbisComment::internalParse(StreamType &stream
|
|||
{
|
||||
// prepare parsing
|
||||
static const string context("parsing Vorbis comment");
|
||||
std::uint64_t startOffset = static_cast<std::uint64_t>(stream.tellg());
|
||||
const auto startOffset = static_cast<std::uint64_t>(stream.tellg());
|
||||
try {
|
||||
// read signature: 0x3 + "vorbis"
|
||||
char sig[8];
|
||||
|
@ -180,7 +180,7 @@ template <class StreamType> void VorbisComment::internalParse(StreamType &stream
|
|||
if (!(flags & VorbisCommentFlags::NoFramingByte)) {
|
||||
stream.ignore(); // skip framing byte
|
||||
}
|
||||
m_size = static_cast<std::uint32_t>(static_cast<std::uint64_t>(stream.tellg()) - startOffset);
|
||||
m_size = static_cast<std::uint64_t>(stream.tellg()) - startOffset;
|
||||
// turn "YEAR" into "DATE" (unless "DATE" exists)
|
||||
// note: "DATE" is an official field and "YEAR" only an unofficial one but present in some files. In consistency with
|
||||
// MediaInfo and VLC player it is treated like "DATE" here.
|
||||
|
@ -197,7 +197,7 @@ template <class StreamType> void VorbisComment::internalParse(StreamType &stream
|
|||
throw InvalidDataException();
|
||||
}
|
||||
} catch (const TruncatedDataException &) {
|
||||
m_size = static_cast<std::uint32_t>(static_cast<std::uint64_t>(stream.tellg()) - startOffset);
|
||||
m_size = static_cast<std::uint64_t>(stream.tellg()) - startOffset;
|
||||
diag.emplace_back(DiagLevel::Critical, "Vorbis comment is truncated.", context);
|
||||
throw;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue