mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 03:09:56 +00:00
[Infer] Fix Infer errors/warnings (#1938)
* [Infer] Fix 11 Infer errors/warnings * fix build error
This commit is contained in:
parent
abf8d5b9aa
commit
4baf9bdbfe
@ -286,7 +286,9 @@ void _ASEnumerateControlEventsIncludedInMaskWithBlock(ASControlNodeEvent mask, v
|
||||
{
|
||||
// Create the dispatch table for this event.
|
||||
eventDispatchTable = [NSMapTable weakToStrongObjectsMapTable];
|
||||
_controlEventDispatchTable[eventKey] = eventDispatchTable;
|
||||
if (eventKey) {
|
||||
[_controlEventDispatchTable setObject:eventDispatchTable forKey:eventKey];
|
||||
}
|
||||
}
|
||||
|
||||
// Have we seen this target before for this event?
|
||||
@ -442,9 +444,11 @@ id<NSCopying> _ASControlNodeEventKeyForControlEvent(ASControlNodeEvent controlEv
|
||||
|
||||
void _ASEnumerateControlEventsIncludedInMaskWithBlock(ASControlNodeEvent mask, void (^block)(ASControlNodeEvent anEvent))
|
||||
{
|
||||
if (block == nil) {
|
||||
return;
|
||||
}
|
||||
// Start with our first event (touch down) and work our way up to the last event (touch cancel)
|
||||
for (ASControlNodeEvent thisEvent = ASControlNodeEventTouchDown; thisEvent <= ASControlNodeEventTouchCancel; thisEvent <<= 1)
|
||||
{
|
||||
for (ASControlNodeEvent thisEvent = ASControlNodeEventTouchDown; thisEvent <= ASControlNodeEventTouchCancel; thisEvent <<= 1){
|
||||
// If it's included in the mask, invoke the block.
|
||||
if ((mask & thisEvent) == thisEvent)
|
||||
block(thisEvent);
|
||||
|
||||
@ -59,13 +59,15 @@ static void runLoopSourceCallback(void *info) {
|
||||
// It is not guaranteed that the runloop will turn if it has no scheduled work, and this causes processing of
|
||||
// the queue to stop. Attaching a custom loop source to the run loop and signal it if new work needs to be done
|
||||
CFRunLoopSourceContext *runLoopSourceContext = (CFRunLoopSourceContext *)calloc(1, sizeof(CFRunLoopSourceContext));
|
||||
runLoopSourceContext->perform = runLoopSourceCallback;
|
||||
if (runLoopSourceContext) {
|
||||
runLoopSourceContext->perform = runLoopSourceCallback;
|
||||
#if ASRunLoopQueueLoggingEnabled
|
||||
runLoopSourceContext->info = (__bridge void *)self;
|
||||
runLoopSourceContext->info = (__bridge void *)self;
|
||||
#endif
|
||||
_runLoopSource = CFRunLoopSourceCreate(NULL, 0, runLoopSourceContext);
|
||||
CFRunLoopAddSource(runloop, _runLoopSource, kCFRunLoopCommonModes);
|
||||
free(runLoopSourceContext);
|
||||
_runLoopSource = CFRunLoopSourceCreate(NULL, 0, runLoopSourceContext);
|
||||
CFRunLoopAddSource(runloop, _runLoopSource, kCFRunLoopCommonModes);
|
||||
free(runLoopSourceContext);
|
||||
}
|
||||
|
||||
#if ASRunLoopQueueLoggingEnabled
|
||||
_runloopQueueLoggingTimer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(checkRunLoop) userInfo:nil repeats:YES];
|
||||
|
||||
@ -606,16 +606,18 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
|
||||
cell.delegate = self;
|
||||
|
||||
ASCellNode *node = [_dataController nodeAtIndexPath:indexPath];
|
||||
[_rangeController configureContentView:cell.contentView forCellNode:node];
|
||||
if (node) {
|
||||
[_rangeController configureContentView:cell.contentView forCellNode:node];
|
||||
|
||||
cell.node = node;
|
||||
cell.backgroundColor = node.backgroundColor;
|
||||
cell.selectionStyle = node.selectionStyle;
|
||||
cell.node = node;
|
||||
cell.backgroundColor = node.backgroundColor;
|
||||
cell.selectionStyle = node.selectionStyle;
|
||||
|
||||
// the following ensures that we clip the entire cell to it's bounds if node.clipsToBounds is set (the default)
|
||||
// This is actually a workaround for a bug we are seeing in some rare cases (selected background view
|
||||
// overlaps other cells if size of ASCellNode has changed.)
|
||||
cell.clipsToBounds = node.clipsToBounds;
|
||||
// the following ensures that we clip the entire cell to it's bounds if node.clipsToBounds is set (the default)
|
||||
// This is actually a workaround for a bug we are seeing in some rare cases (selected background view
|
||||
// overlaps other cells if size of ASCellNode has changed.)
|
||||
cell.clipsToBounds = node.clipsToBounds;
|
||||
}
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
@ -379,19 +379,19 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext;
|
||||
slider.maximumValue = 1.0;
|
||||
|
||||
if (_delegateFlags.delegateScrubberMinimumTrackTintColor) {
|
||||
slider.minimumTrackTintColor = [_delegate videoPlayerNodeScrubberMinimumTrackTint:strongSelf];
|
||||
slider.minimumTrackTintColor = [strongSelf.delegate videoPlayerNodeScrubberMinimumTrackTint:strongSelf];
|
||||
}
|
||||
|
||||
if (_delegateFlags.delegateScrubberMaximumTrackTintColor) {
|
||||
slider.maximumTrackTintColor = [_delegate videoPlayerNodeScrubberMaximumTrackTint:strongSelf];
|
||||
slider.maximumTrackTintColor = [strongSelf.delegate videoPlayerNodeScrubberMaximumTrackTint:strongSelf];
|
||||
}
|
||||
|
||||
if (_delegateFlags.delegateScrubberThumbTintColor) {
|
||||
slider.thumbTintColor = [_delegate videoPlayerNodeScrubberThumbTint:strongSelf];
|
||||
slider.thumbTintColor = [strongSelf.delegate videoPlayerNodeScrubberThumbTint:strongSelf];
|
||||
}
|
||||
|
||||
if (_delegateFlags.delegateScrubberThumbImage) {
|
||||
UIImage *thumbImage = [_delegate videoPlayerNodeScrubberThumbImage:strongSelf];
|
||||
UIImage *thumbImage = [strongSelf.delegate videoPlayerNodeScrubberThumbImage:strongSelf];
|
||||
[slider setThumbImage:thumbImage forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
|
||||
@ -560,6 +560,10 @@ NSString * const ASDataControllerRowNodeKind = @"_ASDataControllerRowNodeKind";
|
||||
return;
|
||||
}
|
||||
|
||||
if (block == nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we have never performed a reload, there is no value in executing edit operations as the initial
|
||||
// reload will directly re-query the latest state of the datasource - so completely skip the block in this case.
|
||||
if (_batchUpdateCounter == 0) {
|
||||
|
||||
@ -68,9 +68,9 @@
|
||||
NSMutableString *result = [NSMutableString stringWithString:@"{ "];
|
||||
[self enumerateRangesUsingBlock:^(NSRange range, BOOL * _Nonnull stop) {
|
||||
if (range.length == 1) {
|
||||
[result appendFormat:@"%zu ", range.location];
|
||||
[result appendFormat:@"%zu ", (unsigned long)range.location];
|
||||
} else {
|
||||
[result appendFormat:@"%zu-%zu ", range.location, NSMaxRange(range) - 1];
|
||||
[result appendFormat:@"%zu-%lu ", (unsigned long)range.location, NSMaxRange(range) - 1];
|
||||
}
|
||||
}];
|
||||
[result appendString:@"}"];
|
||||
|
||||
@ -34,6 +34,9 @@ BOOL ASSubclassOverridesClassSelector(Class superclass, Class subclass, SEL sele
|
||||
|
||||
void ASPerformBlockOnMainThread(void (^block)())
|
||||
{
|
||||
if (block == nil){
|
||||
return;
|
||||
}
|
||||
if (ASDisplayNodeThreadIsMain()) {
|
||||
block();
|
||||
} else {
|
||||
@ -43,6 +46,9 @@ void ASPerformBlockOnMainThread(void (^block)())
|
||||
|
||||
void ASPerformBlockOnBackgroundThread(void (^block)())
|
||||
{
|
||||
if (block == nil){
|
||||
return;
|
||||
}
|
||||
if (ASDisplayNodeThreadIsMain()) {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block);
|
||||
} else {
|
||||
|
||||
@ -43,7 +43,9 @@ static void ASRecursivelyUpdateMultidimensionalArrayAtIndexPaths(NSMutableArray
|
||||
curIdx++;
|
||||
}
|
||||
|
||||
updateBlock(mutableArray, indexSet, curIdx);
|
||||
if (updateBlock){
|
||||
updateBlock(mutableArray, indexSet, curIdx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -75,7 +75,9 @@
|
||||
NSTextContainer *))block
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_textKitMutex);
|
||||
block(_layoutManager, _textStorage, _textContainer);
|
||||
if (block) {
|
||||
block(_layoutManager, _textStorage, _textContainer);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
8
inferScript.sh
Executable file
8
inferScript.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
if ! [ -x "$(command -v infer)" ]; then
|
||||
echo "infer not found"
|
||||
echo "Install infer with homebrew: brew install infer"
|
||||
else
|
||||
infer --continue --reactive -- xcodebuild build -workspace AsyncDisplayKit.xcworkspace -scheme "AsyncDisplayKit-iOS" -configuration Debug -sdk iphonesimulator9.3
|
||||
fi
|
||||
Loading…
x
Reference in New Issue
Block a user