Revision: 173
Author:
thom...@gmail.com
Date: Thu Jul 26 17:25:23 2012
Log: quick fixes of some format string issues
http://code.google.com/p/coverstory/source/detail?r=173
Modified:
/trunk/CoverStoryCoverageData.h
/trunk/CoverStoryCoverageData.m
/trunk/CoverStoryDocument.m
/trunk/CoverStoryValueTransformers.m
=======================================
--- /trunk/CoverStoryCoverageData.h Thu Jun 3 15:06:55 2010
+++ /trunk/CoverStoryCoverageData.h Thu Jul 26 17:25:23 2012
@@ -18,6 +18,7 @@
//
#import <Cocoa/Cocoa.h>
+#import "GTMDefines.h"
@class CoverStoryDocument;
@@ -52,8 +53,10 @@
// methods to get feedback while the data is processed
@protocol CoverStoryCoverageProcessingProtocol
-- (void)coverageErrorForPath:(NSString*)path message:(NSString
*)format, ...;
-- (void)coverageWarningForPath:(NSString*)path message:(NSString
*)format, ...;
+- (void)coverageErrorForPath:(NSString*)path
+ message:(NSString *)format, ... NS_FORMAT_FUNCTION(2,
3);
+- (void)coverageWarningForPath:(NSString*)path
+ message:(NSString *)format, ...
NS_FORMAT_FUNCTION(2, 3);
@end
// Keeps track of the data for a whole source file.
=======================================
--- /trunk/CoverStoryCoverageData.m Fri Jun 4 07:15:04 2010
+++ /trunk/CoverStoryCoverageData.m Thu Jul 26 17:25:23 2012
@@ -394,8 +394,10 @@
if ([newLines count] != [lines_ count]) {
if (receiver) {
[receiver coverageErrorForPath:sourcePath_
- message:@"coverage source (%@) has different
line count '%d' vs '%d'",
- [fileData sourcePath], [newLines count], [lines_ count]];
+ message:@"coverage source (%@) has different
line count '%lu' vs '%lu'",
+ [fileData sourcePath],
+ (unsigned long)[newLines count],
+ (unsigned long)[lines_ count]];
}
return NO;
}
@@ -408,8 +410,8 @@
if (![[lineNew line] isEqual:[lineMe line]]) {
if (receiver) {
[receiver coverageErrorForPath:sourcePath_
- message:@"coverage source (%@) line %d
doesn't match, '%@' vs '%@'",
- [fileData sourcePath], x, [lineNew line], [lineMe line]];
+ message:@"coverage source (%@) line %lu
doesn't match, '%@' vs '%@'",
+ [fileData sourcePath], (unsigned long)x, [lineNew line], [lineMe
line]];
}
return NO;
}
@@ -432,9 +434,10 @@
- (NSString *)description {
return [NSString stringWithFormat:
- @"%@: %d total lines, %d lines non-feasible, "
- @"%d lines of code, %d lines hit",
- sourcePath_, [lines_ count], nonfeasible_, codeLines_,
hitLines_];
+ @"%@: %lu total lines, %ld lines non-feasible, "
+ @"%ld lines of code, %ld lines hit",
+ sourcePath_, (unsigned long)[lines_ count],
+ (long)nonfeasible_, (long)codeLines_, (long)hitLines_];
}
@@ -525,8 +528,8 @@
}
- (NSString *)description {
- return [NSString stringWithFormat:@"%@ <%p>: %u items in set",
- [self class], self, [fileDatas_ count]];
+ return [NSString stringWithFormat:@"%@ <%p>: %lu items in set",
+ [self class], self, (unsigned long)[fileDatas_ count]];
}
@end
@@ -571,14 +574,14 @@
self.hitCount = newHits;
} else if (newHits > 0) {
NSAssert1(self.hitCount >= 0,
- @"how was it not feasible in only one version? (hitCount_
= %d)",
- hitCount_);
+ @"how was it not feasible in only one version? (hitCount_
= %ld)",
+ (long)hitCount_);
self.hitCount += newHits;
}
}
- (NSString*)description {
- return [NSString stringWithFormat:@"%d %@", self.hitCount, self.line];
+ return [NSString stringWithFormat:@"%ld %@", (long)self.hitCount,
self.line];
}
@end
=======================================
--- /trunk/CoverStoryDocument.m Sat Jul 21 17:33:57 2012
+++ /trunk/CoverStoryDocument.m Thu Jul 26 17:25:23 2012
@@ -240,8 +240,8 @@
[runner runScript:scriptPath
withArgs:[NSArray arrayWithObjects:
path,
- [NSString stringWithFormat:@"%d", [selectedRows
firstIndex] + 1],
- [NSString stringWithFormat:@"%d", [selectedRows
lastIndex] + 1],
+ [NSString stringWithFormat:@"%lu", (unsigned
long)[selectedRows firstIndex] + 1],
+ [NSString stringWithFormat:@"%lu", (unsigned
long)[selectedRows lastIndex] + 1],
nil]];
}
}
@@ -350,7 +350,8 @@
messageType:kCSMessageTypeInfo];
} else {
NSString *message =
- [NSString stringWithFormat:@"Found %u gcda files to process.",
pathCount];
+ [NSString stringWithFormat:@"Found %lu gcda files to process.",
+ (unsigned long)pathCount];
[self addMessageFromThread:message
messageType:kCSMessageTypeInfo];
}
@@ -961,15 +962,16 @@
NSString *summary = nil;
if (nonfeasible > 0) {
summary = [NSString stringWithFormat:
- @"Full dataset executed %@%% of %d lines (%d executed, "
- @"%d executable, %d non-feasible, %d total lines).",
- coverage, codeLines, hitLines, codeLines, nonfeasible,
- totalLines];
+ @"Full dataset executed %@%% of %ld lines (%ld executed, "
+ @"%ld executable, %ld non-feasible, %ld total lines).",
+ coverage, (long)codeLines, (long)hitLines,
(long)codeLines,
+ (long)nonfeasible, (long)totalLines];
} else {
summary = [NSString stringWithFormat:
- @"Full dataset executed %@%% of %d lines (%d executed, "
- @"%d executable, %d total lines).",
- coverage, codeLines, hitLines, codeLines, totalLines];
+ @"Full dataset executed %@%% of %ld lines (%ld executed, "
+ @"%ld executable, %ld total lines).",
+ coverage, (long)codeLines, (long)hitLines,
(long)codeLines,
+ (long)totalLines];
}
[self addMessageFromThread:summary
messageType:kCSMessageTypeInfo];
@@ -981,8 +983,8 @@
#if DEBUG
if (startDate_) {
NSTimeInterval elapsed = -[startDate_ timeIntervalSinceNow];
- UInt32 secs = (UInt32)elapsed % 60;
- UInt32 mins = ((UInt32)elapsed / 60) % 60;
+ unsigned int secs = (unsigned int)elapsed % 60;
+ unsigned int mins = ((unsigned int)elapsed / 60) % 60;
NSString *elapsedStr
= [NSString stringWithFormat:@"It took %u:%02u to process the data.",
mins, secs];
@@ -1266,7 +1268,7 @@
hitStyle = @"sourcelinemissed";
}
if (!hitCountString) {
- hitCountString = [NSString stringWithFormat:@"%d", hitCount];
+ hitCountString = [NSString stringWithFormat:@"%ld", (long)hitCount];
}
[sourceHtml appendFormat:
@"<tr class='sourceline'>\n"
=======================================
--- /trunk/CoverStoryValueTransformers.m Thu Jun 3 15:06:55 2010
+++ /trunk/CoverStoryValueTransformers.m Thu Jul 26 17:25:23 2012
@@ -56,7 +56,7 @@
if (count == kCoverStoryNonFeasibleMarker) {
displayString = @"--"; // for non-feasible lines
} else if (count < 999) {
- displayString = [NSString stringWithFormat:@"%d", count];
+ displayString = [NSString stringWithFormat:@"%ld", (long)count];
} else {
displayString = @"99+";
}
@@ -253,14 +253,15 @@
NSString *statString = nil;
if (nonfeasible) {
statString = [NSString stringWithFormat:
- @"Executed %@%% of %d lines (%d executed, %d
executable, "
- "%d non-feasible, %d total lines)", coverage, codeLines,
- hitLines, codeLines, nonfeasible, totalLines];
+ @"Executed %@%% of %ld lines (%ld executed, %ld
executable, "
+ "%ld non-feasible, %ld total lines)", coverage,
+ (long)codeLines, (long)hitLines, (long)codeLines,
+ (long)nonfeasible, (long)totalLines];
} else {
statString = [NSString stringWithFormat:
- @"Executed %@%% of %d lines (%d executed, %d
executable, "
- "%d total lines)", coverage, codeLines, hitLines,
- codeLines, totalLines];
+ @"Executed %@%% of %ld lines (%ld executed, %ld
executable, "
+ "%ld total lines)", coverage, (long)codeLines,
(long)hitLines,
+ (long)codeLines, (long)totalLines];
}
return statString;
}
@@ -302,15 +303,16 @@
NSString *statString = nil;
if (nonfeasible) {
statString = [NSString stringWithFormat:
- @"Executed %@%% of %d lines (%d sources, %d executed, "
- "%d executable, %d non-feasible, %d total lines)",
coverage,
- codeLines, sources, hitLines, codeLines, nonfeasible,
- totalLines];
+ @"Executed %@%% of %ld lines (%ld sources, %ld
executed, "
+ "%ld executable, %ld non-feasible, %ld total lines)",
+ coverage, (long)codeLines, (long)sources, (long)hitLines,
+ (long)codeLines, (long)nonfeasible, (long)totalLines];
} else {
statString = [NSString stringWithFormat:
- @"Executed %@%% of %d lines (%d sources, %d executed, "
- "%d executable, %d total lines)", coverage, codeLines,
- sources, hitLines, codeLines, totalLines];
+ @"Executed %@%% of %ld lines (%ld sources, %ld
executed, "
+ "%ld executable, %ld total lines)", coverage,
(long)codeLines,
+ (long)sources, (long)hitLines, (long)codeLines,
+ (long)totalLines];
}
return statString;
}
@@ -340,7 +342,8 @@
nonFeasibleLines:NULL
coverageString:&coverage
coverage:NULL];
- return [NSString stringWithFormat:@"%@%% of %d lines", coverage,
codeLines];
+ return [NSString stringWithFormat:@"%@%% of %ld lines",
+ coverage, (long)codeLines];
}
@end