]> granicus.if.org Git - libmatroska/commitdiff
clang-tidy: use nullptr
authorRosen Penev <rosenp@gmail.com>
Thu, 19 May 2022 00:28:04 +0000 (17:28 -0700)
committerRosen Penev <rosenp@gmail.com>
Sun, 22 May 2022 21:33:26 +0000 (14:33 -0700)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
matroska/KaxBlock.h
matroska/KaxCluster.h
matroska/KaxTracks.h

index 95a0dc6b48d4bc1a79dbf5f5264b82878ecd698d..56c5a83390b8855d1e2fb02a2238d8ba15a95679 100644 (file)
@@ -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<const SimpleDataBuffer*>(&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;}
 
index 14dc49ba761673aeb4f4b6799a4b2bfca7ca6af0..274cd9e401c1eb72e18ad10d85c8beb6c2e74699 100644 (file)
@@ -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);
index 2bcab6428ae04bfd51e2b2796f4859485dbbfed9..b8740391841eaba9bc8264b8ad1bf13fe75c9463 100644 (file)
@@ -56,7 +56,7 @@ DECLARE_MKX_MASTER(KaxTrackEntry)
     */
     inline bool LacingEnabled() const {
       KaxTrackFlagLacing * myLacing = static_cast<KaxTrackFlagLacing *>(FindFirstElt(EBML_INFO(KaxTrackFlagLacing)));
-      return((myLacing == NULL) || (uint8(*myLacing) != 0));
+      return((myLacing == nullptr) || (uint8(*myLacing) != 0));
     }
 
     void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) {