Bug 1153579 - Fix -Wsign-compare warnings in nsNativeThemeCocoa.mm about int and size_t. r=mstange
authorChris Peterson <cpeterson@mozilla.com>
Fri, 17 Apr 2015 10:02:21 -0700
changeset 239841 c3aa154de9b12abcbe725c966d02d9a23bf42f58
parent 239840 060cd82010b939db80598c580c20e0d2d0e16acc
child 239842 8e82f557f913524cb57eb2b52730c83f9c49b1c3
push id28613
push userphilringnalda@gmail.com
push dateMon, 20 Apr 2015 03:21:42 +0000
treeherdermozilla-central@873698d9ad85 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1153579
milestone40.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 1153579 - Fix -Wsign-compare warnings in nsNativeThemeCocoa.mm about int and size_t. r=mstange
widget/cocoa/nsNativeThemeCocoa.mm
--- a/widget/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/cocoa/nsNativeThemeCocoa.mm
@@ -355,17 +355,17 @@ enum {
 
 enum {
   leftMargin,
   topMargin,
   rightMargin,
   bottomMargin
 };
 
-static int EnumSizeForCocoaSize(NSControlSize cocoaControlSize) {
+static size_t EnumSizeForCocoaSize(NSControlSize cocoaControlSize) {
   if (cocoaControlSize == NSMiniControlSize)
     return miniControlSize;
   else if (cocoaControlSize == NSSmallControlSize)
     return smallControlSize;
   else
     return regularControlSize;
 }
 
@@ -389,17 +389,17 @@ static NSString* CUIControlSizeForCocoaS
 }
 
 static void InflateControlRect(NSRect* rect, NSControlSize cocoaControlSize, const float marginSet[][3][4])
 {
   if (!marginSet)
     return;
 
   static int osIndex = leopardOS;
-  int controlSize = EnumSizeForCocoaSize(cocoaControlSize);
+  size_t controlSize = EnumSizeForCocoaSize(cocoaControlSize);
   const float* buttonMargins = marginSet[osIndex][controlSize];
   rect->origin.x -= buttonMargins[leftMargin];
   rect->origin.y -= buttonMargins[bottomMargin];
   rect->size.width += buttonMargins[leftMargin] + buttonMargins[rightMargin];
   rect->size.height += buttonMargins[bottomMargin] + buttonMargins[topMargin];
 }
 
 static ChildView* ChildViewForFrame(nsIFrame* aFrame)
@@ -815,23 +815,23 @@ static void DrawCellWithSnapping(NSCell 
   HIRect drawRect = destRect;
 
   CGFloat controlWidths[3] = { miniSize.width, smallSize.width, regularSize.width };
   NSControlSize controlSizeX = FindControlSize(rectWidth, controlWidths, snapTolerance);
   CGFloat controlHeights[3] = { miniSize.height, smallSize.height, regularSize.height };
   NSControlSize controlSizeY = FindControlSize(rectHeight, controlHeights, snapTolerance);
 
   NSControlSize controlSize = NSRegularControlSize;
-  int sizeIndex = 0;
+  size_t sizeIndex = 0;
 
   // At some sizes, don't scale but snap.
   const NSControlSize smallerControlSize =
     EnumSizeForCocoaSize(controlSizeX) < EnumSizeForCocoaSize(controlSizeY) ?
     controlSizeX : controlSizeY;
-  const int smallerControlSizeIndex = EnumSizeForCocoaSize(smallerControlSize);
+  const size_t smallerControlSizeIndex = EnumSizeForCocoaSize(smallerControlSize);
   const NSSize size = sizes[smallerControlSizeIndex];
   float diffWidth = size.width ? rectWidth - size.width : 0.0f;
   float diffHeight = size.height ? rectHeight - size.height : 0.0f;
   if (diffWidth >= 0.0f && diffHeight >= 0.0f &&
       diffWidth <= snapTolerance && diffHeight <= snapTolerance) {
     // Snap to the smaller control size.
     controlSize = smallerControlSize;
     sizeIndex = smallerControlSizeIndex;