Fix warnings in CMake source code.

This commit is contained in:
David Cole 2009-10-02 15:30:01 -04:00
parent 837364cb04
commit ccb0cf1306
5 changed files with 28 additions and 17 deletions

View File

@ -251,7 +251,8 @@ bool cmCTestMultiProcessHandler::CheckOutput()
this->TestRunningMap[test] = false;
this->RunningTests.erase(p);
this->WriteCheckpoint(test);
this->WriteCostData(test, p->GetTestResults().ExecutionTime);
this->WriteCostData(test, static_cast<float>(
p->GetTestResults().ExecutionTime));
this->RunningCount -= GetProcessorsUsed(test);
delete p;
}
@ -276,7 +277,7 @@ void cmCTestMultiProcessHandler::ReadCostData()
cmSystemTools::SplitString(line.c_str(), ' ');
int index = atoi(parts[0].c_str());
float cost = atof(parts[1].c_str());
float cost = static_cast<float>(atof(parts[1].c_str()));
if(this->Properties[index] && this->Properties[index]->Cost == 0)
{
this->Properties[index]->Cost = cost;

View File

@ -574,16 +574,16 @@ int cmCTestTestHandler::ProcessHandler()
}
}
float percent = float(passed.size()) * 100.0f / total;
float percent = float(passed.size()) * 100.0f / float(total);
if ( failed.size() > 0 && percent > 99)
{
percent = 99;
}
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl
<< static_cast<int>(percent + .5) << "% tests passed, "
<< failed.size() << " tests failed out of "
<< total << std::endl);
<< failed.size() << " tests failed out of "
<< total << std::endl);
if(this->CTest->GetLabelSummary())
{
this->PrintLabelSummary();
@ -1982,7 +1982,7 @@ bool cmCTestTestHandler::SetTestsProperties(
}
if ( key == "COST" )
{
rtit->Cost = atof(val.c_str());
rtit->Cost = static_cast<float>(atof(val.c_str()));
}
if ( key == "RUN_SERIAL" )
{

View File

@ -172,8 +172,10 @@ cmHexFileConverter::FileType cmHexFileConverter::DetermineFileType(
return Binary;
}
buf[0] = 0;
(void) fgets(buf, 1024, inFile);
if(!fgets(buf, 1024, inFile))
{
buf[0] = 0;
}
fclose(inFile);
FileType type = Binary;
unsigned int minLineLength = 0;

View File

@ -915,8 +915,10 @@ bool RunCommandViaPopen(const char* command,
#endif
return false;
}
buffer[0] = 0;
(void) fgets(buffer, BUFFER_SIZE, cpipe);
if (!fgets(buffer, BUFFER_SIZE, cpipe))
{
buffer[0] = 0;
}
while(!feof(cpipe))
{
if(verbose)
@ -924,8 +926,10 @@ bool RunCommandViaPopen(const char* command,
cmSystemTools::Stdout(buffer);
}
output += buffer;
buffer[0] = 0;
(void) fgets(buffer, BUFFER_SIZE, cpipe);
if(!fgets(buffer, BUFFER_SIZE, cpipe))
{
buffer[0] = 0;
}
}
retVal = pclose(cpipe);

View File

@ -28,8 +28,10 @@ void cmakewizard::AskUser(const char* key,
printf("Current Value: %s\n", iter.GetValue());
printf("New Value (Enter to keep current value): ");
char buffer[4096];
buffer[0] = 0;
(void) fgets(buffer, sizeof(buffer)-1, stdin);
if(!fgets(buffer, sizeof(buffer)-1, stdin))
{
buffer[0] = 0;
}
if(strlen(buffer) > 0)
{
@ -65,8 +67,10 @@ bool cmakewizard::AskAdvanced()
{
printf("Would you like to see advanced options? [No]:");
char buffer[4096];
buffer[0] = 0;
(void) fgets(buffer, sizeof(buffer)-1, stdin);
if(!fgets(buffer, sizeof(buffer)-1, stdin))
{
buffer[0] = 0;
}
if(buffer[0])
{
if(buffer[0] == 'y' || buffer[0] == 'Y')