diff --git a/matroska/matroskacontainer.cpp b/matroska/matroskacontainer.cpp index 39583a3..0fdff03 100644 --- a/matroska/matroskacontainer.cpp +++ b/matroska/matroskacontainer.cpp @@ -93,7 +93,7 @@ void MatroskaContainer::validateIndex() static const string context("validating Matroska file index (cues)"); bool cuesElementsFound = false; if(m_firstElement) { - unordered_set ids; + unordered_set ids; bool cueTimeFound = false, cueTrackPositionsFound = false; unique_ptr clusterElement; uint64 pos, prevClusterSize = 0, currentOffset = 0; @@ -785,10 +785,10 @@ struct SegmentData clusterEndOffset(0), startOffset(0), newPadding(0), - sizeDenotationLength(0), totalDataSize(0), totalSize(0), - newDataOffset(0) + newDataOffset(0), + sizeDenotationLength(0) {} /// \brief whether CRC-32 checksum is present @@ -811,14 +811,14 @@ struct SegmentData uint64 startOffset; /// \brief padding (in the new file) uint64 newPadding; - /// \brief header size (in the new file) - byte sizeDenotationLength; /// \brief total size of the segment data (in the new file, excluding header) uint64 totalDataSize; /// \brief total size of the segment data (in the new file, including header) uint64 totalSize; /// \brief data offset of the segment in the new file uint64 newDataOffset; + /// \brief header size (in the new file) + byte sizeDenotationLength; }; void MatroskaContainer::internalMakeFile() @@ -1036,16 +1036,14 @@ calculateSegmentData: SegmentData &segment = segmentData[segmentIndex]; // parse original "Cues"-element (if present) - if(!segment.cuesElement) { - if((segment.cuesElement = level0Element->childById(MatroskaIds::Cues))) { - try { - segment.cuesUpdater.parse(segment.cuesElement); - } catch(const Failure &) { - addNotifications(segment.cuesUpdater); - throw; - } + if(!segment.cuesElement && (segment.cuesElement = level0Element->childById(MatroskaIds::Cues))) { + try { + segment.cuesUpdater.parse(segment.cuesElement); + } catch(const Failure &) { addNotifications(segment.cuesUpdater); + throw; } + addNotifications(segment.cuesUpdater); } // get first "Cluster"-element @@ -1724,7 +1722,7 @@ nonRewriteCalculations: if(level2Element->dataSize() < sizeLength) { // can't update position -> void position elements ("Position"-elements seem a bit useless anyways) outputStream.seekp(level2Element->startOffset()); - outputStream.put(EbmlIds::Void); + outputStream.put(static_cast(EbmlIds::Void)); } else { // update position outputStream.seekp(level2Element->dataOffset()); @@ -1795,7 +1793,7 @@ nonRewriteCalculations: updateStatus("Reparsing output file ..."); if(rewriteRequired) { // report new size - fileInfo().reportSizeChanged(outputStream.tellp()); + fileInfo().reportSizeChanged(static_cast(outputStream.tellp())); // "save as path" is now the regular path if(!fileInfo().saveFilePath().empty()) { @@ -1814,7 +1812,7 @@ nonRewriteCalculations: // -> close stream before truncating outputStream.close(); // -> truncate file - if(truncate(fileInfo().path().c_str(), newSize) == 0) { + if(truncate(fileInfo().path().c_str(), static_cast(newSize)) == 0) { fileInfo().reportSizeChanged(newSize); } else { addNotification(NotificationType::Critical, "Unable to truncate the file.", context); diff --git a/mp4/mp4container.cpp b/mp4/mp4container.cpp index 4ddb834..de339ec 100644 --- a/mp4/mp4container.cpp +++ b/mp4/mp4container.cpp @@ -77,7 +77,7 @@ void Mp4Container::internalParseHeader() m_firstElement->parse(); Mp4Atom *ftypAtom = m_firstElement->siblingById(Mp4AtomIds::FileType, true); if(ftypAtom) { - stream().seekg(ftypAtom->dataOffset()); + stream().seekg(static_cast(ftypAtom->dataOffset())); m_doctype = reader().readString(4); m_version = reader().readUInt32BE(); } else { @@ -124,7 +124,7 @@ void Mp4Container::internalParseTracks() // get mvhd atom which holds overall track information if(Mp4Atom *mvhdAtom = moovAtom->childById(Mp4AtomIds::MovieHeader)) { if(mvhdAtom->dataSize() > 0) { - stream().seekg(mvhdAtom->dataOffset()); + stream().seekg(static_cast(mvhdAtom->dataOffset())); byte version = reader().readByte(); if((version == 1 && mvhdAtom->dataSize() >= 32) || (mvhdAtom->dataSize() >= 20)) { stream().seekg(3, ios_base::cur); // skip flags @@ -157,7 +157,7 @@ void Mp4Container::internalParseTracks() if(Mp4Atom *mehdAtom = moovAtom->subelementByPath({Mp4AtomIds::MovieExtends, Mp4AtomIds::MovieExtendsHeader})) { m_fragmented = true; if(mehdAtom->dataSize() > 0) { - stream().seekg(mehdAtom->dataOffset()); + stream().seekg(static_cast(mehdAtom->dataOffset())); unsigned int durationSize = reader().readByte() == 1u ? 8u : 4u; // duration size depends on atom version if(mehdAtom->dataSize() >= 4 + durationSize) { stream().seekg(3, ios_base::cur); // skip flags @@ -772,7 +772,7 @@ calculatePadding: outputWriter.writeUInt32BE(Mp4AtomIds::Free); break; default: - outputStream.seekp(level0Atom->totalSize(), ios_base::cur); + outputStream.seekp(static_cast(level0Atom->totalSize()), ios_base::cur); } if(level0Atom == lastAtomToBeWritten) { break; @@ -786,7 +786,7 @@ calculatePadding: updateStatus("Reparsing output file ..."); if(rewriteRequired) { // report new size - fileInfo().reportSizeChanged(outputStream.tellp()); + fileInfo().reportSizeChanged(static_cast(outputStream.tellp())); // "save as path" is now the regular path if(!fileInfo().saveFilePath().empty()) { fileInfo().reportPathChanged(fileInfo().saveFilePath()); @@ -803,7 +803,7 @@ calculatePadding: // -> close stream before truncating outputStream.close(); // -> truncate file - if(truncate(fileInfo().path().c_str(), newSize) == 0) { + if(truncate(fileInfo().path().c_str(), static_cast(newSize)) == 0) { fileInfo().reportSizeChanged(newSize); } else { addNotification(NotificationType::Critical, "Unable to truncate the file.", context); @@ -901,7 +901,7 @@ void Mp4Container::updateOffsets(const std::vector &oldMdatOffsets, const tfhdAtom->parse(); ++tfhdAtomCount; if(tfhdAtom->dataSize() >= 8) { - stream().seekg(tfhdAtom->dataOffset() + 1); + stream().seekg(static_cast(tfhdAtom->dataOffset()) + 1); uint32 flags = reader().readUInt24BE(); if(flags & 1) { if(tfhdAtom->dataSize() >= 16) { @@ -911,7 +911,7 @@ void Mp4Container::updateOffsets(const std::vector &oldMdatOffsets, const iOld != end; ++iOld, ++iNew) { if(off >= static_cast(*iOld)) { off += (*iNew - *iOld); - stream().seekp(tfhdAtom->dataOffset() + 8); + stream().seekp(static_cast(tfhdAtom->dataOffset()) + 8); writer().writeUInt64BE(off); break; }