[vlc-commits] [Git][videolan/vlc][master] 7 commits: macosx: VLCOpenInputMetadata: Add initWithPath
Jean-Baptiste Kempf
gitlab at videolan.org
Sat May 22 16:42:20 UTC 2021
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
1d098b5d by Marvin Scholz at 2021-05-22T11:20:28+00:00
macosx: VLCOpenInputMetadata: Add initWithPath
Add a new initializer method that takes a file path as NSString
and converts it to a VLC URI, using that to initialize the MRLString
value.
Additionally add a factory method for the initializer too.
- - - - -
29f72ea1 by Marvin Scholz at 2021-05-22T11:20:28+00:00
macosx: use inputMetaWithPath where possible
- - - - -
0cd7e54f by Marvin Scholz at 2021-05-22T11:20:28+00:00
macosx: VLCPlaylistDataSource: fix error handling
The previous check if data is nil is useless here, as
unarchiveObjectWithData can not modify data, and there is
already a check above this code that ensures data is not nil.
But unarchiveObjectWithData could fail if it can not decode the
archive, raising an NSInvalidArgumentException, so handle that
properly.
- - - - -
f1e644f1 by Marvin Scholz at 2021-05-22T11:20:28+00:00
macosx: use ObjC fast enumeration where possible
It's more concise, easier to read and less error-prone.
- - - - -
07283e6a by Marvin Scholz at 2021-05-22T11:20:28+00:00
macosx: fix off-by-one in reload logic
When checking for the number of sections in reloadDataForNotification
an index is compared to a count, so the count must always be larger
than the index, else the index points past the last available item
leading to an assertion like this:
*** Assertion failure in -[_NSCollectionViewCore
_endItemAnimationsWithInvalidationContext:tentativelyForReordering:
animator:], …/UIFoundation/CollectionView/UICollectionView.m:7095
*** Terminating app due to uncaught exception
'NSInternalInconsistencyException', reason: 'attempt to delete section
1, but there are only 1 sections before the update'
- - - - -
3156acdd by Marvin Scholz at 2021-05-22T11:20:28+00:00
macosx: simplify item count check
The item count and nil check can be combined as calling count
on nil will give 0 too.
- - - - -
c2f86a25 by Marvin Scholz at 2021-05-22T11:20:28+00:00
macosx: fix typo in method name
- - - - -
18 changed files:
- modules/gui/macosx/extensions/NSMenu+VLCAdditions.m
- modules/gui/macosx/extensions/NSScreen+VLCAdditions.m
- modules/gui/macosx/extensions/NSString+Helpers.m
- modules/gui/macosx/library/VLCLibraryAlbumTableCellView.m
- modules/gui/macosx/library/VLCLibraryAudioDataSource.m
- modules/gui/macosx/library/VLCLibraryInformationPanel.m
- modules/gui/macosx/library/VLCLibraryMenuController.m
- modules/gui/macosx/library/VLCLibraryWindow.m
- modules/gui/macosx/main/VLCMain.m
- modules/gui/macosx/media-source/VLCMediaSourceBaseDataSource.m
- modules/gui/macosx/menus/VLCMainMenu.m
- modules/gui/macosx/playlist/VLCPlaylistDataSource.m
- modules/gui/macosx/windows/VLCOpenInputMetadata.h
- modules/gui/macosx/windows/VLCOpenInputMetadata.m
- modules/gui/macosx/windows/VLCOpenWindowController.m
- modules/gui/macosx/windows/addons/VLCAddonsWindowController.m
- modules/gui/macosx/windows/convertandsave/VLCOutput.m
- modules/gui/macosx/windows/video/VLCVideoWindowCommon.m
Changes:
=====================================
modules/gui/macosx/extensions/NSMenu+VLCAdditions.m
=====================================
@@ -30,9 +30,8 @@
return;
}
- NSUInteger count = array.count;
- for (NSUInteger x = 0; x < count; x++) {
- [self addItem:array[x]];
+ for (NSMenuItem *item in array) {
+ [self addItem:item];
}
}
=====================================
modules/gui/macosx/extensions/NSScreen+VLCAdditions.m
=====================================
@@ -46,10 +46,7 @@ static bool b_old_spaces_style = YES;
+ (NSScreen *)screenWithDisplayID: (CGDirectDisplayID)displayID
{
- NSUInteger count = [[NSScreen screens] count];
-
- for ( NSUInteger i = 0; i < count; i++ ) {
- NSScreen *screen = [[NSScreen screens] objectAtIndex:i];
+ for (NSScreen *screen in [NSScreen screens]) {
if ([screen displayID] == displayID)
return screen;
}
@@ -95,9 +92,7 @@ static bool b_old_spaces_style = YES;
[blackoutWindows makeObjectsPerformSelector:@selector(close)];
[blackoutWindows removeAllObjects];
- NSUInteger screenCount = [[NSScreen screens] count];
- for (NSUInteger i = 0; i < screenCount; i++) {
- NSScreen *screen = [[NSScreen screens] objectAtIndex:i];
+ for (NSScreen *screen in [NSScreen screens]) {
VLCWindow *blackoutWindow;
NSRect screen_rect;
@@ -128,10 +123,7 @@ static bool b_old_spaces_style = YES;
+ (void)unblackoutScreens
{
- NSUInteger blackoutWindowCount = [blackoutWindows count];
-
- for (NSUInteger i = 0; i < blackoutWindowCount; i++) {
- VLCWindow *blackoutWindow = [blackoutWindows objectAtIndex:i];
+ for (VLCWindow *blackoutWindow in blackoutWindows) {
[[blackoutWindow screen] setNonFullscreenPresentationOptions];
[blackoutWindow closeAndAnimate: YES];
}
=====================================
modules/gui/macosx/extensions/NSString+Helpers.m
=====================================
@@ -334,9 +334,7 @@ NSString * getVolumeTypeFromMountPath(NSString *mountPath)
NSFileManager *fileManager = [[NSFileManager alloc] init];
NSArray *directoryContents = [fileManager contentsOfDirectoryAtPath:mountPath error:nil];
- NSUInteger directoryContentCount = [directoryContents count];
- for (NSUInteger i = 0; i < directoryContentCount; i++) {
- NSString *currentFile = directoryContents[i];
+ for (NSString *currentFile in directoryContents) {
NSString *fullPath = [mountPath stringByAppendingPathComponent:currentFile];
BOOL isDirectory;
=====================================
modules/gui/macosx/library/VLCLibraryAlbumTableCellView.m
=====================================
@@ -108,11 +108,9 @@ const CGFloat LayoutSpacer;
_libraryController = [[VLCMain sharedInstance] libraryController];
}
- NSArray *tracks = [_representedAlbum tracksAsMediaItems];
- NSUInteger trackCount = tracks.count;
BOOL playImmediately = YES;
- for (NSUInteger x = 0; x < trackCount; x++) {
- [_libraryController appendItemToPlaylist:tracks[x] playImmediately:playImmediately];
+ for (VLCMediaLibraryMediaItem *mediaItem in [_representedAlbum tracksAsMediaItems]) {
+ [_libraryController appendItemToPlaylist:mediaItem playImmediately:playImmediately];
if (playImmediately) {
playImmediately = NO;
}
=====================================
modules/gui/macosx/library/VLCLibraryAudioDataSource.m
=====================================
@@ -299,7 +299,7 @@ static NSString *VLCAudioLibraryCellIdentifier = @"VLCAudioLibraryCellIdentifier
- (void)collectionSelectionDoubleClickAction:(id)sender
{
- NSArray *listOfAlbums;
+ NSArray <VLCMediaLibraryAlbum *> *listOfAlbums = nil;
switch (_currentParentType) {
case VLC_ML_PARENT_ARTIST:
@@ -331,17 +331,13 @@ static NSString *VLCAudioLibraryCellIdentifier = @"VLCAudioLibraryCellIdentifier
break;
}
- if (!listOfAlbums) {
- return;
- }
- NSUInteger albumCount = listOfAlbums.count;
- if (albumCount == 0) {
+ if (listOfAlbums.count == 0) {
return;
}
VLCLibraryController *libraryController = [[VLCMain sharedInstance] libraryController];
- for (NSUInteger x = 0; x < albumCount; x++) {
- NSArray *tracks = [listOfAlbums[x] tracksAsMediaItems];
+ for (VLCMediaLibraryAlbum *album in listOfAlbums) {
+ NSArray *tracks = [album tracksAsMediaItems];
[libraryController appendItemsToPlaylist:tracks playFirstItemImmediately:YES];
}
}
=====================================
modules/gui/macosx/library/VLCLibraryInformationPanel.m
=====================================
@@ -58,20 +58,14 @@
[textContent appendFormat:@"Small artwork generated? %@\n", _representedMediaItem.smallArtworkGenerated == YES ? _NS("Yes") : _NS("No")];
[textContent appendFormat:@"Favorited? %@, Playback progress: %2.f%%\n", _representedMediaItem.smallArtworkGenerated == YES ? _NS("Yes") : _NS("No"), _representedMediaItem.progress * 100.];
- NSArray *array = _representedMediaItem.files;
- NSUInteger count = array.count;
- [textContent appendFormat:@"\nNumber of files: %lu\n", count];
- for (NSUInteger x = 0; x < count; x++) {
- VLCMediaLibraryFile *file = array[x];
+ [textContent appendFormat:@"\nNumber of files: %lu\n", _representedMediaItem.files.count];
+ for (VLCMediaLibraryFile *file in _representedMediaItem.files) {
[textContent appendFormat:@"URL: %@\n", file.fileURL];
[textContent appendFormat:@"Type: %@\n", file.readableFileType];
}
- array = _representedMediaItem.tracks;
- count = array.count;
- [textContent appendFormat:@"\nNumber of tracks: %lu\n", count];
- for (NSUInteger x = 0; x < count; x++) {
- VLCMediaLibraryTrack *track = array[x];
+ [textContent appendFormat:@"\nNumber of tracks: %lu\n", _representedMediaItem.tracks.count];
+ for (VLCMediaLibraryTrack *track in _representedMediaItem.tracks) {
[textContent appendFormat:@"Type: %@\n", track.readableTrackType];
[textContent appendFormat:@"Codec: %@ (%@) @ %u kB/s\n", track.readableCodecName, track.codec, track.bitrate / 1024 / 8];
if (track.language.length > 0) {
=====================================
modules/gui/macosx/library/VLCLibraryMenuController.m
=====================================
@@ -102,11 +102,8 @@
NSModalResponse modalResponse = [openPanel runModal];
if (modalResponse == NSModalResponseOK) {
- NSArray *URLs = [openPanel URLs];
- NSUInteger count = [URLs count];
VLCLibraryController *libraryController = [[VLCMain sharedInstance] libraryController];
- for (NSUInteger i = 0; i < count ; i++) {
- NSURL *url = URLs[i];
+ for (NSURL *url in [openPanel URLs]) {
[libraryController addFolderWithFileURL:url];
}
}
@@ -120,11 +117,9 @@
- (void)moveToTrash:(id)sender
{
NSArray *filesToTrash = self.representedMediaItem.files;
- NSUInteger trashCount = filesToTrash.count;
NSFileManager *fileManager = [NSFileManager defaultManager];
- for (NSUInteger x = 0; x < trashCount; x++) {
- VLCMediaLibraryFile *fileToTrash = filesToTrash[x];
+ for (VLCMediaLibraryFile *fileToTrash in filesToTrash) {
[fileManager trashItemAtURL:fileToTrash.fileURL resultingItemURL:nil error:nil];
}
}
=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -498,14 +498,13 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
if (valueCount > 0) {
NSMutableArray *metadataArray = [NSMutableArray arrayWithCapacity:valueCount];
- for (NSUInteger i = 0; i < valueCount; i++) {
+ for (NSString *filepath in values) {
VLCOpenInputMetadata *inputMetadata;
- char *psz_uri = vlc_path2uri([values[i] UTF8String], "file");
- if (!psz_uri)
+
+ inputMetadata = [VLCOpenInputMetadata inputMetaWithPath:filepath];
+ if (!inputMetadata)
continue;
- inputMetadata = [[VLCOpenInputMetadata alloc] init];
- inputMetadata.MRLString = toNSStr(psz_uri);
- free(psz_uri);
+
[metadataArray addObject:inputMetadata];
}
[_playlistController addPlaylistItems:metadataArray];
=====================================
modules/gui/macosx/main/VLCMain.m
=====================================
@@ -400,15 +400,14 @@ static VLCMain *sharedInstance = nil;
NSArray *o_sorted_names = [resultItems sortedArrayUsingSelector: @selector(caseInsensitiveCompare:)];
NSMutableArray *o_result = [NSMutableArray arrayWithCapacity: [o_sorted_names count]];
- for (NSUInteger i = 0; i < [o_sorted_names count]; i++) {
- char *psz_uri = vlc_path2uri([[o_sorted_names objectAtIndex:i] UTF8String], "file");
- if (!psz_uri)
+ for (NSString *filepath in o_sorted_names) {
+ VLCOpenInputMetadata *inputMetadata;
+
+ inputMetadata = [VLCOpenInputMetadata inputMetaWithPath:filepath];
+ if (!inputMetadata)
continue;
- VLCOpenInputMetadata *o_inputMetadata = [[VLCOpenInputMetadata alloc] init];
- o_inputMetadata.MRLString = toNSStr(psz_uri);
- [o_result addObject: o_inputMetadata];
- free(psz_uri);
+ [o_result addObject:inputMetadata];
}
[_playlistController addPlaylistItems:o_result];
=====================================
modules/gui/macosx/media-source/VLCMediaSourceBaseDataSource.m
=====================================
@@ -91,7 +91,7 @@ NSString *VLCMediaSourceTableViewCellIdentifier = @"VLCMediaSourceTableViewCellI
self.homeButton.target = self;
self.pathControl.URL = nil;
- self.gridVsListSegmentedControl.action = @selector(switchGripOrListMode:);
+ self.gridVsListSegmentedControl.action = @selector(switchGridOrListMode:);
self.gridVsListSegmentedControl.target = self;
self.gridVsListSegmentedControl.selectedSegment = 0;
@@ -103,7 +103,7 @@ NSString *VLCMediaSourceTableViewCellIdentifier = @"VLCMediaSourceTableViewCellI
- (void)reloadViews
{
- self.gridVsListSegmentedControl.action = @selector(switchGripOrListMode:);
+ self.gridVsListSegmentedControl.action = @selector(switchGridOrListMode:);
self.gridVsListSegmentedControl.target = self;
self.gridVsListSegmentedControl.selectedSegment = _gridViewMode ? 0 : 1;
}
@@ -343,7 +343,7 @@ NSString *VLCMediaSourceTableViewCellIdentifier = @"VLCMediaSourceTableViewCellI
[self reloadData];
}
-- (void)switchGripOrListMode:(id)sender
+- (void)switchGridOrListMode:(id)sender
{
_gridViewMode = !_gridViewMode;
_childDataSource.gridViewMode = _gridViewMode;
@@ -390,7 +390,7 @@ NSString *VLCMediaSourceTableViewCellIdentifier = @"VLCMediaSourceTableViewCellI
if (_gridViewMode) {
if (self.collectionView.dataSource == self) {
NSInteger index = [_mediaSources indexOfObject:aNotification.object];
- if (self.collectionView.numberOfSections >= index) {
+ if (self.collectionView.numberOfSections > index) {
[self.collectionView reloadSections:[NSIndexSet indexSetWithIndex:index]];
} else {
[self.collectionView reloadData];
=====================================
modules/gui/macosx/menus/VLCMainMenu.m
=====================================
@@ -981,8 +981,7 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
[menuItem setEnabled:YES];
[menu addItem:menuItem];
- for (NSUInteger x = 0; x < count; x++) {
- VLCTrackMetaData *metaDataItem = metadataArray[x];
+ for (VLCTrackMetaData *metaDataItem in metadataArray) {
menuItem = [[NSMenuItem alloc] initWithTitle:metaDataItem.name
action:@selector(selectTrack:)
keyEquivalent:@""];
@@ -1257,10 +1256,7 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
i_returnValue = [openPanel runModal];
if (i_returnValue == NSModalResponseOK) {
- NSArray *URLs = [openPanel URLs];
- NSUInteger count = [URLs count];
- for (int i = 0; i < count ; i++) {
- NSURL *url = URLs[i];
+ for (NSURL *url in [openPanel URLs]) {
[_playerController addAssociatedMediaToCurrentFromURL:url
ofCategory:SPU_ES
shallSelectTrack:YES
=====================================
modules/gui/macosx/playlist/VLCPlaylistDataSource.m
=====================================
@@ -143,9 +143,9 @@ static NSString *VLCPlaylistCellIdentifier = @"VLCPlaylistCellIdentifier";
NSUInteger mediaCount = [mediaPaths count];
if (mediaCount > 0) {
NSMutableArray *metadataArray = [NSMutableArray arrayWithCapacity:mediaCount];
- for (NSUInteger i = 0; i < mediaCount; i++) {
+ for (NSString *mediaPath in mediaPaths) {
VLCOpenInputMetadata *inputMetadata;
- NSURL *url = [NSURL fileURLWithPath:mediaPaths[i] isDirectory:NO];
+ NSURL *url = [NSURL fileURLWithPath:mediaPath isDirectory:NO];
if (!url) {
continue;
}
@@ -161,14 +161,19 @@ static NSString *VLCPlaylistCellIdentifier = @"VLCPlaylistCellIdentifier";
}
/* it is a media library item, so unarchive it and add it to the playlist */
- NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithData:data];
- if (!data) {
- return NO;
+ NSArray *array = nil;
+ @try {
+ array = [NSKeyedUnarchiver unarchiveObjectWithData:data];
+ } @catch (NSException *exception) {
+ if ([exception.name isEqualToString:NSInvalidArgumentException]) {
+ msg_Err(getIntf(), "Failed to unarchive MediaLibrary Item: %s",
+ [[exception reason] UTF8String]);
+ return NO;
+ }
+ @throw;
}
- NSUInteger arrayCount = array.count;
- for (NSUInteger x = 0; x < arrayCount; x++) {
- VLCMediaLibraryMediaItem *mediaItem = array[x];
+ for (VLCMediaLibraryMediaItem *mediaItem in array) {
[_playlistController addInputItem:mediaItem.inputItem.vlcInputItem atPosition:row startPlayback:NO];
}
=====================================
modules/gui/macosx/windows/VLCOpenInputMetadata.h
=====================================
@@ -24,6 +24,23 @@
@interface VLCOpenInputMetadata : NSObject
+/**
+ * Create a new VLCOpenInputMetadata with the given file path
+ *
+ * See \c -initWithPath: for details.
+ */
++ (instancetype)inputMetaWithPath:(NSString *)path;
+
+/**
+ * Initialize the VLCOpenInputMetadata with the given file path
+ *
+ * Initializes the new VLCOpenInputMetadata with the MRLString
+ * refering to the file given by path. Note that it is not
+ * verified that the file actually exists, so it will succeed
+ * regardless of the presence of the file.
+ */
+- (instancetype)initWithPath:(NSString *)path;
+
/**
* this is the MRL of the future input item and defines where to search for media
* it is the only required property, because if unset we don't know what to play
=====================================
modules/gui/macosx/windows/VLCOpenInputMetadata.m
=====================================
@@ -4,6 +4,7 @@
* Copyright (C) 2019 VLC authors and VideoLAN
*
* Authors: Felix Paul Kühne <fkuehne # videolan dot org>
+ * Marvin Scholz <epirat07 at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,8 +21,43 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# import <config.h>
+#endif
+
+#import <vlc_common.h>
+#import <vlc_url.h>
+
#import "VLCOpenInputMetadata.h"
@implementation VLCOpenInputMetadata
++ (instancetype)inputMetaWithPath:(NSString *)path
+{
+ return [[VLCOpenInputMetadata alloc] initWithPath:path];
+}
+
+- (instancetype)initWithPath:(NSString *)path
+{
+ if (!path)
+ return nil;
+
+ self = [super init];
+ if (!self)
+ return nil;
+
+ char *vlc_uri_psz = vlc_path2uri([path UTF8String], "file");
+ if (!vlc_uri_psz)
+ return nil;
+
+ NSString *vlc_uri = [NSString stringWithUTF8String:vlc_uri_psz];
+ FREENULL(vlc_uri_psz);
+
+ if (!vlc_uri)
+ return nil;
+
+ self.MRLString = vlc_uri;
+ return self;
+}
+
@end
=====================================
modules/gui/macosx/windows/VLCOpenWindowController.m
=====================================
@@ -447,10 +447,8 @@ NSString *const VLCOpenTextFieldWasClicked = @"VLCOpenTextFieldWasClicked";
- (void)addStreamOutputOptionsToArray:(NSMutableArray *)options
{
- NSArray *soutMRL = [_output soutMRL];
- NSUInteger count = [soutMRL count];
- for (NSUInteger i = 0 ; i < count ; i++)
- [options addObject: [NSString stringWithString: [soutMRL objectAtIndex:i]]];
+ for (NSString *item in [_output soutMRL])
+ [options addObject: [NSString stringWithString: item]];
}
- (void)addScreenRecordingOptionsToArray:(NSMutableArray *)options
@@ -548,18 +546,16 @@ NSString *const VLCOpenTextFieldWasClicked = @"VLCOpenTextFieldWasClicked";
NSUInteger count = [URLs count];
NSMutableArray *values = [NSMutableArray arrayWithCapacity:count];
NSMutableArray *array = [NSMutableArray arrayWithCapacity:count];
- for (NSUInteger i = 0; i < count; i++)
- [values addObject: [[URLs objectAtIndex:i] path]];
+ for (NSURL *url in URLs)
+ [values addObject: [url path]];
[values sortUsingSelector:@selector(caseInsensitiveCompare:)];
- for (NSUInteger i = 0; i < count; i++) {
+ for (NSString *filepath in values) {
VLCOpenInputMetadata *inputMetadata;
- char *psz_uri = vlc_path2uri([[values objectAtIndex:i] UTF8String], "file");
- if (!psz_uri)
+ inputMetadata = [VLCOpenInputMetadata inputMetaWithPath:filepath];
+ if (!inputMetadata)
continue;
- inputMetadata = [[VLCOpenInputMetadata alloc] init];
- inputMetadata.MRLString = toNSStr(psz_uri);
- free(psz_uri);
+
[array addObject:inputMetadata];
}
@@ -781,10 +777,8 @@ NSString *const VLCOpenTextFieldWasClicked = @"VLCOpenTextFieldWasClicked";
{
@autoreleasepool {
NSArray *mountURLs = [[NSFileManager defaultManager] mountedVolumeURLsIncludingResourceValuesForKeys:@[NSURLVolumeIsRemovableKey] options:NSVolumeEnumerationSkipHiddenVolumes];
- NSUInteger count = [mountURLs count];
NSMutableArray *o_result = [NSMutableArray array];
- for (NSUInteger i = 0; i < count; i++) {
- NSURL *currentURL = [mountURLs objectAtIndex:i];
+ for (NSURL *currentURL in mountURLs) {
NSNumber *isRemovable = nil;
if (![currentURL getResourceValue:&isRemovable forKey:NSURLVolumeIsRemovableKey error:nil] || !isRemovable) {
@@ -837,8 +831,7 @@ NSString *const VLCOpenTextFieldWasClicked = @"VLCOpenTextFieldWasClicked";
NSUInteger count = [self->_allMediaDevices count];
if (count > 0) {
- for (NSUInteger i = 0; i < count ; i++) {
- VLCOpenBlockDeviceDescription *deviceDescription = [self->_allMediaDevices objectAtIndex:i];
+ for (VLCOpenBlockDeviceDescription *deviceDescription in self->_allMediaDevices) {
[self->_discSelectorPopup addItemWithTitle: [[NSFileManager defaultManager] displayNameAtPath:deviceDescription.path]];
}
=====================================
modules/gui/macosx/windows/addons/VLCAddonsWindowController.m
=====================================
@@ -273,10 +273,8 @@ static void addonChangedCallback( addons_manager_t *manager,
BOOL installedOnly = _localAddonsOnlyCheckbox.state == NSOnState;
int type = (int)[[_typeSwitcher selectedItem] tag];
- NSUInteger count = _addons.count;
- NSMutableArray *filteredItems = [[NSMutableArray alloc] initWithCapacity:count];
- for (NSUInteger x = 0; x < count; x++) {
- VLCAddonListItem *currentItem = [_addons objectAtIndex:x];
+ NSMutableArray *filteredItems = [[NSMutableArray alloc] initWithCapacity:_addons.count];
+ for (VLCAddonListItem *currentItem in _addons) {
if (type != -1) {
if ([currentItem type] == type) {
if (installedOnly) {
=====================================
modules/gui/macosx/windows/convertandsave/VLCOutput.m
=====================================
@@ -340,8 +340,8 @@
else {
[finalStreamAddress appendFormat: @"\"%@:%@", [urlItems firstObject], [self.streamPortTextField stringValue]];
NSUInteger itemCount = [urlItems count];
- for (NSUInteger x = 0; x < itemCount; x++)
- [finalStreamAddress appendFormat: @"/%@", [urlItems objectAtIndex:x]];
+ for (NSString *item in urlItems)
+ [finalStreamAddress appendFormat: @"/%@", item];
[finalStreamAddress appendString: @"\""];
}
=====================================
modules/gui/macosx/windows/video/VLCVideoWindowCommon.m
=====================================
@@ -535,12 +535,9 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController";
}
}
- NSArray *subviews = [[self videoView] subviews];
- NSUInteger count = [subviews count];
-
- for (NSUInteger x = 0; x < count; x++) {
- if ([[subviews objectAtIndex:x] respondsToSelector:@selector(reshape)])
- [[subviews objectAtIndex:x] reshape];
+ for (__kindof NSView *view in [[self videoView] subviews]) {
+ if ([view respondsToSelector:@selector(reshape)])
+ [view reshape];
}
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/40664df3e951a17fc1f8da425d4d89c7b86a2af4...c2f86a25fdace335c401c4926751df92746ecba8
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/40664df3e951a17fc1f8da425d4d89c7b86a2af4...c2f86a25fdace335c401c4926751df92746ecba8
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list