Skip to content

Commit

Permalink
Fix Xcode warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ibireme committed Aug 6, 2017
1 parent cf25e2b commit 093193c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
5 changes: 2 additions & 3 deletions YYWebImage/Image/YYAnimatedImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ @interface YYAnimatedImageView() {
@package
UIImage <YYAnimatedImage> *_curAnimatedImage;

dispatch_once_t _onceToken;
dispatch_semaphore_t _lock; ///< lock for _buffer
NSOperationQueue *_requestQueue; ///< image request queue, serial

Expand Down Expand Up @@ -231,7 +230,7 @@ - (instancetype)initWithImage:(UIImage *)image highlightedImage:(UIImage *)highl

// init the animated params.
- (void)resetAnimated {
dispatch_once(&_onceToken, ^{
if (!_link) {
_lock = dispatch_semaphore_create(1);
_buffer = [NSMutableDictionary new];
_requestQueue = [[NSOperationQueue alloc] init];
Expand All @@ -244,7 +243,7 @@ - (void)resetAnimated {

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil];
});
}

[_requestQueue cancelAllOperations];
LOCK(
Expand Down
4 changes: 4 additions & 0 deletions YYWebImage/Image/YYImage.m
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ - (void)encodeWithCoder:(NSCoder *)aCoder {
}
}

+ (BOOL)supportsSecureCoding {
return YES;
}

#pragma mark - protocol YYAnimatedImage

- (NSUInteger)animatedImageFrameCount {
Expand Down
2 changes: 1 addition & 1 deletion YYWebImage/Image/YYImageCoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ typedef NS_ENUM(NSUInteger, YYImageBlendOperation) {

/**
Add an image from a file path to encoder.
@param path Image file path.
@param path Image file path.
@param duration Image duration for animation. Pass 0 to ignore this parameter.
*/
- (void)addImageWithFile:(NSString *)path duration:(NSTimeInterval)duration;
Expand Down
2 changes: 1 addition & 1 deletion YYWebImage/YYWebImageOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ - (void)_startRequest:(id)object {
NSArray *keys = @[NSURLFileSizeKey];
NSDictionary *attr = [_request.URL resourceValuesForKeys:keys error:nil];
NSNumber *fileSize = attr[NSURLFileSizeKey];
_expectedSize = fileSize ? fileSize.unsignedIntegerValue : -1;
_expectedSize = (fileSize != nil) ? fileSize.unsignedIntegerValue : -1;
}

// request image from web
Expand Down

0 comments on commit 093193c

Please sign in to comment.