mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-01 07:57:01 +00:00
Merge pull request #43 from diederich/fix/analyzerWarnings
Fix analyzer warnings
This commit is contained in:
commit
a31ea4aeae
@ -271,11 +271,16 @@ static inline NSAttributedString * NSAttributedStringBySettingColorFromContext(N
|
|||||||
- (CTFramesetterRef)framesetter {
|
- (CTFramesetterRef)framesetter {
|
||||||
if (_needsFramesetter) {
|
if (_needsFramesetter) {
|
||||||
@synchronized(self) {
|
@synchronized(self) {
|
||||||
if (_framesetter) CFRelease(_framesetter);
|
if (_framesetter) {
|
||||||
if (_highlightFramesetter) CFRelease(_highlightFramesetter);
|
CFRelease(_framesetter);
|
||||||
|
_framesetter = nil;
|
||||||
|
}
|
||||||
|
if (_highlightFramesetter) {
|
||||||
|
CFRelease(_highlightFramesetter);
|
||||||
|
_highlightFramesetter = nil;
|
||||||
|
}
|
||||||
|
|
||||||
self.framesetter = CTFramesetterCreateWithAttributedString((__bridge CFAttributedStringRef)self.renderedAttributedText);
|
_framesetter = CTFramesetterCreateWithAttributedString((__bridge CFAttributedStringRef)self.renderedAttributedText);
|
||||||
self.highlightFramesetter = nil;
|
|
||||||
_needsFramesetter = NO;
|
_needsFramesetter = NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -666,6 +671,7 @@ static inline NSAttributedString * NSAttributedStringBySettingColorFromContext(N
|
|||||||
|
|
||||||
CTFontRef font = CTFontCreateWithName((__bridge CFStringRef)self.font.fontName, self.font.pointSize, NULL);
|
CTFontRef font = CTFontCreateWithName((__bridge CFStringRef)self.font.fontName, self.font.pointSize, NULL);
|
||||||
CGContextSetLineWidth(c, CTFontGetUnderlineThickness(font));
|
CGContextSetLineWidth(c, CTFontGetUnderlineThickness(font));
|
||||||
|
CFRelease(font);
|
||||||
CGFloat y = roundf(runBounds.origin.y + runBounds.size.height / 2.0f);
|
CGFloat y = roundf(runBounds.origin.y + runBounds.size.height / 2.0f);
|
||||||
CGContextMoveToPoint(c, runBounds.origin.x, y);
|
CGContextMoveToPoint(c, runBounds.origin.x, y);
|
||||||
CGContextAddLineToPoint(c, runBounds.origin.x + runBounds.size.width, y);
|
CGContextAddLineToPoint(c, runBounds.origin.x + runBounds.size.width, y);
|
||||||
@ -685,12 +691,15 @@ static inline NSAttributedString * NSAttributedStringBySettingColorFromContext(N
|
|||||||
[self setText:text afterInheritingLabelAttributesAndConfiguringWithBlock:nil];
|
[self setText:text afterInheritingLabelAttributesAndConfiguringWithBlock:nil];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
NSAssert([text isKindOfClass:[NSAttributedString class]], @"TTTAttributedLabel accepts either NSStrings or NSAttributedStrings");
|
||||||
self.attributedText = text;
|
NSAttributedString *attributedString = text;
|
||||||
|
self.attributedText = attributedString;
|
||||||
|
|
||||||
self.links = [NSArray array];
|
self.links = [NSArray array];
|
||||||
if (self.dataDetectorTypes != UIDataDetectorTypeNone) {
|
if (self.dataDetectorTypes != UIDataDetectorTypeNone) {
|
||||||
for (NSTextCheckingResult *result in [self detectedLinksInString:[self.attributedText string] range:NSMakeRange(0, [text length]) error:nil]) {
|
for (NSTextCheckingResult *result in [self detectedLinksInString:[self.attributedText string]
|
||||||
|
range:NSMakeRange(0, [attributedString length])
|
||||||
|
error:nil]) {
|
||||||
[self addLinkWithTextCheckingResult:result];
|
[self addLinkWithTextCheckingResult:result];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -822,8 +831,8 @@ static inline NSAttributedString * NSAttributedStringBySettingColorFromContext(N
|
|||||||
NSMutableAttributedString *highlightAttributedString = [self.renderedAttributedText mutableCopy];
|
NSMutableAttributedString *highlightAttributedString = [self.renderedAttributedText mutableCopy];
|
||||||
[highlightAttributedString addAttribute:(NSString *)kCTForegroundColorAttributeName value:(id)[self.highlightedTextColor CGColor] range:NSMakeRange(0, highlightAttributedString.length)];
|
[highlightAttributedString addAttribute:(NSString *)kCTForegroundColorAttributeName value:(id)[self.highlightedTextColor CGColor] range:NSMakeRange(0, highlightAttributedString.length)];
|
||||||
|
|
||||||
if (!self.highlightFramesetter) {
|
if (!_highlightFramesetter) {
|
||||||
self.highlightFramesetter = CTFramesetterCreateWithAttributedString((__bridge CFAttributedStringRef)highlightAttributedString);
|
_highlightFramesetter = CTFramesetterCreateWithAttributedString((__bridge CFAttributedStringRef)highlightAttributedString);
|
||||||
}
|
}
|
||||||
|
|
||||||
[self drawFramesetter:self.highlightFramesetter attributedString:highlightAttributedString textRange:textRange inRect:textRect context:c];
|
[self drawFramesetter:self.highlightFramesetter attributedString:highlightAttributedString textRange:textRange inRect:textRect context:c];
|
||||||
|
@ -213,7 +213,7 @@
|
|||||||
1E754E5B1621FBB70070AB92 /* BITCrashReportTextFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITCrashReportTextFormatter.m; sourceTree = "<group>"; };
|
1E754E5B1621FBB70070AB92 /* BITCrashReportTextFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITCrashReportTextFormatter.m; sourceTree = "<group>"; };
|
||||||
1EA512DF167F7EF000FC9FBA /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/HockeySDK.strings"; sourceTree = "<group>"; };
|
1EA512DF167F7EF000FC9FBA /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/HockeySDK.strings"; sourceTree = "<group>"; };
|
||||||
1EACC979162F041E007578C5 /* BITAttributedLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITAttributedLabel.h; sourceTree = "<group>"; };
|
1EACC979162F041E007578C5 /* BITAttributedLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITAttributedLabel.h; sourceTree = "<group>"; };
|
||||||
1EACC97A162F041E007578C5 /* BITAttributedLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITAttributedLabel.m; sourceTree = "<group>"; };
|
1EACC97A162F041E007578C5 /* BITAttributedLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = BITAttributedLabel.m; sourceTree = "<group>"; };
|
||||||
1EAF20A4162DC0F600957B1D /* feedbackActivity@2x~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "feedbackActivity@2x~ipad.png"; sourceTree = "<group>"; };
|
1EAF20A4162DC0F600957B1D /* feedbackActivity@2x~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "feedbackActivity@2x~ipad.png"; sourceTree = "<group>"; };
|
||||||
1EAF20A5162DC0F600957B1D /* feedbackActivity~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "feedbackActivity~ipad.png"; sourceTree = "<group>"; };
|
1EAF20A5162DC0F600957B1D /* feedbackActivity~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "feedbackActivity~ipad.png"; sourceTree = "<group>"; };
|
||||||
1EAF20A6162DC0F600957B1D /* feedbackActiviy.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = feedbackActiviy.png; sourceTree = "<group>"; };
|
1EAF20A6162DC0F600957B1D /* feedbackActiviy.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = feedbackActiviy.png; sourceTree = "<group>"; };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user