Bug 1001708: Don't use ternary operator with class const statics r=jesup
authorGarvan Keeley <gkeeley@mozilla.com>
Sun, 27 Apr 2014 00:02:17 -0400
changeset 180456 f2203bec9507a7e0964ef37fb58258acd3fe5604
parent 180455 93a71ca8b150771199a0293a8e1f8d2f6fbee345
child 180457 18034a2d0732a1cefd859c5d576ffa2abf1a27dd
push id42764
push userrjesup@wgate.com
push dateSun, 27 Apr 2014 04:02:43 +0000
treeherdermozilla-inbound@f2203bec9507 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1001708
milestone31.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 1001708: Don't use ternary operator with class const statics r=jesup
media/webrtc/signaling/src/common/YuvStamper.cpp
--- a/media/webrtc/signaling/src/common/YuvStamper.cpp
+++ b/media/webrtc/signaling/src/common/YuvStamper.cpp
@@ -341,17 +341,23 @@ static unsigned char *DIGITS[] = {
       mask >>= 1;
     }
     return true;
   }
 
   bool YuvStamper::WriteBit(bool one)
   {
     // A bit is mapped to a mSymbolWidth x mSymbolHeight square of luma data points.
-    unsigned char value = one ? sYOn : sYOff;
+    // Don't use ternary op.: https://bugzilla.mozilla.org/show_bug.cgi?id=1001708
+    unsigned char value;
+    if (one)
+      value = sYOn;
+    else
+      value = sYOff;
+
     for (uint32_t y = 0; y < mSymbolHeight; y++) {
       for (uint32_t x = 0; x < mSymbolWidth; x++) {
 	*(pYData + (mCursor.x + x) + ((mCursor.y + y) * mStride)) = value;
       }
     }
 
     return AdvanceCursor();
   }
@@ -447,13 +453,16 @@ static unsigned char *DIGITS[] = {
       }
     }
 
     return true;
   }
 
   void YuvStamper::WritePixel(unsigned char *data, uint32_t x, uint32_t y) {
     unsigned char *ptr = &data[y * mStride + x];
-    *ptr = (*ptr > sLumaThreshold) ? sLumaMin : sLumaMax;
-    return;
+    // Don't use ternary op.: https://bugzilla.mozilla.org/show_bug.cgi?id=1001708
+    if (*ptr > sLumaThreshold)
+      *ptr = sLumaMin;
+    else
+      *ptr = sLumaMax;
    }
 
 }  // Namespace mozilla.