From c64a4c3224e11902d1316b9063d3f385cf093136 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sat, 18 Feb 2017 10:14:25 -0800 Subject: [PATCH] make wxExecute() argv parameter fully const-qualified --- include/wx/utils.h | 4 ++-- interface/wx/utils.h | 4 ++-- src/msw/utilsexc.cpp | 6 +++--- src/osx/core/utilsexc_base.cpp | 4 ++-- src/unix/utilsunx.cpp | 14 +++++++------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/wx/utils.h b/include/wx/utils.h index eda281cb8d..2ec9a198f7 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -381,12 +381,12 @@ WXDLLIMPEXP_BASE long wxExecute(const wxString& command, int flags = wxEXEC_ASYNC, wxProcess *process = NULL, const wxExecuteEnv *env = NULL); -WXDLLIMPEXP_BASE long wxExecute(char **argv, +WXDLLIMPEXP_BASE long wxExecute(const char* const* argv, int flags = wxEXEC_ASYNC, wxProcess *process = NULL, const wxExecuteEnv *env = NULL); #if wxUSE_UNICODE -WXDLLIMPEXP_BASE long wxExecute(wchar_t **argv, +WXDLLIMPEXP_BASE long wxExecute(const wchar_t* const* argv, int flags = wxEXEC_ASYNC, wxProcess *process = NULL, const wxExecuteEnv *env = NULL); diff --git a/interface/wx/utils.h b/interface/wx/utils.h index 020d6b5b39..624ff0710e 100644 --- a/interface/wx/utils.h +++ b/interface/wx/utils.h @@ -1184,10 +1184,10 @@ long wxExecute(const wxString& command, int flags = wxEXEC_ASYNC, In wxPerl this function is called @c Wx::ExecuteArgs. @endWxPerlOnly */ -long wxExecute(char** argv, int flags = wxEXEC_ASYNC, +long wxExecute(const char* const* argv, int flags = wxEXEC_ASYNC, wxProcess* callback = NULL, const wxExecuteEnv *env = NULL); -long wxExecute(wchar_t** argv, int flags = wxEXEC_ASYNC, +long wxExecute(const wchar_t* const* argv, int flags = wxEXEC_ASYNC, wxProcess* callback = NULL, const wxExecuteEnv *env = NULL); //@} diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index e4d6d0c28f..6eef84bbd1 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -1071,7 +1071,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, } template -long wxExecuteImpl(CharType **argv, int flags, wxProcess *handler, +long wxExecuteImpl(const CharType* const* argv, int flags, wxProcess* handler, const wxExecuteEnv *env) { wxString command; @@ -1114,7 +1114,7 @@ long wxExecuteImpl(CharType **argv, int flags, wxProcess *handler, return wxExecute(command, flags, handler, env); } -long wxExecute(char **argv, int flags, wxProcess *handler, +long wxExecute(const char* const* argv, int flags, wxProcess* handler, const wxExecuteEnv *env) { return wxExecuteImpl(argv, flags, handler, env); @@ -1122,7 +1122,7 @@ long wxExecute(char **argv, int flags, wxProcess *handler, #if wxUSE_UNICODE -long wxExecute(wchar_t **argv, int flags, wxProcess *handler, +long wxExecute(const wchar_t* const* argv, int flags, wxProcess* handler, const wxExecuteEnv *env) { return wxExecuteImpl(argv, flags, handler, env); diff --git a/src/osx/core/utilsexc_base.cpp b/src/osx/core/utilsexc_base.cpp index 25d9512a33..ccbcd3ee75 100644 --- a/src/osx/core/utilsexc_base.cpp +++ b/src/osx/core/utilsexc_base.cpp @@ -68,12 +68,12 @@ wxSocketManager *wxOSXSocketManagerCF = NULL; // process is the process passed from wxExecute for pipe streams etc. // returns -1 on error for wxEXEC_SYNC and 0 on error for wxEXEC_ASYNC //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -bool wxMacLaunch(char **argv) +bool wxMacLaunch(const char* const* argv) { // Obtains the number of arguments for determining the size of // the CFArray used to hold them CFIndex cfiCount = 0; - for(char** argvcopy = argv; *argvcopy != NULL ; ++argvcopy) + for (const char* const* argvcopy = argv; *argvcopy != NULL; ++argvcopy) { ++cfiCount; } diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index aa3e8ddb96..efb3044325 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -409,7 +409,7 @@ public: } #if wxUSE_UNICODE - ArgsArray(wchar_t **wargv) + ArgsArray(const wchar_t* const* wargv) { int argc = 0; while ( wargv[argc] ) @@ -434,7 +434,7 @@ public: delete [] m_argv; } - operator char**() const { return m_argv; } + operator const char* const*() const { return m_argv; } private: void Init(int argc) @@ -457,7 +457,7 @@ private: // ---------------------------------------------------------------------------- #if defined(__DARWIN__) && !defined(__WXOSX_IPHONE__) -bool wxMacLaunch(char **argv); +bool wxMacLaunch(const char* const* argv); #endif long wxExecute(const wxString& command, int flags, wxProcess *process, @@ -471,7 +471,7 @@ long wxExecute(const wxString& command, int flags, wxProcess *process, #if wxUSE_UNICODE -long wxExecute(wchar_t **wargv, int flags, wxProcess *process, +long wxExecute(const wchar_t* const* wargv, int flags, wxProcess* process, const wxExecuteEnv *env) { ArgsArray argv(wargv); @@ -559,7 +559,7 @@ int BlockUntilChildExit(wxExecuteData& execData) } // anonymous namespace // wxExecute: the real worker function -long wxExecute(char **argv, int flags, wxProcess *process, +long wxExecute(const char* const* argv, int flags, wxProcess* process, const wxExecuteEnv *env) { // for the sync execution, we return -1 to indicate failure, but for async @@ -743,10 +743,10 @@ long wxExecute(char **argv, int flags, wxProcess *process, } } - execvp(*argv, argv); + execvp(*argv, const_cast(argv)); fprintf(stderr, "execvp("); - for ( char **a = argv; *a; a++ ) + for (const char* const* a = argv; *a; a++) fprintf(stderr, "%s%s", a == argv ? "" : ", ", *a); fprintf(stderr, ") failed with error %d!\n", errno);