make wxExecute() argv parameter fully const-qualified

This commit is contained in:
Paul Cornett
2017-02-18 10:14:25 -08:00
parent c9fad20b7b
commit c64a4c3224
5 changed files with 16 additions and 16 deletions

View File

@@ -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);