Remove BOOL local variable

This commit is contained in:
zhongwuzw 2019-04-03 17:42:56 +08:00
parent 8e5897338c
commit 6e82c1d6d2
1 changed files with 4 additions and 7 deletions

View File

@ -240,13 +240,12 @@
} }
+ (BOOL)canDecodeFromFormat:(SDImageFormat)format { + (BOOL)canDecodeFromFormat:(SDImageFormat)format {
BOOL canDecode = NO;
CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format]; CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format];
NSArray *imageUTTypes = (__bridge_transfer NSArray *)CGImageSourceCopyTypeIdentifiers(); NSArray *imageUTTypes = (__bridge_transfer NSArray *)CGImageSourceCopyTypeIdentifiers();
if ([imageUTTypes containsObject:(__bridge NSString *)(imageUTType)]) { if ([imageUTTypes containsObject:(__bridge NSString *)(imageUTType)]) {
canDecode = YES; return YES;
} }
return canDecode; return NO;
} }
+ (BOOL)canDecodeFromHEICFormat { + (BOOL)canDecodeFromHEICFormat {
@ -268,7 +267,6 @@
} }
+ (BOOL)canEncodeToFormat:(SDImageFormat)format { + (BOOL)canEncodeToFormat:(SDImageFormat)format {
BOOL canEncode = NO;
NSMutableData *imageData = [NSMutableData data]; NSMutableData *imageData = [NSMutableData data];
CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format]; CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format];
@ -276,13 +274,12 @@
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, 1, NULL); CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, 1, NULL);
if (!imageDestination) { if (!imageDestination) {
// Can't encode to HEIC // Can't encode to HEIC
canEncode = NO; return NO;
} else { } else {
// Can encode to HEIC // Can encode to HEIC
CFRelease(imageDestination); CFRelease(imageDestination);
canEncode = YES; return YES;
} }
return canEncode;
} }
+ (BOOL)canEncodeToHEICFormat { + (BOOL)canEncodeToHEICFormat {