use stream not sprintf
This commit is contained in:
parent
a89dd1fbaf
commit
a07cdc75e1
|
@ -997,17 +997,16 @@ bool cmSystemTools::FilesDiffer(const char* source,
|
||||||
if(statSource.st_size != finSource.gcount() ||
|
if(statSource.st_size != finSource.gcount() ||
|
||||||
statSource.st_size != finDestination.gcount())
|
statSource.st_size != finDestination.gcount())
|
||||||
{
|
{
|
||||||
char msg[256];
|
std::strstream msg;
|
||||||
sprintf(msg, "FilesDiffer failed to read files (allocated: %lu, source: %lu, dest: %lu)", statSource.st_size, finSource.gcount(), finDestination.gcount());
|
msg << "FilesDiffer failed to read files (allocated: "
|
||||||
cmSystemTools::Error(msg);
|
<< statSource.st_size << ", read source: " << finSource.gcount()
|
||||||
|
<< ", read dest: " << finDestination.gcount() << std::ends;
|
||||||
|
cmSystemTools::Error(msg.str());
|
||||||
|
delete [] msg.str();
|
||||||
delete [] source_buf;
|
delete [] source_buf;
|
||||||
delete [] dest_buf;
|
delete [] dest_buf;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
finSource.close();
|
|
||||||
finDestination.close();
|
|
||||||
|
|
||||||
int ret = memcmp((const void*)source_buf,
|
int ret = memcmp((const void*)source_buf,
|
||||||
(const void*)dest_buf,
|
(const void*)dest_buf,
|
||||||
statSource.st_size);
|
statSource.st_size);
|
||||||
|
@ -1106,9 +1105,12 @@ void cmSystemTools::cmCopyFile(const char* source,
|
||||||
|
|
||||||
if (statSource.st_size != statDestination.st_size)
|
if (statSource.st_size != statDestination.st_size)
|
||||||
{
|
{
|
||||||
char msg[256];
|
std::strstream msg;
|
||||||
sprintf(msg, "CopyFile failed to copy files (sizes differ, source: %lu, dest: %lu)", statSource.st_size, statDestination.st_size);
|
msg << "CopyFile failed to copy files (sizes differ, source: "
|
||||||
cmSystemTools::Error(msg);
|
<< statSource.st_size << " , dest: " << statDestination.st_size
|
||||||
|
<< std::ends;
|
||||||
|
cmSystemTools::Error(msg.str());
|
||||||
|
delete [] msg.str();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue