make wxExecute() argv parameter fully const-qualified
This commit is contained in:
@@ -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);
|
||||
|
@@ -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);
|
||||
//@}
|
||||
|
@@ -1071,7 +1071,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler,
|
||||
}
|
||||
|
||||
template <typename CharType>
|
||||
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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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<char**>(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);
|
||||
|
||||
|
Reference in New Issue
Block a user