Browse Source

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
pull/71/head
Felix Paul Kühne 8 years ago
parent
commit
eb8821886a
  1. 8
      modules/gui/macosx/VLCAudioEffectsWindowController.m
  2. 10
      modules/gui/macosx/VLCConvertAndSaveWindowController.m
  3. 2
      modules/gui/macosx/VLCInputManager.m
  4. 2
      modules/gui/macosx/VLCLogWindowController.m
  5. 2
      modules/gui/macosx/VLCMain.h
  6. 2
      modules/gui/macosx/VLCOpenWindowController.m
  7. 10
      modules/gui/macosx/VLCPLModel.m
  8. 8
      modules/gui/macosx/VLCSimplePrefsController.m
  9. 6
      modules/gui/macosx/VLCVideoEffectsWindowController.m
  10. 2
      modules/gui/macosx/VLCVideoWindowCommon.m
  11. 2
      modules/gui/macosx/prefs_widgets.m

8
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];

10
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]];
}];
}

2
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);
});

2
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];

2
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";

2
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];
}
}];

10
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 );
}];
}

8
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;
}
}];

6
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;
}

2
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];
}

2
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];
}
}];
}

Loading…
Cancel
Save