Commit 2c828226 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: saved various objc selector dispatches when iterating, additionally fixes #5113

parent eab70f5d
......@@ -246,11 +246,11 @@ static int Open( vlc_object_t *p_this )
goto error;
}
int ivideo;
for(ivideo = 0; ivideo < [myVideoDevices count]; ivideo++){
NSUInteger deviceCount = [myVideoDevices count];
for(NSUInteger ivideo = 0; ivideo < deviceCount; ivideo++){
QTCaptureDevice *qtk_device;
qtk_device = [myVideoDevices objectAtIndex:ivideo];
msg_Dbg( p_demux, "qtcapture %d/%lu %s %s", ivideo, [myVideoDevices count], [[qtk_device localizedDisplayName] UTF8String], [[qtk_device uniqueID] UTF8String]);
msg_Dbg( p_demux, "qtcapture %d/%lu %s %s", ivideo, deviceCount, [[qtk_device localizedDisplayName] UTF8String], [[qtk_device uniqueID] UTF8String]);
if([[[qtk_device uniqueID]stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] isEqualToString:qtk_currdevice_uid]){
break;
}
......@@ -302,7 +302,8 @@ static int Open( vlc_object_t *p_this )
/* Get the formats */
NSArray *format_array = [p_sys->device formatDescriptions];
QTFormatDescription* camera_format = NULL;
for( int k = 0; k < [format_array count]; k++ )
NSUInteger formatCount = [format_array count];
for( NSUInteger k = 0; k < formatCount; k++ )
{
camera_format = [format_array objectAtIndex: k];
......
......@@ -627,8 +627,8 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
memset(cookies, 0, sizeof(IOHIDElementCookie) * NUMBER_OF_APPLE_REMOTE_ACTIONS);
*/
allCookies = [[NSMutableArray alloc] init];
unsigned int i;
for (i=0; i< [elements count]; i++) {
NSUInteger elementCount = [elements count];
for (NSUInteger i=0; i< elementCount; i++) {
element = [elements objectAtIndex:i];
//Get cookie
......@@ -668,8 +668,8 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
if (queue) {
result = (*queue)->create(queue, 0, 12); //depth: maximum number of elements in queue before oldest elements in queue begin to be lost.
unsigned int i=0;
for(i=0; i<[allCookies count]; i++) {
NSUInteger cookieCount = [allCookies count];
for(NSUInteger i=0; i<cookieCount; i++) {
IOHIDElementCookie cookie = (IOHIDElementCookie)[[allCookies objectAtIndex:i] intValue];
(*queue)->addElement(queue, cookie, 0);
}
......
......@@ -375,7 +375,8 @@ static VLCMainMenu *_o_sharedInstance = nil;
if( !p_intf ) return;
NSArray *menuitems_array = [the_menu itemArray];
for( int i=0; i<[menuitems_array count]; i++ )
NSUInteger menuItemCount = [menuitems_array count];
for( NSUInteger i=0; i < menuItemCount; i++ )
{
NSMenuItem *one_item = [menuitems_array objectAtIndex: i];
if( [one_item hasSubmenu] )
......
......@@ -106,7 +106,8 @@ static VLAboutBox *_o_sharedInstance = nil;
[o_name_version_field setStringValue: [NSString stringWithFormat:@"Version %s (%s)", VERSION_MESSAGE, PLATFORM]];
NSMutableArray *tmpArray = [NSMutableArray arrayWithArray: [[NSString stringWithUTF8String: psz_authors]componentsSeparatedByString:@"\n\n"]];
for( int i = 0; i < [tmpArray count]; i++ )
NSUInteger count = [tmpArray count];
for( NSUInteger i = 0; i < count; i++ )
{
[tmpArray replaceObjectAtIndex:i withObject:[[tmpArray objectAtIndex:i]stringByReplacingOccurrencesOfString:@"\n" withString:@", "]];
[tmpArray replaceObjectAtIndex:i withObject:[[tmpArray objectAtIndex:i]stringByReplacingOccurrencesOfString:@", -" withString:@"\n-" options:0 range:NSRangeFromString(@"0 30")]];
......
......@@ -83,9 +83,9 @@ static NSMutableArray *blackoutWindows = NULL;
+ (NSScreen *)screenWithDisplayID: (CGDirectDisplayID)displayID
{
int i;
NSUInteger count = [[NSScreen screens] count];
for( i = 0; i < [[NSScreen screens] count]; i++ )
for( NSUInteger i = 0; i < count; i++ )
{
NSScreen *screen = [[NSScreen screens] objectAtIndex: i];
if([screen displayID] == displayID)
......@@ -111,13 +111,12 @@ static NSMutableArray *blackoutWindows = NULL;
- (void)blackoutOtherScreens
{
unsigned int i;
/* Free our previous blackout window (follow blackoutWindow alloc strategy) */
[blackoutWindows makeObjectsPerformSelector:@selector(close)];
[blackoutWindows removeAllObjects];
for(i = 0; i < [[NSScreen screens] count]; i++)
NSUInteger screenCount = [[NSScreen screens] count];
for(NSUInteger i = 0; i < screenCount; i++)
{
NSScreen *screen = [[NSScreen screens] objectAtIndex: i];
VLCWindow *blackoutWindow;
......@@ -151,9 +150,9 @@ static NSMutableArray *blackoutWindows = NULL;
+ (void)unblackoutScreens
{
unsigned int i;
NSUInteger blackoutWindowCount = [blackoutWindows count];
for(i = 0; i < [blackoutWindows count]; i++)
for(NSUInteger i = 0; i < blackoutWindowCount; i++)
{
VLCWindow *blackoutWindow = [blackoutWindows objectAtIndex: i];
[blackoutWindow closeAndAnimate: YES];
......@@ -398,12 +397,11 @@ static NSMutableArray *blackoutWindows = NULL;
{
if ([o_desired_type isEqualToString:NSFilenamesPboardType])
{
int i;
NSArray *o_array = [NSArray array];
NSArray *o_values = [[o_paste propertyListForType: NSFilenamesPboardType]
sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
NSArray *o_values = [[o_paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
NSUInteger count = [o_values count];
for( i = 0; i < (int)[o_values count]; i++)
for( NSUInteger i = 0; i < count; i++)
{
NSDictionary *o_dic;
char *psz_uri = make_URI([[o_values objectAtIndex:i] UTF8String], NULL);
......@@ -483,12 +481,11 @@ static NSMutableArray *blackoutWindows = NULL;
{
if ([o_desired_type isEqualToString:NSFilenamesPboardType])
{
int i;
NSArray *o_array = [NSArray array];
NSArray *o_values = [[o_paste propertyListForType: NSFilenamesPboardType]
sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
NSArray *o_values = [[o_paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
NSUInteger count = [o_values count];
for( i = 0; i < (int)[o_values count]; i++)
for( NSUInteger i = 0; i < count; i++)
{
NSDictionary *o_dic;
char *psz_uri = make_URI([[o_values objectAtIndex:i] UTF8String], NULL);
......
......@@ -211,7 +211,8 @@ static VLCOpen *_o_sharedMainInstance = nil;
qtk_currdevice_uid = [[[QTCaptureDevice defaultInputDeviceWithMediaType: QTMediaTypeVideo] uniqueID]
stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
}
for(int ivideo = 0; ivideo < [qtkvideoDevices count]; ivideo++){
NSUInteger deviceCount = [qtkvideoDevices count];
for(int ivideo = 0; ivideo < deviceCount; ivideo++){
QTCaptureDevice *qtk_device;
qtk_device = [qtkvideoDevices objectAtIndex:ivideo];
[o_qtk_device_pop addItemWithTitle: [qtk_device localizedDisplayName]];
......@@ -368,7 +369,6 @@ static VLCOpen *_o_sharedMainInstance = nil;
{
NSMutableDictionary *o_dic;
NSMutableArray *o_options = [NSMutableArray array];
unsigned int i;
o_dic = [NSMutableDictionary dictionaryWithObject: [self MRL] forKey: @"ITEM_URL"];
if( [o_file_sub_ckbox state] == NSOnState )
......@@ -400,10 +400,10 @@ static VLCOpen *_o_sharedMainInstance = nil;
}
if( [o_output_ckbox state] == NSOnState )
{
for (i = 0 ; i < [[o_sout_options mrl] count] ; i++)
NSUInteger count = [[o_sout_options mrl] count];
for (NSUInteger i = 0 ; i < count ; i++)
{
[o_options addObject: [NSString stringWithString:
[[(VLCOutput *)o_sout_options mrl] objectAtIndex: i]]];
[o_options addObject: [NSString stringWithString: [[(VLCOutput *)o_sout_options mrl] objectAtIndex: i]]];
}
}
if( [o_file_slave_ckbox state] && o_file_slave_path )
......@@ -752,7 +752,8 @@ static VLCOpen *_o_sharedMainInstance = nil;
{
NSArray * topLevelItems;
topLevelItems = [[NSFileManager defaultManager] subpathsOfDirectoryAtPath: mountPath error: NULL];
for (int i = 0; i < [topLevelItems count]; i++) {
NSUInteger itemCount = [topLevelItems count];
for (int i = 0; i < itemCount; i++) {
if([[topLevelItems objectAtIndex:i] rangeOfString:@"SVCD"].location != NSNotFound) {
returnValue = kVLCMediaSVCD;
break;
......@@ -835,7 +836,8 @@ static VLCOpen *_o_sharedMainInstance = nil;
if ([o_specialMediaFolders count] > 0)
[o_opticalDevices addObjectsFromArray: o_specialMediaFolders];
if ([o_opticalDevices count] > 0) {
for (int i = 0; i < [o_opticalDevices count] ; i++)
NSUInteger deviceCount = [o_opticalDevices count];
for (NSUInteger i = 0; i < deviceCount ; i++)
[o_disc_selector_pop addItemWithTitle: [[NSFileManager defaultManager] displayNameAtPath:[o_opticalDevices objectAtIndex: i]]];
if ([o_disc_selector_pop numberOfItems] <= 1)
......
......@@ -416,27 +416,21 @@
/* split up the hostname and the following path to paste the
* port correctly. Not need, if there isn't any path following the
* hostname. */
NSArray * o_urlItems = [[o_stream_address stringValue] \
componentsSeparatedByString: @"/"];
NSArray * o_urlItems = [[o_stream_address stringValue] componentsSeparatedByString: @"/"];
NSMutableString * o_finalStreamAddress;
o_finalStreamAddress = [[NSMutableString alloc] init];
if ([o_urlItems count] == 1)
{
[o_finalStreamAddress appendFormat: @"\"%@:%@\"", \
[o_stream_address stringValue],[o_stream_port stringValue]];
[o_finalStreamAddress appendFormat: @"\"%@:%@\"", [o_stream_address stringValue],[o_stream_port stringValue]];
}
else
{
[o_finalStreamAddress appendFormat: @"\"%@:%@", [o_urlItems \
objectAtIndex: 0], [o_stream_port stringValue]];
unsigned int x;
x = 1;
while (x != [o_urlItems count])
[o_finalStreamAddress appendFormat: @"\"%@:%@", [o_urlItems objectAtIndex: 0], [o_stream_port stringValue]];
NSUInteger itemCount = [o_urlItems count];
for (NSUInteger x = 0; x < itemCount; x++)
{
[o_finalStreamAddress appendFormat: @"/%@", [o_urlItems \
objectAtIndex: x]];
x = (x + 1);
[o_finalStreamAddress appendFormat: @"/%@", [o_urlItems objectAtIndex: x]];
}
[o_finalStreamAddress appendString: @"\""];
}
......
This diff is collapsed.
......@@ -295,7 +295,8 @@ static VLCPrefs *_o_sharedMainInstance = nil;
- (VLCTreeCategoryItem *)itemRepresentingCategory:(int)category
{
for( int i = 0; i < [[self children] count]; i++ )
NSUInteger childrenCount = [[self children] count];
for( int i = 0; i < childrenCount; i++ )
{
VLCTreeCategoryItem * categoryItem = [[self children] objectAtIndex:i];
if( [categoryItem category] == category )
......@@ -433,7 +434,8 @@ static VLCPrefs *_o_sharedMainInstance = nil;
- (VLCTreeSubCategoryItem *)itemRepresentingSubCategory:(int)subCategory
{
assert( [self isKindOfClass:[VLCTreeCategoryItem class]] );
for( int i = 0; i < [[self children] count]; i++ )
NSUInteger childrenCount = [[self children] count];
for( NSUInteger i = 0; i < childrenCount; i++ )
{
VLCTreeSubCategoryItem * subCategoryItem = [[self children] objectAtIndex:i];
if( [subCategoryItem subCategory] == subCategory )
......@@ -584,8 +586,8 @@ static VLCPrefs *_o_sharedMainInstance = nil;
{
_subviews = [[NSMutableArray alloc] initWithCapacity:10];
long i;
for( i = 0; i < [[self options] count]; i++)
NSUInteger count = [[self options] count];
for( NSUInteger i = 0; i < count; i++)
{
VLCTreeLeafItem * item = [[self options] objectAtIndex:i];
......@@ -638,24 +640,29 @@ static VLCPrefs *_o_sharedMainInstance = nil;
- (void)applyChanges
{
unsigned int i;
for( i = 0 ; i < [_subviews count] ; i++ )
NSUInteger i;
NSUInteger count = [_subviews count];
for( i = 0 ; i < count ; i++ )
[[_subviews objectAtIndex:i] applyChanges];
for( i = 0 ; i < [_children count] ; i++ )
count = [_children count];
for( i = 0 ; i < count ; i++ )
[[_children objectAtIndex:i] applyChanges];
}
- (void)resetView
{
unsigned int i;
for( i = 0 ; i < [_subviews count] ; i++ )
NSUInteger i;
NSUInteger count = [_subviews count];
for( i = 0 ; i < count ; i++ )
[[_subviews objectAtIndex:i] resetValues];
for( i = 0 ; i < [_options count] ; i++ )
count = [_options count];
for( i = 0 ; i < count ; i++ )
[[_options objectAtIndex:i] resetView];
for( i = 0 ; i < [_children count] ; i++ )
count = [_children count];
for( i = 0 ; i < count ; i++ )
[[_children objectAtIndex:i] resetView];
}
......
......@@ -2308,8 +2308,8 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain]; \
- (IBAction)tableChanged:(id)sender
{
NSString *o_newstring = @"";
unsigned int i;
for( i = 0 ; i < [o_modulearray count] ; i++ )
NSUInteger count = [o_modulearray count];
for( NSUInteger i = 0 ; i < count ; i++ )
if( [[[o_modulearray objectAtIndex:i] objectAtIndex:2]
boolValue] != NO )
{
......
......@@ -916,7 +916,8 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
********************/
if( b_hotkeyChanged )
{
for( NSUInteger i = 0; i < [o_hotkeySettings count]; i++ )
NSUInteger hotKeyCount = [o_hotkeySettings count];
for( NSUInteger i = 0; i < hotKeyCount; i++ )
config_PutPsz( p_intf, [[o_hotkeyNames objectAtIndex:i] UTF8String], [[o_hotkeySettings objectAtIndex:i]UTF8String] );
b_hotkeyChanged = NO;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment