Bug 1073003 - Fix -Wnarrowing warnings. r=ehsan
authorBotond Ballo <botond@mozilla.com>
Tue, 23 Dec 2014 03:26:21 -0500
changeset 248392 6550cdd34f6fce661f2fb72da4974013449ae701
parent 248391 dd0a52ad9cb3cf32f5c837b06cc155d1ddb0ed52
child 248393 7a10ad29050eb40110df345e7a865c1320dc02f3
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1073003
milestone37.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 1073003 - Fix -Wnarrowing warnings. r=ehsan
dom/media/omx/OMXCodecDescriptorUtil.cpp
dom/media/omx/OMXCodecWrapper.cpp
--- a/dom/media/omx/OMXCodecDescriptorUtil.cpp
+++ b/dom/media/omx/OMXCodecDescriptorUtil.cpp
@@ -79,18 +79,18 @@ struct AVCParamSet {
     return mSize + 2; // 2 more bytes for length value.
   }
 
   // Append 2 bytes length value and NAL unit bitstream to aOutputBuf.
   void AppendTo(nsTArray<uint8_t>* aOutputBuf)
   {
     // 2 bytes length value.
     uint8_t size[] = {
-      (mSize & 0xFF00) >> 8, // MSB.
-      mSize & 0x00FF,        // LSB.
+      uint8_t((mSize & 0xFF00) >> 8), // MSB.
+      uint8_t(mSize & 0x00FF),        // LSB.
     };
     aOutputBuf->AppendElements(size, sizeof(size));
 
     aOutputBuf->AppendElements(mPtr, mSize);
   }
 
   const uint8_t* mPtr; // Pointer to NAL unit.
   const size_t mSize;  // NAL unit length in bytes.
--- a/dom/media/omx/OMXCodecWrapper.cpp
+++ b/dom/media/omx/OMXCodecWrapper.cpp
@@ -490,20 +490,20 @@ OMXVideoEncoder::AppendFrame(nsTArray<ui
 
   if (mBlobFormat == BlobFormat::AVC_NAL) {
     // Append NAL format data without modification.
     aOutputBuf->AppendElements(aData, aSize);
     return;
   }
   // Replace start code with data length.
   uint8_t length[] = {
-    (aSize >> 24) & 0xFF,
-    (aSize >> 16) & 0xFF,
-    (aSize >> 8) & 0xFF,
-    aSize & 0xFF,
+    uint8_t((aSize >> 24) & 0xFF),
+    uint8_t((aSize >> 16) & 0xFF),
+    uint8_t((aSize >> 8) & 0xFF),
+    uint8_t(aSize & 0xFF),
   };
   aOutputBuf->AppendElements(length, sizeof(length));
   aOutputBuf->AppendElements(aData + sizeof(length), aSize);
 }
 
 // MediaCodec::setParameters() is available only after API level 18.
 #if ANDROID_VERSION >= 18
 nsresult
@@ -903,24 +903,24 @@ OMXAudioEncoder::AppendDecoderConfig(nsT
   NS_ENSURE_TRUE(csdSize == 2, ERROR_MALFORMED);
   // Encoder output must be consistent with kAACFrameDuration:
   // 14th bit (frame length flag) == 0 => 1024 (kAACFrameDuration) samples.
   NS_ENSURE_TRUE((aData->data()[1] & 0x04) == 0, ERROR_MALFORMED);
 
   // Decoder config descriptor
   const uint8_t decConfig[] = {
     0x04,                   // Decoder config descriptor tag.
-    15 + csdSize,           // Size: following bytes + csd size.
+    uint8_t(15 + csdSize),  // Size: following bytes + csd size.
     0x40,                   // Object type: MPEG-4 audio.
     0x15,                   // Stream type: audio, reserved: 1.
     0x00, 0x03, 0x00,       // Buffer size: 768 (kAACFrameSize).
     0x00, 0x01, 0x77, 0x00, // Max bitrate: 96000 (kAACBitrate).
     0x00, 0x01, 0x77, 0x00, // Avg bitrate: 96000 (kAACBitrate).
     0x05,                   // Decoder specific descriptor tag.
-    csdSize,                // Data size.
+    uint8_t(csdSize),       // Data size.
   };
   // SL config descriptor.
   const uint8_t slConfig[] = {
     0x06, // SL config descriptor tag.
     0x01, // Size.
     0x02, // Fixed value.
   };