diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2002-04-15 13:09:39 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2002-04-15 13:09:39 (GMT) |
commit | a07cdc75e19f957b8ea3c6d5cd35514372eeb21a (patch) | |
tree | 2acd2d77ceeb376c9ba9770427a2a17ebd8f7d1f /Source | |
parent | a89dd1fbaf7bf430321f86737417ae6c42fb6de4 (diff) | |
download | CMake-a07cdc75e19f957b8ea3c6d5cd35514372eeb21a.zip CMake-a07cdc75e19f957b8ea3c6d5cd35514372eeb21a.tar.gz CMake-a07cdc75e19f957b8ea3c6d5cd35514372eeb21a.tar.bz2 |
use stream not sprintf
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmSystemTools.cxx | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index a0db02c..822fb3f 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -997,17 +997,16 @@ bool cmSystemTools::FilesDiffer(const char* source, if(statSource.st_size != finSource.gcount() || statSource.st_size != finDestination.gcount()) { - char msg[256]; - sprintf(msg, "FilesDiffer failed to read files (allocated: %lu, source: %lu, dest: %lu)", statSource.st_size, finSource.gcount(), finDestination.gcount()); - cmSystemTools::Error(msg); + std::strstream msg; + msg << "FilesDiffer failed to read files (allocated: " + << statSource.st_size << ", read source: " << finSource.gcount() + << ", read dest: " << finDestination.gcount() << std::ends; + cmSystemTools::Error(msg.str()); + delete [] msg.str(); delete [] source_buf; delete [] dest_buf; return false; } - - finSource.close(); - finDestination.close(); - int ret = memcmp((const void*)source_buf, (const void*)dest_buf, statSource.st_size); @@ -1106,9 +1105,12 @@ void cmSystemTools::cmCopyFile(const char* source, if (statSource.st_size != statDestination.st_size) { - char msg[256]; - sprintf(msg, "CopyFile failed to copy files (sizes differ, source: %lu, dest: %lu)", statSource.st_size, statDestination.st_size); - cmSystemTools::Error(msg); + std::strstream msg; + msg << "CopyFile failed to copy files (sizes differ, source: " + << statSource.st_size << " , dest: " << statDestination.st_size + << std::ends; + cmSystemTools::Error(msg.str()); + delete [] msg.str(); } } |