From: Julian Smart Date: Mon, 25 Jan 1999 12:12:23 +0000 (+0000) Subject: char* -> wxString X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/7482b22003c03f7aa3335aec271b5fcb48e2693d?hp=227869da8d090e2364530dd310e2d63ad18edecf char* -> wxString git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1468 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index 0af0f8a0e0..f33c3423c7 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -102,7 +102,7 @@ int wxFileDialog::ShowModal(void) } -char *wxFileSelector( const char *title, +wxString wxFileSelector( const char *title, const char *defaultDir, const char *defaultFileName, const char *defaultExtension, const char *filter, int flags, wxWindow *parent, int x, int y ) @@ -129,16 +129,15 @@ char *wxFileSelector( const char *title, if ( fileDialog.ShowModal() == wxID_OK ) { - strcpy(wxBuffer, (const char *)fileDialog.GetPath()); - return wxBuffer; + return fileDialog.GetPath(); } else { - return (char *) NULL; + return wxEmptyString; } } -char* wxLoadFileSelector( const char *what, const char *extension, const char *default_name, wxWindow *parent ) +wxString wxLoadFileSelector( const char *what, const char *extension, const char *default_name, wxWindow *parent ) { char *ext = (char *)extension; @@ -153,7 +152,7 @@ char* wxLoadFileSelector( const char *what, const char *extension, const char *d return wxFileSelector (prompt, (const char *) NULL, default_name, ext, wild, 0, parent); } -char* wxSaveFileSelector(const char *what, const char *extension, const char *default_name, +wxString wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent ) { char *ext = (char *)extension; diff --git a/src/gtk1/filedlg.cpp b/src/gtk1/filedlg.cpp index 0af0f8a0e0..f33c3423c7 100644 --- a/src/gtk1/filedlg.cpp +++ b/src/gtk1/filedlg.cpp @@ -102,7 +102,7 @@ int wxFileDialog::ShowModal(void) } -char *wxFileSelector( const char *title, +wxString wxFileSelector( const char *title, const char *defaultDir, const char *defaultFileName, const char *defaultExtension, const char *filter, int flags, wxWindow *parent, int x, int y ) @@ -129,16 +129,15 @@ char *wxFileSelector( const char *title, if ( fileDialog.ShowModal() == wxID_OK ) { - strcpy(wxBuffer, (const char *)fileDialog.GetPath()); - return wxBuffer; + return fileDialog.GetPath(); } else { - return (char *) NULL; + return wxEmptyString; } } -char* wxLoadFileSelector( const char *what, const char *extension, const char *default_name, wxWindow *parent ) +wxString wxLoadFileSelector( const char *what, const char *extension, const char *default_name, wxWindow *parent ) { char *ext = (char *)extension; @@ -153,7 +152,7 @@ char* wxLoadFileSelector( const char *what, const char *extension, const char *d return wxFileSelector (prompt, (const char *) NULL, default_name, ext, wild, 0, parent); } -char* wxSaveFileSelector(const char *what, const char *extension, const char *default_name, +wxString wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent ) { char *ext = (char *)extension; diff --git a/src/motif/filedlg.cpp b/src/motif/filedlg.cpp index a17964d2b8..cde482345f 100644 --- a/src/motif/filedlg.cpp +++ b/src/motif/filedlg.cpp @@ -43,7 +43,7 @@ IMPLEMENT_CLASS(wxFileDialog, wxDialog) #define wxFSB_HEIGHT 500 -char *wxFileSelector(const char *title, +wxString wxFileSelector(const char *title, const char *defaultDir, const char *defaultFileName, const char *defaultExtension, const char *filter, int flags, wxWindow *parent, int x, int y) @@ -73,14 +73,13 @@ char *wxFileSelector(const char *title, if ( fileDialog.ShowModal() == wxID_OK ) { - strcpy(wxBuffer, (const char *)fileDialog.GetPath()); - return wxBuffer; + return fileDialog.GetPath(); } else - return NULL; + return wxEmptyString; } -char *wxFileSelectorEx(const char *title, +wxString wxFileSelectorEx(const char *title, const char *defaultDir, const char *defaultFileName, int* defaultFilterIndex, @@ -97,11 +96,10 @@ char *wxFileSelectorEx(const char *title, if ( fileDialog.ShowModal() == wxID_OK ) { *defaultFilterIndex = fileDialog.GetFilterIndex(); - strcpy(wxBuffer, (const char *)fileDialog.GetPath()); - return wxBuffer; + return fileDialog.GetPath()); } else - return NULL; + return wxEmptyString; } wxString wxFileDialog::m_fileSelectorAnswer = ""; @@ -274,7 +272,7 @@ int wxFileDialog::ShowModal() } // Generic file load/save dialog -static char * +static wxString wxDefaultFileSelector(bool load, const char *what, const char *extension, const char *default_name, wxWindow *parent) { char *ext = (char *)extension; @@ -295,16 +293,14 @@ wxDefaultFileSelector(bool load, const char *what, const char *extension, const } // Generic file load dialog -char * -wxLoadFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent) +wxString wxLoadFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent) { return wxDefaultFileSelector(TRUE, what, extension, default_name, parent); } // Generic file save dialog -char * -wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent) +wxString wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent) { return wxDefaultFileSelector(FALSE, what, extension, default_name, parent); } diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp index 5b63931fe4..b302e60220 100644 --- a/src/msw/filedlg.cpp +++ b/src/msw/filedlg.cpp @@ -106,7 +106,8 @@ wxString wxFileSelector(const char *title, if( i-is-1 > 0 && is+1 < filter2.Len() ) { - if( filter2.Mid(is+1,i-is-1).Contains(defaultExtension) ) +// if( filter2.Mid(is+1,i-is-1).Contains(defaultExtension) ) + if( filter2.Mid(is+1,i-is-1) == defaultExtension ) { filterFind = filterIndex; break; diff --git a/src/stubs/filedlg.cpp b/src/stubs/filedlg.cpp index 2aeffdf926..36182617e0 100644 --- a/src/stubs/filedlg.cpp +++ b/src/stubs/filedlg.cpp @@ -23,7 +23,7 @@ IMPLEMENT_CLASS(wxFileDialog, wxDialog) #endif -char *wxFileSelector(const char *title, +wxString wxFileSelector(const char *title, const char *defaultDir, const char *defaultFileName, const char *defaultExtension, const char *filter, int flags, wxWindow *parent, int x, int y) @@ -53,11 +53,10 @@ char *wxFileSelector(const char *title, if ( fileDialog.ShowModal() == wxID_OK ) { - strcpy(wxBuffer, (const char *)fileDialog.GetPath()); - return wxBuffer; + return fileDialog.GetPath(); } else - return NULL; + return wxEmptyString; } char *wxFileSelectorEx(const char *title, @@ -77,11 +76,10 @@ char *wxFileSelectorEx(const char *title, if ( fileDialog.ShowModal() == wxID_OK ) { *defaultFilterIndex = fileDialog.GetFilterIndex(); - strcpy(wxBuffer, (const char *)fileDialog.GetPath()); - return wxBuffer; + return fileDialog.GetPath(); } else - return NULL; + return wxEmptyString; } wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, @@ -105,8 +103,7 @@ int wxFileDialog::ShowModal() } // Generic file load/save dialog -static char * -wxDefaultFileSelector(bool load, const char *what, const char *extension, const char *default_name, wxWindow *parent) +static wxString wxDefaultFileSelector(bool load, const char *what, const char *extension, const char *default_name, wxWindow *parent) { char *ext = (char *)extension; @@ -126,16 +123,14 @@ wxDefaultFileSelector(bool load, const char *what, const char *extension, const } // Generic file load dialog -char * -wxLoadFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent) +wxString wxLoadFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent) { return wxDefaultFileSelector(TRUE, what, extension, default_name, parent); } // Generic file save dialog -char * -wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent) +wxString wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent) { return wxDefaultFileSelector(FALSE, what, extension, default_name, parent); }