summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/kwsys/ProcessUNIX.c2
-rw-r--r--Source/kwsys/SystemTools.cxx105
-rw-r--r--Source/kwsys/SystemTools.hxx.in9
-rw-r--r--Source/kwsys/testCommandLineArguments1.cxx2
-rw-r--r--Source/kwsys/testProcess.c2
-rw-r--r--Source/kwsys/testSystemTools.cxx22
6 files changed, 6 insertions, 136 deletions
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c
index 241e295..ca9d424 100644
--- a/Source/kwsys/ProcessUNIX.c
+++ b/Source/kwsys/ProcessUNIX.c
@@ -68,6 +68,7 @@ do.
#include <signal.h> /* sigaction */
#include <dirent.h> /* DIR, dirent */
#include <ctype.h> /* isspace */
+#include <assert.h> /* assert */
#if defined(__VMS)
# define KWSYSPE_VMS_NONBLOCK , O_NONBLOCK
@@ -450,6 +451,7 @@ int kwsysProcess_AddCommand(kwsysProcess* cp, char const* const* command)
}
for(i=0; i < n; ++i)
{
+ assert(command[i]); /* Quiet Clang scan-build. */
newCommands[cp->NumberOfCommands][i] = strdup(command[i]);
if(!newCommands[cp->NumberOfCommands][i])
{
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index dcfd49c..e34bb43 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -4600,111 +4600,6 @@ void SystemTools::Delay(unsigned int msec)
#endif
}
-void SystemTools::ConvertWindowsCommandLineToUnixArguments(
- const char *cmd_line, int *argc, char ***argv)
-{
- if (!cmd_line || !argc || !argv)
- {
- return;
- }
-
- // A space delimites an argument except when it is inside a quote
-
- (*argc) = 1;
-
- size_t cmd_line_len = strlen(cmd_line);
-
- size_t i;
- for (i = 0; i < cmd_line_len; i++)
- {
- while (isspace(cmd_line[i]) && i < cmd_line_len)
- {
- i++;
- }
- if (i < cmd_line_len)
- {
- if (cmd_line[i] == '\"')
- {
- i++;
- while (cmd_line[i] != '\"' && i < cmd_line_len)
- {
- i++;
- }
- (*argc)++;
- }
- else
- {
- while (!isspace(cmd_line[i]) && i < cmd_line_len)
- {
- i++;
- }
- (*argc)++;
- }
- }
- }
-
- (*argv) = new char* [(*argc) + 1];
- (*argv)[(*argc)] = NULL;
-
- // Set the first arg to be the exec name
-
- (*argv)[0] = new char [1024];
-#ifdef _WIN32
- wchar_t tmp[1024];
- ::GetModuleFileNameW(0, tmp, 1024);
- strcpy((*argv)[0], Encoding::ToNarrow(tmp).c_str());
-#else
- (*argv)[0][0] = '\0';
-#endif
-
- // Allocate the others
-
- int j;
- for (j = 1; j < (*argc); j++)
- {
- (*argv)[j] = new char [cmd_line_len + 10];
- }
-
- // Grab the args
-
- size_t pos;
- int argc_idx = 1;
-
- for (i = 0; i < cmd_line_len; i++)
- {
- while (isspace(cmd_line[i]) && i < cmd_line_len)
- {
- i++;
- }
- if (i < cmd_line_len)
- {
- if (cmd_line[i] == '\"')
- {
- i++;
- pos = i;
- while (cmd_line[i] != '\"' && i < cmd_line_len)
- {
- i++;
- }
- memcpy((*argv)[argc_idx], &cmd_line[pos], i - pos);
- (*argv)[argc_idx][i - pos] = '\0';
- argc_idx++;
- }
- else
- {
- pos = i;
- while (!isspace(cmd_line[i]) && i < cmd_line_len)
- {
- i++;
- }
- memcpy((*argv)[argc_idx], &cmd_line[pos], i - pos);
- (*argv)[argc_idx][i - pos] = '\0';
- argc_idx++;
- }
- }
- }
- }
-
kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
{
kwsys_stl::string res;
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index 2514699..e88bc8f 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -856,15 +856,6 @@ public:
*/
static kwsys_stl::string GetOperatingSystemNameAndVersion();
- /**
- * Convert windows-style arguments given as a command-line string
- * into more traditional argc/argv arguments.
- * Note that argv[0] will be assigned the executable name using
- * the GetModuleFileName() function.
- */
- static void ConvertWindowsCommandLineToUnixArguments(
- const char *cmd_line, int *argc, char ***argv);
-
/** -----------------------------------------------------------------
* URL Manipulation Routines
* -----------------------------------------------------------------
diff --git a/Source/kwsys/testCommandLineArguments1.cxx b/Source/kwsys/testCommandLineArguments1.cxx
index 3b84c38..b65c37f 100644
--- a/Source/kwsys/testCommandLineArguments1.cxx
+++ b/Source/kwsys/testCommandLineArguments1.cxx
@@ -21,6 +21,7 @@
# include "kwsys_ios_iostream.h.in"
#endif
+#include <assert.h> /* assert */
#include <string.h> /* strcmp */
int testCommandLineArguments1(int argc, char* argv[])
@@ -83,6 +84,7 @@ int testCommandLineArguments1(int argc, char* argv[])
}
for ( cc = 0; cc < newArgc; ++ cc )
{
+ assert(newArgv[cc]); /* Quiet Clang scan-build. */
kwsys_ios::cout << "Unused argument[" << cc << "] = [" << newArgv[cc] << "]"
<< kwsys_ios::endl;
if ( cc >= 9 )
diff --git a/Source/kwsys/testProcess.c b/Source/kwsys/testProcess.c
index 3d62822..47c3fb0 100644
--- a/Source/kwsys/testProcess.c
+++ b/Source/kwsys/testProcess.c
@@ -20,6 +20,7 @@
# include "Encoding.h.in"
#endif
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -104,6 +105,7 @@ static int test4(int argc, const char* argv[])
fprintf(stderr, "Output before crash on stderr from crash test.\n");
fflush(stdout);
fflush(stderr);
+ assert(invalidAddress); /* Quiet Clang scan-build. */
/* Provoke deliberate crash by writing to the invalid address. */
*invalidAddress = 0;
fprintf(stdout, "Output after crash on stdout from crash test.\n");
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index 15123eb..04ab4fc 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -507,28 +507,6 @@ static bool CheckStringOperations()
res = false;
}
- int targc;
- char **targv;
- kwsys::SystemTools::ConvertWindowsCommandLineToUnixArguments
- ("\"Local Mojo\\Voodoo.asp\" -CastHex \"D:\\My Secret Mojo\\Voodoo.mp3\"",
- &targc, &targv);
- if (targc != 4 || strcmp(targv[1],"Local Mojo\\Voodoo.asp") ||
- strcmp(targv[2],"-CastHex") ||
- strcmp(targv[3],"D:\\My Secret Mojo\\Voodoo.mp3"))
- {
- kwsys_ios::cerr
- << "Problem with ConvertWindowsCommandLineToUnixArguments"
- << "\'\"Local Mojo\\Voodoo.asp\" "
- << "-CastHex \"D:\\My Secret Mojo\\Voodoo.mp3\"\'"
- << kwsys_ios::endl;
- res = false;
- }
- for (;targc >=0; --targc)
- {
- delete [] targv[targc];
- }
- delete [] targv;
-
return res;
}