[ios, macos] Fix miscellaneous static analyzer warnings (#7670)

* [ios, macos] Fixed static analyzer warnings

Fixed static analyzer warnings in MGLNetworkConfiguration, MGLRasterSource, and MGLShape.

* [ios] Fixed static analyzer warnings

Fixed static analyzer warnings in MGLAnnotationImage.

* [macos] Fixed static analyzer warnings

Fixed static analyzer warnings in MGLAnnotationImage and NSImage(MGLAdditions).

* [ios, macos] Two pointer-equal images are object-equal by definition
This commit is contained in:
Minh Nguyễn
2017-01-11 03:08:05 -08:00
committed by GitHub
parent b6cf87f5e7
commit 581fb3849d
6 changed files with 9 additions and 22 deletions

View File

@@ -55,17 +55,14 @@
MGLAnnotationImage *otherAnnotationImage = other;
return ((!_reuseIdentifier && !otherAnnotationImage.reuseIdentifier) || [_reuseIdentifier isEqualToString:otherAnnotationImage.reuseIdentifier])
return ((!_reuseIdentifier && !otherAnnotationImage.reuseIdentifier)
|| [_reuseIdentifier isEqualToString:otherAnnotationImage.reuseIdentifier])
&& _enabled == otherAnnotationImage.enabled
&& ((!_image && !otherAnnotationImage.image) || [UIImagePNGRepresentation(_image) isEqualToData:UIImagePNGRepresentation(otherAnnotationImage.image)]);
&& (_image == otherAnnotationImage.image || [UIImagePNGRepresentation(_image) isEqualToData:UIImagePNGRepresentation(otherAnnotationImage.image)]);
}
- (NSUInteger)hash {
NSUInteger hash;
hash += [_reuseIdentifier hash];
hash += _enabled;
hash += [_image hash];
return hash;
return _reuseIdentifier.hash + _enabled + _image.hash;
}
- (void)setImage:(UIImage *)image {