[vlc-devel] [PATCH] macosx: Repack module_config_t.
Rémi Denis-Courmont
remi at remlab.net
Mon Aug 20 19:38:12 CEST 2012
Does this actually *run* (as opposed to merely compile)? I don't know
Objective C, but this seems highly dubious.
Also, dereferencing module_config_t outside the core is not a good idea.
Le lundi 20 août 2012 15:13:26 Sebastien Zwickert, vous avez écrit :
> ---
> modules/gui/macosx/open.m | 16 ++++++------
> modules/gui/macosx/prefs_widgets.m | 50
> ++++++++++++++++++------------------ modules/gui/macosx/simple_prefs.m |
> 30 +++++++++++-----------
> 3 files changed, 48 insertions(+), 48 deletions(-)
>
> diff --git a/modules/gui/macosx/open.m b/modules/gui/macosx/open.m
> index c8261a7..6f7d4b8 100644
> --- a/modules/gui/macosx/open.m
> +++ b/modules/gui/macosx/open.m
> @@ -373,11 +373,11 @@ static VLCOpen *_o_sharedMainInstance = nil;
>
> if( p_item )
> {
> - for( i_index = 0; p_item->ppsz_list && p_item->ppsz_list[i_index];
> + for( i_index = 0; p_item->list.psz && p_item->list.psz[i_index];
> i_index++ )
> {
> [o_file_sub_encoding_pop addItemWithTitle:
> - [NSString stringWithUTF8String:
> p_item->ppsz_list[i_index]]]; + [NSString
> stringWithUTF8String: p_item->list.psz[i_index]]]; }
> [o_file_sub_encoding_pop selectItemWithTitle:
> [NSString stringWithUTF8String: p_item->value.psz]];
> @@ -387,10 +387,10 @@ static VLCOpen *_o_sharedMainInstance = nil;
>
> if ( p_item )
> {
> - for ( i_index = 0; i_index < p_item->i_list; i_index++ )
> + for ( i_index = 0; i_index < p_item->list_count; i_index++ )
> {
> [o_file_sub_align_pop addItemWithTitle:
> - _NS(p_item->ppsz_list_text[i_index])];
> + _NS(p_item->list_text[i_index])];
> }
> [o_file_sub_align_pop selectItemAtIndex: p_item->value.i];
> }
> @@ -399,10 +399,10 @@ static VLCOpen *_o_sharedMainInstance = nil;
>
> if ( p_item )
> {
> - for ( i_index = 0; i_index < p_item->i_list; i_index++ )
> + for ( i_index = 0; i_index < p_item->list_count; i_index++ )
> {
> - [o_file_sub_size_pop addItemWithTitle:
> _NS(p_item->ppsz_list_text[i_index])]; - if ( p_item->value.i
> == p_item->pi_list[i_index] )
> + [o_file_sub_size_pop addItemWithTitle:
> _NS(p_item->list_text[i_index])]; + if ( p_item->value.i ==
> p_item->list.i[i_index] )
> {
> [o_file_sub_size_pop selectItemAtIndex: i_index];
> }
> @@ -452,7 +452,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
> {
> [o_options addObject: [NSString stringWithFormat:
> @"freetype-rel-fontsize=%i",
> - p_item->pi_list[[o_file_sub_size_pop
> indexOfSelectedItem]]]]; +
> p_item->list.i[[o_file_sub_size_pop indexOfSelectedItem]]]]; }
> }
> NSArray * components = [[o_file_starttime_fld stringValue]
> componentsSeparatedByString:@":"]; diff --git
> a/modules/gui/macosx/prefs_widgets.m b/modules/gui/macosx/prefs_widgets.m
> index 8635c51..ef3043c 100644
> --- a/modules/gui/macosx/prefs_widgets.m
> +++ b/modules/gui/macosx/prefs_widgets.m
> @@ -794,7 +794,7 @@ o_textfield = [[[NSSecureTextField alloc]
> initWithFrame: s_rc] retain]; \ {
> case CONFIG_ITEM_STRING:
> case CONFIG_ITEM_PASSWORD:
> - if( !_p_item->i_list )
> + if( !_p_item->list_count )
> {
> p_control = [[StringConfigControl alloc]
> initWithItem: _p_item
> @@ -821,7 +821,7 @@ o_textfield = [[[NSSecureTextField alloc]
> initWithFrame: s_rc] retain]; \ withView: o_parent_view];
> break;
> case CONFIG_ITEM_INTEGER:
> - if( _p_item->i_list )
> + if( _p_item->list_count )
> {
> p_control = [[IntegerListConfigControl alloc]
> initWithItem: _p_item
> @@ -1082,12 +1082,12 @@ o_textfield = [[[NSSecureTextField alloc]
> initWithFrame: s_rc] retain]; \ ADD_COMBO( o_combo, mainFrame,
> [o_label frame].size.width, -2, 0, o_textfieldTooltip )
> [o_combo setAutoresizingMask:NSViewWidthSizable ];
> - for( i_index = 0; i_index < p_item->i_list; i_index++ )
> + for( i_index = 0; i_index < p_item->list_count; i_index++ )
> {
> - if( !p_item->value.psz && !p_item->ppsz_list[i_index] )
> + if( !p_item->value.psz && !p_item->list.psz[i_index] )
> [o_combo selectItemAtIndex: i_index];
> - else if( p_item->value.psz && p_item->ppsz_list[i_index] &&
> - !strcmp( p_item->value.psz, p_item->ppsz_list[i_index] ) )
> + else if( p_item->value.psz && p_item->list.psz[i_index] &&
> + !strcmp( p_item->value.psz, p_item->list.psz[i_index] ) )
> [o_combo selectItemAtIndex: i_index];
> }
> [self addSubview: o_combo];
> @@ -1118,8 +1118,8 @@ o_textfield = [[[NSSecureTextField alloc]
> initWithFrame: s_rc] retain]; \ - (char *)stringValue
> {
> if( [o_combo indexOfSelectedItem] >= 0 ) {
> - if( p_item->ppsz_list[[o_combo indexOfSelectedItem]] != NULL )
> - return strdup( p_item->ppsz_list[[o_combo
> indexOfSelectedItem]] ); + if( p_item->list.psz[[o_combo
> indexOfSelectedItem]] != NULL ) + return strdup(
> p_item->list.psz[[o_combo indexOfSelectedItem]] ); } else {
> if( [[VLCMain sharedInstance] delocalizeString: [o_combo
> stringValue]] != NULL ) return strdup( [[VLCMain sharedInstance]
> delocalizeString: [o_combo stringValue]] ); @@ -1133,12 +1133,12 @@
> o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain];
> \ [o_combo reloadData];
> char *psz_value = config_GetPsz( VLCIntf, p_item->psz_name );
>
> - for( i_index = 0; i_index < p_item->i_list; i_index++ )
> + for( i_index = 0; i_index < p_item->list_count; i_index++ )
> {
> - if( !psz_value && !p_item->ppsz_list[i_index] )
> + if( !psz_value && !p_item->list.psz[i_index] )
> [o_combo selectItemAtIndex: i_index];
> - else if( psz_value && p_item->ppsz_list[i_index] &&
> - !strcmp( psz_value, p_item->ppsz_list[i_index] ) )
> + else if( psz_value && p_item->list.psz[i_index] &&
> + !strcmp( psz_value, p_item->list.psz[i_index] ) )
> [o_combo selectItemAtIndex: i_index];
> }
>
> @@ -1150,16 +1150,16 @@ o_textfield = [[[NSSecureTextField alloc]
> initWithFrame: s_rc] retain]; \ @implementation
> StringListConfigControl (NSComboBoxDataSource)
> - (NSInteger)numberOfItemsInComboBox:(NSComboBox *)aComboBox
> {
> - return p_item->i_list;
> + return p_item->list_count;
> }
>
> - (id)comboBox:(NSComboBox *)aComboBox
> objectValueForItemAtIndex:(NSInteger)i_index {
> - if( p_item->ppsz_list_text && p_item->ppsz_list_text[i_index] )
> + if( p_item->list_text && p_item->list_text[i_index] )
> {
> - return _NS((char *)p_item->ppsz_list_text[i_index]);
> + return _NS((char *)p_item->list_text[i_index]);
> } else
> - return _NS((char *)p_item->ppsz_list[i_index]);
> + return _NS((char *)p_item->list.psz[i_index]);
> }
> @end
>
> @@ -1573,9 +1573,9 @@ o_textfield = [[[NSSecureTextField alloc]
> initWithFrame: s_rc] retain]; \ ADD_COMBO( o_combo, mainFrame,
> [o_label frame].size.width, -2, 0, o_textfieldTooltip )
> [o_combo setAutoresizingMask:NSViewWidthSizable ];
> - for( i_index = 0; i_index < p_item->i_list; i_index++ )
> + for( i_index = 0; i_index < p_item->list_count; i_index++ )
> {
> - if( p_item->value.i == p_item->pi_list[i_index] )
> + if( p_item->value.i == p_item->list.i[i_index] )
> {
> [o_combo selectItemAtIndex: i_index];
> }
> @@ -1608,7 +1608,7 @@ o_textfield = [[[NSSecureTextField alloc]
> initWithFrame: s_rc] retain]; \ - (int)intValue
> {
> if( [o_combo indexOfSelectedItem] >= 0 )
> - return p_item->pi_list[[o_combo indexOfSelectedItem]];
> + return p_item->list.i[[o_combo indexOfSelectedItem]];
> else
> return [o_combo intValue];
> }
> @@ -1617,9 +1617,9 @@ o_textfield = [[[NSSecureTextField alloc]
> initWithFrame: s_rc] retain]; \ {
> int i_index;
> [o_combo reloadData];
> - for( i_index = 0; i_index < p_item->i_list; i_index++ )
> + for( i_index = 0; i_index < p_item->list_count; i_index++ )
> {
> - if( config_GetInt( VLCIntf, p_item->psz_name) ==
> p_item->pi_list[i_index] ) + if( config_GetInt( VLCIntf,
> p_item->psz_name) == p_item->list.i[i_index] ) {
> [o_combo selectItemAtIndex: i_index];
> }
> @@ -1631,15 +1631,15 @@ o_textfield = [[[NSSecureTextField alloc]
> initWithFrame: s_rc] retain]; \ @implementation
> IntegerListConfigControl (NSComboBoxDataSource)
> - (NSInteger)numberOfItemsInComboBox:(NSComboBox *)aComboBox
> {
> - return p_item->i_list;
> + return p_item->list_count;
> }
>
> - (id)comboBox:(NSComboBox *)aComboBox
> objectValueForItemAtIndex:(NSInteger)i_index {
> - if( p_item->ppsz_list_text && p_item->ppsz_list_text[i_index] )
> - return _NS((char *)p_item->ppsz_list_text[i_index]);
> + if( p_item->list_text && p_item->list_text[i_index] )
> + return _NS((char *)p_item->list_text[i_index]);
> else
> - return [NSString stringWithFormat: @"%i",
> p_item->pi_list[i_index]]; + return [NSString stringWithFormat:
> @"%i", p_item->list.i[i_index]]; }
> @end
>
> diff --git a/modules/gui/macosx/simple_prefs.m
> b/modules/gui/macosx/simple_prefs.m index 799ff1d..4ba3abc 100644
> --- a/modules/gui/macosx/simple_prefs.m
> +++ b/modules/gui/macosx/simple_prefs.m
> @@ -364,23 +364,23 @@ static inline char * __config_GetLabel( vlc_object_t
> *p_this, const char *psz_na /* serious problem, if no item found */
> assert( p_item );
>
> - for( int i = 0; i < p_item->i_list; i++ )
> + for( int i = 0; i < p_item->list_count; i++ )
> {
> NSMenuItem *mi;
> - if( p_item->ppsz_list_text != NULL )
> - mi = [[NSMenuItem alloc] initWithTitle: _NS(
> p_item->ppsz_list_text[i] ) action:NULL keyEquivalent: @""]; - else
> if( p_item->ppsz_list[i] && strcmp(p_item->ppsz_list[i],"") == 0 ) +
> if( p_item->list_text != NULL )
> + mi = [[NSMenuItem alloc] initWithTitle: _NS(
> p_item->list_text[i] ) action:NULL keyEquivalent: @""]; + else if(
> p_item->list.psz[i] && strcmp(p_item->list.psz[i],"") == 0 ) {
> [[object menu] addItem: [NSMenuItem separatorItem]];
> continue;
> }
> - else if( p_item->ppsz_list[i] )
> - mi = [[NSMenuItem alloc] initWithTitle: [NSString
> stringWithUTF8String: p_item->ppsz_list[i]] action:NULL keyEquivalent:
> @""]; + else if( p_item->list.psz[i] )
> + mi = [[NSMenuItem alloc] initWithTitle: [NSString
> stringWithUTF8String: 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->ppsz_list[i]]]; + [mi setRepresentedObject:[NSString
> stringWithUTF8String: p_item->list.psz[i]]]; [[object menu] addItem: [mi
> autorelease]];
> - if( p_item->value.psz && !strcmp( p_item->value.psz,
> p_item->ppsz_list[i] ) ) + if( p_item->value.psz && !strcmp(
> p_item->value.psz, p_item->list.psz[i] ) ) [object selectItem:[object
> lastItem]];
> }
> [object setToolTip: _NS( p_item->psz_longtext )];
> @@ -396,18 +396,18 @@ static inline char * __config_GetLabel( vlc_object_t
> *p_this, const char *psz_na /* serious problem, if no item found */
> assert( p_item );
>
> - for( int i = 0; i < p_item->i_list; i++ )
> + for( int i = 0; i < p_item->list_count; i++ )
> {
> NSMenuItem *mi;
> - if( p_item->ppsz_list_text != NULL)
> - mi = [[NSMenuItem alloc] initWithTitle: _NS(
> p_item->ppsz_list_text[i] ) action:NULL keyEquivalent: @""]; - else
> if( p_item->pi_list[i] )
> - mi = [[NSMenuItem alloc] initWithTitle: [NSString
> stringWithFormat: @"%d", p_item->pi_list[i]] action:NULL keyEquivalent:
> @""]; + if( p_item->list_text != NULL)
> + mi = [[NSMenuItem alloc] initWithTitle: _NS(
> p_item->list_text[i] ) action:NULL keyEquivalent: @""]; + else if(
> p_item->list.i[i] )
> + 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->pi_list[i]]]; + [mi setRepresentedObject:[NSNumber
> numberWithInt: p_item->list.i[i]]]; [[object menu] addItem: [mi
> autorelease]];
> - if( p_item->value.i == p_item->pi_list[i] )
> + if( p_item->value.i == p_item->list.i[i] )
> [object selectItem:[object lastItem]];
> }
> [object setToolTip: _NS( p_item->psz_longtext )];
--
Rémi Denis-Courmont
C/C++ software engineer looking for a job
http://www.linkedin.com/in/remidenis
More information about the vlc-devel
mailing list