From f2d76101815904b9f82665f6ea7f1dbb4b5339a8 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Tue, 7 Feb 2023 02:32:11 +0800 Subject: [PATCH] Change Objc BOOL true/false into correct YES/NO --- SDWebImage/Core/SDAnimatedImagePlayer.m | 4 ++-- SDWebImage/Core/SDWebImageDownloader.m | 2 +- Tests/Tests/SDAnimatedImageTest.m | 8 ++++---- Tests/Tests/SDImageCacheTests.m | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/SDWebImage/Core/SDAnimatedImagePlayer.m b/SDWebImage/Core/SDAnimatedImagePlayer.m index 5ed75c1b..88d8e4de 100644 --- a/SDWebImage/Core/SDAnimatedImagePlayer.m +++ b/SDWebImage/Core/SDAnimatedImagePlayer.m @@ -249,9 +249,9 @@ } else if (self.playbackMode == SDAnimatedImagePlaybackModeBounce || self.playbackMode == SDAnimatedImagePlaybackModeReversedBounce) { if (currentFrameIndex == 0) { - self.shouldReverse = false; + self.shouldReverse = NO; } else if (currentFrameIndex == totalFrameCount - 1) { - self.shouldReverse = true; + self.shouldReverse = YES; } nextFrameIndex = self.shouldReverse ? (currentFrameIndex - 1) : (currentFrameIndex + 1); nextFrameIndex %= totalFrameCount; diff --git a/SDWebImage/Core/SDWebImageDownloader.m b/SDWebImage/Core/SDWebImageDownloader.m index c1d27f0f..ed866cf7 100644 --- a/SDWebImage/Core/SDWebImageDownloader.m +++ b/SDWebImage/Core/SDWebImageDownloader.m @@ -518,7 +518,7 @@ didReceiveResponse:(NSURLResponse *)response if (dataOperation) { @synchronized (dataOperation) { // Mark the downloader operation `isCompleted = YES`, no longer re-use this operation when new request comes in - SDWebImageDownloaderOperationSetCompleted(dataOperation, true); + SDWebImageDownloaderOperationSetCompleted(dataOperation, YES); } } if ([dataOperation respondsToSelector:@selector(URLSession:task:didCompleteWithError:)]) { diff --git a/Tests/Tests/SDAnimatedImageTest.m b/Tests/Tests/SDAnimatedImageTest.m index 11e2390f..9d47b1b8 100644 --- a/Tests/Tests/SDAnimatedImageTest.m +++ b/Tests/Tests/SDAnimatedImageTest.m @@ -680,7 +680,7 @@ static BOOL _isCalled; player.playbackMode = SDAnimatedImagePlaybackModeBounce; __block NSInteger i = 0; - __block BOOL flag = false; + __block BOOL flag = NO; __block NSUInteger cnt = 0; __weak typeof(imageView) wimageView = imageView; [player setAnimationFrameHandler:^(NSUInteger index, UIImage * _Nonnull frame) { @@ -689,10 +689,10 @@ static BOOL _isCalled; if (index >= player.totalFrameCount - 1) { cnt++; - flag = true; + flag = YES; } else if (cnt != 0 && index == 0) { cnt++; - flag = false; + flag = NO; } if (!flag) { @@ -745,7 +745,7 @@ static BOOL _isCalled; flag = false; } else if (index == 0) { cnt++; - flag = true; + flag = YES; } if (flag) { diff --git a/Tests/Tests/SDImageCacheTests.m b/Tests/Tests/SDImageCacheTests.m index 324912cb..60f2ef16 100644 --- a/Tests/Tests/SDImageCacheTests.m +++ b/Tests/Tests/SDImageCacheTests.m @@ -233,7 +233,7 @@ static NSString *kTestImageKeyPNG = @"TestImageKey.png"; [SDImageCache.sharedImageCache removeImageFromDiskForKey:key]; __block BOOL callced = NO; SDImageCacheToken *token = [SDImageCache.sharedImageCache queryCacheOperationForKey:key done:^(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType) { - callced = true; + callced = YES; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0), dispatch_get_main_queue(), ^{ [expectation fulfill]; // callback once fulfill once });