From: Rosen Penev Date: Thu, 19 May 2022 00:28:04 +0000 (-0700) Subject: clang-tidy: use nullptr X-Git-Tag: release-1.7.0~13^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7f40021d3c916f70fd395c8e3ace11b4e2c04a5b;p=libmatroska clang-tidy: use nullptr Signed-off-by: Rosen Penev --- diff --git a/matroska/KaxBlock.h b/matroska/KaxBlock.h index 95a0dc6..56c5a83 100644 --- a/matroska/KaxBlock.h +++ b/matroska/KaxBlock.h @@ -61,8 +61,8 @@ class MATROSKA_DLL_API DataBuffer { bool bInternalBuffer; public: - DataBuffer(binary * aBuffer, uint32 aSize, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = NULL, bool _bInternalBuffer = false) - :myBuffer(NULL) + DataBuffer(binary * aBuffer, uint32 aSize, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = nullptr, bool _bInternalBuffer = false) + :myBuffer(nullptr) ,mySize(aSize) ,bValidValue(true) ,myFreeBuffer(aFreeBuffer) @@ -71,7 +71,7 @@ class MATROSKA_DLL_API DataBuffer { if (bInternalBuffer) { myBuffer = new (std::nothrow) binary[mySize]; - if (myBuffer == NULL) + if (myBuffer == nullptr) bValidValue = false; else memcpy(myBuffer, aBuffer, mySize); @@ -87,12 +87,12 @@ class MATROSKA_DLL_API DataBuffer { virtual uint32 Size() const {return mySize;}; bool FreeBuffer(const DataBuffer & aBuffer) { bool bResult = true; - if (myBuffer != NULL && bValidValue) { - if (myFreeBuffer != NULL) + if (myBuffer != nullptr && bValidValue) { + if (myFreeBuffer != nullptr) bResult = myFreeBuffer(aBuffer); if (bInternalBuffer) delete [] myBuffer; - myBuffer = NULL; + myBuffer = nullptr; mySize = 0; bValidValue = false; } @@ -120,7 +120,7 @@ class MATROSKA_DLL_API SimpleDataBuffer : public DataBuffer { static bool myFreeBuffer(const DataBuffer & aBuffer) { binary *_Buffer = static_cast(&aBuffer)->BaseBuffer; - if (_Buffer != NULL) + if (_Buffer != nullptr) free(_Buffer); return true; } @@ -177,7 +177,7 @@ DECLARE_MKX_MASTER(KaxBlockGroup) */ uint64 GlobalTimecode() const; uint64 GlobalTimecodeScale() const { - assert(ParentTrack != NULL); + assert(ParentTrack != nullptr); return ParentTrack->GlobalTimecodeScale(); } @@ -208,7 +208,7 @@ DECLARE_MKX_MASTER(KaxBlockGroup) class MATROSKA_DLL_API KaxInternalBlock : public EbmlBinary { public: KaxInternalBlock(EBML_DEF_CONS EBML_DEF_SEP bool bSimple EBML_DEF_SEP EBML_EXTRA_PARAM) :EBML_DEF_BINARY_INIT EBML_DEF_SEP bLocalTimecodeUsed(false), mLacing(LACING_AUTO), mInvisible(false) - ,ParentCluster(NULL), bIsSimple(bSimple), bIsKeyframe(true), bIsDiscardable(false) + ,ParentCluster(nullptr), bIsSimple(bSimple), bIsKeyframe(true), bIsDiscardable(false) {} KaxInternalBlock(const KaxInternalBlock & ElementToClone); ~KaxInternalBlock() override; @@ -318,9 +318,9 @@ class MATROSKA_DLL_API KaxSimpleBlock : public KaxInternalBlock { /// Placeholder class for either a BlockGroup or a SimpleBlock class MATROSKA_DLL_API KaxBlockBlob { public: - KaxBlockBlob(BlockBlobType sblock_mode) :ParentCluster(NULL), SimpleBlockMode(sblock_mode) { + KaxBlockBlob(BlockBlobType sblock_mode) :ParentCluster(nullptr), SimpleBlockMode(sblock_mode) { bUseSimpleBlock = (sblock_mode != BLOCK_BLOB_NO_SIMPLE); - Block.group = NULL; + Block.group = nullptr; } ~KaxBlockBlob() { @@ -341,7 +341,7 @@ public: void SetBlockDuration(uint64 TimeLength); void SetParent(KaxCluster & aParentCluster); - bool AddFrameAuto(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO, const KaxBlockBlob * PastBlock = NULL, const KaxBlockBlob * ForwBlock = NULL); + bool AddFrameAuto(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO, const KaxBlockBlob * PastBlock = nullptr, const KaxBlockBlob * ForwBlock = nullptr); bool IsSimpleBlock() const {return bUseSimpleBlock;} diff --git a/matroska/KaxCluster.h b/matroska/KaxCluster.h index 14dc49b..274cd9e 100644 --- a/matroska/KaxCluster.h +++ b/matroska/KaxCluster.h @@ -127,7 +127,7 @@ DECLARE_MKX_MASTER_CONS(KaxCluster) bool SetSilentTrackUsed() { bSilentTracksUsed = true; - return FindFirstElt(EBML_INFO(KaxClusterSilentTracks), true) != NULL; + return FindFirstElt(EBML_INFO(KaxClusterSilentTracks), true) != nullptr; } bool AddBlockBlob(KaxBlockBlob * NewBlob); diff --git a/matroska/KaxTracks.h b/matroska/KaxTracks.h index 2bcab64..b874039 100644 --- a/matroska/KaxTracks.h +++ b/matroska/KaxTracks.h @@ -56,7 +56,7 @@ DECLARE_MKX_MASTER(KaxTrackEntry) */ inline bool LacingEnabled() const { KaxTrackFlagLacing * myLacing = static_cast(FindFirstElt(EBML_INFO(KaxTrackFlagLacing))); - return((myLacing == NULL) || (uint8(*myLacing) != 0)); + return((myLacing == nullptr) || (uint8(*myLacing) != 0)); } void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) {