Brion VIBBER has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/141271

Change subject: Cleanup some integer type conversion warnings
......................................................................

Cleanup some integer type conversion warnings

* NSInteger is 'int' on 32-bit and 'long' on 64-bit, so there were
  some fun warnings about usage in formatting strings where %d was
  being used when building for 64-bit device
* Some warnings about enum types

Change-Id: I4bea97dc4b80e44ed63336132100ce4440658e0c
---
M wikipedia/Categories/NSString+Extras.m
M wikipedia/Categories/NSString+FormattedAttributedString.m
M wikipedia/Categories/Section+DisplayHtml.m
M wikipedia/View Controllers/ModalOverlay/ModalContentViewController.m
M wikipedia/View Controllers/Navigation/Secondary/SecondaryMenuViewController.m
M wikipedia/View Controllers/WebView/WebViewController.m
6 files changed, 18 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/ios/wikipedia 
refs/changes/71/141271/1

diff --git a/wikipedia/Categories/NSString+Extras.m 
b/wikipedia/Categories/NSString+Extras.m
index 74fc208..c1c5ed0 100644
--- a/wikipedia/Categories/NSString+Extras.m
+++ b/wikipedia/Categories/NSString+Extras.m
@@ -23,7 +23,7 @@
     }
     
     uint8_t digest[CC_SHA1_DIGEST_LENGTH];
-    CC_SHA1(data.bytes, data.length, digest);
+    CC_SHA1(data.bytes, (unsigned int)data.length, digest);
     NSMutableString *output = [NSMutableString 
stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2];
     
     for (int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++)
diff --git a/wikipedia/Categories/NSString+FormattedAttributedString.m 
b/wikipedia/Categories/NSString+FormattedAttributedString.m
index cc320ea..6093dd6 100644
--- a/wikipedia/Categories/NSString+FormattedAttributedString.m
+++ b/wikipedia/Categories/NSString+FormattedAttributedString.m
@@ -15,7 +15,7 @@
     
     for (NSUInteger i = 0; i < substitutionStrings.count; i++) {
         NSRegularExpression *regex =
-        [NSRegularExpression regularExpressionWithPattern: [NSString 
stringWithFormat:@"\\$%d+", i + 1]
+        [NSRegularExpression regularExpressionWithPattern: [NSString 
stringWithFormat:@"\\$%lu+", (unsigned long)i + 1]
                                                   options: 0
                                                     error: nil];
         NSArray *matches =
diff --git a/wikipedia/Categories/Section+DisplayHtml.m 
b/wikipedia/Categories/Section+DisplayHtml.m
index 854963a..318b1e7 100644
--- a/wikipedia/Categories/Section+DisplayHtml.m
+++ b/wikipedia/Categories/Section+DisplayHtml.m
@@ -13,16 +13,16 @@
 
     return
         [NSString stringWithFormat:@"\
-<div id=\"section_heading_and_content_block_%d\">\
+<div id=\"section_heading_and_content_block_%ld\">\
 %@\
-<div id=\"content_block_%d\">\
+<div id=\"content_block_%ld\">\
 %@\
 </div>\
 </div>\
          ",
-             self.sectionId.integerValue,
+             (long)self.sectionId.integerValue,
              (isMainPage ? @"" : [self getHeaderTag:isMainPage]),
-             self.sectionId.integerValue,
+             (long)self.sectionId.integerValue,
              self.html
          ];
 }
@@ -39,17 +39,17 @@
 
     return
         [NSString stringWithFormat:@"\
-<h%d class=\"section_heading\" data-id=\"%d\" id=\"%@\">\
+<h%ld class=\"section_heading\" data-id=\"%ld\" id=\"%@\">\
 %@\
 %@\
-</h%d>\
+</h%ld>\
             ",
-            headingTagSize,
-            self.sectionId.integerValue,
+            (long)headingTagSize,
+            (long)self.sectionId.integerValue,
             self.anchor,
             title,
             pencilAnchor,
-            headingTagSize
+            (long)headingTagSize
         ];
 }
 
@@ -78,8 +78,8 @@
 -(NSString *)getEditPencilAnchor
 {
     return [NSString stringWithFormat:
-        @"<a class=\"edit_section_button\" data-action=\"edit_section\" 
data-id=\"%d\"></a>",
-        self.sectionId.integerValue];
+        @"<a class=\"edit_section_button\" data-action=\"edit_section\" 
data-id=\"%ld\"></a>",
+        (long)self.sectionId.integerValue];
 }
 
 @end
diff --git a/wikipedia/View 
Controllers/ModalOverlay/ModalContentViewController.m b/wikipedia/View 
Controllers/ModalOverlay/ModalContentViewController.m
index 124c413..9e2862b 100644
--- a/wikipedia/View Controllers/ModalOverlay/ModalContentViewController.m
+++ b/wikipedia/View Controllers/ModalOverlay/ModalContentViewController.m
@@ -64,7 +64,7 @@
         [invocation invoke];
         NSUInteger destNavBarMode;
         [invocation getReturnValue:&destNavBarMode];
-        self.navBarMode = destNavBarMode;
+        self.navBarMode = (NavBarMode)destNavBarMode;
     }
 
     selector = NSSelectorFromString(@"navBarStyle");
@@ -76,7 +76,7 @@
         [invocation invoke];
         NSUInteger destNavBarStyle;
         [invocation getReturnValue:&destNavBarStyle];
-        self.navBarStyle = destNavBarStyle;
+        self.navBarStyle = (NavBarStyle)destNavBarStyle;
     }
 }
 
diff --git a/wikipedia/View 
Controllers/Navigation/Secondary/SecondaryMenuViewController.m b/wikipedia/View 
Controllers/Navigation/Secondary/SecondaryMenuViewController.m
index 0e1963f..27b2e56 100644
--- a/wikipedia/View 
Controllers/Navigation/Secondary/SecondaryMenuViewController.m
+++ b/wikipedia/View 
Controllers/Navigation/Secondary/SecondaryMenuViewController.m
@@ -195,7 +195,7 @@
 
 -(SecondaryMenuRowIndex)getIndexOfRow:(NSDictionary *)row
 {
-    return ((NSNumber *)row[@"tag"]).integerValue;
+    return (SecondaryMenuRowIndex)((NSNumber *)row[@"tag"]).integerValue;
 }
 
 -(SecondaryMenuRowView *)getViewWithTag:(SecondaryMenuRowIndex)tag
@@ -492,7 +492,7 @@
 
     CGFloat animationScale = 1.28f;
     
-    NSMutableDictionary *row = [self getRowWithTag:tappedItem.tag];
+    NSMutableDictionary *row = [self 
getRowWithTag:(SecondaryMenuRowIndex)tappedItem.tag];
     
     NSString *icon = [row objectForKey:@"icon"];
     
diff --git a/wikipedia/View Controllers/WebView/WebViewController.m 
b/wikipedia/View Controllers/WebView/WebViewController.m
index 8c8fda9..b7a75f6 100644
--- a/wikipedia/View Controllers/WebView/WebViewController.m
+++ b/wikipedia/View Controllers/WebView/WebViewController.m
@@ -227,7 +227,7 @@
 {
     NSDate *lastHousekeepingDate = [[NSUserDefaults standardUserDefaults] 
objectForKey:@"LastHousekeepingDate"];
     NSInteger daysSinceLastHouseKeeping = [[NSDate date] 
daysAfterDate:lastHousekeepingDate];
-    NSLog(@"daysSinceLastHouseKeeping = %d", daysSinceLastHouseKeeping);
+    NSLog(@"daysSinceLastHouseKeeping = %ld", (long)daysSinceLastHouseKeeping);
     if (daysSinceLastHouseKeeping > 1) {
         NSLog(@"Performing housekeeping...");
         CoreDataHousekeeping *imageHousekeeping = [[CoreDataHousekeeping 
alloc] init];

-- 
To view, visit https://gerrit.wikimedia.org/r/141271
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4bea97dc4b80e44ed63336132100ce4440658e0c
Gerrit-PatchSet: 1
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Brion VIBBER <br...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to