Commit c26c8eec authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/preferences*: beware, casts from strings to char * are allocated on the stack.
parent 414b3c3b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* preferences.cpp : wxWindows plugin for vlc * preferences.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: preferences.cpp,v 1.36 2003/10/19 22:41:18 sigmunau Exp $ * $Id: preferences.cpp,v 1.37 2003/10/20 00:09:27 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -927,8 +927,8 @@ void PrefsPanel::ApplyChanges() ...@@ -927,8 +927,8 @@ void PrefsPanel::ApplyChanges()
case CONFIG_ITEM_FILE: case CONFIG_ITEM_FILE:
case CONFIG_ITEM_DIRECTORY: case CONFIG_ITEM_DIRECTORY:
case CONFIG_ITEM_MODULE: case CONFIG_ITEM_MODULE:
config_PutPsz( p_intf, config_data->option_name.mb_str(), (char *) config_PutPsz( p_intf, config_data->option_name.mb_str(),
config_data->control->GetPszValue() ); config_data->control->GetPszValue().mb_str() );
break; break;
case CONFIG_ITEM_INTEGER: case CONFIG_ITEM_INTEGER:
case CONFIG_ITEM_KEY: case CONFIG_ITEM_KEY:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* preferences_widgets.cpp : wxWindows plugin for vlc * preferences_widgets.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: preferences_widgets.cpp,v 1.2 2003/10/19 23:38:09 gbazin Exp $ * $Id: preferences_widgets.cpp,v 1.3 2003/10/20 00:09:27 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* Sigmund Augdal <sigmunau@idi.ntnu.no> * Sigmund Augdal <sigmunau@idi.ntnu.no>
...@@ -69,9 +69,9 @@ float ConfigControl::GetFloatValue() ...@@ -69,9 +69,9 @@ float ConfigControl::GetFloatValue()
return f_value; return f_value;
} }
const char *ConfigControl::GetPszValue() wxString ConfigControl::GetPszValue()
{ {
return psz_value; return wxString(psz_value ? wxU(psz_value) : wxT(""));
} }
/***************************************************************************** /*****************************************************************************
...@@ -184,9 +184,9 @@ ModuleConfigControl::~ModuleConfigControl() ...@@ -184,9 +184,9 @@ ModuleConfigControl::~ModuleConfigControl()
; ;
} }
const char *ModuleConfigControl::GetPszValue() wxString ModuleConfigControl::GetPszValue()
{ {
return combo->GetStringSelection().mb_str(); return combo->GetStringSelection();
} }
/***************************************************************************** /*****************************************************************************
...@@ -214,9 +214,9 @@ StringConfigControl::~StringConfigControl() ...@@ -214,9 +214,9 @@ StringConfigControl::~StringConfigControl()
; ;
} }
const char *StringConfigControl::GetPszValue() wxString StringConfigControl::GetPszValue()
{ {
return textctrl->GetValue().mb_str(); return textctrl->GetValue();
} }
/***************************************************************************** /*****************************************************************************
...@@ -255,9 +255,9 @@ StringListConfigControl::~StringListConfigControl() ...@@ -255,9 +255,9 @@ StringListConfigControl::~StringListConfigControl()
; ;
} }
const char *StringListConfigControl::GetPszValue() wxString StringListConfigControl::GetPszValue()
{ {
return combo->GetStringSelection().mb_str(); return combo->GetStringSelection();
} }
/***************************************************************************** /*****************************************************************************
...@@ -317,9 +317,9 @@ FileConfigControl::~FileConfigControl() ...@@ -317,9 +317,9 @@ FileConfigControl::~FileConfigControl()
; ;
} }
const char *FileConfigControl::GetPszValue() wxString FileConfigControl::GetPszValue()
{ {
return textctrl->GetValue().mb_str(); return textctrl->GetValue();
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* preferences_widgets.h : wxWindows plugin for vlc * preferences_widgets.h : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2003 VideoLAN * Copyright (C) 2000-2003 VideoLAN
* $Id: preferences_widgets.h,v 1.1 2003/10/19 22:41:18 sigmunau Exp $ * $Id: preferences_widgets.h,v 1.2 2003/10/20 00:09:27 gbazin Exp $
* *
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
* *
...@@ -29,7 +29,7 @@ public: ...@@ -29,7 +29,7 @@ public:
wxSizer *Sizer(); wxSizer *Sizer();
virtual int GetIntValue(); virtual int GetIntValue();
virtual float GetFloatValue(); virtual float GetFloatValue();
virtual const char * GetPszValue(); virtual wxString GetPszValue();
protected: protected:
wxBoxSizer *sizer; wxBoxSizer *sizer;
wxStaticText *label; wxStaticText *label;
...@@ -58,7 +58,7 @@ public: ...@@ -58,7 +58,7 @@ public:
ModuleConfigControl( intf_thread_t *p_intf, module_config_t *p_item, ModuleConfigControl( intf_thread_t *p_intf, module_config_t *p_item,
wxWindow *parent ); wxWindow *parent );
~ModuleConfigControl(); ~ModuleConfigControl();
virtual const char *GetPszValue(); virtual wxString GetPszValue();
private: private:
wxComboBox *combo; wxComboBox *combo;
}; };
...@@ -68,7 +68,7 @@ class StringConfigControl: public ConfigControl ...@@ -68,7 +68,7 @@ class StringConfigControl: public ConfigControl
public: public:
StringConfigControl( module_config_t *p_item, wxWindow *parent ); StringConfigControl( module_config_t *p_item, wxWindow *parent );
~StringConfigControl(); ~StringConfigControl();
virtual const char *GetPszValue(); virtual wxString GetPszValue();
private: private:
wxTextCtrl *textctrl; wxTextCtrl *textctrl;
}; };
...@@ -78,7 +78,7 @@ class StringListConfigControl: public ConfigControl ...@@ -78,7 +78,7 @@ class StringListConfigControl: public ConfigControl
public: public:
StringListConfigControl( module_config_t *p_item, wxWindow *parent ); StringListConfigControl( module_config_t *p_item, wxWindow *parent );
~StringListConfigControl(); ~StringListConfigControl();
virtual const char *GetPszValue(); virtual wxString GetPszValue();
private: private:
wxComboBox *combo; wxComboBox *combo;
}; };
...@@ -89,7 +89,7 @@ public: ...@@ -89,7 +89,7 @@ public:
FileConfigControl( module_config_t *p_item, wxWindow *parent ); FileConfigControl( module_config_t *p_item, wxWindow *parent );
~FileConfigControl(); ~FileConfigControl();
void FileConfigControl::OnBrowse( wxCommandEvent& ); void FileConfigControl::OnBrowse( wxCommandEvent& );
virtual const char *GetPszValue(); virtual wxString GetPszValue();
private: private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
wxTextCtrl *textctrl; wxTextCtrl *textctrl;
......
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