diff options
author | David Cole <david.cole@kitware.com> | 2009-10-01 20:47:08 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2009-10-01 20:47:08 (GMT) |
commit | 44bcba746156ad1d5fe7f784380c3fb4f4672f6b (patch) | |
tree | 34028a688c7649519a6a1086949f859d75a1a63f /Source | |
parent | 86459a89a10733bad549c34a4c4c0ca962397bc6 (diff) | |
download | CMake-44bcba746156ad1d5fe7f784380c3fb4f4672f6b.zip CMake-44bcba746156ad1d5fe7f784380c3fb4f4672f6b.tar.gz CMake-44bcba746156ad1d5fe7f784380c3fb4f4672f6b.tar.bz2 |
Fix warnings in CMake source code. Suppress rampant warnings emanating from Qt files.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CPack/cmCPackTGZGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 4 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.cxx | 2 | ||||
-rw-r--r-- | Source/cmHexFileConverter.cxx | 3 | ||||
-rw-r--r-- | Source/cmScriptGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 9 | ||||
-rw-r--r-- | Source/cmake.cxx | 10 | ||||
-rw-r--r-- | Source/cmakewizard.cxx | 4 |
9 files changed, 26 insertions, 18 deletions
diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx index 3ca0e53..1c56d81 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -176,12 +176,12 @@ int cmCPackTGZ_Data_Close(void *client_data) int n; uLong x = mydata->CRC; for (n = 0; n < 4; n++) { - buffer[n] = (int)(x & 0xff); + buffer[n] = static_cast<char>(x & 0xff); x >>= 8; } x = mydata->ZLibStream.total_in; for (n = 0; n < 4; n++) { - buffer[n+4] = (int)(x & 0xff); + buffer[n+4] = static_cast<char>(x & 0xff); x >>= 8; } diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index d93da07..0095bbc 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -596,8 +596,8 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(std::ostream& os) std::vector<cmCTestBuildErrorWarning>::iterator it; // only report the first 50 warnings and first 50 errors - unsigned short numErrorsAllowed = this->MaxErrors; - unsigned short numWarningsAllowed = this->MaxWarnings; + int numErrorsAllowed = this->MaxErrors; + int numWarningsAllowed = this->MaxWarnings; std::string srcdir = this->CTest->GetCTestConfiguration("SourceDirectory"); // make sure the source dir is in the correct case on windows // via a call to collapse full path. diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index b6e10bf..50b1d26 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -1590,13 +1590,13 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( std::string shortFileName = this->CTest->GetShortPathToFile(file.c_str()); - float cper = percentBranch + percentFunction; + float cper = static_cast<float>(percentBranch + percentFunction); if(totalBranches > 0) { cper /= 2.0f; } percent_coverage += cper; - float cmet = percentFunction + percentBranch; + float cmet = static_cast<float>(percentFunction + percentBranch); if(totalBranches > 0) { cmet /= 2.0f; diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 854b919..cd231ad 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -920,7 +920,7 @@ void cmCursesMainForm::HandleInput() { if ( this->SearchString.size() < static_cast<std::string::size_type>(x-10) ) { - this->SearchString += key; + this->SearchString += static_cast<char>(key); } } else if ( key == ctrl('h') || key == KEY_BACKSPACE || key == KEY_DC ) diff --git a/Source/cmHexFileConverter.cxx b/Source/cmHexFileConverter.cxx index 2970531..91565b4 100644 --- a/Source/cmHexFileConverter.cxx +++ b/Source/cmHexFileConverter.cxx @@ -172,7 +172,8 @@ cmHexFileConverter::FileType cmHexFileConverter::DetermineFileType( return Binary; } - fgets(buf, 1024, inFile); + buf[0] = 0; + (void) fgets(buf, 1024, inFile); fclose(inFile); FileType type = Binary; unsigned int minLineLength = 0; diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index 20246d7..86ecebe 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -53,7 +53,7 @@ static void cmScriptGeneratorEncodeConfig(const char* config, if(*c >= 'a' && *c <= 'z') { result += "["; - result += *c + ('A' - 'a'); + result += static_cast<char>(*c + 'A' - 'a'); result += *c; result += "]"; } @@ -61,7 +61,7 @@ static void cmScriptGeneratorEncodeConfig(const char* config, { result += "["; result += *c; - result += *c + ('a' - 'A'); + result += static_cast<char>(*c + 'a' - 'A'); result += "]"; } else diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index bf82981..0af46c1 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -338,7 +338,7 @@ bool cmSystemTools::IsOn(const char* val) for(std::basic_string<char>::iterator c = v.begin(); c != v.end(); c++) { - *c = toupper(*c); + *c = static_cast<char>(toupper(*c)); } return (v == "ON" || v == "1" || v == "YES" || v == "TRUE" || v == "Y"); } @@ -371,7 +371,7 @@ bool cmSystemTools::IsOff(const char* val) for(std::basic_string<char>::iterator c = v.begin(); c != v.end(); c++) { - *c = toupper(*c); + *c = static_cast<char>(toupper(*c)); } return (v == "OFF" || v == "0" || v == "NO" || v == "FALSE" || v == "N" || cmSystemTools::IsNOTFOUND(v.c_str()) || v == "IGNORE"); @@ -915,7 +915,8 @@ bool RunCommandViaPopen(const char* command, #endif return false; } - fgets(buffer, BUFFER_SIZE, cpipe); + buffer[0] = 0; + (void) fgets(buffer, BUFFER_SIZE, cpipe); while(!feof(cpipe)) { if(verbose) @@ -924,7 +925,7 @@ bool RunCommandViaPopen(const char* command, } output += buffer; buffer[0] = 0; - fgets(buffer, BUFFER_SIZE, cpipe); + (void) fgets(buffer, BUFFER_SIZE, cpipe); } retVal = pclose(cpipe); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index cdee8d2..108827a 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1276,7 +1276,10 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args) int count; if (countFile) { - fscanf(countFile,"%i",&count); + if (1!=fscanf(countFile,"%i",&count)) + { + cmSystemTools::Message("Could not read from count file."); + } fclose(countFile); } else @@ -1318,7 +1321,10 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args) } else { - fscanf(progFile,"%i",&count); + if (1!=fscanf(progFile,"%i",&count)) + { + cmSystemTools::Message("Could not read from progress file."); + } fclose(progFile); } unsigned int i; diff --git a/Source/cmakewizard.cxx b/Source/cmakewizard.cxx index 4173413..1dcfcc1 100644 --- a/Source/cmakewizard.cxx +++ b/Source/cmakewizard.cxx @@ -29,7 +29,7 @@ void cmakewizard::AskUser(const char* key, printf("New Value (Enter to keep current value): "); char buffer[4096]; buffer[0] = 0; - fgets(buffer, sizeof(buffer)-1, stdin); + (void) fgets(buffer, sizeof(buffer)-1, stdin); if(strlen(buffer) > 0) { @@ -66,7 +66,7 @@ bool cmakewizard::AskAdvanced() printf("Would you like to see advanced options? [No]:"); char buffer[4096]; buffer[0] = 0; - fgets(buffer, sizeof(buffer)-1, stdin); + (void) fgets(buffer, sizeof(buffer)-1, stdin); if(buffer[0]) { if(buffer[0] == 'y' || buffer[0] == 'Y') |