[vlc-commits] macosx: coding style improvements

Felix Paul Kühne git at videolan.org
Tue Sep 4 17:26:55 CEST 2018


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Tue Sep  4 17:04:58 2018 +0200| [eb8821886a4509a570d2bb8ddb77aea43ca7fea0] | committer: Felix Paul Kühne

macosx: coding style improvements

self is implicitly retained by the affected blocks. This commits makes this explicit to improve readibility

Spotted by the clang static analyzer

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=eb8821886a4509a570d2bb8ddb77aea43ca7fea0
---

 modules/gui/macosx/VLCAudioEffectsWindowController.m   |  8 ++++----
 modules/gui/macosx/VLCConvertAndSaveWindowController.m | 10 +++++-----
 modules/gui/macosx/VLCInputManager.m                   |  2 +-
 modules/gui/macosx/VLCLogWindowController.m            |  2 +-
 modules/gui/macosx/VLCMain.h                           |  2 +-
 modules/gui/macosx/VLCOpenWindowController.m           |  2 +-
 modules/gui/macosx/VLCPLModel.m                        | 10 +++++-----
 modules/gui/macosx/VLCSimplePrefsController.m          |  8 ++++----
 modules/gui/macosx/VLCVideoEffectsWindowController.m   |  6 +++---
 modules/gui/macosx/VLCVideoWindowCommon.m              |  2 +-
 modules/gui/macosx/prefs_widgets.m                     |  2 +-
 11 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/modules/gui/macosx/VLCAudioEffectsWindowController.m b/modules/gui/macosx/VLCAudioEffectsWindowController.m
index 139dde510d..e0213f27c8 100644
--- a/modules/gui/macosx/VLCAudioEffectsWindowController.m
+++ b/modules/gui/macosx/VLCAudioEffectsWindowController.m
@@ -516,7 +516,7 @@
 
         NSInteger currentProfileIndex = [_self currentProfileIndex];
         if (returnCode != NSModalResponseOK) {
-            [_profilePopup selectItemAtIndex:currentProfileIndex];
+            [self->_profilePopup selectItemAtIndex:currentProfileIndex];
             return;
         }
 
@@ -525,7 +525,7 @@
 
         // duplicate names are not allowed in the popup control
         if ([resultingText length] == 0 || [profileNames containsObject:resultingText]) {
-            [_profilePopup selectItemAtIndex:currentProfileIndex];
+            [self->_profilePopup selectItemAtIndex:currentProfileIndex];
 
             NSAlert *alert = [[NSAlert alloc] init];
             [alert setAlertStyle:NSCriticalAlertStyle];
@@ -571,7 +571,7 @@
 
         NSInteger currentProfileIndex = [_self currentProfileIndex];
         if (returnCode != NSModalResponseOK) {
-            [_profilePopup selectItemAtIndex:currentProfileIndex];
+            [self->_profilePopup selectItemAtIndex:currentProfileIndex];
             return;
         }
 
@@ -836,7 +836,7 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
         [workArray addObject:resultingText];
         [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQTitles"];
         workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQPreampValues"]];
-        [workArray addObject:[NSString stringWithFormat:@"%.1f", [_equalizerPreampSlider floatValue]]];
+        [workArray addObject:[NSString stringWithFormat:@"%.1f", [self->_equalizerPreampSlider floatValue]]];
         [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQPreampValues"];
         workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQNames"]];
         [workArray addObject:decomposedStringWithCanonicalMapping];
diff --git a/modules/gui/macosx/VLCConvertAndSaveWindowController.m b/modules/gui/macosx/VLCConvertAndSaveWindowController.m
index 5b545622e3..454909a753 100644
--- a/modules/gui/macosx/VLCConvertAndSaveWindowController.m
+++ b/modules/gui/macosx/VLCConvertAndSaveWindowController.m
@@ -434,9 +434,9 @@
     [saveFilePanel beginSheetModalForWindow:self.window completionHandler:^(NSInteger returnCode) {
         if (returnCode == NSModalResponseOK) {
             [self setOutputDestination:[[saveFilePanel URL] path]];
-            [_fileDestinationFileName setStringValue: [[NSFileManager defaultManager] displayNameAtPath:_outputDestination]];
-            [[_fileDestinationFileNameStub animator] setHidden: YES];
-            [[_fileDestinationFileName animator] setHidden: NO];
+            [self->_fileDestinationFileName setStringValue: [[NSFileManager defaultManager] displayNameAtPath:self->_outputDestination]];
+            [[self->_fileDestinationFileNameStub animator] setHidden: YES];
+            [[self->_fileDestinationFileName animator] setHidden: NO];
         }
 
         [self updateOKButton];
@@ -508,7 +508,7 @@
 
         /* update UI */
         [_self recreateProfilePopup];
-        [_profilePopup selectItemWithTitle:resultingText];
+        [self->_profilePopup selectItemWithTitle:resultingText];
 
         /* update internals */
         [_self switchProfile:self];
@@ -617,7 +617,7 @@
     [saveFilePanel setAllowedFileTypes:[NSArray arrayWithObject:@"sdp"]];
     [saveFilePanel beginSheetModalForWindow:_streamPanel completionHandler:^(NSInteger returnCode) {
         if (returnCode == NSModalResponseOK)
-            [_streamSDPField setStringValue:[[saveFilePanel URL] path]];
+            [self->_streamSDPField setStringValue:[[saveFilePanel URL] path]];
     }];
 }
 
diff --git a/modules/gui/macosx/VLCInputManager.m b/modules/gui/macosx/VLCInputManager.m
index c4d13b5bac..3193e744f8 100644
--- a/modules/gui/macosx/VLCInputManager.m
+++ b/modules/gui/macosx/VLCInputManager.m
@@ -278,7 +278,7 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
      * The serial queue ensures that changed inputs are propagated in the same order as they arrive.
      */
     dispatch_async(informInputChangedQueue, ^{
-        [[o_main extensionsManager] inputChanged:p_input_changed];
+        [[self->o_main extensionsManager] inputChanged:p_input_changed];
         if (p_input_changed)
             vlc_object_release(p_input_changed);
     });
diff --git a/modules/gui/macosx/VLCLogWindowController.m b/modules/gui/macosx/VLCLogWindowController.m
index 7818bfef25..a52336d93e 100644
--- a/modules/gui/macosx/VLCLogWindowController.m
+++ b/modules/gui/macosx/VLCLogWindowController.m
@@ -200,7 +200,7 @@ static void MsgCallback(void *data, int type, const vlc_log_t *item, const char
         }
         NSMutableString *string = [[NSMutableString alloc] init];
 
-        for (VLCLogMessage *message in _messagesArray) {
+        for (VLCLogMessage *message in self->_messagesArray) {
             [string appendFormat:@"%@\r\n", message.fullMessage];
         }
         NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
diff --git a/modules/gui/macosx/VLCMain.h b/modules/gui/macosx/VLCMain.h
index 9ece125e59..9638ac2cab 100644
--- a/modules/gui/macosx/VLCMain.h
+++ b/modules/gui/macosx/VLCMain.h
@@ -48,7 +48,7 @@
  * Local prototypes.
  *****************************************************************************/
 
-intf_thread_t *getIntf();
+intf_thread_t *getIntf(void);
 
 static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
 static NSString * VLCConfigurationChangedNotification = @"VLCConfigurationChangedNotification";
diff --git a/modules/gui/macosx/VLCOpenWindowController.m b/modules/gui/macosx/VLCOpenWindowController.m
index 8c05a0d0c2..5f6f7d2a0a 100644
--- a/modules/gui/macosx/VLCOpenWindowController.m
+++ b/modules/gui/macosx/VLCOpenWindowController.m
@@ -668,7 +668,7 @@ static NSString *kCaptureTabViewId  = @"capture";
     [openPanel setPrompt: _NS("Open")];
     [openPanel beginSheetModalForWindow:[sender window] completionHandler:^(NSInteger returnCode) {
         if (returnCode == NSFileHandlingPanelOKButton) {
-            _filePath = [[[openPanel URLs] firstObject] path];
+            self->_filePath = [[[openPanel URLs] firstObject] path];
             [self openFilePathChanged: nil];
         }
     }];
diff --git a/modules/gui/macosx/VLCPLModel.m b/modules/gui/macosx/VLCPLModel.m
index 7a2b16879b..4a8f0a0aef 100644
--- a/modules/gui/macosx/VLCPLModel.m
+++ b/modules/gui/macosx/VLCPLModel.m
@@ -206,16 +206,16 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
         _retainedRowSelection = 0;
 
     [selectedIndexes enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
-        VLCPLItem *item = [_outlineView itemAtRow: idx];
+        VLCPLItem *item = [self->_outlineView itemAtRow: idx];
         if (!item)
             return;
 
         // model deletion is done via callback
-        PL_LOCK;
-        playlist_item_t *p_root = playlist_ItemGetById(p_playlist, [item plItemId]);
+        playlist_Lock( self->p_playlist );
+        playlist_item_t *p_root = playlist_ItemGetById(self->p_playlist, [item plItemId]);
         if( p_root != NULL )
-            playlist_NodeDelete(p_playlist, p_root);
-        PL_UNLOCK;
+            playlist_NodeDelete(self->p_playlist, p_root);
+        playlist_Unlock( self->p_playlist );
     }];
 }
 
diff --git a/modules/gui/macosx/VLCSimplePrefsController.m b/modules/gui/macosx/VLCSimplePrefsController.m
index 305196cc09..23e273bdaa 100644
--- a/modules/gui/macosx/VLCSimplePrefsController.m
+++ b/modules/gui/macosx/VLCSimplePrefsController.m
@@ -823,7 +823,7 @@ static inline const char * __config_GetLabel(vlc_object_t *p_this, const char *p
             [self resetControls];
 
             /* force config file creation, since libvlc won't exit normally */
-            config_SaveConfigFile(p_intf);
+            config_SaveConfigFile(self->p_intf);
 
             /* reset OS X defaults */
             [[VLCMain sharedInstance] resetAndReinitializeUserDefaults];
@@ -1149,7 +1149,7 @@ static inline void save_string_list(intf_thread_t * p_intf, id object, const cha
         [_selectFolderPanel setPrompt: _NS("Choose")];
         [_selectFolderPanel beginSheetModalForWindow:self.window completionHandler: ^(NSInteger returnCode) {
             if (returnCode == NSModalResponseOK) {
-                [_video_snap_folderTextField setStringValue: [[_selectFolderPanel URL] path]];
+                [self->_video_snap_folderTextField setStringValue: [[self->_selectFolderPanel URL] path]];
             }
         }];
     }
@@ -1253,8 +1253,8 @@ static inline void save_string_list(intf_thread_t * p_intf, id object, const cha
         [_selectFolderPanel beginSheetModalForWindow:self.window completionHandler: ^(NSInteger returnCode) {
             if (returnCode == NSModalResponseOK)
             {
-                [_input_recordTextField setStringValue: [[_selectFolderPanel URL] path]];
-                _inputSettingChanged = YES;
+                [self->_input_recordTextField setStringValue: [[self->_selectFolderPanel URL] path]];
+                self->_inputSettingChanged = YES;
             }
         }];
 
diff --git a/modules/gui/macosx/VLCVideoEffectsWindowController.m b/modules/gui/macosx/VLCVideoEffectsWindowController.m
index 9a92d5c6d3..6e69986da4 100644
--- a/modules/gui/macosx/VLCVideoEffectsWindowController.m
+++ b/modules/gui/macosx/VLCVideoEffectsWindowController.m
@@ -787,7 +787,7 @@
 
         NSInteger currentProfileIndex = [_self currentProfileIndex];
         if (returnCode != NSModalResponseOK) {
-            [_profilePopup selectItemAtIndex:currentProfileIndex];
+            [self->_profilePopup selectItemAtIndex:currentProfileIndex];
             return;
         }
 
@@ -796,7 +796,7 @@
 
         // duplicate names are not allowed in the popup control
         if ([resultingText length] == 0 || [profileNames containsObject:resultingText]) {
-            [_profilePopup selectItemAtIndex:currentProfileIndex];
+            [self->_profilePopup selectItemAtIndex:currentProfileIndex];
 
             NSAlert *alert = [[NSAlert alloc] init];
             [alert setAlertStyle:NSCriticalAlertStyle];
@@ -848,7 +848,7 @@
         NSInteger activeProfileIndex = [_self currentProfileIndex];
 
         if (returnCode != NSModalResponseOK) {
-            [_profilePopup selectItemAtIndex:activeProfileIndex];
+            [self->_profilePopup selectItemAtIndex:activeProfileIndex];
             return;
         }
 
diff --git a/modules/gui/macosx/VLCVideoWindowCommon.m b/modules/gui/macosx/VLCVideoWindowCommon.m
index 6a7e47ad16..9785862fdb 100644
--- a/modules/gui/macosx/VLCVideoWindowCommon.m
+++ b/modules/gui/macosx/VLCVideoWindowCommon.m
@@ -428,7 +428,7 @@
 
     [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
         [context setDuration:0.5 * duration];
-        [[window animator] setFrame:frameBeforeLionFullscreen display:YES animate:YES];
+        [[window animator] setFrame:self->frameBeforeLionFullscreen display:YES animate:YES];
     } completionHandler:nil];
 }
 
diff --git a/modules/gui/macosx/prefs_widgets.m b/modules/gui/macosx/prefs_widgets.m
index 92abc330da..7f5a148197 100644
--- a/modules/gui/macosx/prefs_widgets.m
+++ b/modules/gui/macosx/prefs_widgets.m
@@ -1147,7 +1147,7 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc];              \
     [o_open_panel beginSheetModalForWindow:[sender window] completionHandler:^(NSInteger returnCode) {
         if (returnCode == NSModalResponseOK) {
             NSString *o_path = [[[o_open_panel URLs] firstObject] path];
-            [o_textfield setStringValue: o_path];
+            [self->o_textfield setStringValue: o_path];
         }
     }];
 }



More information about the vlc-commits mailing list