From: Felix Paul Kühne Date: Sun, 23 Dec 2007 10:15:49 +0000 (+0000) Subject: * withCString is deprecated in 10.4. Use WithUTF8String instead, as VLC's core is... X-Git-Tag: 0.9.0-test0~3908 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=d0d0541e004aae6cc99c76f4d9d01070f6de0799;p=vlc * withCString is deprecated in 10.4. Use WithUTF8String instead, as VLC's core is completely UTF8 now. Remove a couple of (nowadays) useless checks --- diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m index 1e17a48b36..c4ca255884 100644 --- a/modules/gui/macosx/intf.m +++ b/modules/gui/macosx/intf.m @@ -1282,9 +1282,6 @@ static VLCMain *_o_sharedMainInstance = nil; } o_temp = [NSString stringWithUTF8String: p_playlist->status.p_item->p_input->psz_name]; - if( o_temp == NULL ) - o_temp = [NSString stringWithCString: - p_playlist->status.p_item->p_input->psz_name]; [self setScrollField: o_temp stopAfter:-1]; [[[self getControls] getFSPanel] setStreamTitle: o_temp]; @@ -1487,9 +1484,6 @@ static VLCMain *_o_sharedMainInstance = nil; vlc_object_yield( p_input ); o_temp = [NSString stringWithUTF8String: p_playlist->status.p_item->p_input->psz_name]; - if( o_temp == NULL ) - o_temp = [NSString stringWithCString: - p_playlist->status.p_item->p_input->psz_name]; [self setScrollField: o_temp stopAfter:-1]; vlc_object_release( p_input ); vlc_object_release( p_playlist ); diff --git a/modules/gui/macosx/open.m b/modules/gui/macosx/open.m index d826c64e74..df3194495e 100644 --- a/modules/gui/macosx/open.m +++ b/modules/gui/macosx/open.m @@ -109,7 +109,7 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class ) sizeof(psz_buf) - dev_path_length, kCFStringEncodingASCII ) ) { - [p_list addObject: [NSString stringWithCString: psz_buf]]; + [p_list addObject: [NSString stringWithUTF8String: psz_buf]]; } CFRelease( str_bsd_path ); @@ -291,12 +291,10 @@ static VLCOpen *_o_sharedMainInstance = nil; i_index++ ) { [o_file_sub_encoding_pop addItemWithTitle: - [NSString stringWithCString: - p_item->ppsz_list[i_index]]]; + [NSString stringWithUTF8String: p_item->ppsz_list[i_index]]]; } [o_file_sub_encoding_pop selectItemWithTitle: - [NSString stringWithCString: - p_item->value.psz]]; + [NSString stringWithUTF8String: p_item->value.psz]]; } p_item = config_FindConfig( VLC_OBJECT(p_intf), "subsdec-align" ); diff --git a/modules/gui/macosx/playlist.m b/modules/gui/macosx/playlist.m index 49d9263f63..a13cfa3b80 100644 --- a/modules/gui/macosx/playlist.m +++ b/modules/gui/macosx/playlist.m @@ -275,8 +275,6 @@ if( !EMPTY_STR( psz_title ) ) { o_value = [NSString stringWithUTF8String: psz_title]; - if( o_value == NULL ) - o_value = [NSString stringWithCString: psz_title]; } else { @@ -284,8 +282,6 @@ if( psz_name != NULL ) { o_value = [NSString stringWithUTF8String: psz_name]; - if( o_value == NULL ) - o_value = [NSString stringWithCString: psz_name]; } free( psz_name ); } @@ -297,8 +293,6 @@ if( [[o_tc identifier] isEqualToString:@"2"] && !EMPTY_STR( psz_artist ) ) { o_value = [NSString stringWithUTF8String: psz_artist]; - if( o_value == NULL ) - o_value = [NSString stringWithCString: psz_artist]; } else if( [[o_tc identifier] isEqualToString:@"3"] ) { @@ -410,7 +404,7 @@ action: @selector(servicesChange:) keyEquivalent: @""]; [o_lmi setTarget: self]; - [o_lmi setRepresentedObject: [NSString stringWithCString: ppsz_services[i]]]; + [o_lmi setRepresentedObject: [NSString stringWithUTF8String: ppsz_services[i]]]; if( b_enabled ) [o_lmi setState: NSOnState]; /* Create the menu entries for the main menu */ @@ -419,7 +413,7 @@ action: @selector(servicesChange:) keyEquivalent: @""]; [o_lmi setTarget: self]; - [o_lmi setRepresentedObject: [NSString stringWithCString: ppsz_services[i]]]; + [o_lmi setRepresentedObject: [NSString stringWithUTF8String: ppsz_services[i]]]; if( b_enabled ) [o_lmi setState: NSOnState]; free( ppsz_services[i] ); @@ -953,14 +947,14 @@ { NSMutableString *o_temp, *o_temp2; o_temp = [NSMutableString stringWithString: o_uri]; - o_temp2 = [NSMutableString stringWithCString: mounts[i_index].f_mntfromname]; + o_temp2 = [NSMutableString stringWithUTF8String: mounts[i_index].f_mntfromname]; [o_temp replaceOccurrencesOfString: @"/dev/rdisk" withString: @"/dev/disk" options:nil range:NSMakeRange(0, [o_temp length]) ]; [o_temp2 replaceOccurrencesOfString: @"s0" withString: @"" options:nil range:NSMakeRange(0, [o_temp2 length]) ]; [o_temp2 replaceOccurrencesOfString: @"s1" withString: @"" options:nil range:NSMakeRange(0, [o_temp2 length]) ]; if( strstr( [o_temp fileSystemRepresentation], [o_temp2 fileSystemRepresentation] ) != NULL ) { - o_name = [[NSFileManager defaultManager] displayNameAtPath: [NSString stringWithCString:mounts[i_index].f_mntonname]]; + o_name = [[NSFileManager defaultManager] displayNameAtPath: [NSString stringWithUTF8String:mounts[i_index].f_mntonname]]; } } } @@ -980,7 +974,7 @@ buf = (struct statfs *) malloc (sizeof(struct statfs)); statfs( [o_uri fileSystemRepresentation], buf ); psz_dev = strdup(buf->f_mntfromname); - o_temp = [NSMutableString stringWithCString: psz_dev ]; + o_temp = [NSMutableString stringWithUTF8String: psz_dev ]; [o_temp replaceOccurrencesOfString: @"/dev/disk" withString: @"/dev/rdisk" options:nil range:NSMakeRange(0, [o_temp length]) ]; [o_temp replaceOccurrencesOfString: @"s0" withString: @"" options:nil range:NSMakeRange(0, [o_temp length]) ]; [o_temp replaceOccurrencesOfString: @"s1" withString: @"" options:nil range:NSMakeRange(0, [o_temp length]) ]; diff --git a/modules/gui/macosx/playlistinfo.m b/modules/gui/macosx/playlistinfo.m index e223f707c8..0208aaf631 100644 --- a/modules/gui/macosx/playlistinfo.m +++ b/modules/gui/macosx/playlistinfo.m @@ -182,10 +182,7 @@ char *psz_uri = input_item_GetURI( p_item->p_input ); if( psz_uri ) { - [o_uri_txt setStringValue: - ([NSString stringWithUTF8String:psz_uri] == nil ) ? - [NSString stringWithCString:psz_uri] : - [NSString stringWithUTF8String:psz_uri]]; + [o_uri_txt setStringValue: [NSString stringWithUTF8String:psz_uri]]; } free( psz_uri ); @@ -220,10 +217,7 @@ - (void)setMeta: (char *)psz_meta forLabel: (id)theItem { if( psz_meta != NULL && *psz_meta) - [theItem setStringValue: - ([NSString stringWithUTF8String:psz_meta] == nil ) ? - [NSString stringWithCString:psz_meta] : - [NSString stringWithUTF8String:psz_meta]]; + [theItem setStringValue: [NSString stringWithUTF8String:psz_meta]]; else [theItem setStringValue: @"-"]; } diff --git a/modules/gui/macosx/prefs_widgets.m b/modules/gui/macosx/prefs_widgets.m index 062845e546..6772ea1611 100644 --- a/modules/gui/macosx/prefs_widgets.m +++ b/modules/gui/macosx/prefs_widgets.m @@ -1986,7 +1986,7 @@ for ( i = 0; i < sizeof(vlc_keys) / sizeof(key_descriptor_t); i++) if( vlc_keys[i].psz_key_string && *vlc_keys[i].psz_key_string ) POPULATE_A_KEY( o_keys_menu, - [NSString stringWithCString:vlc_keys[i].psz_key_string] + [NSString stringWithUTF8String:vlc_keys[i].psz_key_string] , vlc_keys[i].i_key_code) } [o_popup setMenu:[o_keys_menu copyWithZone:nil]]; @@ -2141,7 +2141,7 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST ) [o_dataCell setTitle:@""]; [o_dataCell setFont:[NSFont systemFontOfSize:0]]; NSTableColumn *o_tableColumn = [[NSTableColumn alloc] - initWithIdentifier:[NSString stringWithCString: "Enabled"]]; + initWithIdentifier:@"Enabled"]; [o_tableColumn setHeaderCell: o_headerCell]; [o_tableColumn setDataCell: o_dataCell]; [o_tableColumn setWidth:17]; @@ -2151,7 +2151,7 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST ) o_dataCell = [[NSTextFieldCell alloc] init]; [o_dataCell setFont:[NSFont systemFontOfSize:12]]; o_tableColumn = [[NSTableColumn alloc] - initWithIdentifier:[NSString stringWithCString: "Module"]]; + initWithIdentifier:@"Module"]; [o_tableColumn setHeaderCell: o_headerCell]; [o_tableColumn setDataCell: o_dataCell]; [o_tableColumn setWidth:388 - 17]; @@ -2311,11 +2311,9 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST ) - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex { - if( [[aTableColumn identifier] isEqualToString: - [NSString stringWithCString:"Enabled"]] ) + if( [[aTableColumn identifier] isEqualToString: @"Enabled"] ) return [[o_modulearray objectAtIndex:rowIndex] objectAtIndex:2]; - if( [[aTableColumn identifier] isEqualToString: - [NSString stringWithCString:"Module"]] ) + if( [[aTableColumn identifier] isEqualToString: @"Module"] ) return [[o_modulearray objectAtIndex:rowIndex] objectAtIndex:1]; return nil; diff --git a/modules/gui/macosx/vout.m b/modules/gui/macosx/vout.m index 6451547981..f9d84bbd9b 100644 --- a/modules/gui/macosx/vout.m +++ b/modules/gui/macosx/vout.m @@ -321,7 +321,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, } else { - [o_window setTitle: [NSString stringWithCString: VOUT_TITLE]]; + [o_window setTitle: [NSString stringWithUTF8String: VOUT_TITLE]]; } vlc_object_release( p_input ); }