소스 검색

add voids to block that don't require parameters, make implicit selfs explicit

Carola Nitz 7 년 전
부모
커밋
6066231bf9

+ 1 - 1
SharedSources/ServerBrowsing/General/VLCNetworkServerBrowserVLCMedia.m

@@ -128,7 +128,7 @@
     double amountOfSeconds = 0.1;
     dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(amountOfSeconds * NSEC_PER_SEC));
     dispatch_after(delayTime, dispatch_get_main_queue(), ^{
-        _needsNotifyDelegate = NO;
+        self->_needsNotifyDelegate = NO;
         [self.delegate networkServerBrowserDidUpdate:self];
     });
 }

+ 3 - 3
SharedSources/ServerBrowsing/UPnP/VLCNetworkServerBrowserUPnP.m

@@ -75,10 +75,10 @@
             [itemsArray addObject:[[VLCNetworkServerBrowserItemUPnP alloc] initWithBasicObject:object device:self.upnpDevice]];
         }
 
-        @synchronized(_items) {
-            _items = [itemsArray copy];
+        @synchronized(self->_items) {
+            self->_items = [itemsArray copy];
         }
-        _mediaList = [self buildMediaList];
+        self->_mediaList = [self buildMediaList];
         [[NSOperationQueue mainQueue] addOperationWithBlock:^{
             [self.delegate networkServerBrowserDidUpdate:self];
         }];

+ 1 - 2
SharedSources/VLCActivityViewControllerVendor.m

@@ -42,8 +42,7 @@
         [excludedActivities addObject:UIActivityTypeMarkupAsPDF];
     }
     controller.excludedActivityTypes = excludedActivities;
-
-    controller.completionHandler = ^(UIActivityType  _Nullable activityType, BOOL completed) {
+    controller.completionWithItemsHandler = ^(UIActivityType  _Nullable activityType, BOOL completed, NSArray * _Nullable returnedItems, NSError * _Nullable activityError) {
         APLog(@"UIActivityViewController finished with activity type: %@, completed: %i", activityType, completed);
 
         // Provide feedback. This could cause a false positive if the user chose "Don't Allow" in the permissions dialog, and UIActivityViewController does not inform us of that, so check the authorization status.

+ 5 - 5
Sources/VLCAppDelegate.m

@@ -110,10 +110,10 @@ NSString *const VLCDropboxSessionWasAuthorized = @"VLCDropboxSessionWasAuthorize
     self.window.rootViewController = rootViewController;
     [self.window makeKeyAndVisible];
     // enable crash preventer
-    void (^setupBlock)() = ^{
-        void (^setupLibraryBlock)() = ^{
-            appCoordinator = [[AppCoordinator alloc] initWithTabBarController:rootViewController];
-            [appCoordinator start];
+    void (^setupBlock)(void) = ^{
+        void (^setupLibraryBlock)(void) = ^{
+            self->appCoordinator = [[AppCoordinator alloc] initWithTabBarController:self->rootViewController];
+            [self->appCoordinator start];
         };
         [self validatePasscodeIfNeededWithCompletion:setupLibraryBlock];
 
@@ -138,7 +138,7 @@ NSString *const VLCDropboxSessionWasAuthorized = @"VLCDropboxSessionWasAuthorize
 
             //migrate
             setupBlock();
-            _isRunningMigration = NO;
+            self->_isRunningMigration = NO;
             [[MLMediaLibrary sharedMediaLibrary] updateMediaDatabase];
             [[VLCMediaFileDiscoverer sharedInstance] updateMediaList];
         };

+ 3 - 3
Sources/VLCBoxController.m

@@ -143,7 +143,7 @@
 
     BoxCollectionBlock success = ^(BoxCollection *collection)
     {
-        _fileList = collection;
+        self->_fileList = collection;
         [self _listOfGoodFilesAndFolders];
     };
 
@@ -254,9 +254,9 @@
 
     BoxAPIDataProgressBlock progressBlock = ^(long long expectedTotalBytes, unsigned long long bytesReceived)
     {
-        if ((_lastStatsUpdate > 0 && ([NSDate timeIntervalSinceReferenceDate] - _lastStatsUpdate > .5)) || _lastStatsUpdate <= 0) {
+        if ((self->_lastStatsUpdate > 0 && ([NSDate timeIntervalSinceReferenceDate] - self->_lastStatsUpdate > .5)) || self->_lastStatsUpdate <= 0) {
             [self calculateRemainingTime:(CGFloat)bytesReceived expectedDownloadSize:(CGFloat)expectedTotalBytes];
-            _lastStatsUpdate = [NSDate timeIntervalSinceReferenceDate];
+            self->_lastStatsUpdate = [NSDate timeIntervalSinceReferenceDate];
         }
 
         CGFloat progress = (CGFloat)bytesReceived / (CGFloat)expectedTotalBytes;

+ 2 - 2
Sources/VLCDownloadViewController.m

@@ -233,8 +233,8 @@ typedef NS_ENUM(NSUInteger, VLCDownloadScheme) {
     if (!_backgroundTaskIdentifier || _backgroundTaskIdentifier == UIBackgroundTaskInvalid) {
         dispatch_block_t expirationHandler = ^{
             APLog(@"Downloads were interrupted after being in background too long, time remaining: %f", [[UIApplication sharedApplication] backgroundTimeRemaining]);
-            [[UIApplication sharedApplication] endBackgroundTask:_backgroundTaskIdentifier];
-            _backgroundTaskIdentifier = 0;
+            [[UIApplication sharedApplication] endBackgroundTask:self->_backgroundTaskIdentifier];
+            self->_backgroundTaskIdentifier = 0;
         };
 
         _backgroundTaskIdentifier = [[UIApplication sharedApplication] beginBackgroundTaskWithName:@"VLCDownloader" expirationHandler:expirationHandler];

+ 5 - 5
Sources/VLCDropboxController.m

@@ -198,12 +198,12 @@
     }
     [[[self client].filesRoutes listFolder:path] setResponseBlock:^(DBFILESListFolderResult * _Nullable result, DBFILESListFolderError * _Nullable routeError, DBRequestError * _Nullable networkError) {
         if (result) {
-            _currentFileList = [result.entries sortedArrayUsingComparator:^NSComparisonResult(id a, id b) {
+            self->_currentFileList = [result.entries sortedArrayUsingComparator:^NSComparisonResult(id a, id b) {
                 NSString *first = [(DBFILESMetadata*)a name];
                 NSString *second = [(DBFILESMetadata*)b name];
                 return [first caseInsensitiveCompare:second];
             }];
-            APLog(@"found filtered metadata for %lu files", (unsigned long)_currentFileList.count);
+            APLog(@"found filtered metadata for %lu files", (unsigned long)self->_currentFileList.count);
             if ([self.delegate respondsToSelector:@selector(mediaListUpdated)])
                 [self.delegate mediaListUpdated];
         } else {
@@ -237,7 +237,7 @@
                 [self.delegate operationWithProgressInformationStopped];
             }
 
-            _downloadInProgress = NO;
+            self->_downloadInProgress = NO;
             [self _triggerNextDownload];
             if (networkError) {
                 APLog(@"downloadFile failed with network error %li and error tag %li", (long)networkError.statusCode, (long)networkError.tag);
@@ -248,9 +248,9 @@
                 UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, NSLocalizedString(@"GDRIVE_DOWNLOAD_SUCCESSFUL", nil));
             }
 
-            if ((_lastStatsUpdate > 0 && ([NSDate timeIntervalSinceReferenceDate] - _lastStatsUpdate > .5)) || _lastStatsUpdate <= 0) {
+            if ((self->_lastStatsUpdate > 0 && ([NSDate timeIntervalSinceReferenceDate] - self->_lastStatsUpdate > .5)) || self->_lastStatsUpdate <= 0) {
                 [self calculateRemainingTime:(CGFloat)totalBytesWritten expectedDownloadSize:(CGFloat)totalBytesExpectedToWrite];
-                _lastStatsUpdate = [NSDate timeIntervalSinceReferenceDate];
+                self->_lastStatsUpdate = [NSDate timeIntervalSinceReferenceDate];
             }
 
             if ([self.delegate respondsToSelector:@selector(currentProgressInformation:)])

+ 1 - 1
Sources/VLCEqualizerView.m

@@ -207,7 +207,7 @@
     _12K_slider.minimumValue = -20.;
     _12K_slider.maximumValue = 20.;
     [_12K_slider addTarget:self action:@selector(sliderChangedValue:) forControlEvents:UIControlEventValueChanged];
-    [self addSubview:_12K_slider],
+    [self addSubview:_12K_slider];
 
     textView = [[UITextView alloc] initWithFrame:CGRectMake(horizontal_padding * 9. + sliderWidth * 9.5, frame.size.height - vertical_padding_down, 35, 25)];
     textView.text = @"12K";

+ 5 - 5
Sources/VLCGoogleDriveController.m

@@ -202,9 +202,9 @@
                                               GTLDriveFileList *fileList,
                                               NSError *error) {
                               if (error == nil) {
-                                  _fileList = fileList;
-                                  _nextPageToken = fileList.nextPageToken;
-                                  _fileListTicket = nil;
+                                  self->_fileList = fileList;
+                                  self->_nextPageToken = fileList.nextPageToken;
+                                  self->_fileListTicket = nil;
                                   [self _listOfGoodFilesAndFolders];
                               } else {
                                   [self showAlert:NSLocalizedString(@"GDRIVE_ERROR_FETCHING_FILES",nil) message:error.localizedDescription];
@@ -311,9 +311,9 @@
         fetcher.downloadProgressBlock = ^(int64_t bytesWritten,
                                           int64_t totalBytesWritten,
                                           int64_t totalBytesExpectedToWrite) {
-            if ((_lastStatsUpdate > 0 && ([NSDate timeIntervalSinceReferenceDate] - _lastStatsUpdate > .5)) || _lastStatsUpdate <= 0) {
+            if ((self->_lastStatsUpdate > 0 && ([NSDate timeIntervalSinceReferenceDate] - self->_lastStatsUpdate > .5)) || self->_lastStatsUpdate <= 0) {
                 [self calculateRemainingTime:totalBytesWritten expectedDownloadSize:totalBytesExpectedToWrite];
-                _lastStatsUpdate = [NSDate timeIntervalSinceReferenceDate];
+                self->_lastStatsUpdate = [NSDate timeIntervalSinceReferenceDate];
             }
 
             CGFloat progress = (CGFloat)weakFetcher.downloadedLength / (CGFloat)[file.size unsignedLongValue];

+ 3 - 3
Sources/VLCGoogleDriveTableViewController.m

@@ -174,13 +174,13 @@
                self.authorizationInProgress = NO;
                if (authState) {
                    // Upon successful completion...
-                   _googleDriveController.driveService.authorizer = [[GTMAppAuthFetcherAuthorization alloc] initWithAuthState:authState];
-                   [GTMAppAuthFetcherAuthorization saveAuthorization:(GTMAppAuthFetcherAuthorization *)_googleDriveController.driveService.authorizer
+                   self->_googleDriveController.driveService.authorizer = [[GTMAppAuthFetcherAuthorization alloc] initWithAuthState:authState];
+                   [GTMAppAuthFetcherAuthorization saveAuthorization:(GTMAppAuthFetcherAuthorization *)self->_googleDriveController.driveService.authorizer
                                                    toKeychainForName:kKeychainItemName];
                    [self updateViewAfterSessionChange];
                    [self.activityIndicator startAnimating];
                } else {
-                   _googleDriveController.driveService.authorizer = nil;
+                   self->_googleDriveController.driveService.authorizer = nil;
                }
            }];
 

+ 2 - 2
Sources/VLCHTTPUploaderController.m

@@ -87,8 +87,8 @@
         if (!_backgroundTaskIdentifier || _backgroundTaskIdentifier == UIBackgroundTaskInvalid) {
             dispatch_block_t expirationHandler = ^{
                 [self changeHTTPServerState:NO];
-                [[UIApplication sharedApplication] endBackgroundTask:_backgroundTaskIdentifier];
-                _backgroundTaskIdentifier = 0;
+                [[UIApplication sharedApplication] endBackgroundTask:self->_backgroundTaskIdentifier];
+                self->_backgroundTaskIdentifier = 0;
             };
             if ([[UIApplication sharedApplication] respondsToSelector:@selector(beginBackgroundTaskWithName:expirationHandler:)]) {
                 _backgroundTaskIdentifier = [[UIApplication sharedApplication] beginBackgroundTaskWithName:@"VLCUploader" expirationHandler:expirationHandler];

+ 1 - 1
Sources/VLCMediaFileDiscoverer.m

@@ -109,7 +109,7 @@ const float MediaTimerInterval = 2.f;
                                               DISPATCH_VNODE_WRITE, DISPATCH_TARGET_QUEUE_DEFAULT);
 
     dispatch_source_set_event_handler(_directorySource, ^(){
-        unsigned long const data = dispatch_source_get_data(_directorySource);
+        unsigned long const data = dispatch_source_get_data(self->_directorySource);
         if (data & DISPATCH_VNODE_WRITE) {
             // Do all the work on the main thread,
             // including timer scheduling, notifications delivering

+ 1 - 1
Sources/VLCMigrationViewController.h

@@ -16,5 +16,5 @@
 
 @property(nonatomic) IBOutlet UILabel *statusLabel;
 @property(nonatomic) IBOutlet UIActivityIndicatorView *spinner;
-@property(nonatomic, copy) void (^completionHandler)();
+@property(nonatomic, copy) void (^completionHandler)(void);
 @end

+ 1 - 1
Sources/VLCMovieViewController.m

@@ -1695,7 +1695,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
 - (void)showOnExternalDisplay
 {
     UIScreen *screen = [UIScreen screens][1];
-    screen.overscanCompensation = UIScreenOverscanCompensationInsetApplicationFrame;
+    screen.overscanCompensation = UIScreenOverscanCompensationNone;
 
     self.externalWindow = [[UIWindow alloc] initWithFrame:screen.bounds];
 

+ 1 - 1
Sources/VLCOpenInActivity.m

@@ -123,7 +123,7 @@
     __block BOOL controllerWasPresentedSuccessfully = NO;
 
     dispatch_block_t controllerPresentationBlock = ^{
-        controllerWasPresentedSuccessfully = [_documentInteractionController presentOpenInMenuFromBarButtonItem:self.presentingBarButtonItem animated:YES];
+        controllerWasPresentedSuccessfully = [self->_documentInteractionController presentOpenInMenuFromBarButtonItem:self.presentingBarButtonItem animated:YES];
 
         if (!controllerWasPresentedSuccessfully) {
             VLCAlertView *alertView = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"SHARING_ERROR_NO_APPLICATIONS", nil)

+ 3 - 3
Sources/VLCPlaybackController.m

@@ -1141,10 +1141,10 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
     if (_needsMetadataUpdate == NO) {
         _needsMetadataUpdate = YES;
         dispatch_async(dispatch_get_main_queue(), ^{
-            [_metadata updateMetadataFromMediaPlayer:_mediaPlayer];
-            _needsMetadataUpdate = NO;
+            [self->_metadata updateMetadataFromMediaPlayer:self->_mediaPlayer];
+            self->_needsMetadataUpdate = NO;
             if ([self.delegate respondsToSelector:@selector(displayMetadataForPlaybackController:metadata:)])
-                [self.delegate displayMetadataForPlaybackController:self metadata:_metadata];
+                [self.delegate displayMetadataForPlaybackController:self metadata:self->_metadata];
         });
     }
 }

+ 1 - 1
Sources/VLCPlayerDisplayController.m

@@ -313,7 +313,7 @@ static NSString *const VLCPlayerDisplayControllerDisplayModeKey = @"VLCPlayerDis
                               delay:animationDuration
                             options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction
                          animations:^{
-                             self.bottomConstraint.constant = needsHide ? 0 : -_miniPlaybackView.frame.size.height -self.view.layoutMargins.bottom;
+                             self.bottomConstraint.constant = needsHide ? 0 : -self->_miniPlaybackView.frame.size.height -self.view.layoutMargins.bottom;
                              [self.view layoutIfNeeded];
                          }
                          completion:completionBlock];

+ 1 - 1
Sources/VLCPlaylistCollectionViewCell.m

@@ -500,7 +500,7 @@
         videoTracks = audioTracks = spuTracks = nil;
     }
 
-    void (^animationBlock)() = ^() {
+    void (^animationBlock)(void) = ^() {
         self.metaDataLabel.hidden = !showMeta;
     };
 

+ 2 - 2
Sources/VLCPlaylistTableViewCell.m

@@ -490,7 +490,7 @@
     } else
         self.metaDataLabel.text = @"";
 
-    void (^animationBlock)() = ^() {
+    void (^animationBlock)(void) = ^() {
         self.frame = frame;
         self.metaDataLabel.hidden = metaHidden;
     };
@@ -519,7 +519,7 @@
     frame.size.height = 90.;
     BOOL metaHidden = YES;
 
-    void (^animationBlock)() = ^() {
+    void (^animationBlock)(void) = ^() {
         self.frame = frame;
         self.metaDataLabel.hidden = metaHidden;
     };

+ 1 - 1
Sources/VLCSettingsController.m

@@ -57,7 +57,7 @@
 
 - (NSSet *)hiddenBiometryKeys
 {
-    if (@available(iOS 11.0, *)) {
+    if (@available(iOS 11.0.1, *)) {
         LAContext *laContext = [[LAContext alloc] init];
         if ([laContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil]) {
             switch (laContext.biometryType) {

+ 1 - 1
Sources/VLCStatusLabel.m

@@ -87,7 +87,7 @@
         self.hidden = NO;
     }
 
-    void (^animationBlock)() = ^() {
+    void (^animationBlock)(void) = ^() {
         self.alpha = alpha;
     };
 

+ 1 - 1
Sources/VLCTrackSelectorView.m

@@ -232,7 +232,7 @@
     }
 
     self.alpha = 1.0f;
-    void (^animationBlock)() = ^() {
+    void (^animationBlock)(void) = ^() {
         self.alpha =  0.0f;;
     };