aboutsummaryrefslogtreecommitdiff
path: root/Foundation
diff options
context:
space:
mode:
authorGravatar Mark Mentovai <mark@chromium.org>2017-07-23 21:05:55 -0400
committerGravatar Sergio Campamá <kaipi@google.com>2017-07-24 10:57:24 -0500
commit3c3111d3aefe907c8c0f0e933029608d96ceefeb (patch)
treea4322828d03be2d05a407dedf36bce485e9e450a /Foundation
parentec72a2bc500a716369c383837bffdc7d2a22855b (diff)
Cast NSInteger to long for formatting as %ld
In https://crbug.com/747643, a new version of Clang produces warnings when attempting to format NSInteger as %zd (which is normally used for ssize_t). Acquiesce by casting NSInteger to long and formatting using %ld. In the process, I audited all occurrences of %zd in GTM and found that the remainder were being used to format size_t, which ought to use %zu, so I’ve corrected those. I also audited the existing uses of %zu and found them all to be correct.
Diffstat (limited to 'Foundation')
-rw-r--r--Foundation/GTMGeometryUtilsTest.m4
-rw-r--r--Foundation/GTMRegex.m2
2 files changed, 3 insertions, 3 deletions
diff --git a/Foundation/GTMGeometryUtilsTest.m b/Foundation/GTMGeometryUtilsTest.m
index f4cf731..80b4392 100644
--- a/Foundation/GTMGeometryUtilsTest.m
+++ b/Foundation/GTMGeometryUtilsTest.m
@@ -125,7 +125,7 @@
NSRect result = GTMNSScaleRectangleToSize(rect, tests[i].size_,
GTMScaleProportionally);
XCTAssertTrue(NSEqualRects(result, GTMNSRectOfSize(tests[i].newSize_)),
- @"failed on test %zd", i);
+ @"failed on test %zu", i);
}
NSRect result = GTMNSScaleRectangleToSize(NSZeroRect, tests[0].size_,
@@ -288,7 +288,7 @@
CGRect result = GTMCGScaleRectangleToSize(rect, tests[i].size_,
GTMScaleProportionally);
XCTAssertTrue(CGRectEqualToRect(result, GTMCGRectOfSize(tests[i].newSize_)),
- @"failed on test %zd", i);
+ @"failed on test %zu", i);
}
CGRect result = GTMCGScaleRectangleToSize(CGRectZero, tests[0].size_,
diff --git a/Foundation/GTMRegex.m b/Foundation/GTMRegex.m
index 7ac4665..957b9ce 100644
--- a/Foundation/GTMRegex.m
+++ b/Foundation/GTMRegex.m
@@ -410,7 +410,7 @@ static NSString *const kReplacementPattern =
- (NSString *)description {
NSMutableString *result =
- [NSMutableString stringWithFormat:@"%@<%p> { pattern=\"%@\", rawNumSubPatterns=%zd, options=(",
+ [NSMutableString stringWithFormat:@"%@<%p> { pattern=\"%@\", rawNumSubPatterns=%zu, options=(",
[self class], self, pattern_, regexData_.re_nsub];
if (options_) {
if (options_ & kGTMRegexOptionIgnoreCase)