From 6e82c1d6d2a6e218556d3bb0b1acdc9b35066a88 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Wed, 3 Apr 2019 17:42:56 +0800 Subject: [PATCH] Remove BOOL local variable --- SDWebImage/SDImageIOCoder.m | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/SDWebImage/SDImageIOCoder.m b/SDWebImage/SDImageIOCoder.m index d52b6af3..7d5d6bf4 100644 --- a/SDWebImage/SDImageIOCoder.m +++ b/SDWebImage/SDImageIOCoder.m @@ -240,13 +240,12 @@ } + (BOOL)canDecodeFromFormat:(SDImageFormat)format { - BOOL canDecode = NO; CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format]; NSArray *imageUTTypes = (__bridge_transfer NSArray *)CGImageSourceCopyTypeIdentifiers(); if ([imageUTTypes containsObject:(__bridge NSString *)(imageUTType)]) { - canDecode = YES; + return YES; } - return canDecode; + return NO; } + (BOOL)canDecodeFromHEICFormat { @@ -268,7 +267,6 @@ } + (BOOL)canEncodeToFormat:(SDImageFormat)format { - BOOL canEncode = NO; NSMutableData *imageData = [NSMutableData data]; CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format]; @@ -276,13 +274,12 @@ CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, 1, NULL); if (!imageDestination) { // Can't encode to HEIC - canEncode = NO; + return NO; } else { // Can encode to HEIC CFRelease(imageDestination); - canEncode = YES; + return YES; } - return canEncode; } + (BOOL)canEncodeToHEICFormat {