From: Rosen Penev Date: Sat, 24 Sep 2022 21:34:44 +0000 (-0700) Subject: clang-tidy: do the same for pointers X-Git-Tag: release-1.7.0~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4d8b8891ffa10864ccf1f9cc80c093d275bd86d7;p=libmatroska clang-tidy: do the same for pointers Signed-off-by: Rosen Penev --- diff --git a/matroska/KaxBlock.h b/matroska/KaxBlock.h index 2c45da7..14d7a55 100644 --- a/matroska/KaxBlock.h +++ b/matroska/KaxBlock.h @@ -117,7 +117,7 @@ class MATROSKA_DLL_API SimpleDataBuffer : public DataBuffer { static bool myFreeBuffer(const DataBuffer & aBuffer) { - binary *_Buffer = static_cast(&aBuffer)->BaseBuffer; + auto _Buffer = static_cast(&aBuffer)->BaseBuffer; if (_Buffer != nullptr) free(_Buffer); return true; diff --git a/src/KaxBlock.cpp b/src/KaxBlock.cpp index 4d069de..6d6b1b3 100644 --- a/src/KaxBlock.cpp +++ b/src/KaxBlock.cpp @@ -455,7 +455,7 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully) if (Result != GetSize()) throw SafeReadIOCallback::EndOfStreamX(GetSize() - Result); - binary *BufferStart = EbmlBinary::GetBuffer(); + binary *const BufferStart = EbmlBinary::GetBuffer(); SafeReadIOCallback Mem(*this); uint8 BlockHeadSize = 4; @@ -562,14 +562,14 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully) } } - binary *BufferEnd = BufferStart + GetSize(); + binary *const BufferEnd = BufferStart + GetSize(); const size_t NumFrames = myBuffers.size(); // Sanity checks for frame pointers and boundaries. for (size_t Index = 0; Index < NumFrames; ++Index) { - binary *FrameStart = myBuffers[Index]->Buffer(); - binary *FrameEnd = FrameStart + myBuffers[Index]->Size(); - binary *ExpectedEnd = (Index + 1) < NumFrames ? myBuffers[Index + 1]->Buffer() : BufferEnd; + binary *const FrameStart = myBuffers[Index]->Buffer(); + binary *const FrameEnd = FrameStart + myBuffers[Index]->Size(); + binary *const ExpectedEnd = (Index + 1) < NumFrames ? myBuffers[Index + 1]->Buffer() : BufferEnd; if ((FrameStart < BufferStart) || (FrameEnd > BufferEnd) || (FrameEnd != ExpectedEnd)) throw SafeReadIOCallback::EndOfStreamX(0); @@ -1027,7 +1027,7 @@ bool KaxBlockBlob::ReplaceSimpleByGroup() else { if (Block.simpleblock != nullptr) { - KaxSimpleBlock *old_simpleblock = Block.simpleblock; + KaxSimpleBlock *const old_simpleblock = Block.simpleblock; Block.group = new KaxBlockGroup(); // _TODO_ : move all the data to the blockgroup assert(false); diff --git a/src/KaxCues.cpp b/src/KaxCues.cpp index 9309d04..bdaf359 100644 --- a/src/KaxCues.cpp +++ b/src/KaxCues.cpp @@ -142,11 +142,11 @@ const KaxCuePoint * KaxCues::GetTimecodePoint(uint64 aTimecode) const uint64 KaxCues::GetTimecodePosition(uint64 aTimecode) const { - const KaxCuePoint * aPoint = GetTimecodePoint(aTimecode); + const KaxCuePoint * const aPoint = GetTimecodePoint(aTimecode); if (aPoint == nullptr) return 0; - const KaxCueTrackPositions * aTrack = aPoint->GetSeekPosition(); + const KaxCueTrackPositions * const aTrack = aPoint->GetSeekPosition(); if (aTrack == nullptr) return 0; diff --git a/src/KaxCuesData.cpp b/src/KaxCuesData.cpp index 9c50f3e..f528714 100644 --- a/src/KaxCuesData.cpp +++ b/src/KaxCuesData.cpp @@ -120,7 +120,7 @@ void KaxCuePoint::PositionSet(const KaxInternalBlock & BlockReference, const Kax #endif // MATROSKA_VERSION if (BlockGroup != nullptr) { - const KaxCodecState *CodecState = static_cast(BlockGroup->FindFirstElt(EBML_INFO(KaxCodecState))); + const auto CodecState = static_cast(BlockGroup->FindFirstElt(EBML_INFO(KaxCodecState))); if (CodecState != nullptr) { auto &CueCodecState = AddNewChild(NewPositions); *static_cast(&CueCodecState) = BlockGroup->GetParentCluster()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition());