diff options
author | Clinton Stimpson <clinton@elemtech.com> | 2014-01-04 05:47:13 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-01-07 14:27:44 (GMT) |
commit | 5730710c86e5b844c48e17e9001647ae0aa841a3 (patch) | |
tree | 95f04b085aab74156bbbd39089541c6ec586b89c /Source/cmFileCommand.cxx | |
parent | 7fb2b806626b9af791d7372d2ff82b2cf1503237 (diff) | |
download | CMake-5730710c86e5b844c48e17e9001647ae0aa841a3.zip CMake-5730710c86e5b844c48e17e9001647ae0aa841a3.tar.gz CMake-5730710c86e5b844c48e17e9001647ae0aa841a3.tar.bz2 |
Use cmsys::[io]fstream instead of cmsys_ios::[io]fstream.
Also use SystemTools::Fopen() instead of fopen().
This is to eventually support utf-8 filenames.
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r-- | Source/cmFileCommand.cxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 4446f72..311763b 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -32,6 +32,7 @@ #include <cmsys/Directory.hxx> #include <cmsys/Glob.hxx> #include <cmsys/RegularExpression.hxx> +#include <cmsys/FStream.hxx> // Table of permissions flags. #if defined(_WIN32) && !defined(__CYGWIN__) @@ -228,7 +229,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args, } // If GetPermissions fails, pretend like it is ok. File open will fail if // the file is not writable - std::ofstream file(fileName.c_str(), append?std::ios::app: std::ios::out); + cmsys::ofstream file(fileName.c_str(), append?std::ios::app: std::ios::out); if ( !file ) { std::string error = "Internal CMake error when trying to open file: "; @@ -283,10 +284,10 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args) // Open the specified file. #if defined(_WIN32) || defined(__CYGWIN__) - std::ifstream file(fileName.c_str(), std::ios::in | + cmsys::ifstream file(fileName.c_str(), std::ios::in | (hexOutputArg.IsEnabled() ? std::ios::binary : std::ios::in)); #else - std::ifstream file(fileName.c_str(), std::ios::in); + cmsys::ifstream file(fileName.c_str(), std::ios::in); #endif if ( !file ) @@ -577,9 +578,9 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) // Open the specified file. #if defined(_WIN32) || defined(__CYGWIN__) - std::ifstream fin(fileName.c_str(), std::ios::in | std::ios::binary); + cmsys::ifstream fin(fileName.c_str(), std::ios::in | std::ios::binary); #else - std::ifstream fin(fileName.c_str(), std::ios::in); + cmsys::ifstream fin(fileName.c_str(), std::ios::in); #endif if(!fin) { @@ -2490,7 +2491,7 @@ namespace { void *data) { int realsize = (int)(size * nmemb); - std::ofstream* fout = static_cast<std::ofstream*>(data); + cmsys::ofstream* fout = static_cast<cmsys::ofstream*>(data); const char* chPtr = static_cast<char*>(ptr); fout->write(chPtr, realsize); return realsize; @@ -2838,7 +2839,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) return false; } - std::ofstream fout(file.c_str(), std::ios::binary); + cmsys::ofstream fout(file.c_str(), std::ios::binary); if(!fout) { this->SetError("DOWNLOAD cannot open file for write."); @@ -3094,7 +3095,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) // Open file for reading: // - FILE *fin = fopen(filename.c_str(), "rb"); + FILE *fin = cmsys::SystemTools::Fopen(filename.c_str(), "rb"); if(!fin) { std::string errStr = "UPLOAD cannot open file '"; |