Bug 1374774: P6. Fix ByteReader constness. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 22 Jun 2017 22:50:08 +0200
changeset 414374 babdaefa1a981c5164ab334a71920887a84a1ca0
parent 414373 aa9660e02f665d87d02bab05e85209ef1ec5c2d0
child 414375 d7e7edd0f8ed256d864cfdb737f05ef7d476dec2
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1374774
milestone55.0
Bug 1374774: P6. Fix ByteReader constness. r=gerald MozReview-Commit-ID: 8bQA189OOVF
media/libstagefright/binding/include/mp4_demuxer/ByteReader.h
--- a/media/libstagefright/binding/include/mp4_demuxer/ByteReader.h
+++ b/media/libstagefright/binding/include/mp4_demuxer/ByteReader.h
@@ -45,24 +45,24 @@ public:
     mRemaining = aData.Length();
     mLength = mRemaining;
   }
 
   ~ByteReader()
   {
   }
 
-  size_t Offset()
+  size_t Offset() const
   {
     return mLength - mRemaining;
   }
 
   size_t Remaining() const { return mRemaining; }
 
-  bool CanRead8() { return mRemaining >= 1; }
+  bool CanRead8() const { return mRemaining >= 1; }
 
   uint8_t ReadU8()
   {
     auto ptr = Read(1);
     if (!ptr) {
       MOZ_ASSERT(false);
       return 0;
     }
@@ -183,92 +183,92 @@ public:
     if (aCount < rewind) {
       rewind = aCount;
     }
     mRemaining += rewind;
     mPtr -= rewind;
     return mPtr;
   }
 
-  uint8_t PeekU8()
+  uint8_t PeekU8() const
   {
     auto ptr = Peek(1);
     if (!ptr) {
       MOZ_ASSERT(false);
       return 0;
     }
     return *ptr;
   }
 
-  uint16_t PeekU16()
+  uint16_t PeekU16() const
   {
     auto ptr = Peek(2);
     if (!ptr) {
       MOZ_ASSERT(false);
       return 0;
     }
     return mozilla::BigEndian::readUint16(ptr);
   }
 
-  uint32_t PeekU24()
+  uint32_t PeekU24() const
   {
     auto ptr = Peek(3);
     if (!ptr) {
       MOZ_ASSERT(false);
       return 0;
     }
     return ptr[0] << 16 | ptr[1] << 8 | ptr[2];
   }
 
-  uint32_t Peek24()
+  uint32_t Peek24() const
   {
     return (uint32_t)PeekU24();
   }
 
-  uint32_t PeekU32()
+  uint32_t PeekU32() const
   {
     auto ptr = Peek(4);
     if (!ptr) {
       MOZ_ASSERT(false);
       return 0;
     }
     return mozilla::BigEndian::readUint32(ptr);
   }
 
-  int32_t Peek32()
+  int32_t Peek32() const
   {
     auto ptr = Peek(4);
     if (!ptr) {
       MOZ_ASSERT(false);
       return 0;
     }
     return mozilla::BigEndian::readInt32(ptr);
   }
 
-  uint64_t PeekU64()
+  uint64_t PeekU64() const
   {
     auto ptr = Peek(8);
     if (!ptr) {
       MOZ_ASSERT(false);
       return 0;
     }
     return mozilla::BigEndian::readUint64(ptr);
   }
 
-  int64_t Peek64()
+  int64_t Peek64() const
   {
     auto ptr = Peek(8);
     if (!ptr) {
       MOZ_ASSERT(false);
       return 0;
     }
     return mozilla::BigEndian::readInt64(ptr);
   }
 
-  const uint8_t* Peek(size_t aCount)
+  const uint8_t* Peek(size_t aCount) const
   {
     if (aCount > mRemaining) {
       return nullptr;
     }
     return mPtr;
   }
 
   const uint8_t* Seek(size_t aOffset)
@@ -285,22 +285,22 @@ public:
 
   const uint8_t* Reset()
   {
     mPtr -= Offset();
     mRemaining = mLength;
     return mPtr;
   }
 
-  uint32_t Align()
+  uint32_t Align() const
   {
     return 4 - ((intptr_t)mPtr & 3);
   }
 
-  template <typename T> bool CanReadType() { return mRemaining >= sizeof(T); }
+  template <typename T> bool CanReadType() const { return mRemaining >= sizeof(T); }
 
   template <typename T> T ReadType()
   {
     auto ptr = Read(sizeof(T));
     if (!ptr) {
       MOZ_ASSERT(false);
       return 0;
     }