Procházet zdrojové kódy

fixed some compiler warnings and leaks

Ken Martin před 23 roky
rodič
revize
3704cc268e
1 změnil soubory, kde provedl 4 přidání a 15 odebrání
  1. 4 15
      Source/cmCreateTestSourceList.cxx

+ 4 - 15
Source/cmCreateTestSourceList.cxx

@@ -194,7 +194,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
     "  p = new_string;\n"
     "  while (*p != 0)\n"
     "    {\n"
-    "    *p = tolower(*p);\n"
+    "    *p = (char)tolower(*p);\n"
     "    ++p;\n"
     "    }\n"
     "  return new_string;\n"
@@ -202,7 +202,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
     "\n"
     "int main(int ac, char *av[])\n"
     "{\n"
-    "  int NumTests, i, testNum, partial_match;\n"
+    "  int i, testNum, partial_match;\n"
     "  char *arg, *test_name;\n"
     "  \n"
     "  NumTests = " << numTests << ";\n"
@@ -217,12 +217,6 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
   fout <<
     "  if (ac < 2)\n"
     "    {\n"
-    "    // If there is only one test, then run it with the arguments\n"
-    "    if (NumTests == 1)\n"
-    "      {\n"
-    "      return (*cmakeGeneratedFunctionMapEntries[0].func)(ac, av);\n"
-    "      }\n"
-    "    \n"
     "    // Ask for a test\n"
     "    printf(\"Available tests:\\n\");\n"
     "    for (i =0; i < NumTests; ++i)\n"
@@ -254,23 +248,18 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
     "    test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);\n"
     "    if (partial_match && strstr(test_name, arg) != NULL)\n"
     "      {\n"
+    "      free(test_name);\n"
     "      return (*cmakeGeneratedFunctionMapEntries[i].func)(ac - 2, av + 2);\n"
     "      }\n"
     "    else if (!partial_match && strcmp(test_name, arg) == 0)\n"
     "      {\n"
+    "      free(test_name);\n"
     "      return (*cmakeGeneratedFunctionMapEntries[i].func)(ac - 1, av + 1);\n"
     "      }\n"
     "    free(test_name);\n"
     "    }\n"
     "  free(arg);\n"
     "  \n"
-    "  // If the test was not found but there is only one test, then\n"
-    "  // run it with the arguments\n"
-    "  if (NumTests == 1)\n"
-    "    {\n"
-    "    return (*cmakeGeneratedFunctionMapEntries[0].func)(ac, av);\n"
-    "    }\n"
-    "  \n"
     "  // Nothing was run, display the test names\n"
     "  printf(\"Available tests:\\n\");\n"
     "  for (i =0; i < NumTests; ++i)\n"