Bug 1453672 - Make MediaRawDataWriter's allocation methods MOZ_MUST_USE. r=gerald
authorNathan Froyd <froydnj@gmail.com>
Thu, 12 Apr 2018 07:29:00 -0400
changeset 413246 6a53c90b362b4eb2243e07592ef4aff23ef6166f
parent 413245 f7fb95c9979452fe25e42873f54cf56a80a0a0d8
child 413247 5db230cb9ff83e82646f8a28a4465994112a27dd
push id33840
push userapavel@mozilla.com
push dateFri, 13 Apr 2018 21:56:54 +0000
treeherdermozilla-central@6547c27303bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1453672
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1453672 - Make MediaRawDataWriter's allocation methods MOZ_MUST_USE. r=gerald The documentation says that the boolean return values from these methods must be checked. We might as well make the compiler check these things for us.
dom/media/MediaData.h
--- a/dom/media/MediaData.h
+++ b/dom/media/MediaData.h
@@ -640,30 +640,30 @@ public:
   size_t Size();
   // Writeable reference to MediaRawData::mCryptoInternal
   CryptoSample& mCrypto;
 
   // Data manipulation methods. mData and mSize may be updated accordingly.
 
   // Set size of buffer, allocating memory as required.
   // If size is increased, new buffer area is filled with 0.
-  bool SetSize(size_t aSize);
+  MOZ_MUST_USE bool SetSize(size_t aSize);
   // Add aData at the beginning of buffer.
-  bool Prepend(const uint8_t* aData, size_t aSize);
+  MOZ_MUST_USE bool Prepend(const uint8_t* aData, size_t aSize);
   // Replace current content with aData.
-  bool Replace(const uint8_t* aData, size_t aSize);
+  MOZ_MUST_USE bool Replace(const uint8_t* aData, size_t aSize);
   // Clear the memory buffer. Will set target mData and mSize to 0.
   void Clear();
   // Remove aSize bytes from the front of the sample.
   void PopFront(size_t aSize);
 
 private:
   friend class MediaRawData;
   explicit MediaRawDataWriter(MediaRawData* aMediaRawData);
-  bool EnsureSize(size_t aSize);
+  MOZ_MUST_USE bool EnsureSize(size_t aSize);
   MediaRawData* mTarget;
 };
 
 class MediaRawData : public MediaData
 {
 public:
   MediaRawData();
   MediaRawData(const uint8_t* aData, size_t aSize);