Commit cc3fef6d authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: use modern ObjC syntax for C-String to NSString conversations

parent 70337297
......@@ -77,8 +77,8 @@ static VLCAudioEffects *_o_sharedInstance = nil;
eqz_preset_10b[i].f_amp[9]];
[workValues addObject:workString];
[workPreamp addObject:[NSString stringWithFormat:@"%1.f", eqz_preset_10b[i].f_preamp]];
[workTitles addObject:[NSString stringWithUTF8String:preset_list_text[i]]];
[workNames addObject:[NSString stringWithUTF8String:preset_list[i]]];
[workTitles addObject:@(preset_list_text[i])];
[workNames addObject:@(preset_list[i])];
}
NSString *defaultProfile = [NSString stringWithFormat:@"ZmxhdA==;;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%i",
......@@ -178,9 +178,9 @@ static VLCAudioEffects *_o_sharedInstance = nil;
}
} else {
if (psz_tmp) {
psz_tmp = (char *)[[[NSString stringWithUTF8String: psz_tmp] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:[NSString stringWithFormat:@":%s",psz_name]]] UTF8String];
psz_tmp = (char *)[[[NSString stringWithUTF8String: psz_tmp] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:[NSString stringWithFormat:@"%s:",psz_name]]] UTF8String];
psz_tmp = (char *)[[[NSString stringWithUTF8String: psz_tmp] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:[NSString stringWithUTF8String:psz_name]]] UTF8String];
psz_tmp = (char *)[[@(psz_tmp) stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:[NSString stringWithFormat:@":%s",psz_name]]] UTF8String];
psz_tmp = (char *)[[@(psz_tmp) stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:[NSString stringWithFormat:@"%s:",psz_name]]] UTF8String];
psz_tmp = (char *)[[@(psz_tmp) stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@(psz_name)]] UTF8String];
config_PutPsz(p_intf, "audio-filter", psz_tmp);
}
}
......
......@@ -320,7 +320,7 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
[openPanel beginSheetModalForWindow:_window completionHandler:^(NSInteger returnCode) {
if (returnCode == NSOKButton)
{
[self setMRL: [NSString stringWithUTF8String:vlc_path2uri([[[openPanel URL] path] UTF8String], NULL)]];
[self setMRL: @(vlc_path2uri([[[openPanel URL] path] UTF8String], NULL))];
[self updateOKButton];
[self updateDropView];
}
......@@ -543,7 +543,7 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
NSArray *values = [[paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
if ([values count] > 0) {
[self setMRL: [NSString stringWithUTF8String:vlc_path2uri([[values objectAtIndex:0] UTF8String], NULL)]];
[self setMRL: @(vlc_path2uri([[values objectAtIndex:0] UTF8String], NULL))];
[self updateOKButton];
[self updateDropView];
return YES;
......
......@@ -233,7 +233,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
}
NSURL *o_url;
o_url = [NSURL URLWithString:[NSString stringWithUTF8String:psz_uri]];
o_url = [NSURL URLWithString:@(psz_uri)];
vlc_object_release(p_input);
return o_url;
......@@ -265,10 +265,10 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
char *format = var_InheritString(VLCIntf, "input-title-format");
char *formated = str_format_meta(pl_Get(VLCIntf), format);
free(format);
o_name = [NSString stringWithUTF8String:formated];
o_name = @(formated);
free(formated);
NSURL * o_url = [NSURL URLWithString: [NSString stringWithUTF8String: psz_uri]];
NSURL * o_url = [NSURL URLWithString: @(psz_uri)];
free(psz_uri);
if ([o_name isEqualToString:@""]) {
......
......@@ -142,7 +142,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
// Get the web view
assert([control isKindOfClass:[WebView class]]);
WebView *webView = (WebView *)control;
NSString *string = [NSString stringWithUTF8String:widget->psz_text];
NSString *string = @(widget->psz_text);
[[webView mainFrame] loadHTMLString:string baseURL:[NSURL URLWithString:@""]];
[webView setNeedsDisplay:YES];
break;
......@@ -151,7 +151,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
{
assert([control isKindOfClass:[NSTextView class]]);
NSTextView *textView = (NSTextView *)control;
NSString *string = [NSString stringWithUTF8String:widget->psz_text];
NSString *string = @(widget->psz_text);
NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTML:[string dataUsingEncoding: NSISOLatin1StringEncoding] documentAttributes:NULL];
[[textView textStorage] setAttributedString:attrString];
[textView setNeedsDisplay:YES];
......@@ -181,7 +181,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
NSButton *button = (NSButton *)control;
if (!widget->psz_text)
break;
[button setTitle:[NSString stringWithUTF8String:widget->psz_text]];
[button setTitle:@(widget->psz_text)];
break;
}
case EXTENSION_WIDGET_DROPDOWN:
......@@ -191,9 +191,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
[popup removeAllItems];
struct extension_widget_value_t *value;
for (value = widget->p_values; value != NULL; value = value->p_next)
{
[popup addItemWithTitle:[NSString stringWithUTF8String:value->psz_text]];
}
[popup addItemWithTitle:@(value->psz_text)];
[popup synchronizeTitleAndSelectedItem];
[self popUpSelectionChanged:popup];
break;
......@@ -211,7 +209,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
{
NSDictionary *entry = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:value->i_id], @"id",
[NSString stringWithUTF8String:value->psz_text], @"text",
@(value->psz_text), @"text",
nil];
[contentArray addObject:entry];
}
......@@ -223,7 +221,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
{
assert([control isKindOfClass:[NSImageView class]]);
NSImageView *imageView = (NSImageView *)control;
NSString *string = widget->psz_text ? [NSString stringWithUTF8String:widget->psz_text] : nil;
NSString *string = widget->psz_text ? @(widget->psz_text) : nil;
NSImage *image = nil;
if (string)
image = [[NSImage alloc] initWithContentsOfURL:[NSURL fileURLWithPath:string]];
......@@ -311,7 +309,7 @@ static ExtensionsDialogProvider *_o_sharedInstance = nil;
- (void)performEventWithObject: (NSValue *)o_value ofType: (const char*)type
{
NSString *o_type = [NSString stringWithUTF8String:type];
NSString *o_type = @(type);
if ([o_type isEqualToString: @"dialog-extension"]) {
[self performSelectorOnMainThread:@selector(updateExtensionDialog:)
......@@ -459,7 +457,7 @@ static ExtensionsDialogProvider *_o_sharedInstance = nil;
defer:NO];
[dialogWindow setDelegate:self];
[dialogWindow setDialog:p_dialog];
[dialogWindow setTitle:[NSString stringWithUTF8String:p_dialog->psz_title]];
[dialogWindow setTitle:@(p_dialog->psz_title)];
VLCDialogGridView *gridView = [[VLCDialogGridView alloc] init];
[gridView setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
......
......@@ -289,7 +289,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
[mi setTarget:self];
[mi setAction:selector];
[mi setTag:p_item->list.i[i]];
[mi setRepresentedObject:[NSString stringWithUTF8String:psz_name]];
[mi setRepresentedObject:@(psz_name)];
[menu addItem: [mi autorelease]];
if (p_item->value.i == p_item->list.i[i])
[mi setState:NSOnState];
......@@ -926,7 +926,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
[openPanel setCanChooseDirectories: NO];
[openPanel setAllowsMultipleSelection: YES];
[openPanel setAllowedFileTypes: @[@"cdg",@"@idx",@"srt",@"sub",@"utf",@"ass",@"ssa",@"aqt",@"jss",@"psb",@"rt",@"smi",@"txt",@"smil"]];
[openPanel setDirectoryURL:[NSURL fileURLWithPath:[[NSString stringWithUTF8String:path] stringByExpandingTildeInPath]]];
[openPanel setDirectoryURL:[NSURL fileURLWithPath:[@(path) stringByExpandingTildeInPath]]];
i_returnValue = [openPanel runModal];
free(path);
......
......@@ -249,19 +249,19 @@ static VLCMainWindow *_o_sharedInstance = nil;
else
[[internetItems lastObject] setIcon: [NSImage imageNamed:@"NSApplicationIcon"]];
[[internetItems lastObject] setSdtype: SD_CAT_INTERNET];
[[internetItems lastObject] setUntranslatedTitle: [NSString stringWithUTF8String: *ppsz_longname]];
[[internetItems lastObject] setUntranslatedTitle: @(*ppsz_longname)];
break;
case SD_CAT_DEVICES:
[devicesItems addObject: [SideBarItem itemWithTitle: _NS(*ppsz_longname) identifier: o_identifier]];
[[devicesItems lastObject] setIcon: [NSImage imageNamed:@"NSApplicationIcon"]];
[[devicesItems lastObject] setSdtype: SD_CAT_DEVICES];
[[devicesItems lastObject] setUntranslatedTitle: [NSString stringWithUTF8String: *ppsz_longname]];
[[devicesItems lastObject] setUntranslatedTitle: @(*ppsz_longname)];
break;
case SD_CAT_LAN:
[lanItems addObject: [SideBarItem itemWithTitle: _NS(*ppsz_longname) identifier: o_identifier]];
[[lanItems lastObject] setIcon: [NSImage imageNamed:@"sidebar-local"]];
[[lanItems lastObject] setSdtype: SD_CAT_LAN];
[[lanItems lastObject] setUntranslatedTitle: [NSString stringWithUTF8String: *ppsz_longname]];
[[lanItems lastObject] setUntranslatedTitle: @(*ppsz_longname)];
break;
case SD_CAT_MYCOMPUTER:
[mycompItems addObject: [SideBarItem itemWithTitle: _NS(*ppsz_longname) identifier: o_identifier]];
......@@ -273,7 +273,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
[[mycompItems lastObject] setIcon: [NSImage imageNamed:@"sidebar-pictures"]];
else
[[mycompItems lastObject] setIcon: [NSImage imageNamed:@"NSApplicationIcon"]];
[[mycompItems lastObject] setUntranslatedTitle: [NSString stringWithUTF8String: *ppsz_longname]];
[[mycompItems lastObject] setUntranslatedTitle: @(*ppsz_longname)];
[[mycompItems lastObject] setSdtype: SD_CAT_MYCOMPUTER];
break;
default:
......@@ -635,14 +635,14 @@ static VLCMainWindow *_o_sharedInstance = nil;
char *format = var_InheritString(VLCIntf, "input-title-format");
char *formated = str_format_meta(pl_Get(VLCIntf), format);
free(format);
aString = [NSString stringWithUTF8String:formated];
aString = @(formated);
free(formated);
} else
aString = [NSString stringWithUTF8String:config_GetPsz(VLCIntf, "video-title")];
aString = @(config_GetPsz(VLCIntf, "video-title"));
char *uri = input_item_GetURI(input_GetItem(p_input));
NSURL * o_url = [NSURL URLWithString: [NSString stringWithUTF8String: uri]];
NSURL * o_url = [NSURL URLWithString: @(uri)];
if ([o_url isFileURL]) {
[self setRepresentedURL: o_url];
[[[VLCMain sharedInstance] voutController] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) {
......@@ -1189,7 +1189,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
{
if (config_GetPsz(VLCIntf, "podcast-urls") != NULL) {
[o_podcast_unsubscribe_pop removeAllItems];
[o_podcast_unsubscribe_pop addItemsWithTitles:[[NSString stringWithUTF8String:config_GetPsz(VLCIntf, "podcast-urls")] componentsSeparatedByString:@"|"]];
[o_podcast_unsubscribe_pop addItemsWithTitles:[@(config_GetPsz(VLCIntf, "podcast-urls")) componentsSeparatedByString:@"|"]];
[NSApp beginSheet:o_podcast_unsubscribe_window modalForWindow:self modalDelegate:self didEndSelector:NULL contextInfo:nil];
}
}
......@@ -1200,7 +1200,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
[NSApp endSheet: o_podcast_unsubscribe_window];
if (sender == o_podcast_unsubscribe_ok_btn) {
NSMutableArray * urls = [[NSMutableArray alloc] initWithArray:[[NSString stringWithUTF8String:config_GetPsz(VLCIntf, "podcast-urls")] componentsSeparatedByString:@"|"]];
NSMutableArray * urls = [[NSMutableArray alloc] initWithArray:[@(config_GetPsz(VLCIntf, "podcast-urls")) componentsSeparatedByString:@"|"]];
[urls removeObjectAtIndex: [o_podcast_unsubscribe_pop indexOfSelectedItem]];
config_PutPsz(VLCIntf, "podcast-urls", [[urls componentsJoinedByString:@"|"] UTF8String]);
var_SetString(pl_Get(VLCIntf), "podcast-urls", config_GetPsz(VLCIntf, "podcast-urls"));
......
......@@ -130,18 +130,18 @@ static VLCStringUtility *_o_sharedInstance = nil;
theString = [NSString stringWithFormat:@"%@-", theString];
}
/* modifiers */
theString = [theString stringByReplacingOccurrencesOfString:@"Command" withString: [NSString stringWithUTF8String: "\xE2\x8C\x98"]];
theString = [theString stringByReplacingOccurrencesOfString:@"Alt" withString: [NSString stringWithUTF8String: "\xE2\x8C\xA5"]];
theString = [theString stringByReplacingOccurrencesOfString:@"Shift" withString: [NSString stringWithUTF8String: "\xE2\x87\xA7"]];
theString = [theString stringByReplacingOccurrencesOfString:@"Ctrl" withString: [NSString stringWithUTF8String: "\xE2\x8C\x83"]];
theString = [theString stringByReplacingOccurrencesOfString:@"Command" withString: @("\xE2\x8C\x98")];
theString = [theString stringByReplacingOccurrencesOfString:@"Alt" withString: @("\xE2\x8C\xA5")];
theString = [theString stringByReplacingOccurrencesOfString:@"Shift" withString: @("\xE2\x87\xA7")];
theString = [theString stringByReplacingOccurrencesOfString:@"Ctrl" withString: @("\xE2\x8C\x83")];
/* show non-character keys correctly */
theString = [theString stringByReplacingOccurrencesOfString:@"Right" withString:[NSString stringWithUTF8String:"\xE2\x86\x92"]];
theString = [theString stringByReplacingOccurrencesOfString:@"Left" withString:[NSString stringWithUTF8String:"\xE2\x86\x90"]];
theString = [theString stringByReplacingOccurrencesOfString:@"Up" withString:[NSString stringWithUTF8String:"\xE2\x86\x91"]];
theString = [theString stringByReplacingOccurrencesOfString:@"Down" withString:[NSString stringWithUTF8String:"\xE2\x86\x93"]];
theString = [theString stringByReplacingOccurrencesOfString:@"Enter" withString:[NSString stringWithUTF8String:"\xe2\x86\xb5"]];
theString = [theString stringByReplacingOccurrencesOfString:@"Tab" withString:[NSString stringWithUTF8String:"\xe2\x87\xa5"]];
theString = [theString stringByReplacingOccurrencesOfString:@"Delete" withString:[NSString stringWithUTF8String:"\xe2\x8c\xab"]]; /* capitalize plain characters to suit the menubar's look */
theString = [theString stringByReplacingOccurrencesOfString:@"Right" withString:@("\xE2\x86\x92")];
theString = [theString stringByReplacingOccurrencesOfString:@"Left" withString:@("\xE2\x86\x90")];
theString = [theString stringByReplacingOccurrencesOfString:@"Up" withString:@("\xE2\x86\x91")];
theString = [theString stringByReplacingOccurrencesOfString:@"Down" withString:@("\xE2\x86\x93")];
theString = [theString stringByReplacingOccurrencesOfString:@"Enter" withString:@("\xe2\x86\xb5")];
theString = [theString stringByReplacingOccurrencesOfString:@"Tab" withString:@("\xe2\x87\xa5")];
theString = [theString stringByReplacingOccurrencesOfString:@"Delete" withString:@("\xe2\x8c\xab")]; /* capitalize plain characters to suit the menubar's look */
theString = [theString capitalizedString];
}
else
......@@ -165,7 +165,7 @@ static VLCStringUtility *_o_sharedInstance = nil;
remaining = dur - time.i_time;
return [NSString stringWithFormat: @"-%s", secstotimestr(psz_time, (remaining / 1000000))];
} else
return [NSString stringWithUTF8String: secstotimestr(psz_time, (time.i_time / 1000000))];
return @(secstotimestr(psz_time, (time.i_time / 1000000)));
}
#pragma mark -
......
......@@ -366,7 +366,7 @@ static VLCVideoEffects *_o_sharedInstance = nil;
[o_crop_sync_left_right_ckb setState: NSOffState];
tmpChar = config_GetPsz(p_intf, "transform-type");
tmpString = [NSString stringWithUTF8String: tmpChar];
tmpString = @(tmpChar);
if ([tmpString isEqualToString:@"hflip"])
[o_transform_pop selectItemWithTag: 1];
else if ([tmpString isEqualToString:@"vflip"])
......@@ -425,7 +425,7 @@ static VLCVideoEffects *_o_sharedInstance = nil;
[o_sepia_lbl setEnabled: b_state];
tmpChar = config_GetPsz(p_intf, "gradient-mode");
tmpString = [NSString stringWithUTF8String: tmpChar];
tmpString = @(tmpChar);
if ([tmpString isEqualToString:@"hough"])
[o_gradient_mode_pop selectItemWithTag: 3];
else if ([tmpString isEqualToString:@"edge"])
......@@ -458,7 +458,7 @@ static VLCVideoEffects *_o_sharedInstance = nil;
tmpChar = config_GetPsz(p_intf, "marq-marquee");
if (tmpChar) {
[o_addtext_text_fld setStringValue: [NSString stringWithUTF8String: tmpChar]];
[o_addtext_text_fld setStringValue: @(tmpChar)];
FREENULL(tmpChar);
} else
[o_addtext_text_fld setStringValue: @""];
......@@ -471,7 +471,7 @@ static VLCVideoEffects *_o_sharedInstance = nil;
tmpChar = config_GetPsz(p_intf, "logo-file");
if (tmpChar) {
[o_addlogo_logo_fld setStringValue: [NSString stringWithUTF8String: tmpChar]];
[o_addlogo_logo_fld setStringValue: @(tmpChar)];
FREENULL(tmpChar);
} else
[o_addlogo_logo_fld setStringValue: @""];
......
......@@ -117,7 +117,7 @@ static VLAboutBox *_o_sharedInstance = nil;
/* Setup the nameversion field */
[o_name_version_field setStringValue: [NSString stringWithFormat:@"Version %s (%s)", VERSION_MESSAGE, PLATFORM]];
NSMutableArray *tmpArray = [NSMutableArray arrayWithArray: [[NSString stringWithUTF8String: psz_authors]componentsSeparatedByString:@"\n\n"]];
NSMutableArray *tmpArray = [NSMutableArray arrayWithArray: [@(psz_authors) componentsSeparatedByString:@"\n\n"]];
NSUInteger count = [tmpArray count];
for (NSUInteger i = 0; i < count; i++) {
[tmpArray replaceObjectAtIndex:i withObject:[[tmpArray objectAtIndex:i]stringByReplacingOccurrencesOfString:@"\n" withString:@", "]];
......@@ -236,9 +236,9 @@ static VLAboutBox *_o_sharedInstance = nil;
if (sender == o_authors_btn)
[o_credits_textview setString:o_authors];
else if (sender == o_credits_btn)
[o_credits_textview setString:[[NSString stringWithUTF8String: psz_thanks] stringByReplacingOccurrencesOfString:@"\n" withString:@" " options:0 range:NSRangeFromString(@"680 2")]];
[o_credits_textview setString:[@(psz_thanks) stringByReplacingOccurrencesOfString:@"\n" withString:@" " options:0 range:NSRangeFromString(@"680 2")]];
else
[o_credits_textview setString:[NSString stringWithUTF8String: psz_license]];
[o_credits_textview setString:@(psz_license)];
[o_credits_textview scrollPoint:NSMakePoint(0, 0)];
b_restart = YES;
......@@ -255,7 +255,7 @@ static VLAboutBox *_o_sharedInstance = nil;
[o_credits_textview setHidden:NO];
[o_joinus_txt setHidden:YES];
[o_credits_textview setString:[NSString stringWithUTF8String: psz_license]];
[o_credits_textview setString:@(psz_license)];
[o_credits_textview scrollPoint:NSMakePoint(0, 0)];
b_restart = YES;
......
......@@ -67,7 +67,7 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
-(void)performEventWithObject: (NSValue *)o_value ofType: (const char*)type
{
NSString *o_type = [NSString stringWithUTF8String:type];
NSString *o_type = @(type);
if ([o_type isEqualToString: @"dialog-error"])
[self performSelectorOnMainThread:@selector(showFatalDialog:) withObject:o_value waitUntilDone:YES];
......@@ -87,7 +87,7 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
{
dialog_fatal_t *p_dialog = [o_value pointerValue];
[o_error_panel addError: [NSString stringWithUTF8String: p_dialog->title] withMsg: [NSString stringWithUTF8String: p_dialog->message]];
[o_error_panel addError: @(p_dialog->title) withMsg: @(p_dialog->message)];
[o_error_panel showPanel];
}
......@@ -96,7 +96,7 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
dialog_fatal_t *p_dialog = [o_value pointerValue];
NSAlert *o_alert;
o_alert = [NSAlert alertWithMessageText: [NSString stringWithUTF8String: p_dialog->title] defaultButton: _NS("OK") alternateButton: nil otherButton: nil informativeTextWithFormat: @"%s", p_dialog->message];
o_alert = [NSAlert alertWithMessageText: @(p_dialog->title) defaultButton: _NS("OK") alternateButton: nil otherButton: nil informativeTextWithFormat: @"%s", p_dialog->message];
[o_alert setAlertStyle: NSCriticalAlertStyle];
[o_alert runModal];
}
......@@ -109,13 +109,13 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
NSInteger i_returnValue = 0;
if (p_dialog->yes != NULL)
o_yes = [NSString stringWithUTF8String: p_dialog->yes];
o_yes = @(p_dialog->yes);
if (p_dialog->no != NULL)
o_no = [NSString stringWithUTF8String: p_dialog->no];
o_no = @(p_dialog->no);
if (p_dialog->cancel != NULL)
o_cancel = [NSString stringWithUTF8String: p_dialog->cancel];
o_cancel = @(p_dialog->cancel);
o_alert = [NSAlert alertWithMessageText: [NSString stringWithUTF8String: p_dialog->title] defaultButton: o_yes alternateButton:o_no otherButton: o_cancel informativeTextWithFormat: @"%s", p_dialog->message];
o_alert = [NSAlert alertWithMessageText: @(p_dialog->title) defaultButton: o_yes alternateButton:o_no otherButton: o_cancel informativeTextWithFormat: @"%s", p_dialog->message];
[o_alert setAlertStyle: NSInformationalAlertStyle];
i_returnValue = [o_alert runModal];
......@@ -132,9 +132,9 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
dialog_login_t *p_dialog = [o_value pointerValue];
NSInteger i_returnValue = 0;
[o_auth_title_txt setStringValue: [NSString stringWithUTF8String: p_dialog->title]];
[o_auth_win setTitle: [NSString stringWithUTF8String: p_dialog->title]];
[o_auth_description_txt setStringValue: [NSString stringWithUTF8String: p_dialog->message]];
[o_auth_title_txt setStringValue: @(p_dialog->title)];
[o_auth_win setTitle: @(p_dialog->title)];
[o_auth_description_txt setStringValue: @(p_dialog->message)];
[o_auth_login_fld setStringValue: @""];
[o_auth_pw_fld setStringValue: @""];
......@@ -170,18 +170,18 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
if (p_dialog->title != NULL)
{
[o_prog_win setTitle: [NSString stringWithUTF8String: p_dialog->title]];
[o_prog_title_txt setStringValue: [NSString stringWithUTF8String: p_dialog->title]];
[o_prog_win setTitle: @(p_dialog->title)];
[o_prog_title_txt setStringValue: @(p_dialog->title)];
} else {
[o_prog_win setTitle: @""];
[o_prog_title_txt setStringValue: @""];
}
if (p_dialog->cancel != NULL)
[o_prog_cancel_btn setTitle: [NSString stringWithUTF8String: p_dialog->cancel]];
[o_prog_cancel_btn setTitle: @(p_dialog->cancel)];
else
[o_prog_cancel_btn setTitle: _NS("Cancel")];
if (p_dialog->message != NULL)
[o_prog_description_txt setStringValue: [NSString stringWithUTF8String: p_dialog->message]];
[o_prog_description_txt setStringValue: @(p_dialog->message)];
else
[o_prog_description_txt setStringValue: @""];
......
......@@ -551,13 +551,13 @@
remaining = dur - time.i_time;
o_total_time = [NSString stringWithFormat: @"-%s", secstotimestr(psz_time, (remaining / 1000000))];
} else
o_total_time = [NSString stringWithUTF8String: secstotimestr(psz_time, (dur / 1000000))];
o_total_time = @(secstotimestr(psz_time, (dur / 1000000)));
[o_streamLength_txt setStringValue: o_total_time];
}
// update current position (left field)
NSString *o_playback_pos = [NSString stringWithUTF8String: secstotimestr(psz_time, (time.i_time / 1000000))];
NSString *o_playback_pos = @(secstotimestr(psz_time, (time.i_time / 1000000)));
[o_streamPosition_txt setStringValue: o_playback_pos];
vlc_object_release(p_input);
......
......@@ -496,7 +496,7 @@ static int DialogCallback(vlc_object_t *p_this, const char *type, vlc_value_t pr
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
VLCMain *interface = (VLCMain *)data;
if ([[NSString stringWithUTF8String: type] isEqualToString: @"dialog-progress-bar"]) {
if ([@(type) isEqualToString: @"dialog-progress-bar"]) {
/* the progress panel needs to update itself and therefore wants special treatment within this context */
dialog_progress_bar_t *p_dialog = (dialog_progress_bar_t *)value.p_address;
......@@ -519,7 +519,7 @@ void updateProgressPanel (void *priv, const char *text, float value)
NSString *o_txt;
if (text != NULL)
o_txt = [NSString stringWithUTF8String: text];
o_txt = @(text);
else
o_txt = @"";
......@@ -1271,7 +1271,7 @@ static VLCMain *_o_sharedMainInstance = nil;
&& !strncmp(p_item->psz_name , "key-", 4)
&& !EMPTY_STR(p_item->psz_text)) {
if (p_item->value.psz)
[o_tempArray addObject: [NSString stringWithUTF8String:p_item->value.psz]];
[o_tempArray addObject: @(p_item->value.psz)];
}
}
module_config_free (p_config);
......
......@@ -850,7 +850,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
GetVolParmsInfoBuffer volumeParms;
err = FSGetVolumeParms(actualVolume, &volumeParms, sizeof(volumeParms));
if (noErr == err) {
NSString *bsdName = [NSString stringWithUTF8String:(char *)volumeParms.vMDeviceID];
NSString *bsdName = @((char *)volumeParms.vMDeviceID);
return [NSString stringWithFormat:@"/dev/r%@", bsdName];
}
......
......@@ -295,20 +295,20 @@
if ([o_identifier isEqualToString:TRACKNUM_COLUMN]) {
psz_value = input_item_GetTrackNumber(p_item->p_input);
if (psz_value) {
o_value = [NSString stringWithUTF8String: psz_value];
o_value = @(psz_value);
free(psz_value);
}
} else if ([o_identifier isEqualToString:TITLE_COLUMN]) {
/* sanity check to prevent the NSString class from crashing */
char *psz_title = input_item_GetTitleFbName(p_item->p_input);
if (psz_title) {
o_value = [NSString stringWithUTF8String: psz_title];
o_value = @(psz_title);
free(psz_title);
}
} else if ([o_identifier isEqualToString:ARTIST_COLUMN]) {
psz_value = input_item_GetArtist(p_item->p_input);
if (psz_value) {
o_value = [NSString stringWithUTF8String: psz_value];
o_value = @(psz_value);
free(psz_value);
}
} else if ([o_identifier isEqualToString:@"duration"]) {
......@@ -316,45 +316,45 @@
mtime_t dur = input_item_GetDuration(p_item->p_input);
if (dur != -1) {
secstotimestr(psz_duration, dur/1000000);
o_value = [NSString stringWithUTF8String: psz_duration];
o_value = @(psz_duration);
}
else
o_value = @"--:--";
} else if ([o_identifier isEqualToString:GENRE_COLUMN]) {
psz_value = input_item_GetGenre(p_item->p_input);
if (psz_value) {
o_value = [NSString stringWithUTF8String: psz_value];
o_value = @(psz_value);
free(psz_value);
}
} else if ([o_identifier isEqualToString:ALBUM_COLUMN]) {
psz_value = input_item_GetAlbum(p_item->p_input);
if (psz_value) {
o_value = [NSString stringWithUTF8String: psz_value];
o_value = @(psz_value);
free(psz_value);
}
} else if ([o_identifier isEqualToString:DESCRIPTION_COLUMN]) {
psz_value = input_item_GetDescription(p_item->p_input);
if (psz_value) {
o_value = [NSString stringWithUTF8String: psz_value];
o_value = @(psz_value);
free(psz_value);
}
} else if ([o_identifier isEqualToString:DATE_COLUMN]) {
psz_value = input_item_GetDate(p_item->p_input);
if (psz_value) {
o_value = [NSString stringWithUTF8String: psz_value];
o_value = @(psz_value);
free(psz_value);
}
} else if ([o_identifier isEqualToString:LANGUAGE_COLUMN]) {
psz_value = input_item_GetLanguage(p_item->p_input);
if (psz_value) {
o_value = [NSString stringWithUTF8String: psz_value];
o_value = @(psz_value);
free(psz_value);
}
}
else if ([o_identifier isEqualToString:URI_COLUMN]) {
psz_value = decode_URI(input_item_GetURI(p_item->p_input));
if (psz_value) {
o_value = [NSString stringWithUTF8String: psz_value];
o_value = @(psz_value);
free(psz_value);
}
}
......@@ -792,7 +792,7 @@
continue;
char * psz_url = decode_URI(input_item_GetURI(p_item->p_input));
o_mrl = [[NSMutableString alloc] initWithString: [NSString stringWithUTF8String: psz_url ? psz_url : ""]];
o_mrl = [[NSMutableString alloc] initWithString: @(psz_url ? psz_url : "")];
if (psz_url != NULL)
free( psz_url );
......@@ -1111,11 +1111,9 @@
NSString *o_current_name, *o_current_author;
PL_LOCK;
o_current_name = [NSString stringWithUTF8String:
p_item->pp_children[i_current]->p_input->psz_name];
psz_temp = input_item_GetInfo(p_item->p_input ,
_("Meta-information"),_("Artist"));
o_current_author = [NSString stringWithUTF8String: psz_temp];
o_current_name = @(p_item->pp_children[i_current]->p_input->psz_name);
psz_temp = input_item_GetInfo(p_item->p_input, _("Meta-information"),_("Artist"));
o_current_author = @(psz_temp);
free(psz_temp);
PL_UNLOCK;
......
......@@ -216,14 +216,14 @@ static VLCInfo *_o_sharedInstance = nil;
/* fill uri info */
char * psz_url = decode_URI(input_item_GetURI(p_item));
[o_uri_txt setStringValue: [NSString stringWithUTF8String: psz_url ? psz_url : ""]];
[o_uri_txt setStringValue: @(psz_url ? psz_url : "")];
free(psz_url);
/* fill title info */
char * psz_title = input_item_GetTitle(p_item);
if (!psz_title)
psz_title = input_item_GetName(p_item);
[o_title_txt setStringValue: [NSString stringWithUTF8String: psz_title ? : "" ]];
[o_title_txt setStringValue: @(psz_title ? : "")];
free(psz_title);
#define SET( foo, bar ) \
......@@ -252,7 +252,7 @@ static VLCInfo *_o_sharedInstance = nil;
/* FIXME Can also be attachment:// */
if (psz_meta && strncmp(psz_meta, "attachment://", 13))
o_image = [[NSImage alloc] initWithContentsOfURL: [NSURL URLWithString:[NSString stringWithUTF8String: psz_meta]]];
o_image = [[NSImage alloc] initWithContentsOfURL: [NSURL URLWithString:@(psz_meta)]];
else
o_image = [[NSImage imageNamed: @"noart.png"] retain];
[o_image_well setImage: o_image];
......@@ -272,7 +272,7 @@ static VLCInfo *_o_sharedInstance = nil;
- (void)setMeta: (char *)psz_meta forLabel: (id)theItem
{
if (psz_meta != NULL && *psz_meta)
[theItem setStringValue: [NSString stringWithUTF8String:psz_meta]];
[theItem setStringValue: @(psz_meta)];
else
[theItem setStringValue: @""];
}
......@@ -464,7 +464,7 @@ error:
vlc_mutex_lock(&p_item->lock);
o_children = [[NSMutableArray alloc] initWithCapacity: p_item->i_categories];
for (int i = 0 ; i < p_item->i_categories ; i++) {
NSString * name = [NSString stringWithUTF8String: p_item->pp_categories[i]->psz_name];
NSString * name = @(p_item->pp_categories[i]->psz_name);
VLCInfoTreeItem * item = [[VLCInfoTreeItem alloc] initWithName:name value:@"" ID:i parent:self];
[item autorelease];
[o_children addObject:item];
......@@ -476,8 +476,8 @@ error:
info_category_t * cat = p_item->pp_categories[i_object_id];
o_children = [[NSMutableArray alloc] initWithCapacity: cat->i_infos];
for (int i = 0 ; i < cat->i_infos ; i++) {
NSString * name = [NSString stringWithUTF8String: cat->pp_infos[i]->psz_name];
NSString * value = [NSString stringWithUTF8String: cat->pp_infos[i]->psz_value ? : ""];
NSString * name = @(cat->pp_infos[i]->psz_name);
NSString * value = @(cat->pp_infos[i]->psz_value ? : "");
VLCInfoTreeItem * item = [[VLCInfoTreeItem alloc] initWithName:name value:value ID:i parent:self];
[item autorelease];
[o_children addObject:item];
......
This diff is collapsed.
......@@ -330,10 +330,10 @@ static inline char * __config_GetLabel(vlc_object_t *p_this, const char *psz_nam
continue;
}
else if (p_item->list.psz[i])
mi = [[NSMenuItem alloc] initWithTitle: [NSString stringWithUTF8String: p_item->list.psz[i]] action:NULL keyEquivalent: @""];
mi = [[NSMenuItem alloc] initWithTitle: @(p_item->list.psz[i]) action:NULL keyEquivalent: @""];
else
msg_Err(p_intf, "item %d of pref %s failed to be created", i, name);
[mi setRepresentedObject:[NSString stringWithUTF8String: p_item->list.psz[i]]];
[mi setRepresentedObject:@(p_item->list.psz[i])];
[[object menu] addItem: [mi autorelease]];
if (p_item->value.psz && !strcmp(p_item->value.psz, p_item->list.psz[i]))
[object selectItem:[object lastItem]];
......@@ -388,7 +388,7 @@ static inline char * __config_GetLabel(vlc_object_t *p_this, const char *psz_nam
for (size_t i_index = 0; i_index < count; i_index++) {
p_parser = p_list[i_index];
if (module_provides(p_parser, p_item->psz_type)) {
[object addItemWithTitle: [NSString stringWithUTF8String: _(module_GetLongName(p_parser)) ?: ""]];
[object addItemWithTitle: @(_(module_GetLongName(p_parser)) ?: "")];
if (p_item->value.psz && !strcmp(p_item->value.psz, module_get_name(p_parser, false)))
[object selectItem: [object lastItem]];
}
......@@ -406,7 +406,7 @@ static inline char * __config_GetLabel(vlc_object_t *p_this, const char *psz_nam
- (void)setupField:(NSTextField *)o_object forOption:(const char *)psz_option
{
char *psz_tmp = config_GetPsz(p_intf, psz_option);
[o_object setStringValue: [NSString stringWithUTF8String: psz_tmp ?: ""]];
[o_object setStringValue: @(psz_tmp ?: "")];
[o_object setToolTip: _NS(config_GetLabel(p_intf, psz_option))];
free(psz_tmp);
}
......@@ -633,9 +633,9 @@ static inline char * __config_GetLabel(vlc_object_t *p_this, const char *psz_nam
&& !strncmp(p_item->psz_name , "key-", 4)
&& !EMPTY_STR(p_item->psz_text)) {
[o_tempArray_desc addObject: _NS(p_item->psz_text)];
[o_tempArray_names addObject: [NSString stringWithUTF8String:p_item->psz_name]];
[o_tempArray_names addObject: @(p_item->psz_name)];
if (p_item->value.psz)
[o_hotkeySettings addObject: [NSString stringWithUTF8String:p_item->value.psz]];
[o_hotkeySettings addObject: @(p_item->value.psz)];
else
[o_hotkeySettings addObject: [NSString string]];
}
......@@ -1114,7 +1114,7 @@ static inline void save_module_list(intf_thread_t * p_intf, id object, const cha
- (IBAction)showFontPicker:(id)sender
{
char * font = config_GetPsz(p_intf, "freetype-font");
NSString * fontName = font ? [NSString stringWithUTF8String: font] : nil;
NSString * fontName = font ? @(font) : nil;
free(font);
if (fontName) {
NSFont * font = [NSFont fontWithName:fontName size:0.0];
......
......@@ -553,7 +553,7 @@ static VLCWizard *_o_sharedInstance = nil;
if (p_item->i_children <= 0)
{
char *psz_uri = input_item_GetURI( p_item->p_input);
[tempArray addObject: [NSString stringWithUTF8String: psz_uri]];
[tempArray addObject: @(psz_uri)];
free( psz_uri);
stop = NO;
}
......
......@@ -276,7 +276,7 @@ void updateProgressPanel (void *priv, const char *text, float value)
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat:value], @"value",
text ? [NSString stringWithUTF8String:text] : nil, @"text",
text ? @(text) : nil, @"text",
nil];
[sys->displayer performSelectorOnMainThread:@selector(updateProgressPanel:) withObject:dict waitUntilDone:YES];
......@@ -329,15 +329,15 @@ bool checkProgressPanel (void *priv)
{
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
if (title)
[dict setObject:[NSString stringWithUTF8String:title] forKey:@"title"];
[dict setObject:@(title) forKey:@"title"];
if (message)
[dict setObject:[NSString stringWithUTF8String:message] forKey:@"message"];
[dict setObject:@(message) forKey:@"message"];
if (yes)
[dict setObject:[NSString stringWithUTF8String:yes] forKey:@"yes"];
[dict setObject:@(yes) forKey:@"yes"];
if (no)
[dict setObject:[NSString stringWithUTF8String:no] forKey:@"no"];
[dict setObject:@(no) forKey:@"no"];
if (cancel)
[dict setObject:[NSString stringWithUTF8String:cancel] forKey:@"cancel"];
[dict setObject:@(cancel) forKey:@"cancel"];
return dict;
}
......@@ -672,7 +672,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
//
// assert([control isKindOfClass:[NSTextView class]]);
// NSTextView *textView = (NSTextView *)control;
// NSString *string = [NSString stringWithUTF8String:widget->psz_text];
// NSString *string = @(widget->psz_text);
// NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTML:[string dataUsingEncoding:NSISOLatin1StringEncoding] documentAttributes:NULL];
// [[textView textStorage] setAttributedString:[[NSAttributedString alloc] initWithString:@"Hello"]];
// [textView setNeedsDisplay:YES];
......@@ -684,7 +684,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
{
assert([control isKindOfClass:[NSTextView class]]);
NSTextView *textView = (NSTextView *)control;
NSString *string = [NSString stringWithUTF8String:widget->psz_text];
NSString *string = @(widget->psz_text);
NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTML:[string dataUsingEncoding:NSISOLatin1StringEncoding] documentAttributes:NULL];
[[textView textStorage] setAttributedString:attrString];
[textView setNeedsDisplay:YES];
......@@ -701,7 +701,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
break;
assert([control isKindOfClass:[NSControl class]]);
NSControl *field = (NSControl *)control;
NSString *string = [NSString stringWithUTF8String:widget->psz_text];
NSString *string = @(widget->psz_text);
NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTML:[string dataUsingEncoding:NSISOLatin1StringEncoding] documentAttributes:NULL];
[field setAttributedStringValue:attrString];
[attrString release];
......@@ -714,7 +714,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
NSButton *button = (NSButton *)control;
if (!widget->psz_text)
break;
[button setTitle:[NSString stringWithUTF8String:widget->psz_text]];
[button setTitle:@(widget->psz_text)];
break;
}
case EXTENSION_WIDGET_DROPDOWN:
......@@ -725,7 +725,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
struct extension_widget_value_t *value;
for(value = widget->p_values; value != NULL; value = value->p_next)
{
[popup addItemWithTitle:[NSString stringWithUTF8String:value->psz_text]];
[popup addItemWithTitle:@(value->psz_text)];
}
[popup synchronizeTitleAndSelectedItem];
[self popUpSelectionChanged:popup];
......@@ -745,7 +745,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
{
NSDictionary *entry = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:value->i_id], @"id",
[NSString stringWithUTF8String:value->psz_text], @"text",
@(value->psz_text), @"text",
nil];
[contentArray addObject:entry];
}
......@@ -757,7 +757,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
{
assert([control isKindOfClass:[NSImageView class]]);
NSImageView *imageView = (NSImageView *)control;
NSString *string = widget->psz_text ? [NSString stringWithUTF8String:widget->psz_text] : nil;
NSString *string = widget->psz_text ? @(widget->psz_text) : nil;
NSImage *image = nil;
if (string)
image = [[NSImage alloc] initWithContentsOfURL:[NSURL fileURLWithPath:string]];
......@@ -855,7 +855,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
window = [[VLCDialogWindow alloc] initWithContentRect:content styleMask:NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask backing:NSBackingStoreBuffered defer:NO];
[window setDelegate:self];
[window setDialog:dialog];
[window setTitle:[NSString stringWithUTF8String:dialog->psz_title]];
[window setTitle:@(dialog->psz_title)];
VLCDialogGridView *gridView = [[VLCDialogGridView alloc] init];
[gridView setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
[window setContentView:gridView];
......
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