Skip to content

Commit 0e124d1

Browse files
committed
Update format strings since newer clangs don't like some.
1 parent 8ce2c70 commit 0e124d1

File tree

6 files changed

+29
-21
lines changed

6 files changed

+29
-21
lines changed

Source/Objects/GTLRBatchQuery.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ - (NSString *)description {
9494
[dedupedNames removeObject:[NSNull null]]; // In case any didn't have a loggingName.
9595
NSString *namesStr = [[dedupedNames allObjects] componentsJoinedByString:@","];
9696

97-
return [NSString stringWithFormat:@"%@ %p (queries:%tu - %@)",
98-
[self class], self, queries.count, namesStr];
97+
return [NSString stringWithFormat:@"%@ %p (queries:%lu - %@)",
98+
[self class], self, (long)queries.count, namesStr];
9999
}
100100

101101
#pragma mark -

Source/Objects/GTLRBatchResult.m

+4-2
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,11 @@ - (BOOL)isEqual:(id)object {
7575
}
7676

7777
- (NSString *)description {
78-
return [NSString stringWithFormat:@"%@ %p (successes:%tu failures:%tu responseHeaders:%tu)",
78+
return [NSString stringWithFormat:@"%@ %p (successes:%lu failures:%lu responseHeaders:%lu)",
7979
[self class], self,
80-
self.successes.count, self.failures.count, self.responseHeaders.count];
80+
(unsigned long)self.successes.count,
81+
(unsigned long)self.failures.count,
82+
(unsigned long)self.responseHeaders.count];
8183
}
8284

8385
// This class is a subclass of GTLRObject, which declares NSSecureCoding

Source/Objects/GTLRObject.m

+8-6
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,8 @@ - (NSString *)JSONDescription {
468468
} else if ([rawValue isKindOfClass:[NSArray class]]) {
469469
// for arrays, show the number of items in the array:
470470
// [3]
471-
value = [NSString stringWithFormat:@"[%tu]", ((NSArray *)rawValue).count];
471+
value = [NSString stringWithFormat:@"[%lu]",
472+
(unsigned long)((NSArray *)rawValue).count];
472473
} else if ([rawValue isKindOfClass:[NSString class]]) {
473474
// for strings, show the string in quotes:
474475
// "Hi mom."
@@ -580,8 +581,8 @@ - (id)objectAtIndexedSubscript:(NSUInteger)idx {
580581
NSArray *items = [self valueForKey:key];
581582
if (items == nil) {
582583
[NSException raise:NSRangeException
583-
format:@"index %tu beyond bounds (%@ property \"%@\" is nil)",
584-
idx, [self class], key];
584+
format:@"index %lu beyond bounds (%@ property \"%@\" is nil)",
585+
(unsigned long)idx, [self class], key];
585586
}
586587
id result = [items objectAtIndexedSubscript:idx];
587588
return result;
@@ -611,8 +612,9 @@ - (NSString *)description {
611612
if (self.JSON.count > 0) {
612613
jsonDesc = [self JSONDescription];
613614
}
614-
return [NSString stringWithFormat:@"%@ %p: %tu bytes, contentType:%@ %@",
615-
[self class], self, self.data.length, self.contentType, jsonDesc];
615+
return [NSString stringWithFormat:@"%@ %p: %lu bytes, contentType:%@ %@",
616+
[self class], self, (unsigned long)self.data.length, self.contentType,
617+
jsonDesc];
616618
}
617619

618620
- (id)copyWithZone:(NSZone *)zone {
@@ -661,7 +663,7 @@ - (NSArray *)itemsWithItemClass:(Class)itemClass {
661663

662664
- (NSString *)JSONDescription {
663665
// Just like GTLRObject's handing of arrays, just return the count.
664-
return [NSString stringWithFormat:@"[%tu]", self.JSON.count];
666+
return [NSString stringWithFormat:@"[%lu]", (unsigned long)self.JSON.count];
665667
}
666668

667669
@end

Source/Objects/GTLRQuery.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ + (NSString *)nextRequestID {
208208

209209
@synchronized([GTLRQuery class]) {
210210
++lastRequestID;
211-
result = [NSString stringWithFormat:@"gtlr_%tu", lastRequestID];
211+
result = [NSString stringWithFormat:@"gtlr_%lu", (unsigned long)lastRequestID];
212212
}
213213
return result;
214214
}

Source/Objects/GTLRService.m

+11-7
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,8 @@ - (GTLRServiceTicket *)fetchObjectWithURL:(NSURL *)targetURL
692692
if (loggingName.length > 0) {
693693
NSUInteger pageNumber = ticket.pagesFetchedCounter + 1;
694694
if (pageNumber > 1) {
695-
loggingName = [loggingName stringByAppendingFormat:@", page %tu", pageNumber];
695+
loggingName = [loggingName stringByAppendingFormat:@", page %lu",
696+
(unsigned long)pageNumber];
696697
}
697698
fetcher.comment = loggingName;
698699
}
@@ -1028,11 +1029,12 @@ - (GTLRServiceTicket *)executeBatchQuery:(GTLRBatchQuery *)batchObj
10281029
NSUInteger pageNumber = ticket.pagesFetchedCounter;
10291030
NSString *pageStr = @"";
10301031
if (pageNumber > 0) {
1031-
pageStr = [NSString stringWithFormat:@"page %tu, ", pageNumber + 1];
1032+
pageStr = [NSString stringWithFormat:@"page %lu, ",
1033+
(unsigned long)(pageNumber + 1)];
10321034
}
1033-
batchCopy.loggingName = [NSString stringWithFormat:@"batch: %@ (%@%tu queries)",
1035+
batchCopy.loggingName = [NSString stringWithFormat:@"batch: %@ (%@%lu queries)",
10341036
[loggingNames.allObjects componentsJoinedByString:@", "],
1035-
pageStr, numberOfQueries];
1037+
pageStr, (unsigned long)numberOfQueries];
10361038
}
10371039
#endif
10381040

@@ -1371,8 +1373,9 @@ - (void)handleParsedObjectForFetcher:(GTMSessionFetcher *)fetcher
13711373
} else {
13721374
queryLabel = [[executingQuery class] description];
13731375
}
1374-
GTLR_DEBUG_LOG(@"Executing %@ query required fetching %tu pages; use a query with"
1375-
@" a larger maxResults for faster results", queryLabel, pageCount);
1376+
GTLR_DEBUG_LOG(@"Executing %@ query required fetching %lu pages; use a query with"
1377+
@" a larger maxResults for faster results",
1378+
queryLabel, (unsigned long)pageCount);
13761379
}
13771380
#endif
13781381
} // nextPageQuery
@@ -2668,7 +2671,8 @@ - (void)cancelTicket {
26682671
- (void)startBackgroundTask {
26692672
#if GTM_BACKGROUND_TASK_FETCHING
26702673
GTLR_DEBUG_ASSERT(self.backgroundTaskIdentifier == UIBackgroundTaskInvalid,
2671-
@"Redundant GTLRService background task: %tu", self.backgroundTaskIdentifier);
2674+
@"Redundant GTLRService background task: %lu",
2675+
(unsigned long)self.backgroundTaskIdentifier);
26722676

26732677
NSString *taskName = [[self.executingQuery class] description];
26742678

Source/Tests/GTLRURITemplateTest.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@ - (void)runTestSuites:(NSDictionary *)testSuites {
5656
for (NSArray *testCase in testCases) {
5757
// Each case is an array of the template and value...
5858
XCTAssertEqual(testCase.count, (NSUInteger)2,
59-
@" test index %tu of '%@'", idx, suiteName);
59+
@" test index %lu of '%@'", (unsigned long)idx, suiteName);
6060

6161
NSString *testTemplate = [testCase objectAtIndex:0];
6262
NSString *expectedResult = [testCase objectAtIndex:1];
6363

6464
NSString *result = [GTLRURITemplate expandTemplate:testTemplate
6565
values:vars];
6666
XCTAssertEqualObjects(result, expectedResult,
67-
@"template was '%@' (index %tu of '%@')",
68-
testTemplate, idx, suiteName);
67+
@"template was '%@' (index %lu of '%@')",
68+
testTemplate, (unsigned long)idx, suiteName);
6969
++idx;
7070
}
7171
}

0 commit comments

Comments
 (0)