Commit 5e8d27a2 authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

macosx: use modern ObjC syntax for C-Numbers to NSNumber conversations

parent cc3fef6d
......@@ -350,7 +350,7 @@ static int Open(vlc_object_t *p_this)
[p_sys->output setSampleBufferDelegate:p_sys->output queue:queue];
dispatch_release(queue);
p_sys->output.videoSettings = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:kCVPixelFormatType_32BGRA] forKey:(id)kCVPixelBufferPixelFormatTypeKey];
p_sys->output.videoSettings = [NSDictionary dictionaryWithObject:@(kCVPixelFormatType_32BGRA) forKey:(id)kCVPixelBufferPixelFormatTypeKey];
[p_sys->session startRunning];
[input release];
......
......@@ -344,10 +344,10 @@ static int Open(vlc_object_t *p_this)
msg_Dbg(p_demux, "PAR size %i %i", (int)par_size.width, (int)par_size.height);
[p_sys->output setPixelBufferAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithUnsignedInt:kCVPixelFormatType_422YpCbCr8], (id)kCVPixelBufferPixelFormatTypeKey,
[NSNumber numberWithInt: p_sys->height], kCVPixelBufferHeightKey,
[NSNumber numberWithInt: p_sys->width], kCVPixelBufferWidthKey,
[NSNumber numberWithBool:YES], (id)kCVPixelBufferOpenGLCompatibilityKey,
@(kCVPixelFormatType_422YpCbCr8), (id)kCVPixelBufferPixelFormatTypeKey,
@(p_sys->height), kCVPixelBufferHeightKey,
@(p_sys->width), kCVPixelBufferWidthKey,
@YES, (id)kCVPixelBufferOpenGLCompatibilityKey,
nil]];
[p_sys->output setAutomaticallyDropsLateVideoFrames:YES];
[p_sys->output setMinimumVideoFrameInterval: (1/25)]; // 25 fps
......
......@@ -86,25 +86,25 @@ static AppleRemote *_o_sharedInstance = nil;
hidDeviceInterface = NULL;
NSMutableDictionary * mutableCookieToButtonMapping = [[NSMutableDictionary alloc] init];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Plus] forKey:@"33_31_30_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Minus] forKey:@"33_32_30_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonMenu] forKey:@"33_22_21_20_2_33_22_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay] forKey:@"33_23_21_20_2_33_23_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonRight] forKey:@"33_24_21_20_2_33_24_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonLeft] forKey:@"33_25_21_20_2_33_25_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonRight_Hold] forKey:@"33_21_20_14_12_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonLeft_Hold] forKey:@"33_21_20_13_12_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonMenu_Hold] forKey:@"33_21_20_2_33_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay_Sleep] forKey:@"37_33_21_20_2_37_33_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:k2009RemoteButtonPlay] forKey:@"33_21_20_8_2_33_21_20_8_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:k2009RemoteButtonFullscreen] forKey:@"33_21_20_3_2_33_21_20_3_2_"];
[mutableCookieToButtonMapping setObject:@(kRemoteButtonVolume_Plus) forKey:@"33_31_30_21_20_2_"];
[mutableCookieToButtonMapping setObject:@(kRemoteButtonVolume_Minus) forKey:@"33_32_30_21_20_2_"];
[mutableCookieToButtonMapping setObject:@(kRemoteButtonMenu) forKey:@"33_22_21_20_2_33_22_21_20_2_"];
[mutableCookieToButtonMapping setObject:@(kRemoteButtonPlay) forKey:@"33_23_21_20_2_33_23_21_20_2_"];
[mutableCookieToButtonMapping setObject:@(kRemoteButtonRight) forKey:@"33_24_21_20_2_33_24_21_20_2_"];
[mutableCookieToButtonMapping setObject:@(kRemoteButtonLeft) forKey:@"33_25_21_20_2_33_25_21_20_2_"];
[mutableCookieToButtonMapping setObject:@(kRemoteButtonRight_Hold) forKey:@"33_21_20_14_12_2_"];
[mutableCookieToButtonMapping setObject:@(kRemoteButtonLeft_Hold) forKey:@"33_21_20_13_12_2_"];
[mutableCookieToButtonMapping setObject:@(kRemoteButtonMenu_Hold) forKey:@"33_21_20_2_33_21_20_2_"];
[mutableCookieToButtonMapping setObject:@(kRemoteButtonPlay_Sleep) forKey:@"37_33_21_20_2_37_33_21_20_2_"];
[mutableCookieToButtonMapping setObject:@(k2009RemoteButtonPlay) forKey:@"33_21_20_8_2_33_21_20_8_2_"];
[mutableCookieToButtonMapping setObject:@(k2009RemoteButtonFullscreen) forKey:@"33_21_20_3_2_33_21_20_3_2_"];
if( OSX_SNOW_LEOPARD )
/* 10.6.2+ Snow Leopard cookies */
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteControl_Switched] forKey:@"19_"];
[mutableCookieToButtonMapping setObject:@(kRemoteControl_Switched) forKey:@"19_"];
else
/* Lion cookies */
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteControl_Switched] forKey:@"42_33_23_21_20_2_33_23_21_20_2_"];
[mutableCookieToButtonMapping setObject:@(kRemoteControl_Switched) forKey:@"42_33_23_21_20_2_33_23_21_20_2_"];
_cookieToButtonMapping = [[NSDictionary alloc] initWithDictionary: mutableCookieToButtonMapping];
[mutableCookieToButtonMapping release];
......@@ -343,7 +343,7 @@ static AppleRemote* sharedInstance=nil;
lastPlusMinusEvent = event;
lastPlusMinusEventTime = [NSDate timeIntervalSinceReferenceDate];
[self performSelector:@selector(sendSimulatedPlusMinusEvent:)
withObject:[NSNumber numberWithDouble:lastPlusMinusEventTime]
withObject:@(lastPlusMinusEventTime)
afterDelay:HOLD_RECOGNITION_TIME_INTERVAL];
return;
} else {
......@@ -375,8 +375,8 @@ static AppleRemote* sharedInstance=nil;
eventClickCount = 1;
}
lastClickCountEvent = event;
timeNumber = [NSNumber numberWithDouble:lastClickCountEventTime];
eventNumber= [NSNumber numberWithUnsignedInt:event];
timeNumber = @(lastClickCountEventTime);
eventNumber= @(event);
}
[self performSelector: @selector(executeClickCountEvent:)
withObject: @[eventNumber, timeNumber]
......@@ -584,7 +584,7 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
if (object == nil || ![object isKindOfClass:[NSNumber class]]) continue;
usagePage = [object longValue];
[mutableAllCookies addObject: [NSNumber numberWithInt:(int)cookie]];
[mutableAllCookies addObject: @((int)cookie)];
}
_allCookies = [[NSArray alloc] initWithArray: mutableAllCookies];
[mutableAllCookies release];
......
......@@ -208,7 +208,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
for (value = widget->p_values; value != NULL; value = value->p_next)
{
NSDictionary *entry = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:value->i_id], @"id",
@(value->i_id), @"id",
@(value->psz_text), @"text",
nil];
[contentArray addObject:entry];
......
......@@ -411,7 +411,7 @@
}
- (NSNumber*)extendedAccessibilityIsAttributeSettable: (NSString*)theAttributeName {
return ([theAttributeName isEqualToString: NSAccessibilitySubroleAttribute] ? [NSNumber numberWithBool: NO] : nil); // make the Subrole attribute we added non-settable
return ([theAttributeName isEqualToString: NSAccessibilitySubroleAttribute] ? @NO : nil); // make the Subrole attribute we added non-settable
}
- (void)accessibilityPerformAction: (NSString*)theActionName {
......
......@@ -317,10 +317,10 @@
[dict setObject:view forKey:@"view"];
[_griddedViews addObject:dict];
}
[dict setObject:[NSNumber numberWithInt:rowSpan] forKey:@"rowSpan"];
[dict setObject:[NSNumber numberWithInt:colSpan] forKey:@"colSpan"];
[dict setObject:[NSNumber numberWithInt:row] forKey:@"row"];
[dict setObject:[NSNumber numberWithInt:column] forKey:@"col"];
[dict setObject:@(rowSpan) forKey:@"rowSpan"];
[dict setObject:@(colSpan) forKey:@"colSpan"];
[dict setObject:@(row) forKey:@"row"];
[dict setObject:@(column) forKey:@"col"];
[self addSubview:view];
[self relayout];
......
......@@ -90,7 +90,7 @@ static VLAboutBox *_o_sharedInstance = nil;
/* l10n */
[o_about_window setTitle: _NS("About VLC media player")];
NSDictionary *stringAttributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:NSUnderlineStyleSingle], NSUnderlineStyleAttributeName, [NSColor colorWithCalibratedRed:0. green:0.3411 blue:0.6824 alpha:1.], NSForegroundColorAttributeName, [NSFont systemFontOfSize:13], NSFontAttributeName, nil];
NSDictionary *stringAttributes = [NSDictionary dictionaryWithObjectsAndKeys:@(NSUnderlineStyleSingle), NSUnderlineStyleAttributeName, [NSColor colorWithCalibratedRed:0. green:0.3411 blue:0.6824 alpha:1.], NSForegroundColorAttributeName, [NSFont systemFontOfSize:13], NSFontAttributeName, nil];
NSAttributedString *attrStr;
attrStr = [[NSAttributedString alloc] initWithString:_NS("Credits") attributes:stringAttributes];
[o_credits_btn setAttributedTitle:attrStr];
......
......@@ -265,7 +265,7 @@
if ([self alphaValue] < 1.0 || b_displayed != YES) {
if (![self fadeTimer])
[self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(focus:) userInfo:[NSNumber numberWithShort:1] repeats:YES]];
[self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(focus:) userInfo:@1 repeats:YES]];
else if ([[[self fadeTimer] userInfo] shortValue]==0)
b_fadeQueued=YES;
}
......@@ -279,7 +279,7 @@
if (([self alphaValue] > 0.0)) {
if (![self fadeTimer])
[self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(unfocus:) userInfo:[NSNumber numberWithShort:0] repeats:YES]];
[self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(unfocus:) userInfo:@0 repeats:YES]];
else if ([[[self fadeTimer] userInfo] shortValue]==1)
b_fadeQueued=YES;
}
......
......@@ -1153,7 +1153,7 @@ static VLCMain *_o_sharedMainInstance = nil;
/* simulate an event as long as the user holds the button */
b_remote_button_hold = pressedDown;
if (pressedDown) {
NSNumber* buttonIdentifierNumber = [NSNumber numberWithInt: buttonIdentifier];
NSNumber* buttonIdentifierNumber = @(buttonIdentifier);
[self performSelector:@selector(executeHoldActionForRemoteButton:)
withObject:buttonIdentifierNumber];
}
......
......@@ -1043,7 +1043,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_specialMediaFolders addObject:o_dict];
}
[self performSelectorOnMainThread:@selector(updateMediaSelector:) withObject:[NSNumber numberWithBool:YES] waitUntilDone:NO];
[self performSelectorOnMainThread:@selector(updateMediaSelector:) withObject:@YES waitUntilDone:NO];
[o_pool release];
}
......
......@@ -2006,9 +2006,9 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain]; \
if (_p_item->value.psz &&
strstr(_p_item->value.psz, module_get_object(p_parser)))
o_moduleenabled = [NSNumber numberWithBool:YES];
o_moduleenabled = @YES;
else
o_moduleenabled = [NSNumber numberWithBool:NO];
o_moduleenabled = @NO;
[o_modulearray addObject:[NSMutableArray
arrayWithObjects: o_modulename, o_modulelongname,
......@@ -2025,9 +2025,9 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain]; \
#define addLuaIntf(shortname, longname) \
if (_p_item->value.psz && strstr(_p_item->value.psz, shortname))\
o_moduleenabled = [NSNumber numberWithBool:YES];\
o_moduleenabled = @YES;\
else\
o_moduleenabled = [NSNumber numberWithBool:NO];\
o_moduleenabled = @NO;\
[o_modulearray addObject:[NSMutableArray arrayWithObjects: @shortname, _NS(longname), o_moduleenabled, nil]]
addLuaIntf("http", "Web");
......
......@@ -359,7 +359,7 @@ static inline char * __config_GetLabel(vlc_object_t *p_this, const char *psz_nam
mi = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: @"%d", p_item->list.i[i]] action:NULL keyEquivalent: @""];
else
msg_Err(p_intf, "item %d of pref %s failed to be created", i, name);
[mi setRepresentedObject:[NSNumber numberWithInt: p_item->list.i[i]]];
[mi setRepresentedObject:@(p_item->list.i[i])];
[[object menu] addItem: [mi autorelease]];
if (p_item->value.i == p_item->list.i[i])
[object selectItem:[object lastItem]];
......
......@@ -632,8 +632,7 @@ static VLCWizard *_o_sharedInstance = nil;
[o_t4_pop_videoCodec removeItemWithTitle:@"Theora"];
} else {
/* RTP/UDP Unicast/Multicast Streaming */
[o_userSelections setObject: [[NSNumber numberWithInt: mode]
stringValue] forKey:@"stmgMhd"];
[o_userSelections setObject: [@(mode) stringValue] forKey:@"stmgMhd"];
/* disable all codecs which don't support MPEG-TS */
[o_t4_pop_audioCodec removeItemWithTitle:@"Vorbis"];
......@@ -678,7 +677,7 @@ static VLCWizard *_o_sharedInstance = nil;
if ([o_t4_ckb_video state] == NSOnState)
{
NSNumber * theNum;
theNum = [NSNumber numberWithInt:[[o_t4_pop_videoCodec selectedItem]tag]];
theNum = @([[o_t4_pop_videoCodec selectedItem]tag]);
[o_userSelections setObject:@"YES" forKey:@"trnscdVideo"];
[o_userSelections setObject:[o_t4_pop_videoBitrate titleOfSelectedItem]
forKey:@"trnscdVideoBitrate"];
......@@ -692,7 +691,7 @@ static VLCWizard *_o_sharedInstance = nil;
if ([o_t4_ckb_audio state] == NSOnState)
{
NSNumber * theNum;
theNum = [NSNumber numberWithInt:[[o_t4_pop_audioCodec selectedItem]tag]];
theNum = @([[o_t4_pop_audioCodec selectedItem]tag]);
[o_userSelections setObject:@"YES" forKey:@"trnscdAudio"];
[o_userSelections setObject:[o_t4_pop_audioBitrate titleOfSelectedItem]
forKey:@"trnscdAudioBitrate"];
......@@ -1002,7 +1001,7 @@ static VLCWizard *_o_sharedInstance = nil;
{
/* get the chosen encap format and store it */
NSNumber * theNum;
theNum = [NSNumber numberWithInt:[[o_t5_matrix_encap selectedCell] tag]];
theNum = @([[o_t5_matrix_encap selectedCell] tag]);
[o_userSelections setObject:[theNum stringValue] forKey:@"encapFormat"];
/* show either "Streaming 2" or "Transcode 2" to the user */
......@@ -1051,8 +1050,7 @@ static VLCWizard *_o_sharedInstance = nil;
/* include subtitles? */
[o_userSelections setObject:
[[NSNumber numberWithInt:[o_t6_ckb_soverlay state]] stringValue]
forKey: @"soverlay"];
[@([o_t6_ckb_soverlay state]) stringValue] forKey: @"soverlay"];
/* go to "Summary" */
[self showSummary];
......@@ -1178,8 +1176,7 @@ static VLCWizard *_o_sharedInstance = nil;
/* include subtitles ? */
[o_userSelections setObject:
[[NSNumber numberWithInt:[o_t7_ckb_soverlay state]] stringValue]
forKey: @"soverlay"];
[@([o_t7_ckb_soverlay state]) stringValue] forKey: @"soverlay"];
/* go to "Summary" */
[self showSummary];
......
......@@ -275,7 +275,7 @@ void updateProgressPanel (void *priv, const char *text, float value)
intf_sys_t *sys = (intf_sys_t *)priv;
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat:value], @"value",
@(value), @"value",
text ? @(text) : nil, @"text",
nil];
......@@ -392,7 +392,7 @@ bool checkProgressPanel (void *priv)
break;
}
return [NSNumber numberWithInt:ret];
return @(ret);
}
- (NSDictionary *)displayLogin:(NSDictionary *)dialog
......@@ -456,7 +456,7 @@ bool checkProgressPanel (void *priv)
{
VLCAssertIsMainThread();
return [NSNumber numberWithBool:[_currentProgressBarPanel isCancelled]];
return @([_currentProgressBarPanel isCancelled]);
}
#pragma mark -
......@@ -744,7 +744,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
for(value = widget->p_values; value != NULL; value = value->p_next)
{
NSDictionary *entry = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:value->i_id], @"id",
@(value->i_id), @"id",
@(value->psz_text), @"text",
nil];
[contentArray addObject:entry];
......
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