aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMRegex.m
diff options
context:
space:
mode:
Diffstat (limited to 'Foundation/GTMRegex.m')
-rw-r--r--Foundation/GTMRegex.m15
1 files changed, 8 insertions, 7 deletions
diff --git a/Foundation/GTMRegex.m b/Foundation/GTMRegex.m
index 4c393a6..f4d6362 100644
--- a/Foundation/GTMRegex.m
+++ b/Foundation/GTMRegex.m
@@ -719,13 +719,14 @@ static NSString *const kReplacementPattern =
[NSMutableString stringWithFormat:@"%@<%p> { isMatch=\"%s\", subPatterns=(",
[self class], self, (isMatch_ ? "YES" : "NO")];
for (NSUInteger x = 0; x <= numRegMatches_; ++x) {
- NSString *format = @", \"%.*s\"";
- if (x == 0)
- format = @" \"%.*s\"";
-
- [result appendFormat:format,
- (int)(regMatches_[x].rm_eo - regMatches_[x].rm_so),
- (((const char*)[utf8StrBuf_ bytes]) + regMatches_[x].rm_so)];
+ NSInteger length = (NSInteger)(regMatches_[x].rm_eo - regMatches_[x].rm_so);
+ const char* string
+ = (((const char*)[utf8StrBuf_ bytes]) + regMatches_[x].rm_so);
+ if (x == 0) {
+ [result appendFormat:@" \"%.*s\"", length , string];
+ } else {
+ [result appendFormat:@", \"%.*s\"", length , string];
+ }
}
[result appendString:@" ) }"];