Skip to content

Commit

Permalink
Minor code improvements (#1622)
Browse files Browse the repository at this point in the history
* Simplify code logic

* Keep using user-defined type
  • Loading branch information
hanton authored and nguyenhuy committed Aug 21, 2019
1 parent beadc28 commit 1467319
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Source/ASExperimentalFeatures.mm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
ASExperimentalFeatures ASExperimentalFeaturesFromArray(NSArray<NSString *> *array)
{
NSArray *allNames = ASExperimentalFeaturesGetNames(ASExperimentalFeatureAll);
ASExperimentalFeatures result = 0;
ASExperimentalFeatures result = kNilOptions;
for (NSString *str in array) {
NSUInteger i = [allNames indexOfObject:str];
if (i != NSNotFound) {
Expand Down
2 changes: 1 addition & 1 deletion Source/ASImageNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ + (UIImage *)displayWithParameters:(id<NSObject>)parameter isCancelled:(NS_NOESC


// If we're not supposed to do any cropping, just decode image at original size
if (!cropEnabled || !contentModeSupported || stretchable) {
if (!cropEnabled || !contentModeSupported) {
backingSize = imageSizeInPixels;
imageDrawRect = (CGRect){.size = backingSize};
} else {
Expand Down
4 changes: 1 addition & 3 deletions Source/ASNetworkImageNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -555,9 +555,7 @@ - (void)_updateProgressImageBlockOnDownloaderIfNeeded
if (clearAndReattempt) {
// In this case another thread changed the _downloadIdentifierForProgressBlock before we finished registering
// the new progress block for newDownloadIDForProgressBlock ID. Let's clear it now and reattempt to register
if (newDownloadIDForProgressBlock) {
[_downloader setProgressImageBlock:nil callbackQueue:[self callbackQueue] withDownloadIdentifier:newDownloadIDForProgressBlock];
}
[_downloader setProgressImageBlock:nil callbackQueue:[self callbackQueue] withDownloadIdentifier:newDownloadIDForProgressBlock];
[self _updateProgressImageBlockOnDownloaderIfNeeded];
}
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Debug/AsyncDisplayKit+Debug.mm
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,10 @@ - (void)updateRangeController:(ASRangeController *)controller
CGFloat leadingDisplayTuningRatio = 0;
CGFloat leadingPreloadTuningRatio = 0;

if (!((displayTuningParameters.leadingBufferScreenfuls + displayTuningParameters.trailingBufferScreenfuls) == 0)) {
if (displayTuningParameters.leadingBufferScreenfuls + displayTuningParameters.trailingBufferScreenfuls != 0) {
leadingDisplayTuningRatio = displayTuningParameters.leadingBufferScreenfuls / (displayTuningParameters.leadingBufferScreenfuls + displayTuningParameters.trailingBufferScreenfuls);
}
if (!((preloadTuningParameters.leadingBufferScreenfuls + preloadTuningParameters.trailingBufferScreenfuls) == 0)) {
if (preloadTuningParameters.leadingBufferScreenfuls + preloadTuningParameters.trailingBufferScreenfuls != 0) {
leadingPreloadTuningRatio = preloadTuningParameters.leadingBufferScreenfuls / (preloadTuningParameters.leadingBufferScreenfuls + preloadTuningParameters.trailingBufferScreenfuls);
}

Expand Down
1 change: 0 additions & 1 deletion Source/Private/TextExperiment/Utility/ASTextUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ static inline CGFloat ASTextEmojiGetDescentWithFontSize(CGFloat fontSize) {
} else {
return 0.3125 * fontSize;
}
return 0;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Source/Private/_ASPendingState.mm
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ @implementation _ASPendingState
@package //Expose all ivars for ASDisplayNode to bypass getters for efficiency

UIViewAutoresizing autoresizingMask;
unsigned int edgeAntialiasingMask;
CAEdgeAntialiasingMask edgeAntialiasingMask;
CGRect frame; // Frame is only to be used for synchronous views wrapped by nodes (see setFrame:)
CGRect bounds;
UIColor *backgroundColor;
Expand Down

0 comments on commit 1467319

Please sign in to comment.