From 7326fad1f18a82b58db09d0a0ddc7c086c60c62e Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Duraffort?= Date: Wed, 12 Mar 2008 12:02:01 +0100 Subject: [PATCH] One more time removing of some useless tests. --- modules/gui/fbosd.c | 11 ++++++---- modules/gui/macosx/controls.m | 6 +++--- modules/gui/macosx/prefs_widgets.m | 2 +- modules/gui/ncurses.c | 21 ++++++++----------- .../qt4/components/preferences_widgets.cpp | 2 +- modules/gui/qt4/dialogs/interaction.cpp | 3 +++ modules/gui/qt4/menus.cpp | 2 +- modules/gui/qt4/menus.hpp | 6 +++--- modules/gui/skins2/src/theme_loader.cpp | 2 +- modules/gui/wince/dialogs.cpp | 4 ++-- modules/gui/wince/menus.cpp | 12 +++++------ modules/gui/wince/open.cpp | 2 +- modules/gui/wince/preferences.cpp | 6 +++--- modules/gui/wince/subtitles.cpp | 2 +- modules/gui/wxwidgets/dialogs.cpp | 4 ++-- modules/gui/wxwidgets/dialogs/bookmarks.cpp | 2 +- modules/gui/wxwidgets/dialogs/open.cpp | 8 +++---- modules/gui/wxwidgets/dialogs/preferences.cpp | 10 ++++----- .../wxwidgets/dialogs/preferences_widgets.cpp | 4 ++-- modules/gui/wxwidgets/dialogs/subtitles.cpp | 2 +- modules/gui/wxwidgets/dialogs/wizard.cpp | 6 +++--- modules/gui/wxwidgets/menus.cpp | 12 +++++------ modules/gui/wxwidgets/wxwidgets.cpp | 4 ++-- 23 files changed, 68 insertions(+), 65 deletions(-) diff --git a/modules/gui/fbosd.c b/modules/gui/fbosd.c index 8daf1bc35a..c6d4b6302b 100644 --- a/modules/gui/fbosd.c +++ b/modules/gui/fbosd.c @@ -580,7 +580,7 @@ static int OpenTextRenderer( intf_thread_t *p_intf ) p_intf->p_sys->p_text->p_module = module_Need( p_intf->p_sys->p_text, "text renderer", 0, 0 ); } - if( psz_modulename ) free( psz_modulename ); + free( psz_modulename ); if( !p_intf->p_sys->p_text->p_module ) return VLC_EGENERIC; @@ -684,9 +684,12 @@ static picture_t *AllocatePicture( vlc_object_t *p_this, static void DeAllocatePicture( vlc_object_t *p_this, picture_t *p_pic, video_format_t *p_fmt ) { - if( p_pic && p_pic->p_data_orig ) free( p_pic->p_data_orig ); - if( p_pic && p_pic->pf_release ) p_pic->pf_release( p_pic ); - if( p_fmt && p_fmt->p_palette ) + if( p_pic ) + { + free( p_pic->p_data_orig ); + if( p_pic->pf_release ) p_pic->pf_release( p_pic ); + } + if( p_fmt ) { free( p_fmt->p_palette ); p_fmt->p_palette = NULL; diff --git a/modules/gui/macosx/controls.m b/modules/gui/macosx/controls.m index 7a8d41b8af..9ad5c89c35 100644 --- a/modules/gui/macosx/controls.m +++ b/modules/gui/macosx/controls.m @@ -623,7 +623,7 @@ [self setupVarMenu: o_menu forMenuItem: o_mi target:p_object var:psz_variable selector:pf_callback]; - if( text.psz_string ) free( text.psz_string ); + free( text.psz_string ); return; } @@ -645,12 +645,12 @@ break; default: - if( text.psz_string ) free( text.psz_string ); + free( text.psz_string ); return; } if( ( i_type & VLC_VAR_TYPE ) == VLC_VAR_STRING ) free( val.psz_string ); - if( text.psz_string ) free( text.psz_string ); + free( text.psz_string ); } diff --git a/modules/gui/macosx/prefs_widgets.m b/modules/gui/macosx/prefs_widgets.m index 5769eaca9e..2b0782c890 100644 --- a/modules/gui/macosx/prefs_widgets.m +++ b/modules/gui/macosx/prefs_widgets.m @@ -416,7 +416,7 @@ - (void)dealloc { if( o_label ) [o_label release]; - if( psz_name ) free( psz_name ); + free( psz_name ); [super dealloc]; } diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c index 3f5f1f6e35..2d636472a5 100644 --- a/modules/gui/ncurses.c +++ b/modules/gui/ncurses.c @@ -343,16 +343,16 @@ static void Close( vlc_object_t *p_this ) for( i = 0; i < p_sys->i_dir_entries; i++ ) { struct dir_entry_t *p_dir_entry = p_sys->pp_dir_entries[i]; - if( p_dir_entry->psz_path ) free( p_dir_entry->psz_path ); + free( p_dir_entry->psz_path ); REMOVE_ELEM( p_sys->pp_dir_entries, p_sys->i_dir_entries, i ); - if( p_dir_entry ) free( p_dir_entry ); + free( p_dir_entry ); } p_sys->pp_dir_entries = NULL; - if( p_sys->psz_current_dir ) free( p_sys->psz_current_dir ); - if( p_sys->psz_search_chain ) free( p_sys->psz_search_chain ); - if( p_sys->psz_old_search ) free( p_sys->psz_old_search ); - if( p_sys->psz_open_chain ) free( p_sys->psz_open_chain ); + free( p_sys->psz_current_dir ); + free( p_sys->psz_search_chain ); + free( p_sys->psz_old_search ); + free( p_sys->psz_open_chain ); if( p_sys->p_input ) { @@ -948,11 +948,8 @@ static int HandleKey( intf_thread_t *p_intf, int i_key ) break; } } - if( p_sys->psz_old_search ) - { - free( p_sys->psz_old_search ); - p_sys->psz_old_search = NULL; - } + free( p_sys->psz_old_search ); + p_sys->psz_old_search = NULL; SearchPlaylist( p_intf, p_sys->psz_search_chain ); return 1; } @@ -2361,7 +2358,7 @@ static void Eject( intf_thread_t *p_intf ) intf_Eject( p_intf, psz_device ); } - free(psz_device); + free( psz_device ); return; } diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp index d64b207c60..2346bfd5aa 100644 --- a/modules/gui/qt4/components/preferences_widgets.cpp +++ b/modules/gui/qt4/components/preferences_widgets.cpp @@ -386,7 +386,7 @@ StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this, // this, like the one behind the refresh push button? p_module_config->b_dirty = VLC_FALSE; - if(val.psz_string) free(val.psz_string); + free( val.psz_string ); } finish( p_module_config, bycat ); diff --git a/modules/gui/qt4/dialogs/interaction.cpp b/modules/gui/qt4/dialogs/interaction.cpp index 0cf4149906..60f3acce05 100644 --- a/modules/gui/qt4/dialogs/interaction.cpp +++ b/modules/gui/qt4/dialogs/interaction.cpp @@ -190,6 +190,9 @@ void InteractionDialog::update() if( ( p_dialog->i_flags & DIALOG_INTF_PROGRESS ) && ( p_dialog->val.f_float >= 100.0 ) ) progressBar->hide(); + if( ( p_dialog->i_flags & DIALOG_USER_PROGRESS ) && + ( p_dialog->val.f_float >= 100.0 ) ) + altButton->setText( qtr( "close" ) ); } InteractionDialog::~InteractionDialog() diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp index e76a793c05..0057d7495d 100644 --- a/modules/gui/qt4/menus.cpp +++ b/modules/gui/qt4/menus.cpp @@ -960,7 +960,7 @@ int QVLCMenu::CreateChoicesMenu( QMenu *submenu, const char *psz_var, NOTCOMMAND && val.psz_string && !strcmp( val.psz_string, CURVAL.psz_string ) ); - if( val.psz_string ) free( val.psz_string ); + free( val.psz_string ); break; case VLC_VAR_INTEGER: diff --git a/modules/gui/qt4/menus.hpp b/modules/gui/qt4/menus.hpp index f7d66f7499..b23da2b524 100644 --- a/modules/gui/qt4/menus.hpp +++ b/modules/gui/qt4/menus.hpp @@ -58,9 +58,9 @@ public: } virtual ~MenuItemData() { - if( psz_var ) free( psz_var ); - if( ((i_val_type & VLC_VAR_TYPE) == VLC_VAR_STRING) - && val.psz_string ) free( val.psz_string ); + free( psz_var ); + if( ( i_val_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) + free( val.psz_string ); } int i_object_id; int i_val_type; diff --git a/modules/gui/skins2/src/theme_loader.cpp b/modules/gui/skins2/src/theme_loader.cpp index 2100ba900d..2f0c4c3728 100644 --- a/modules/gui/skins2/src/theme_loader.cpp +++ b/modules/gui/skins2/src/theme_loader.cpp @@ -114,7 +114,7 @@ bool ThemeLoader::load( const string &fileName ) // Show the windows pNewTheme->getWindowManager().showAll( true ); } - if( skin_last ) free( skin_last ); + free( skin_last ); // The new theme cannot embed a video output yet VlcProc::instance( getIntf() )->dropVout(); diff --git a/modules/gui/wince/dialogs.cpp b/modules/gui/wince/dialogs.cpp index 4fee91c443..83ba42d442 100644 --- a/modules/gui/wince/dialogs.cpp +++ b/modules/gui/wince/dialogs.cpp @@ -320,8 +320,8 @@ void DialogsProvider::OnOpenFileGeneric( intf_dialog_args_t *p_arg ) } free( p_arg->psz_results ); } - if( p_arg->psz_title ) free( p_arg->psz_title ); - if( p_arg->psz_extensions ) free( p_arg->psz_extensions ); + free( p_arg->psz_title ); + free( p_arg->psz_extensions ); free( p_arg ); } diff --git a/modules/gui/wince/menus.cpp b/modules/gui/wince/menus.cpp index 9aed3fba0e..f9a9b5b479 100644 --- a/modules/gui/wince/menus.cpp +++ b/modules/gui/wince/menus.cpp @@ -558,7 +558,7 @@ void CreateMenuItem( intf_thread_t *p_intf, vector *p_menu_list, AppendMenu( hMenu, MF_STRING | MF_POPUP, (UINT)hMenuItem, _FROMMB(text.psz_string ? text.psz_string : psz_var) ); if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string ); - if( text.psz_string ) free( text.psz_string ); + free( text.psz_string ); return; } @@ -585,12 +585,12 @@ void CreateMenuItem( intf_thread_t *p_intf, vector *p_menu_list, break; default: - if( text.psz_string ) free( text.psz_string ); + free( text.psz_string ); return; } if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string ); - if( text.psz_string ) free( text.psz_string ); + free( text.psz_string ); } HMENU CreateChoicesMenu( intf_thread_t *p_intf, @@ -802,9 +802,9 @@ MenuItemExt::MenuItemExt( intf_thread_t *p_intf, int _id, char *_psz_var, MenuItemExt::~MenuItemExt() { - if( psz_var ) free( psz_var ); - if( ((i_val_type & VLC_VAR_TYPE) == VLC_VAR_STRING) - && val.psz_string ) free( val.psz_string ); + free( psz_var ); + if( ( i_val_type & VLC_VAR_TYPE ) == VLC_VAR_STRING ) + free( val.psz_string ); }; void MenuItemExt::ClearList( vector *p_menu_list ) diff --git a/modules/gui/wince/open.cpp b/modules/gui/wince/open.cpp index e5be15c1e0..1805617b89 100644 --- a/modules/gui/wince/open.cpp +++ b/modules/gui/wince/open.cpp @@ -310,7 +310,7 @@ void OpenDialog::FilePanel( HWND hwnd ) sz_subsfile += psz_subsfile; subsfile_mrl.push_back( sz_subsfile ); } - if( psz_subsfile ) free( psz_subsfile ); + free( psz_subsfile ); } void OpenDialog::NetPanel( HWND hwnd ) diff --git a/modules/gui/wince/preferences.cpp b/modules/gui/wince/preferences.cpp index 1193418a03..7a158af6e6 100644 --- a/modules/gui/wince/preferences.cpp +++ b/modules/gui/wince/preferences.cpp @@ -128,9 +128,9 @@ public: ConfigTreeData() { b_submodule = 0; panel = NULL; psz_section = NULL; psz_help = NULL; } - virtual ~ConfigTreeData() { if( panel ) delete panel; - if( psz_section) free(psz_section); - if( psz_help) free(psz_help); } + virtual ~ConfigTreeData() { delete panel; + free( psz_section ); + free( psz_help ); } vlc_bool_t b_submodule; diff --git a/modules/gui/wince/subtitles.cpp b/modules/gui/wince/subtitles.cpp index 9cff6611a4..175e7e109d 100644 --- a/modules/gui/wince/subtitles.cpp +++ b/modules/gui/wince/subtitles.cpp @@ -116,7 +116,7 @@ LRESULT SubsFileDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) 10, 10 + 15 + 10 - 3, rcClient.right - 2*10, 5*15 + 6, hwnd, NULL, hInst, NULL ); - if( psz_subsfile ) free( psz_subsfile ); + free( psz_subsfile ); browse_button = CreateWindow( _T("BUTTON"), _T("Browse..."), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, diff --git a/modules/gui/wxwidgets/dialogs.cpp b/modules/gui/wxwidgets/dialogs.cpp index 2701e7932c..b62632be84 100644 --- a/modules/gui/wxwidgets/dialogs.cpp +++ b/modules/gui/wxwidgets/dialogs.cpp @@ -427,8 +427,8 @@ void DialogsProvider::OnOpenFileGeneric( wxCommandEvent& event ) } free( p_arg->psz_results ); } - if( p_arg->psz_title ) free( p_arg->psz_title ); - if( p_arg->psz_extensions ) free( p_arg->psz_extensions ); + free( p_arg->psz_title ); + free( p_arg->psz_extensions ); free( p_arg ); } diff --git a/modules/gui/wxwidgets/dialogs/bookmarks.cpp b/modules/gui/wxwidgets/dialogs/bookmarks.cpp index 5f6ebed466..e2f138c4e8 100644 --- a/modules/gui/wxwidgets/dialogs/bookmarks.cpp +++ b/modules/gui/wxwidgets/dialogs/bookmarks.cpp @@ -118,7 +118,7 @@ BookmarkEditDialog::~BookmarkEditDialog() } void BookmarkEditDialog::OnOK( wxCommandEvent &event ) { - if( p_seekpoint->psz_name ) free( p_seekpoint->psz_name ); + free( p_seekpoint->psz_name ); p_seekpoint->psz_name = strdup( name_text->GetValue().mb_str(wxConvUTF8) ); p_seekpoint->i_byte_offset = atoi( bytes_text->GetValue().mb_str(wxConvUTF8) ); p_seekpoint->i_time_offset = 1000000 * diff --git a/modules/gui/wxwidgets/dialogs/open.cpp b/modules/gui/wxwidgets/dialogs/open.cpp index 3b92e19fd2..df988e4a8c 100644 --- a/modules/gui/wxwidgets/dialogs/open.cpp +++ b/modules/gui/wxwidgets/dialogs/open.cpp @@ -444,7 +444,7 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent, sout_button->Enable(); subsfile_mrl.Add( wxString(wxT("sout=")) + wxL2U(psz_sout) ); } - if( psz_sout ) free( psz_sout ); + free( psz_sout ); common_opt_sizer->Add( sout_button, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL ); @@ -661,7 +661,7 @@ wxPanel *OpenDialog::FilePanel( wxWindow* parent ) 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); subfile_combo = new wxComboBox( panel, SubFileName_Event, wxL2U( psz_subsfile ) ); - if( psz_subsfile ) free( psz_subsfile ); + free( psz_subsfile ); subbrowse_button = new wxButton( panel, SubFileBrowse_Event, wxU(_("Browse...")) ); subfile_sizer->Add( subfile_combo, 1, wxALL | wxALIGN_CENTER_VERTICAL, 5 ); @@ -1632,7 +1632,7 @@ void OpenDialog::OnDiscProbe( wxCommandEvent& WXUNUSED(event) ) break; } - free(psz_device); + free( psz_device ); disc_probe->SetValue(FALSE); UpdateMRL( DISC_ACCESS ); @@ -1746,7 +1746,7 @@ void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) ) disc_title->SetValue( 0 ); i_disc_title = 0; disc_chapter->SetValue( 0 ); i_disc_chapter = 0; - if( psz_device ) free( psz_device ); + free( psz_device ); UpdateMRL( DISC_ACCESS ); } diff --git a/modules/gui/wxwidgets/dialogs/preferences.cpp b/modules/gui/wxwidgets/dialogs/preferences.cpp index 8dbbda7823..a6a2a84479 100644 --- a/modules/gui/wxwidgets/dialogs/preferences.cpp +++ b/modules/gui/wxwidgets/dialogs/preferences.cpp @@ -124,9 +124,9 @@ public: ConfigTreeData() { b_submodule = 0; panel = NULL; psz_name = NULL; psz_help = NULL; } virtual ~ConfigTreeData() { - if( panel ) delete panel; - if( psz_name ) free( psz_name ); - if( psz_help ) free( psz_help ); + delete panel; + free( psz_name ); + free( psz_help ); }; vlc_bool_t b_submodule; @@ -435,10 +435,10 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf, GetItemData( current_item ); cd->i_type = TYPE_CATSUBCAT; cd->i_subcat_id = p_item->value.i; - if( cd->psz_name ) free( cd->psz_name ); + free( cd->psz_name ); cd->psz_name = strdup( config_CategoryNameGet( p_item->value.i ) ); - if( cd->psz_help ) free( cd->psz_help ); + free( cd->psz_help ); const char *psz_help = config_CategoryHelpGet( p_item->value.i ); if( psz_help ) { diff --git a/modules/gui/wxwidgets/dialogs/preferences_widgets.cpp b/modules/gui/wxwidgets/dialogs/preferences_widgets.cpp index 692c5896f6..34ca3fc1de 100644 --- a/modules/gui/wxwidgets/dialogs/preferences_widgets.cpp +++ b/modules/gui/wxwidgets/dialogs/preferences_widgets.cpp @@ -579,7 +579,7 @@ StringListConfigControl::StringListConfigControl( vlc_object_t *p_this, // this, like the one behind the refresh push button? p_module_config->b_dirty = VLC_FALSE; - if(val.psz_string) free(val.psz_string); + free( val.psz_string ); } UpdateCombo( p_module_config ); @@ -601,7 +601,7 @@ StringListConfigControl::StringListConfigControl( vlc_object_t *p_this, StringListConfigControl::~StringListConfigControl() { - if( psz_default_value ) free( psz_default_value ); + free( psz_default_value ); } void StringListConfigControl::UpdateCombo( module_config_t *p_item ) diff --git a/modules/gui/wxwidgets/dialogs/subtitles.cpp b/modules/gui/wxwidgets/dialogs/subtitles.cpp index 2de103a2b1..22c5682b16 100644 --- a/modules/gui/wxwidgets/dialogs/subtitles.cpp +++ b/modules/gui/wxwidgets/dialogs/subtitles.cpp @@ -77,7 +77,7 @@ SubsFileDialog::SubsFileDialog( intf_thread_t *_p_intf, wxWindow* _p_parent ): if( !psz_subsfile ) psz_subsfile = strdup(""); file_combo = new wxComboBox( panel, -1, wxL2U(psz_subsfile), wxPoint(20,25), wxSize(300, -1) ); - if( psz_subsfile ) free( psz_subsfile ); + free( psz_subsfile ); wxButton *browse_button = new wxButton( panel, FileBrowse_Event, wxU(_("Browse...")) ); file_sizer->Add( file_combo, 1, wxALL, 5 ); diff --git a/modules/gui/wxwidgets/dialogs/wizard.cpp b/modules/gui/wxwidgets/dialogs/wizard.cpp index c41448912c..0f444f80a0 100644 --- a/modules/gui/wxwidgets/dialogs/wizard.cpp +++ b/modules/gui/wxwidgets/dialogs/wizard.cpp @@ -899,8 +899,8 @@ wizTranscodeCodecPage::wizTranscodeCodecPage( wxWizard *parent, wizTranscodeCodecPage::~wizTranscodeCodecPage() { - if( acodec ) free( acodec ); - if( vcodec ) free( vcodec ); + free( acodec ); + free( vcodec ); } void wizTranscodeCodecPage::OnEnableVideo(wxCommandEvent& event) @@ -1605,7 +1605,7 @@ void WizardDialog::Run() ":sout=#%smux=%s,dst=%s%s%s%s}", method, mux, v6 ? "[" : "", address, v6 ? "]" : "", psz_sap_option ?: "" ); - if( psz_sap_option ) free( psz_sap_option ); + free( psz_sap_option ); } playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, diff --git a/modules/gui/wxwidgets/menus.cpp b/modules/gui/wxwidgets/menus.cpp index 2600e9232d..57b96ef3b8 100644 --- a/modules/gui/wxwidgets/menus.cpp +++ b/modules/gui/wxwidgets/menus.cpp @@ -703,7 +703,7 @@ void Menu::CreateMenuItem( wxMenu *menu, const char *psz_var, CreateChoicesMenu( psz_var, p_object, TRUE ), wxT("")/* Nothing for now (maybe use a GETLONGTEXT) */ ); - if( text.psz_string ) free( text.psz_string ); + free( text.psz_string ); return; } @@ -733,7 +733,7 @@ void Menu::CreateMenuItem( wxMenu *menu, const char *psz_var, break; } - if( text.psz_string ) free( text.psz_string ); + free( text.psz_string ); } wxMenu *Menu::CreateChoicesMenu( const char *psz_var, vlc_object_t *p_object, @@ -808,7 +808,7 @@ wxMenu *Menu::CreateChoicesMenu( const char *psz_var, vlc_object_t *p_object, val_list.p_list->p_values[i].psz_string ) ) menu->Check( i_item_id, TRUE ); - if( val.psz_string ) free( val.psz_string ); + free( val.psz_string ); break; case VLC_VAR_INTEGER: @@ -1043,7 +1043,7 @@ wxMenuItemExt::wxMenuItemExt( wxMenu* parentMenu, int id, const wxString& text, wxMenuItemExt::~wxMenuItemExt() { - if( psz_var ) free( psz_var ); - if( ((i_val_type & VLC_VAR_TYPE) == VLC_VAR_STRING) - && val.psz_string ) free( val.psz_string ); + free( psz_var ); + if( ( i_val_type & VLC_VAR_TYPE ) == VLC_VAR_STRING ) + free( val.psz_string ); }; diff --git a/modules/gui/wxwidgets/wxwidgets.cpp b/modules/gui/wxwidgets/wxwidgets.cpp index 591b54e76b..706f456d4a 100644 --- a/modules/gui/wxwidgets/wxwidgets.cpp +++ b/modules/gui/wxwidgets/wxwidgets.cpp @@ -560,7 +560,7 @@ WindowSettings::WindowSettings( intf_thread_t *_p_intf ) } } - if( psz_org ) free( psz_org ); + free( psz_org ); return; invalid: @@ -572,7 +572,7 @@ invalid: position[i] = wxDefaultPosition; size[i] = wxDefaultSize; } - if( psz_org ) free( psz_org ); + free( psz_org ); } -- 2.39.2