From f87057813da84451aa60e85d3992b89e1f3c7bb0 Mon Sep 17 00:00:00 2001 From: Sebastien Barre Date: Tue, 30 Jul 2002 10:23:39 -0400 Subject: [PATCH] =?UTF-8?q?FIX:=20la=20commande=20cr=C3=A9ait=20du=20code?= =?UTF-8?q?=20C++.=20Du=20code=20C=20devrait=20faire=20l'affaire.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/cmCreateTestSourceList.cxx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index e8643ab7b..74279fe96 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -159,13 +159,14 @@ bool cmCreateTestSourceList::InitialPass(std::vector const& argsIn) "\n" "char* lowercase(const char *string)\n" "{\n" - " char *new_string = new char[strlen(string) + 1];\n" + " char *new_string, *p;\n" + " new_string = new char[strlen(string) + 1];\n" " if (!new_string)\n" " {\n" " return NULL;\n" " }\n" " strcpy(new_string, string);\n" - " char *p = new_string;\n" + " p = new_string;\n" " while (*p != 0)\n" " {\n" " *p = tolower(*p);\n" @@ -176,8 +177,10 @@ bool cmCreateTestSourceList::InitialPass(std::vector const& argsIn) "\n" "int main(int ac, char** av)\n" "{\n" - " int NumTests = " << numTests << ";\n" - " int i;\n" + " int NumTests, i, testNum, partial_match;\n" + " char *arg, *test_name;\n" + " \n" + " NumTests = " << numTests << ";\n" " \n" " // If no test name was given\n"; if(function.size()) @@ -202,7 +205,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector const& argsIn) " printf(\"%3d. %s\\n\", i, cmakeGeneratedFunctionMapEntries[i].name);\n" " }\n" " printf(\"To run a test, enter the test number: \");\n" - " int testNum = 0;\n" + " testNum = 0;\n" " scanf(\"%d\", &testNum);\n" " if (testNum >= NumTests)\n" " {\n" @@ -213,17 +216,17 @@ bool cmCreateTestSourceList::InitialPass(std::vector const& argsIn) " }\n" " \n" " // If partial match is requested\n" - " int partial_match = (strcmp(av[1], \"-R\") == 0) ? 1 : 0;\n" + " partial_match = (strcmp(av[1], \"-R\") == 0) ? 1 : 0;\n" " if (partial_match && ac < 3)\n" " {\n" " printf(\"-R needs an additional parameter.\\n\");\n" " return -1;\n" " }\n" " \n" - " char *arg = lowercase(av[1 + partial_match]);\n" + " arg = lowercase(av[1 + partial_match]);\n" " for (i =0; i < NumTests; ++i)\n" " {\n" - " char *test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);\n" + " test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);\n" " if (partial_match && strstr(test_name, arg) != NULL)\n" " {\n" " return (*cmakeGeneratedFunctionMapEntries[i].func)(ac - 2, av + 2);\n"