summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2014-01-04 05:47:13 (GMT)
committerBrad King <brad.king@kitware.com>2014-01-07 14:27:44 (GMT)
commit5730710c86e5b844c48e17e9001647ae0aa841a3 (patch)
tree95f04b085aab74156bbbd39089541c6ec586b89c
parent7fb2b806626b9af791d7372d2ff82b2cf1503237 (diff)
downloadCMake-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.
-rw-r--r--Source/CPack/OSXScriptLauncher.cxx4
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx5
-rw-r--r--Source/CPack/WiX/cmWIXRichTextFormatWriter.h4
-rw-r--r--Source/CPack/WiX/cmWIXSourceWriter.h4
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.cxx3
-rw-r--r--Source/CPack/cmCPackGenerator.cxx3
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.cxx5
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.cxx5
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx7
-rw-r--r--Source/CTest/cmCTestBuildHandler.h4
-rw-r--r--Source/CTest/cmCTestCVS.cxx3
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx19
-rw-r--r--Source/CTest/cmCTestCoverageHandler.h2
-rw-r--r--Source/CTest/cmCTestGIT.cxx3
-rw-r--r--Source/CTest/cmCTestLaunch.cxx15
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx5
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx7
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx8
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx17
-rw-r--r--Source/CTest/cmCTestTestHandler.h10
-rw-r--r--Source/CTest/cmParseCacheCoverage.cxx3
-rw-r--r--Source/CTest/cmParseGTMCoverage.cxx5
-rw-r--r--Source/CTest/cmParseMumpsCoverage.cxx5
-rw-r--r--Source/CTest/cmParsePHPCoverage.cxx13
-rw-r--r--Source/CTest/cmParsePHPCoverage.h10
-rw-r--r--Source/CTest/cmParsePythonCoverage.cxx4
-rw-r--r--Source/CursesDialog/cmCursesForm.cxx2
-rw-r--r--Source/CursesDialog/cmCursesForm.h3
-rw-r--r--Source/cmArchiveWrite.cxx3
-rw-r--r--Source/cmCTest.cxx15
-rw-r--r--Source/cmCTest.h2
-rw-r--r--Source/cmCacheManager.cxx6
-rw-r--r--Source/cmCoreTryCompile.cxx2
-rw-r--r--Source/cmCryptoHash.cxx3
-rw-r--r--Source/cmDepends.cxx3
-rw-r--r--Source/cmDependsC.cxx7
-rw-r--r--Source/cmDependsFortran.cxx20
-rw-r--r--Source/cmDependsJavaParserHelper.cxx3
-rw-r--r--Source/cmDocumentation.cxx7
-rw-r--r--Source/cmELF.cxx9
-rw-r--r--Source/cmExportFileGenerator.cxx7
-rw-r--r--Source/cmExportLibraryDependencies.cxx6
-rw-r--r--Source/cmFileCommand.cxx17
-rw-r--r--Source/cmFindPackageCommand.cxx2
-rw-r--r--Source/cmGeneratedFileStream.cxx2
-rw-r--r--Source/cmGeneratedFileStream.h5
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.cxx5
-rw-r--r--Source/cmGlobalGenerator.cxx5
-rw-r--r--Source/cmGlobalKdevelopGenerator.cxx5
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.cxx3
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx3
-rw-r--r--Source/cmHexFileConverter.cxx6
-rw-r--r--Source/cmListFileLexer.c71
-rw-r--r--Source/cmListFileLexer.in.l9
-rw-r--r--Source/cmLoadCacheCommand.cxx3
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx2
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx13
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx6
-rw-r--r--Source/cmMakeDepend.cxx3
-rw-r--r--Source/cmMakefile.cxx6
-rw-r--r--Source/cmMakefile.h1
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx5
-rw-r--r--Source/cmQtAutoGenerators.cxx5
-rw-r--r--Source/cmRST.cxx4
-rw-r--r--Source/cmSystemTools.cxx13
-rw-r--r--Source/cmTryRunCommand.cxx3
-rw-r--r--Source/cmUseMangledMesaCommand.cxx5
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx2
-rw-r--r--Source/cmVisualStudioSlnParser.cxx3
-rw-r--r--Source/cmWriteFileCommand.cxx3
-rw-r--r--Source/cmXMLParser.cxx3
-rw-r--r--Source/cmake.cxx13
-rw-r--r--Source/cmcldeps.cxx2
-rw-r--r--Source/cmcmd.cxx17
75 files changed, 292 insertions, 228 deletions
diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx
index a9842c1..d9d6236 100644
--- a/Source/CPack/OSXScriptLauncher.cxx
+++ b/Source/CPack/OSXScriptLauncher.cxx
@@ -11,8 +11,8 @@
============================================================================*/
#include <cmsys/SystemTools.hxx>
#include <cmsys/Process.h>
-#include <cmsys/ios/fstream>
#include <cmsys/ios/iostream>
+#include <cmsys/FStream.hxx>
#include <CoreFoundation/CoreFoundation.h>
@@ -27,7 +27,7 @@ int main(int argc, char* argv[])
{
//if ( cmsys::SystemTools::FileExists(
cmsys_stl::string cwd = cmsys::SystemTools::GetCurrentWorkingDirectory();
- cmsys_ios::ofstream ofs("/tmp/output.txt");
+ cmsys::ofstream ofs("/tmp/output.txt");
CFStringRef fileName;
CFBundleRef appBundle;
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 78e7339..a55a6a6 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -24,6 +24,7 @@
#include <cmsys/SystemTools.hxx>
#include <cmsys/Directory.hxx>
#include <cmsys/Encoding.hxx>
+#include <cmsys/FStream.hxx>
#include <rpc.h> // for GUID generation
@@ -56,7 +57,7 @@ bool cmCPackWIXGenerator::RunWiXCommand(const std::string& command)
bool status = cmSystemTools::RunSingleCommand(command.c_str(), &output,
&returnValue, 0, cmSystemTools::OUTPUT_NONE);
- std::ofstream logFile(logFileName.c_str(), std::ios::app);
+ cmsys::ofstream logFile(logFileName.c_str(), std::ios::app);
logFile << command << std::endl;
logFile << output;
logFile.close();
@@ -838,7 +839,7 @@ bool cmCPackWIXGenerator::CreateLicenseFile()
{
cmWIXRichTextFormatWriter rtfWriter(licenseDestinationFilename);
- std::ifstream licenseSource(licenseSourceFilename.c_str());
+ cmsys::ifstream licenseSource(licenseSourceFilename.c_str());
std::string line;
while(std::getline(licenseSource, line))
diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
index 38e40b0..2b665d4 100644
--- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
+++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
@@ -13,7 +13,7 @@
#ifndef cmWIXRichTextFormatWriter_h
#define cmWIXRichTextFormatWriter_h
-#include <fstream>
+#include <cmsys/FStream.hxx>
/** \class cmWIXRichtTextFormatWriter
* \brief Helper class to generate Rich Text Format (RTF) documents
@@ -46,7 +46,7 @@ private:
void EmitInvalidCodepoint(int c);
- std::ofstream File;
+ cmsys::ofstream File;
};
#endif
diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h
index f291d25..894ad78 100644
--- a/Source/CPack/WiX/cmWIXSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXSourceWriter.h
@@ -15,7 +15,7 @@
#include <vector>
#include <string>
-#include <fstream>
+#include <cmsys/FStream.hxx>
#include <CPack/cmCPackLog.h>
@@ -60,7 +60,7 @@ private:
cmCPackLog* Logger;
- std::ofstream File;
+ cmsys::ofstream File;
State State;
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 4494e8a..0162d55 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -803,7 +803,7 @@ static int put_arobj(CF *cfp, struct stat *sb)
static int ar_append(const char* archive,const std::vector<std::string>& files)
{
int eval = 0;
- FILE* aFile = fopen(archive, "wb+");
+ FILE* aFile = cmSystemTools::Fopen(archive, "wb+");
if (aFile!=NULL) {
fwrite(ARMAG, SARMAG, 1, aFile);
if (fseek(aFile, 0, SEEK_END) != -1) {
@@ -814,7 +814,7 @@ static int ar_append(const char* archive,const std::vector<std::string>& files)
for(std::vector<std::string>::const_iterator fileIt = files.begin();
fileIt!=files.end(); ++fileIt) {
const char* filename = fileIt->c_str();
- FILE* file = fopen(filename, "rb");
+ FILE* file = cmSystemTools::Fopen(filename, "rb");
if (file == NULL) {
eval = -1;
continue;
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx
index dfb2f15..9f0a77e 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -16,6 +16,7 @@
#include "cmGeneratedFileStream.h"
#include <cmsys/RegularExpression.hxx>
+#include <cmsys/FStream.hxx>
static const char* SLAHeader =
"data 'LPic' (5000) {\n"
@@ -422,7 +423,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
std::string sla_r = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
sla_r += "/sla.r";
- std::ifstream ifs;
+ cmsys::ifstream ifs;
ifs.open(cpack_license_file.c_str());
if(ifs.is_open())
{
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index cd2fcc7..96491aa 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -23,6 +23,7 @@
#include <cmsys/SystemTools.hxx>
#include <cmsys/Glob.hxx>
+#include <cmsys/FStream.hxx>
#include <algorithm>
#if defined(__HAIKU__)
@@ -152,7 +153,7 @@ int cmCPackGenerator::PrepareNames()
<< descFileName << "]" << std::endl);
return 0;
}
- std::ifstream ifs(descFileName);
+ cmsys::ifstream ifs(descFileName);
if ( !ifs )
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx
index c617a3e..c5b9c6f 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.cxx
+++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx
@@ -22,6 +22,7 @@
#include <cmsys/SystemTools.hxx>
#include <cmsys/Glob.hxx>
+#include <cmsys/FStream.hxx>
//----------------------------------------------------------------------
cmCPackPackageMakerGenerator::cmCPackPackageMakerGenerator()
@@ -467,7 +468,7 @@ int cmCPackPackageMakerGenerator::InitializeInternal()
return 0;
}
- std::ifstream ifs(versionFile.c_str());
+ cmsys::ifstream ifs(versionFile.c_str());
if ( !ifs )
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -716,7 +717,7 @@ GenerateComponentPackage(const char *packageFile,
// X packages, which work on Mac OS X 10.3 and newer.
std::string descriptionFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
descriptionFile += '/' + component.Name + "-Description.plist";
- std::ofstream out(descriptionFile.c_str());
+ cmsys::ofstream out(descriptionFile.c_str());
out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl
<< "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\""
<< "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" << std::endl
diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx
index 9b6cf14..8342fee 100644
--- a/Source/CPack/cmCPackSTGZGenerator.cxx
+++ b/Source/CPack/cmCPackSTGZGenerator.cxx
@@ -20,6 +20,7 @@
#include "cmCPackLog.h"
#include <cmsys/ios/sstream>
+#include <cmsys/FStream.hxx>
#include <sys/types.h>
#include <sys/stat.h>
@@ -91,7 +92,7 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
std::string inLicFile = this->GetOption("CPACK_RESOURCE_FILE_LICENSE");
std::string line;
- std::ifstream ilfs(inLicFile.c_str());
+ cmsys::ifstream ilfs(inLicFile.c_str());
std::string licenseText;
while ( cmSystemTools::GetLineFromStream(ilfs, line) )
{
@@ -104,7 +105,7 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
// Create the header
std::string inFile = this->GetOption("CPACK_STGZ_HEADER_FILE");
- std::ifstream ifs(inFile.c_str());
+ cmsys::ifstream ifs(inFile.c_str());
std::string packageHeaderText;
while ( cmSystemTools::GetLineFromStream(ifs, line) )
{
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index e480fff..c5deb96 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -24,6 +24,7 @@
//#include <cmsys/RegularExpression.hxx>
#include <cmsys/Process.h>
#include <cmsys/Directory.hxx>
+#include <cmsys/FStream.hxx>
// used for sleep
#ifdef _WIN32
@@ -751,7 +752,7 @@ void cmCTestBuildHandler::GenerateXMLFooter(std::ostream& os,
void cmCTestBuildHandler::GenerateXMLLaunchedFragment(std::ostream& os,
const char* fname)
{
- std::ifstream fin(fname, std::ios::in | std::ios::binary);
+ cmsys::ifstream fin(fname, std::ios::in | std::ios::binary);
std::string line;
while(cmSystemTools::GetLineFromStream(fin, line))
{
@@ -885,7 +886,7 @@ cmCTestBuildHandler::LaunchHelper
//----------------------------------------------------------------------
int cmCTestBuildHandler::RunMakeCommand(const char* command,
- int* retVal, const char* dir, int timeout, std::ofstream& ofs)
+ int* retVal, const char* dir, int timeout, std::ostream& ofs)
{
// First generate the command and arguments
std::vector<cmStdString> args = cmSystemTools::ParseArguments(command);
@@ -1049,7 +1050,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
//----------------------------------------------------------------------
void cmCTestBuildHandler::ProcessBuffer(const char* data, int length,
- size_t& tick, size_t tick_len, std::ofstream& ofs,
+ size_t& tick, size_t tick_len, std::ostream& ofs,
t_BuildProcessingQueueType* queue)
{
const std::string::size_type tick_line_len = 50;
diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h
index 439efd6..ff7cfd6 100644
--- a/Source/CTest/cmCTestBuildHandler.h
+++ b/Source/CTest/cmCTestBuildHandler.h
@@ -54,7 +54,7 @@ private:
// and retVal is return value or exception.
int RunMakeCommand(const char* command,
int* retVal, const char* dir, int timeout,
- std::ofstream& ofs);
+ std::ostream& ofs);
enum {
b_REGULAR_LINE,
@@ -113,7 +113,7 @@ private:
typedef std::deque<char> t_BuildProcessingQueueType;
void ProcessBuffer(const char* data, int length, size_t& tick,
- size_t tick_len, std::ofstream& ofs, t_BuildProcessingQueueType* queue);
+ size_t tick_len, std::ostream& ofs, t_BuildProcessingQueueType* queue);
int ProcessSingleLine(const char* data);
t_BuildProcessingQueueType BuildProcessingQueue;
diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx
index 7269507..17dbb55 100644
--- a/Source/CTest/cmCTestCVS.cxx
+++ b/Source/CTest/cmCTestCVS.cxx
@@ -16,6 +16,7 @@
#include "cmXMLSafe.h"
#include <cmsys/RegularExpression.hxx>
+#include <cmsys/FStream.hxx>
//----------------------------------------------------------------------------
cmCTestCVS::cmCTestCVS(cmCTest* ct, std::ostream& log): cmCTestVC(ct, log)
@@ -231,7 +232,7 @@ std::string cmCTestCVS::ComputeBranchFlag(std::string const& dir)
// Lookup the branch in the tag file, if any.
std::string tagLine;
- std::ifstream tagStream(tagFile.c_str());
+ cmsys::ifstream tagStream(tagFile.c_str());
if(tagStream && cmSystemTools::GetLineFromStream(tagStream, tagLine) &&
tagLine.size() > 1 && tagLine[0] == 'T')
{
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 33b084e..3c65c55 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -26,6 +26,7 @@
#include <cmsys/Glob.hxx>
#include <cmsys/stl/iterator>
#include <cmsys/stl/algorithm>
+#include <cmsys/FStream.hxx>
#include <stdlib.h>
#include <math.h>
@@ -511,7 +512,7 @@ int cmCTestCoverageHandler::ProcessHandler()
<< "\" FullPath=\"" << cmXMLSafe(shortFileName) << "\">\n"
<< "\t\t<Report>" << std::endl;
- std::ifstream ifs(fullFileName.c_str());
+ cmsys::ifstream ifs(fullFileName.c_str());
if ( !ifs)
{
cmOStringStream ostr;
@@ -600,7 +601,7 @@ int cmCTestCoverageHandler::ProcessHandler()
<< "\" FullPath=\"" << cmXMLSafe(*i) << "\">\n"
<< "\t\t<Report>" << std::endl;
- std::ifstream ifs(fullPath.c_str());
+ cmsys::ifstream ifs(fullPath.c_str());
if (!ifs)
{
cmOStringStream ostr;
@@ -1158,7 +1159,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in gcovFile: "
<< gcovFile << std::endl);
- std::ifstream ifile(gcovFile.c_str());
+ cmsys::ifstream ifile(gcovFile.c_str());
if ( ! ifile )
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open file: "
@@ -1370,7 +1371,7 @@ int cmCTestCoverageHandler::HandleTracePyCoverage(
= &cont->TotalCoverage[actualSourceFile];
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" in file: " << fileIt->c_str() << std::endl);
- std::ifstream ifile(fileIt->c_str());
+ cmsys::ifstream ifile(fileIt->c_str());
if ( ! ifile )
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open file: "
@@ -1530,7 +1531,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
"covbr output in " << outputFile
<< std::endl);
// open the output file
- std::ifstream fin(outputFile.c_str());
+ cmsys::ifstream fin(outputFile.c_str());
if(!fin)
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
@@ -1743,7 +1744,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
std::vector<std::string> coveredFiles;
std::vector<std::string> coveredFilesFullPath;
// Read and parse the summary output file
- std::ifstream fin(outputFile.c_str());
+ cmsys::ifstream fin(outputFile.c_str());
if(!fin)
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
@@ -2012,7 +2013,7 @@ void cmCTestCoverageHandler::LoadLabels()
fileList += "/TargetDirectories.txt";
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" target directory list [" << fileList << "]\n");
- std::ifstream finList(fileList.c_str());
+ cmsys::ifstream finList(fileList.c_str());
std::string line;
while(cmSystemTools::GetLineFromStream(finList, line))
{
@@ -2026,7 +2027,7 @@ void cmCTestCoverageHandler::LoadLabels(const char* dir)
LabelSet& dirLabels = this->TargetDirs[dir];
std::string fname = dir;
fname += "/Labels.txt";
- std::ifstream fin(fname.c_str());
+ cmsys::ifstream fin(fname.c_str());
if(!fin)
{
return;
@@ -2080,7 +2081,7 @@ void cmCTestCoverageHandler::LoadLabels(const char* dir)
}
//----------------------------------------------------------------------
-void cmCTestCoverageHandler::WriteXMLLabels(std::ofstream& os,
+void cmCTestCoverageHandler::WriteXMLLabels(std::ostream& os,
std::string const& source)
{
LabelMapType::const_iterator li = this->SourceLabels.find(source);
diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h
index 3506928..660f501 100644
--- a/Source/CTest/cmCTestCoverageHandler.h
+++ b/Source/CTest/cmCTestCoverageHandler.h
@@ -132,7 +132,7 @@ private:
// Label reading and writing methods.
void LoadLabels();
void LoadLabels(const char* dir);
- void WriteXMLLabels(std::ofstream& os, std::string const& source);
+ void WriteXMLLabels(std::ostream& os, std::string const& source);
// Label-based filtering.
std::set<int> LabelFilter;
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 725f613..0e0e797 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -18,6 +18,7 @@
#include <cmsys/RegularExpression.hxx>
#include <cmsys/ios/sstream>
#include <cmsys/Process.h>
+#include <cmsys/FStream.hxx>
#include <sys/types.h>
#include <time.h>
@@ -200,7 +201,7 @@ bool cmCTestGIT::UpdateByFetchAndReset()
std::string sha1;
{
std::string fetch_head = this->FindGitDir() + "/FETCH_HEAD";
- std::ifstream fin(fetch_head.c_str(), std::ios::in | std::ios::binary);
+ cmsys::ifstream fin(fetch_head.c_str(), std::ios::in | std::ios::binary);
if(!fin)
{
this->Log << "Unable to open " << fetch_head << "\n";
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index 8e5fd78..7d9c034 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -19,6 +19,7 @@
#include <cmsys/MD5.h>
#include <cmsys/Process.h>
#include <cmsys/RegularExpression.hxx>
+#include <cmsys/FStream.hxx>
//----------------------------------------------------------------------------
cmCTestLaunch::cmCTestLaunch(int argc, const char* const* argv)
@@ -171,7 +172,7 @@ void cmCTestLaunch::HandleRealArg(const char* arg)
// Expand response file arguments.
if(arg[0] == '@' && cmSystemTools::FileExists(arg+1))
{
- std::ifstream fin(arg+1);
+ cmsys::ifstream fin(arg+1);
std::string line;
while(cmSystemTools::GetLineFromStream(fin, line))
{
@@ -241,8 +242,8 @@ void cmCTestLaunch::RunChild()
cmsysProcess* cp = this->Process;
cmsysProcess_SetCommand(cp, this->RealArgV);
- std::ofstream fout;
- std::ofstream ferr;
+ cmsys::ofstream fout;
+ cmsys::ofstream ferr;
if(this->Passthru)
{
// In passthru mode we just share the output pipes.
@@ -330,7 +331,7 @@ void cmCTestLaunch::LoadLabels()
cmSystemTools::ConvertToUnixSlashes(source);
// Load the labels file.
- std::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
+ cmsys::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
if(!fin) { return; }
bool inTarget = true;
bool inSource = false;
@@ -579,7 +580,7 @@ void cmCTestLaunch::WriteXMLLabels(std::ostream& fxml)
void cmCTestLaunch::DumpFileToXML(std::ostream& fxml,
std::string const& fname)
{
- std::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
+ cmsys::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
std::string line;
const char* sep = "";
@@ -652,7 +653,7 @@ cmCTestLaunch
fname += "Custom";
fname += purpose;
fname += ".txt";
- std::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
+ cmsys::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
std::string line;
cmsys::RegularExpression rex;
while(cmSystemTools::GetLineFromStream(fin, line))
@@ -671,7 +672,7 @@ bool cmCTestLaunch::ScrapeLog(std::string const& fname)
// Look for log file lines matching warning expressions but not
// suppression expressions.
- std::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
+ cmsys::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
std::string line;
while(cmSystemTools::GetLineFromStream(fin, line))
{
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 3ae2ac6..fdce04d 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -18,6 +18,7 @@
#include <cmsys/Process.h>
#include <cmsys/RegularExpression.hxx>
#include <cmsys/Base64.h>
+#include <cmsys/FStream.hxx>
#include "cmMakefile.h"
#include "cmXMLSafe.h"
@@ -929,7 +930,7 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res,
}
// put a scope around this to close ifs so the file can be removed
{
- std::ifstream ifs(ofile.c_str());
+ cmsys::ifstream ifs(ofile.c_str());
if ( !ifs )
{
std::string log = "Cannot read memory tester output file: " + ofile;
@@ -984,7 +985,7 @@ cmCTestMemCheckHandler::appendMemTesterOutput(cmCTestTestResult& res,
{
return;
}
- std::ifstream ifs(ofile.c_str());
+ cmsys::ifstream ifs(ofile.c_str());
if ( !ifs )
{
std::string log = "Cannot read memory tester output file: " + ofile;
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 729f14a..ddd1707 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -17,6 +17,7 @@
#include <stdlib.h>
#include <stack>
#include <float.h>
+#include <cmsys/FStream.hxx>
class TestComparator
{
@@ -325,7 +326,7 @@ void cmCTestMultiProcessHandler::UpdateCostData()
if(cmSystemTools::FileExists(fname.c_str()))
{
- std::ifstream fin;
+ cmsys::ifstream fin;
fin.open(fname.c_str());
std::string line;
@@ -384,7 +385,7 @@ void cmCTestMultiProcessHandler::ReadCostData()
if(cmSystemTools::FileExists(fname.c_str(), true))
{
- std::ifstream fin;
+ cmsys::ifstream fin;
fin.open(fname.c_str());
std::string line;
while(std::getline(fin, line))
@@ -721,7 +722,7 @@ void cmCTestMultiProcessHandler::CheckResume()
<< "----------------------------------------------------------"
<< std::endl;
- std::ifstream fin;
+ cmsys::ifstream fin;
fin.open(fname.c_str());
std::string line;
while(std::getline(fin, line))
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 941d348..139f515 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -235,7 +235,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix,
return false;
}
- ftpfile = ::fopen(local_file.c_str(), "rb");
+ ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb");
*this->LogFile << "\tUpload file: " << local_file.c_str() << " to "
<< upload_as.c_str() << std::endl;
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: "
@@ -476,7 +476,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
return false;
}
- ftpfile = ::fopen(local_file.c_str(), "rb");
+ ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb");
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: "
<< local_file.c_str() << " to "
<< upload_as.c_str() << " Size: " << st.st_size << std::endl);
@@ -566,7 +566,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
<< count << std::endl);
::fclose(ftpfile);
- ftpfile = ::fopen(local_file.c_str(), "rb");
+ ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb");
::curl_easy_setopt(curl, CURLOPT_INFILE, ftpfile);
chunk.clear();
@@ -998,7 +998,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
return false;
}
size_t fileSize = static_cast<size_t>(st.st_size);
- FILE* fp = fopen(local_file.c_str(), "rb");
+ FILE* fp = cmsys::SystemTools::Fopen(local_file.c_str(), "rb");
if ( !fp )
{
cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot open file: "
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index da24ae4..26f8014 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -21,6 +21,7 @@
#include <cmsys/RegularExpression.hxx>
#include <cmsys/Base64.h>
#include <cmsys/Directory.hxx>
+#include <cmsys/FStream.hxx>
#include "cmMakefile.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
@@ -931,7 +932,7 @@ void cmCTestTestHandler::UpdateMaxTestNameWidth()
bool cmCTestTestHandler::GetValue(const char* tag,
int& value,
- std::ifstream& fin)
+ std::istream& fin)
{
std::string line;
bool ret = true;
@@ -953,7 +954,7 @@ bool cmCTestTestHandler::GetValue(const char* tag,
bool cmCTestTestHandler::GetValue(const char* tag,
double& value,
- std::ifstream& fin)
+ std::istream& fin)
{
std::string line;
cmSystemTools::GetLineFromStream(fin, line);
@@ -975,7 +976,7 @@ bool cmCTestTestHandler::GetValue(const char* tag,
bool cmCTestTestHandler::GetValue(const char* tag,
bool& value,
- std::ifstream& fin)
+ std::istream& fin)
{
std::string line;
cmSystemTools::GetLineFromStream(fin, line);
@@ -1007,7 +1008,7 @@ bool cmCTestTestHandler::GetValue(const char* tag,
bool cmCTestTestHandler::GetValue(const char* tag,
size_t& value,
- std::ifstream& fin)
+ std::istream& fin)
{
std::string line;
cmSystemTools::GetLineFromStream(fin, line);
@@ -1029,7 +1030,7 @@ bool cmCTestTestHandler::GetValue(const char* tag,
bool cmCTestTestHandler::GetValue(const char* tag,
std::string& value,
- std::ifstream& fin)
+ std::istream& fin)
{
std::string line;
cmSystemTools::GetLineFromStream(fin, line);
@@ -1798,7 +1799,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
}
// parse the list of tests to rerun from LastTestsFailed.log
- std::ifstream ifs(lastTestsFailedLog.c_str());
+ cmsys::ifstream ifs(lastTestsFailedLog.c_str());
if ( ifs )
{
std::string line;
@@ -1964,7 +1965,7 @@ std::string cmCTestTestHandler::GenerateRegressionImages(
}
else
{
- std::ifstream ifs(filename.c_str(), std::ios::in
+ cmsys::ifstream ifs(filename.c_str(), std::ios::in
#ifdef _WIN32
| std::ios::binary
#endif
@@ -2054,7 +2055,7 @@ void cmCTestTestHandler::SetTestsToRunInformation(const char* in)
// string
if(cmSystemTools::FileExists(in))
{
- std::ifstream fin(in);
+ cmsys::ifstream fin(in);
unsigned long filelen = cmSystemTools::FileLength(in);
char* buff = new char[filelen+1];
fin.getline(buff, filelen);
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 398f052..6dda300 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -227,19 +227,19 @@ private:
bool GetValue(const char* tag,
std::string& value,
- std::ifstream& fin);
+ std::istream& fin);
bool GetValue(const char* tag,
int& value,
- std::ifstream& fin);
+ std::istream& fin);
bool GetValue(const char* tag,
size_t& value,
- std::ifstream& fin);
+ std::istream& fin);
bool GetValue(const char* tag,
bool& value,
- std::ifstream& fin);
+ std::istream& fin);
bool GetValue(const char* tag,
double& value,
- std::ifstream& fin);
+ std::istream& fin);
/**
* Find the executable for a test
*/
diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx
index 137f344..85e07ae 100644
--- a/Source/CTest/cmParseCacheCoverage.cxx
+++ b/Source/CTest/cmParseCacheCoverage.cxx
@@ -5,6 +5,7 @@
#include "cmParseCacheCoverage.h"
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
+#include <cmsys/FStream.hxx>
cmParseCacheCoverage::cmParseCacheCoverage(
@@ -106,7 +107,7 @@ bool cmParseCacheCoverage::SplitString(std::vector<std::string>& args,
bool cmParseCacheCoverage::ReadCMCovFile(const char* file)
{
- std::ifstream in(file);
+ cmsys::ifstream in(file);
if(!in)
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx
index 6b4adb4..528d0db 100644
--- a/Source/CTest/cmParseGTMCoverage.cxx
+++ b/Source/CTest/cmParseGTMCoverage.cxx
@@ -5,6 +5,7 @@
#include "cmParseGTMCoverage.h"
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
+#include <cmsys/FStream.hxx>
cmParseGTMCoverage::cmParseGTMCoverage(cmCTestCoverageHandlerContainer& cont,
@@ -48,7 +49,7 @@ bool cmParseGTMCoverage::LoadCoverageData(const char* d)
bool cmParseGTMCoverage::ReadMCovFile(const char* file)
{
- std::ifstream in(file);
+ cmsys::ifstream in(file);
if(!in)
{
return false;
@@ -127,7 +128,7 @@ bool cmParseGTMCoverage::FindFunctionInMumpsFile(std::string const& filepath,
std::string const& function,
int& lineoffset)
{
- std::ifstream in(filepath.c_str());
+ cmsys::ifstream in(filepath.c_str());
if(!in)
{
return false;
diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx
index 37e8bd0..6226feb 100644
--- a/Source/CTest/cmParseMumpsCoverage.cxx
+++ b/Source/CTest/cmParseMumpsCoverage.cxx
@@ -5,6 +5,7 @@
#include "cmParseGTMCoverage.h"
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
+#include <cmsys/FStream.hxx>
cmParseMumpsCoverage::cmParseMumpsCoverage(
@@ -23,7 +24,7 @@ bool cmParseMumpsCoverage::ReadCoverageFile(const char* file)
// Read the gtm_coverage.mcov file, that has two lines of data:
// packages:/full/path/to/Vista/Packages
// coverage_dir:/full/path/to/dir/with/*.mcov
- std::ifstream in(file);
+ cmsys::ifstream in(file);
if(!in)
{
return false;
@@ -61,7 +62,7 @@ bool cmParseMumpsCoverage::ReadCoverageFile(const char* file)
void cmParseMumpsCoverage::InitializeMumpsFile(std::string& file)
{
// initialize the coverage information for a given mumps file
- std::ifstream in(file.c_str());
+ cmsys::ifstream in(file.c_str());
if(!in)
{
return;
diff --git a/Source/CTest/cmParsePHPCoverage.cxx b/Source/CTest/cmParsePHPCoverage.cxx
index 593b2d1..1c26c1c 100644
--- a/Source/CTest/cmParsePHPCoverage.cxx
+++ b/Source/CTest/cmParsePHPCoverage.cxx
@@ -2,6 +2,7 @@
#include "cmSystemTools.h"
#include "cmParsePHPCoverage.h"
#include <cmsys/Directory.hxx>
+#include <cmsys/FStream.hxx>
/*
To setup coverage for php.
@@ -20,7 +21,7 @@ cmParsePHPCoverage::cmParsePHPCoverage(cmCTestCoverageHandlerContainer& cont,
{
}
-bool cmParsePHPCoverage::ReadUntil(std::ifstream& in, char until)
+bool cmParsePHPCoverage::ReadUntil(std::istream& in, char until)
{
char c = 0;
while(in.get(c) && c != until)
@@ -32,7 +33,7 @@ bool cmParsePHPCoverage::ReadUntil(std::ifstream& in, char until)
}
return true;
}
-bool cmParsePHPCoverage::ReadCoverageArray(std::ifstream& in,
+bool cmParsePHPCoverage::ReadCoverageArray(std::istream& in,
cmStdString const& fileName)
{
cmCTestCoverageHandlerContainer::SingleFileCoverageVector& coverageVector
@@ -109,7 +110,7 @@ bool cmParsePHPCoverage::ReadCoverageArray(std::ifstream& in,
return true;
}
-bool cmParsePHPCoverage::ReadInt(std::ifstream& in, int& v)
+bool cmParsePHPCoverage::ReadInt(std::istream& in, int& v)
{
std::string s;
char c = 0;
@@ -121,7 +122,7 @@ bool cmParsePHPCoverage::ReadInt(std::ifstream& in, int& v)
return true;
}
-bool cmParsePHPCoverage::ReadArraySize(std::ifstream& in, int& size)
+bool cmParsePHPCoverage::ReadArraySize(std::istream& in, int& size)
{
char c = 0;
in.get(c);
@@ -139,7 +140,7 @@ bool cmParsePHPCoverage::ReadArraySize(std::ifstream& in, int& size)
return false;
}
-bool cmParsePHPCoverage::ReadFileInformation(std::ifstream& in)
+bool cmParsePHPCoverage::ReadFileInformation(std::istream& in)
{
char buf[4];
in.read(buf, 2);
@@ -190,7 +191,7 @@ bool cmParsePHPCoverage::ReadFileInformation(std::ifstream& in)
bool cmParsePHPCoverage::ReadPHPData(const char* file)
{
- std::ifstream in(file);
+ cmsys::ifstream in(file);
if(!in)
{
return false;
diff --git a/Source/CTest/cmParsePHPCoverage.h b/Source/CTest/cmParsePHPCoverage.h
index d50a83c..035a093 100644
--- a/Source/CTest/cmParsePHPCoverage.h
+++ b/Source/CTest/cmParsePHPCoverage.h
@@ -32,11 +32,11 @@ public:
void PrintCoverage();
private:
bool ReadPHPData(const char* file);
- bool ReadArraySize(std::ifstream& in, int& size);
- bool ReadFileInformation(std::ifstream& in);
- bool ReadInt(std::ifstream& in, int& v);
- bool ReadCoverageArray(std::ifstream& in, cmStdString const&);
- bool ReadUntil(std::ifstream& in, char until);
+ bool ReadArraySize(std::istream& in, int& size);
+ bool ReadFileInformation(std::istream& in);
+ bool ReadInt(std::istream& in, int& v);
+ bool ReadCoverageArray(std::istream& in, cmStdString const&);
+ bool ReadUntil(std::istream& in, char until);
cmCTestCoverageHandlerContainer& Coverage;
cmCTest* CTest;
};
diff --git a/Source/CTest/cmParsePythonCoverage.cxx b/Source/CTest/cmParsePythonCoverage.cxx
index a086f13..38a770a 100644
--- a/Source/CTest/cmParsePythonCoverage.cxx
+++ b/Source/CTest/cmParsePythonCoverage.cxx
@@ -3,7 +3,7 @@
#include "cmXMLParser.h"
#include "cmParsePythonCoverage.h"
#include <cmsys/Directory.hxx>
-
+#include <cmsys/FStream.hxx>
//----------------------------------------------------------------------------
class cmParsePythonCoverage::XMLParser: public cmXMLParser
@@ -35,7 +35,7 @@ protected:
atts[tagCount+1];
FileLinesType& curFileLines =
this->Coverage.TotalCoverage[this->CurFileName];
- std::ifstream fin(this->CurFileName.c_str());
+ cmsys::ifstream fin(this->CurFileName.c_str());
if(!fin)
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
diff --git a/Source/CursesDialog/cmCursesForm.cxx b/Source/CursesDialog/cmCursesForm.cxx
index 72ae5ee..d1b470c 100644
--- a/Source/CursesDialog/cmCursesForm.cxx
+++ b/Source/CursesDialog/cmCursesForm.cxx
@@ -11,7 +11,7 @@
============================================================================*/
#include "cmCursesForm.h"
-std::ofstream cmCursesForm::DebugFile;
+cmsys::ofstream cmCursesForm::DebugFile;
bool cmCursesForm::Debug = false;
cmCursesForm::cmCursesForm()
diff --git a/Source/CursesDialog/cmCursesForm.h b/Source/CursesDialog/cmCursesForm.h
index 3cba856..f9317b9 100644
--- a/Source/CursesDialog/cmCursesForm.h
+++ b/Source/CursesDialog/cmCursesForm.h
@@ -14,6 +14,7 @@
#include "../cmStandardIncludes.h"
#include "cmCursesStandardIncludes.h"
+#include <cmsys/FStream.hxx>
class cmCursesForm
{
@@ -63,7 +64,7 @@ public:
protected:
- static std::ofstream DebugFile;
+ static cmsys::ofstream DebugFile;
static bool Debug;
cmCursesForm(const cmCursesForm& form);
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index b410e44..d5dcd6a 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -14,6 +14,7 @@
#include "cmSystemTools.h"
#include <cmsys/ios/iostream>
#include <cmsys/Directory.hxx>
+#include <cmsys/FStream.hxx>
#include <cm_libarchive.h>
//----------------------------------------------------------------------------
@@ -263,7 +264,7 @@ bool cmArchiveWrite::AddFile(const char* file,
//----------------------------------------------------------------------------
bool cmArchiveWrite::AddData(const char* file, size_t size)
{
- std::ifstream fin(file, std::ios::in | cmsys_ios_binary);
+ cmsys::ifstream fin(file, std::ios::in | cmsys_ios_binary);
if(!fin)
{
this->Error = "Error opening \"";
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 125a3bf..acedc1a 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -19,6 +19,7 @@
#include <cmsys/Base64.h>
#include <cmsys/Directory.hxx>
#include <cmsys/SystemInformation.hxx>
+#include <cmsys/FStream.hxx>
#include "cmDynamicLoader.h"
#include "cmGeneratedFileStream.h"
#include "cmXMLSafe.h"
@@ -207,7 +208,7 @@ int cmCTest::HTTPRequest(std::string url, HTTPMethod method,
return -1;
}
::curl_easy_setopt(curl, CURLOPT_PUT, 1);
- file = ::fopen(putFile.c_str(), "rb");
+ file = cmsys::SystemTools::Fopen(putFile.c_str(), "rb");
::curl_easy_setopt(curl, CURLOPT_INFILE, file);
//fall through to append GET fields
case cmCTest::HTTP_GET:
@@ -549,7 +550,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
}
std::string tagfile = testingDir + "/TAG";
- std::ifstream tfin(tagfile.c_str());
+ cmsys::ifstream tfin(tagfile.c_str());
std::string tag;
if (createNewTag)
@@ -604,7 +605,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
lctime->tm_hour,
lctime->tm_min);
tag = datestring;
- std::ofstream ofs(tagfile.c_str());
+ cmsys::ofstream ofs(tagfile.c_str());
if ( ofs )
{
ofs << tag << std::endl;
@@ -763,7 +764,7 @@ bool cmCTest::UpdateCTestConfiguration()
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "Parse Config file:"
<< fileName.c_str() << "\n");
// parse the dart test file
- std::ifstream fin(fileName.c_str());
+ cmsys::ifstream fin(fileName.c_str());
if(!fin)
{
@@ -1149,7 +1150,7 @@ int cmCTest::GetTestModelFromString(const char* str)
//----------------------------------------------------------------------
int cmCTest::RunMakeCommand(const char* command, std::string* output,
- int* retVal, const char* dir, int timeout, std::ofstream& ofs)
+ int* retVal, const char* dir, int timeout, std::ostream& ofs)
{
// First generate the command and arguments
std::vector<cmStdString> args = cmSystemTools::ParseArguments(command);
@@ -1611,7 +1612,7 @@ int cmCTest::GenerateCTestNotesOutput(std::ostream& os,
<< "<Time>" << cmSystemTools::GetTime() << "</Time>\n"
<< "<DateTime>" << note_time << "</DateTime>\n"
<< "<Text>" << std::endl;
- std::ifstream ifs(it->c_str());
+ cmsys::ifstream ifs(it->c_str());
if ( ifs )
{
std::string line;
@@ -1692,7 +1693,7 @@ std::string cmCTest::Base64GzipEncodeFile(std::string file)
std::string cmCTest::Base64EncodeFile(std::string file)
{
long len = cmSystemTools::FileLength(file.c_str());
- std::ifstream ifs(file.c_str(), std::ios::in
+ cmsys::ifstream ifs(file.c_str(), std::ios::in
#ifdef _WIN32
| std::ios::binary
#endif
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index c0a06c5..becb0f5 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -273,7 +273,7 @@ public:
// and retVal is return value or exception.
int RunMakeCommand(const char* command, std::string* output,
int* retVal, const char* dir, int timeout,
- std::ofstream& ofs);
+ std::ostream& ofs);
/*
* return the current tag
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index a2baa80..d3d8f3f 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -20,7 +20,7 @@
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
-
+#include <cmsys/FStream.hxx>
#include <cmsys/RegularExpression.hxx>
const char* cmCacheManagerTypes[] =
@@ -211,7 +211,7 @@ bool cmCacheManager::LoadCache(const char* path,
return false;
}
- std::ifstream fin(cacheFile.c_str());
+ cmsys::ifstream fin(cacheFile.c_str());
if(!fin)
{
return false;
@@ -566,7 +566,7 @@ bool cmCacheManager::SaveCache(const char* path)
checkCacheFile += cmake::GetCMakeFilesDirectory();
cmSystemTools::MakeDirectory(checkCacheFile.c_str());
checkCacheFile += "/cmake.check_cache";
- std::ofstream checkCache(checkCacheFile.c_str());
+ cmsys::ofstream checkCache(checkCacheFile.c_str());
if(!checkCache)
{
cmSystemTools::Error("Unable to open check cache file for write. ",
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index bbfc427..78bb9a6 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -278,7 +278,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
sourceDirectory = this->BinaryDirectory.c_str();
// now create a CMakeLists.txt file in that directory
- FILE *fout = fopen(outFileName.c_str(),"w");
+ FILE *fout = cmsys::SystemTools::Fopen(outFileName.c_str(),"w");
if (!fout)
{
cmOStringStream e;
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx
index a4f6ac4..7f4b10f 100644
--- a/Source/cmCryptoHash.cxx
+++ b/Source/cmCryptoHash.cxx
@@ -12,6 +12,7 @@
#include "cmCryptoHash.h"
#include <cmsys/MD5.h>
+#include <cmsys/FStream.hxx>
#include "cm_sha2.h"
//----------------------------------------------------------------------------
@@ -45,7 +46,7 @@ std::string cmCryptoHash::HashString(const char* input)
//----------------------------------------------------------------------------
std::string cmCryptoHash::HashFile(const char* file)
{
- std::ifstream fin(file, std::ios::in | cmsys_ios_binary);
+ cmsys::ifstream fin(file, std::ios::in | cmsys_ios_binary);
if(!fin)
{
return "";
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index 74a0ccb..1a0e93f 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -17,6 +17,7 @@
#include "cmSystemTools.h"
#include "cmFileTimeComparison.h"
#include <string.h>
+#include <cmsys/FStream.hxx>
//----------------------------------------------------------------------------
cmDepends::cmDepends(cmLocalGenerator* lg, const char* targetDir):
@@ -103,7 +104,7 @@ bool cmDepends::Check(const char *makeFile, const char *internalFile,
// Check whether dependencies must be regenerated.
bool okay = true;
- std::ifstream fin(internalFile);
+ cmsys::ifstream fin(internalFile);
if(!(fin && this->CheckDependencies(fin, internalFile, validDeps)))
{
// Clear all dependencies so they will be regenerated.
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index a252a1a..4fc5efb 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -15,6 +15,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
+#include <cmsys/FStream.hxx>
#include <ctype.h> // isspace
@@ -246,7 +247,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
// Try to scan the file. Just leave it out if we cannot find
// it.
- std::ifstream fin(fullName.c_str());
+ cmsys::ifstream fin(fullName.c_str());
if(fin)
{
// Add this file as a dependency.
@@ -291,7 +292,7 @@ void cmDependsC::ReadCacheFile()
{
return;
}
- std::ifstream fin(this->CacheFileName.c_str());
+ cmsys::ifstream fin(this->CacheFileName.c_str());
if(!fin)
{
return;
@@ -380,7 +381,7 @@ void cmDependsC::WriteCacheFile() const
{
return;
}
- std::ofstream cacheOut(this->CacheFileName.c_str());
+ cmsys::ofstream cacheOut(this->CacheFileName.c_str());
if(!cacheOut)
{
return;
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index e41e5ea..d5472a1 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -17,7 +17,7 @@
#include "cmGeneratedFileStream.h"
#include "cmDependsFortranParser.h" /* Interface to parser object. */
-
+#include <cmsys/FStream.hxx>
#include <assert.h>
#include <stack>
@@ -356,7 +356,7 @@ void cmDependsFortran::LocateModules()
{
std::string targetDir = cmSystemTools::GetFilenamePath(*i);
std::string fname = targetDir + "/fortran.internal";
- std::ifstream fin(fname.c_str());
+ cmsys::ifstream fin(fname.c_str());
if(fin)
{
this->MatchRemoteModules(fin, targetDir.c_str());
@@ -700,7 +700,7 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args)
// is later used for longer sequences it should be re-written using an
// efficient string search algorithm such as Boyer-Moore.
static
-bool cmDependsFortranStreamContainsSequence(std::ifstream& ifs,
+bool cmDependsFortranStreamContainsSequence(std::istream& ifs,
const char* seq, int len)
{
assert(len > 0);
@@ -733,8 +733,8 @@ bool cmDependsFortranStreamContainsSequence(std::ifstream& ifs,
//----------------------------------------------------------------------------
// Helper function to compare the remaining content in two streams.
-static bool cmDependsFortranStreamsDiffer(std::ifstream& ifs1,
- std::ifstream& ifs2)
+static bool cmDependsFortranStreamsDiffer(std::istream& ifs1,
+ std::istream& ifs2)
{
// Compare the remaining content.
for(;;)
@@ -799,11 +799,11 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
}
#if defined(_WIN32) || defined(__CYGWIN__)
- std::ifstream finModFile(modFile, std::ios::in | std::ios::binary);
- std::ifstream finStampFile(stampFile, std::ios::in | std::ios::binary);
+ cmsys::ifstream finModFile(modFile, std::ios::in | std::ios::binary);
+ cmsys::ifstream finStampFile(stampFile, std::ios::in | std::ios::binary);
#else
- std::ifstream finModFile(modFile, std::ios::in);
- std::ifstream finStampFile(stampFile, std::ios::in);
+ cmsys::ifstream finModFile(modFile, std::ios::in);
+ cmsys::ifstream finStampFile(stampFile, std::ios::in);
#endif
if(!finModFile || !finStampFile)
{
@@ -944,7 +944,7 @@ bool cmDependsFortranParser_FilePush(cmDependsFortranParser* parser,
{
// Open the new file and push it onto the stack. Save the old
// buffer with it on the stack.
- if(FILE* file = fopen(fname, "rb"))
+ if(FILE* file = cmsys::SystemTools::Fopen(fname, "rb"))
{
YY_BUFFER_STATE current =
cmDependsFortranLexer_GetCurrentBuffer(parser->Scanner);
diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx
index 6136baa..c30d4bd 100644
--- a/Source/cmDependsJavaParserHelper.cxx
+++ b/Source/cmDependsJavaParserHelper.cxx
@@ -13,6 +13,7 @@
#include "cmSystemTools.h"
#include "cmDependsJavaLexer.h"
+#include <cmsys/FStream.hxx>
int cmDependsJava_yyparse( yyscan_t yyscanner );
@@ -412,7 +413,7 @@ int cmDependsJavaParserHelper::ParseFile(const char* file)
{
return 0;
}
- std::ifstream ifs(file);
+ cmsys::ifstream ifs(file);
if ( !ifs )
{
return 0;
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 8576bf2..01f7a20 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -17,6 +17,7 @@
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
+#include <cmsys/FStream.hxx>
#include <ctype.h>
@@ -156,11 +157,11 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os)
this->CurrentArgument = i->Argument;
// If a file name was given, use it. Otherwise, default to the
// given stream.
- std::ofstream* fout = 0;
+ cmsys::ofstream* fout = 0;
std::ostream* s = &os;
if(i->Filename.length() > 0)
{
- fout = new std::ofstream(i->Filename.c_str(), std::ios::out);
+ fout = new cmsys::ofstream(i->Filename.c_str(), std::ios::out);
if(fout)
{
s = fout;
@@ -631,7 +632,7 @@ void cmDocumentation::PrintNames(std::ostream& os,
i != files.end(); ++i)
{
std::string line;
- std::ifstream fin(i->c_str());
+ cmsys::ifstream fin(i->c_str());
while(fin && cmSystemTools::GetLineFromStream(fin, line))
{
if(!line.empty() && (isalnum(line[0]) || line[0] == '<'))
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 30de9a8..353f2e9 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -13,6 +13,7 @@
#include "cmELF.h"
#include <cmsys/auto_ptr.hxx>
+#include <cmsys/FStream.hxx>
// Need the native byte order of the running CPU.
#define cmsys_CPU_UNKNOWN_OKAY // We can decide at runtime if not known.
@@ -71,7 +72,7 @@ public:
// Construct and take ownership of the file stream object.
cmELFInternal(cmELF* external,
- cmsys::auto_ptr<std::ifstream>& fin,
+ cmsys::auto_ptr<cmsys::ifstream>& fin,
ByteOrderType order):
External(external),
Stream(*fin.release()),
@@ -204,7 +205,7 @@ public:
// Construct with a stream and byte swap indicator.
cmELFInternalImpl(cmELF* external,
- cmsys::auto_ptr<std::ifstream>& fin,
+ cmsys::auto_ptr<cmsys::ifstream>& fin,
ByteOrderType order);
// Return the number of sections as specified by the ELF header.
@@ -462,7 +463,7 @@ private:
template <class Types>
cmELFInternalImpl<Types>
::cmELFInternalImpl(cmELF* external,
- cmsys::auto_ptr<std::ifstream>& fin,
+ cmsys::auto_ptr<cmsys::ifstream>& fin,
ByteOrderType order):
cmELFInternal(external, fin, order)
{
@@ -707,7 +708,7 @@ cmELFInternalImpl<Types>::GetDynamicSectionString(int tag)
cmELF::cmELF(const char* fname): Internal(0)
{
// Try to open the file.
- cmsys::auto_ptr<std::ifstream> fin(new std::ifstream(fname));
+ cmsys::auto_ptr<cmsys::ifstream> fin(new cmsys::ifstream(fname));
// Quit now if the file could not be opened.
if(!fin.get() || !*fin)
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 2a87e4f..d5f81ce 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -24,6 +24,7 @@
#include "cmComputeLinkInformation.h"
#include <cmsys/auto_ptr.hxx>
+#include <cmsys/FStream.hxx>
#include <assert.h>
//----------------------------------------------------------------------------
@@ -61,12 +62,12 @@ const char* cmExportFileGenerator::GetMainExportFileName() const
bool cmExportFileGenerator::GenerateImportFile()
{
// Open the output file to generate it.
- cmsys::auto_ptr<std::ofstream> foutPtr;
+ cmsys::auto_ptr<cmsys::ofstream> foutPtr;
if(this->AppendMode)
{
// Open for append.
- cmsys::auto_ptr<std::ofstream>
- ap(new std::ofstream(this->MainImportFile.c_str(), std::ios::app));
+ cmsys::auto_ptr<cmsys::ofstream>
+ ap(new cmsys::ofstream(this->MainImportFile.c_str(), std::ios::app));
foutPtr = ap;
}
else
diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx
index 064ffa3..4624e92 100644
--- a/Source/cmExportLibraryDependencies.cxx
+++ b/Source/cmExportLibraryDependencies.cxx
@@ -55,11 +55,11 @@ void cmExportLibraryDependenciesCommand::FinalPass()
void cmExportLibraryDependenciesCommand::ConstFinalPass() const
{
// Use copy-if-different if not appending.
- cmsys::auto_ptr<std::ofstream> foutPtr;
+ cmsys::auto_ptr<cmsys::ofstream> foutPtr;
if(this->Append)
{
- cmsys::auto_ptr<std::ofstream> ap(
- new std::ofstream(this->Filename.c_str(), std::ios::app));
+ cmsys::auto_ptr<cmsys::ofstream> ap(
+ new cmsys::ofstream(this->Filename.c_str(), std::ios::app));
foutPtr = ap;
}
else
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 '";
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 55c20d6..d051063 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1334,7 +1334,7 @@ void cmFindPackageCommand::LoadPackageRegistryDir(std::string const& dir)
cmFindPackageCommandHoldFile holdFile(fname.c_str());
// Load the file.
- std::ifstream fin(fname.c_str(), std::ios::in | cmsys_ios_binary);
+ cmsys::ifstream fin(fname.c_str(), std::ios::in | cmsys_ios_binary);
if(fin && this->CheckPackageRegistryEntry(fin))
{
// The file references an existing package, so release it.
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index 0af0753..34efc15 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/Source/cmGeneratedFileStream.cxx
@@ -213,7 +213,7 @@ int cmGeneratedFileStreamBase::CompressFile(const char* oldname,
{
return 0;
}
- FILE* ifs = fopen(oldname, "r");
+ FILE* ifs = cmsys::SystemTools::Fopen(oldname, "r");
if ( !ifs )
{
return 0;
diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h
index dac9c7b..99f3b47 100644
--- a/Source/cmGeneratedFileStream.h
+++ b/Source/cmGeneratedFileStream.h
@@ -13,6 +13,7 @@
#define cmGeneratedFileStream_h
#include "cmStandardIncludes.h"
+#include <cmsys/FStream.hxx>
#if defined(__sgi) && !defined(__GNUC__)
# pragma set woff 1375 /* base class destructor not virtual */
@@ -77,10 +78,10 @@ protected:
* being updated.
*/
class cmGeneratedFileStream: private cmGeneratedFileStreamBase,
- public std::ofstream
+ public cmsys::ofstream
{
public:
- typedef std::ofstream Stream;
+ typedef cmsys::ofstream Stream;
/**
* This constructor prepares a default stream. The open method must
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index cab99ed..bf85870 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -13,6 +13,7 @@
#include "cmGeneratorExpressionEvaluationFile.h"
#include "cmMakefile.h"
+#include <cmsys/FStream.hxx>
#include <assert.h>
@@ -78,7 +79,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(const char *config,
this->Files.push_back(outputFileName);
outputFiles[outputFileName] = outputContent;
- std::ofstream fout(outputFileName.c_str());
+ cmsys::ofstream fout(outputFileName.c_str());
if(!fout)
{
@@ -103,7 +104,7 @@ void cmGeneratorExpressionEvaluationFile::Generate()
}
else
{
- std::ifstream fin(this->Input.c_str());
+ cmsys::ifstream fin(this->Input.c_str());
if(!fin)
{
cmOStringStream e;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 3b858af..780b072 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -30,6 +30,7 @@
#include "cmExportBuildFileGenerator.h"
#include <cmsys/Directory.hxx>
+#include <cmsys/FStream.hxx>
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include <cmsys/MD5.h>
@@ -2747,9 +2748,9 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile,
std::string const& home)
{
#if defined(_WIN32) || defined(__CYGWIN__)
- std::ifstream fin(pfile.c_str(), std::ios::in | std::ios::binary);
+ cmsys::ifstream fin(pfile.c_str(), std::ios::in | std::ios::binary);
#else
- std::ifstream fin(pfile.c_str(), std::ios::in);
+ cmsys::ifstream fin(pfile.c_str(), std::ios::in);
#endif
if(!fin)
{
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index ab7db51..61ff45b 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -21,6 +21,7 @@
#include <cmsys/SystemTools.hxx>
#include <cmsys/Directory.hxx>
+#include <cmsys/FStream.hxx>
//----------------------------------------------------------------------------
void cmGlobalKdevelopGenerator
@@ -189,7 +190,7 @@ bool cmGlobalKdevelopGenerator
//check if the output file already exists and read it
//insert all files which exist into the set of files
- std::ifstream oldFilelist(filename.c_str());
+ cmsys::ifstream oldFilelist(filename.c_str());
if (oldFilelist)
{
while (cmSystemTools::GetLineFromStream(oldFilelist, tmp))
@@ -310,7 +311,7 @@ void cmGlobalKdevelopGenerator
const std::string& fileToOpen,
const std::string& sessionFilename)
{
- std::ifstream oldProjectFile(filename.c_str());
+ cmsys::ifstream oldProjectFile(filename.c_str());
if (!oldProjectFile)
{
this->CreateNewProjectFile(outputDir, projectDir, filename,
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
index 539d2af..16f05e5 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.cxx
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -13,6 +13,7 @@
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmake.h"
+#include <cmsys/FStream.hxx>
cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator()
{
@@ -27,7 +28,7 @@ cmGlobalMSYSMakefileGenerator::FindMinGW(std::string const& makeloc)
{
std::string fstab = makeloc;
fstab += "/../etc/fstab";
- std::ifstream fin(fstab.c_str());
+ cmsys::ifstream fin(fstab.c_str());
std::string path;
std::string mount;
std::string mingwBin;
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index 38c47ef..6c458c3 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -14,6 +14,7 @@
#include "cmMakefile.h"
#include "cmake.h"
#include "cmGeneratedFileStream.h"
+#include <cmsys/FStream.hxx>
// Utility function to make a valid VS6 *.dsp filename out
// of a CMake target name:
@@ -244,7 +245,7 @@ void cmGlobalVisualStudio6Generator
fname += "/";
fname += root->GetMakefile()->GetProjectName();
fname += ".dsw";
- std::ofstream fout(fname.c_str());
+ cmsys::ofstream fout(fname.c_str());
if(!fout)
{
cmSystemTools::Error("Error can not open DSW file for write: ",
diff --git a/Source/cmHexFileConverter.cxx b/Source/cmHexFileConverter.cxx
index a540825..6ea597e 100644
--- a/Source/cmHexFileConverter.cxx
+++ b/Source/cmHexFileConverter.cxx
@@ -166,7 +166,7 @@ cmHexFileConverter::FileType cmHexFileConverter::DetermineFileType(
const char* inFileName)
{
char buf[1024];
- FILE* inFile = fopen(inFileName, "rb");
+ FILE* inFile = cmsys::SystemTools::Fopen(inFileName, "rb");
if (inFile == 0)
{
return Binary;
@@ -223,8 +223,8 @@ bool cmHexFileConverter::TryConvert(const char* inFileName,
}
// try to open the file
- FILE* inFile = fopen(inFileName, "rb");
- FILE* outFile = fopen(outFileName, "wb");
+ FILE* inFile = cmsys::SystemTools::Fopen(inFileName, "rb");
+ FILE* outFile = cmsys::SystemTools::Fopen(outFileName, "wb");
if ((inFile == 0) || (outFile == 0))
{
if (inFile != 0)
diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c
index be27884..bfa388e 100644
--- a/Source/cmListFileLexer.c
+++ b/Source/cmListFileLexer.c
@@ -569,6 +569,9 @@ Modify cmListFileLexer.c:
*/
#include "cmStandardLexer.h"
+#ifdef WIN32
+#include <cmsys/Encoding.h>
+#endif
/* Setup the proper cmListFileLexer_yylex declaration. */
#define YY_EXTRA_TYPE cmListFileLexer*
@@ -612,7 +615,7 @@ static void cmListFileLexerDestroy(cmListFileLexer* lexer);
-#line 618 "cmListFileLexer.c"
+#line 621 "cmListFileLexer.c"
#define INITIAL 0
#define STRING 1
@@ -844,10 +847,10 @@ YY_DECL
int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-#line 88 "cmListFileLexer.in.l"
+#line 91 "cmListFileLexer.in.l"
-#line 855 "cmListFileLexer.c"
+#line 858 "cmListFileLexer.c"
if ( !yyg->yy_init )
{
@@ -945,7 +948,7 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
/* rule 1 can match eol */
YY_RULE_SETUP
-#line 90 "cmListFileLexer.in.l"
+#line 93 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_Newline;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -957,7 +960,7 @@ YY_RULE_SETUP
case 2:
/* rule 2 can match eol */
YY_RULE_SETUP
-#line 99 "cmListFileLexer.in.l"
+#line 102 "cmListFileLexer.in.l"
{
const char* bracket = yytext;
lexer->comment = yytext[0] == '#';
@@ -986,7 +989,7 @@ YY_RULE_SETUP
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 125 "cmListFileLexer.in.l"
+#line 128 "cmListFileLexer.in.l"
{
lexer->column += yyleng;
BEGIN(COMMENT);
@@ -994,14 +997,14 @@ YY_RULE_SETUP
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 130 "cmListFileLexer.in.l"
+#line 133 "cmListFileLexer.in.l"
{
lexer->column += yyleng;
}
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 134 "cmListFileLexer.in.l"
+#line 137 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ParenLeft;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1010,7 +1013,7 @@ YY_RULE_SETUP
}
case 6:
YY_RULE_SETUP
-#line 141 "cmListFileLexer.in.l"
+#line 144 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ParenRight;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1019,7 +1022,7 @@ YY_RULE_SETUP
}
case 7:
YY_RULE_SETUP
-#line 148 "cmListFileLexer.in.l"
+#line 151 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_Identifier;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1028,7 +1031,7 @@ YY_RULE_SETUP
}
case 8:
YY_RULE_SETUP
-#line 155 "cmListFileLexer.in.l"
+#line 158 "cmListFileLexer.in.l"
{
/* Handle ]]====]=======]*/
cmListFileLexerAppend(lexer, yytext, yyleng);
@@ -1041,7 +1044,7 @@ YY_RULE_SETUP
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 165 "cmListFileLexer.in.l"
+#line 168 "cmListFileLexer.in.l"
{
lexer->column += yyleng;
/* Erase the partial bracket from the token. */
@@ -1052,7 +1055,7 @@ YY_RULE_SETUP
}
case 10:
YY_RULE_SETUP
-#line 174 "cmListFileLexer.in.l"
+#line 177 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
@@ -1061,7 +1064,7 @@ YY_RULE_SETUP
case 11:
/* rule 11 can match eol */
YY_RULE_SETUP
-#line 179 "cmListFileLexer.in.l"
+#line 182 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
++lexer->line;
@@ -1071,7 +1074,7 @@ YY_RULE_SETUP
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 186 "cmListFileLexer.in.l"
+#line 189 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
@@ -1080,7 +1083,7 @@ YY_RULE_SETUP
YY_BREAK
case YY_STATE_EOF(BRACKET):
case YY_STATE_EOF(BRACKETEND):
-#line 192 "cmListFileLexer.in.l"
+#line 195 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_BadBracket;
BEGIN(INITIAL);
@@ -1088,7 +1091,7 @@ case YY_STATE_EOF(BRACKETEND):
}
case 13:
YY_RULE_SETUP
-#line 198 "cmListFileLexer.in.l"
+#line 201 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1097,7 +1100,7 @@ YY_RULE_SETUP
}
case 14:
YY_RULE_SETUP
-#line 205 "cmListFileLexer.in.l"
+#line 208 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1106,7 +1109,7 @@ YY_RULE_SETUP
}
case 15:
YY_RULE_SETUP
-#line 212 "cmListFileLexer.in.l"
+#line 215 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ArgumentQuoted;
cmListFileLexerSetToken(lexer, "", 0);
@@ -1116,7 +1119,7 @@ YY_RULE_SETUP
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 219 "cmListFileLexer.in.l"
+#line 222 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
@@ -1125,7 +1128,7 @@ YY_RULE_SETUP
case 17:
/* rule 17 can match eol */
YY_RULE_SETUP
-#line 224 "cmListFileLexer.in.l"
+#line 227 "cmListFileLexer.in.l"
{
/* Continuation: text is not part of string */
++lexer->line;
@@ -1135,7 +1138,7 @@ YY_RULE_SETUP
case 18:
/* rule 18 can match eol */
YY_RULE_SETUP
-#line 230 "cmListFileLexer.in.l"
+#line 233 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
++lexer->line;
@@ -1144,7 +1147,7 @@ YY_RULE_SETUP
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 236 "cmListFileLexer.in.l"
+#line 239 "cmListFileLexer.in.l"
{
lexer->column += yyleng;
BEGIN(INITIAL);
@@ -1152,14 +1155,14 @@ YY_RULE_SETUP
}
case 20:
YY_RULE_SETUP
-#line 242 "cmListFileLexer.in.l"
+#line 245 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
}
YY_BREAK
case YY_STATE_EOF(STRING):
-#line 247 "cmListFileLexer.in.l"
+#line 250 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_BadString;
BEGIN(INITIAL);
@@ -1167,7 +1170,7 @@ case YY_STATE_EOF(STRING):
}
case 21:
YY_RULE_SETUP
-#line 253 "cmListFileLexer.in.l"
+#line 256 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_Space;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1176,7 +1179,7 @@ YY_RULE_SETUP
}
case 22:
YY_RULE_SETUP
-#line 260 "cmListFileLexer.in.l"
+#line 263 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_BadCharacter;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1185,7 +1188,7 @@ YY_RULE_SETUP
}
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(COMMENT):
-#line 267 "cmListFileLexer.in.l"
+#line 270 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_None;
cmListFileLexerSetToken(lexer, 0, 0);
@@ -1193,10 +1196,10 @@ case YY_STATE_EOF(COMMENT):
}
case 23:
YY_RULE_SETUP
-#line 273 "cmListFileLexer.in.l"
+#line 276 "cmListFileLexer.in.l"
ECHO;
YY_BREAK
-#line 1217 "cmListFileLexer.c"
+#line 1220 "cmListFileLexer.c"
case YY_END_OF_BUFFER:
{
@@ -2317,7 +2320,7 @@ void cmListFileLexer_yyfree (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
-#line 273 "cmListFileLexer.in.l"
+#line 276 "cmListFileLexer.in.l"
@@ -2542,7 +2545,13 @@ int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name,
cmListFileLexerDestroy(lexer);
if(name)
{
+#ifdef _WIN32
+ wchar_t* wname = cmsysEncoding_DupToWide(name);
+ lexer->file = _wfopen(wname, L"rb");
+ free(wname);
+#else
lexer->file = fopen(name, "rb");
+#endif
if(lexer->file)
{
if(bom)
diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l
index d45a8ea..ed4bf6b 100644
--- a/Source/cmListFileLexer.in.l
+++ b/Source/cmListFileLexer.in.l
@@ -31,6 +31,9 @@ Modify cmListFileLexer.c:
*/
#include "cmStandardLexer.h"
+#ifdef WIN32
+#include <cmsys/Encoding.h>
+#endif
/* Setup the proper cmListFileLexer_yylex declaration. */
#define YY_EXTRA_TYPE cmListFileLexer*
@@ -493,7 +496,13 @@ int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name,
cmListFileLexerDestroy(lexer);
if(name)
{
+#ifdef _WIN32
+ wchar_t* wname = cmsysEncoding_DupToWide(name);
+ lexer->file = _wfopen(wname, L"rb");
+ free(wname);
+#else
lexer->file = fopen(name, "rb");
+#endif
if(lexer->file)
{
if(bom)
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index 462e086..dfd98fa 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -12,6 +12,7 @@
#include "cmLoadCacheCommand.h"
#include <cmsys/RegularExpression.hxx>
+#include <cmsys/FStream.hxx>
// cmLoadCacheCommand
bool cmLoadCacheCommand
@@ -115,7 +116,7 @@ bool cmLoadCacheCommand::ReadWithPrefix(std::vector<std::string> const& args)
}
// Read the cache file.
- std::ifstream fin(cacheFile.c_str());
+ cmsys::ifstream fin(cacheFile.c_str());
// This is a big hack read loop to overcome a buggy ifstream
// implementation on HP-UX. This should work on all platforms even
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 20e8eea..93722d1 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1172,7 +1172,7 @@ cmLocalUnixMakefileGenerator3
}
cleanfile += ".cmake";
std::string cleanfilePath = this->Convert(cleanfile.c_str(), FULL);
- std::ofstream fout(cleanfilePath.c_str());
+ cmsys::ofstream fout(cleanfilePath.c_str());
if(!fout)
{
cmSystemTools::Error("Could not create ", cleanfilePath.c_str());
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index a665b93..8eeb89a 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -21,6 +21,7 @@
#include "cmComputeLinkInformation.h"
#include <cmsys/RegularExpression.hxx>
+#include <cmsys/FStream.hxx>
cmLocalVisualStudio6Generator::cmLocalVisualStudio6Generator():
cmLocalVisualStudioGenerator(VS6)
@@ -200,7 +201,7 @@ void cmLocalVisualStudio6Generator::CreateSingleDSP(const char *lname,
// save the name of the real dsp file
std::string realDSP = fname;
fname += ".cmake";
- std::ofstream fout(fname.c_str());
+ cmsys::ofstream fout(fname.c_str());
if(!fout)
{
cmSystemTools::Error("Error Writing ", fname.c_str());
@@ -336,11 +337,11 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
std::string path = cmSystemTools::GetFilenamePath(source);
cmSystemTools::MakeDirectory(path.c_str());
#if defined(_WIN32) || defined(__CYGWIN__)
- std::ofstream sourceFout(source.c_str(),
+ cmsys::ofstream sourceFout(source.c_str(),
std::ios::binary | std::ios::out
| std::ios::trunc);
#else
- std::ofstream sourceFout(source.c_str(),
+ cmsys::ofstream sourceFout(source.c_str(),
std::ios::out | std::ios::trunc);
#endif
if(sourceFout)
@@ -758,7 +759,7 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b,
// once the build type is set, determine what configurations are
// possible
- std::ifstream fin(this->DSPHeaderTemplate.c_str());
+ cmsys::ifstream fin(this->DSPHeaderTemplate.c_str());
cmsys::RegularExpression reg("# Name ");
if(!fin)
@@ -1452,7 +1453,7 @@ void cmLocalVisualStudio6Generator
std::string customRuleCodeRelWithDebInfo
= this->CreateTargetRules(target, "RELWITHDEBINFO", libName);
- std::ifstream fin(this->DSPHeaderTemplate.c_str());
+ cmsys::ifstream fin(this->DSPHeaderTemplate.c_str());
if(!fin)
{
cmSystemTools::Error("Error Reading ", this->DSPHeaderTemplate.c_str());
@@ -1785,7 +1786,7 @@ void cmLocalVisualStudio6Generator
void cmLocalVisualStudio6Generator::WriteDSPFooter(std::ostream& fout)
{
- std::ifstream fin(this->DSPFooterTemplate.c_str());
+ cmsys::ifstream fin(this->DSPFooterTemplate.c_str());
if(!fin)
{
cmSystemTools::Error("Error Reading ",
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 14832e5..b645f8f 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -205,7 +205,7 @@ void cmLocalVisualStudio7Generator::WriteStampFiles()
cmSystemTools::MakeDirectory(stampName.c_str());
stampName += "/";
stampName += "generate.stamp";
- std::ofstream stamp(stampName.c_str());
+ cmsys::ofstream stamp(stampName.c_str());
stamp << "# CMake generation timestamp file for this directory.\n";
// Create a helper file so CMake can determine when it is run
@@ -216,7 +216,7 @@ void cmLocalVisualStudio7Generator::WriteStampFiles()
// the stamp file can just be touched.
std::string depName = stampName;
depName += ".depend";
- std::ofstream depFile(depName.c_str());
+ cmsys::ofstream depFile(depName.c_str());
depFile << "# CMake generation dependency list for this directory.\n";
std::vector<std::string> const& listFiles = this->Makefile->GetListFiles();
for(std::vector<std::string>::const_iterator lf = listFiles.begin();
@@ -1826,7 +1826,7 @@ WriteCustomRule(std::ostream& fout,
// make sure the rule runs reliably.
if(!cmSystemTools::FileExists(source))
{
- std::ofstream depout(source);
+ cmsys::ofstream depout(source);
depout << "Artificial dependency for a custom command.\n";
}
fout << this->ConvertToXMLOutputPath(source);
diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx
index 2ae35ef..615e6f2 100644
--- a/Source/cmMakeDepend.cxx
+++ b/Source/cmMakeDepend.cxx
@@ -14,6 +14,7 @@
#include "cmGeneratorExpression.h"
#include <cmsys/RegularExpression.hxx>
+#include <cmsys/FStream.hxx>
void cmDependInformation::AddDependencies(cmDependInformation* info)
{
@@ -217,7 +218,7 @@ void cmMakeDepend::DependWalk(cmDependInformation* info)
{
cmsys::RegularExpression includeLine
("^[ \t]*#[ \t]*include[ \t]*[<\"]([^\">]+)[\">]");
- std::ifstream fin(info->FullPath.c_str());
+ cmsys::ifstream fin(info->FullPath.c_str());
if(!fin)
{
cmSystemTools::Error("Cannot open ", info->FullPath.c_str());
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 30a1557..401ea5b 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -34,7 +34,7 @@
#include <stdlib.h> // required for atoi
#include <cmsys/RegularExpression.hxx>
-
+#include <cmsys/FStream.hxx>
#include <cmsys/auto_ptr.hxx>
#include <stack>
@@ -3499,7 +3499,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
}
std::string tempOutputFile = soutfile;
tempOutputFile += ".tmp";
- std::ofstream fout(tempOutputFile.c_str(), omode);
+ cmsys::ofstream fout(tempOutputFile.c_str(), omode);
if(!fout)
{
cmSystemTools::Error(
@@ -3508,7 +3508,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
cmSystemTools::ReportLastSystemError("");
return 0;
}
- std::ifstream fin(sinfile.c_str());
+ cmsys::ifstream fin(sinfile.c_str());
if(!fin)
{
cmSystemTools::Error("Could not open file for read in copy operation ",
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 44aaa66..d9fc93c 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -957,7 +957,6 @@ private:
bool EnforceUniqueDir(const char* srcPath, const char* binPath);
- void ReadSources(std::ifstream& fin, bool t);
friend class cmMakeDepend; // make depend needs direct access
// to the Sources array
void PrintStringVector(const char* s, const
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index 5de36ed..c0d9e99 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -11,6 +11,7 @@
============================================================================*/
#include "cmOutputRequiredFilesCommand.h"
#include "cmMakeDepend.h"
+#include <cmsys/FStream.hxx>
class cmLBDepend : public cmMakeDepend
{
@@ -22,7 +23,7 @@ class cmLBDepend : public cmMakeDepend
void cmLBDepend::DependWalk(cmDependInformation* info)
{
- std::ifstream fin(info->FullPath.c_str());
+ cmsys::ifstream fin(info->FullPath.c_str());
if(!fin)
{
cmSystemTools::Error("error can not open ", info->FullPath.c_str());
@@ -196,7 +197,7 @@ bool cmOutputRequiredFilesCommand
if (info)
{
// write them out
- FILE *fout = fopen(this->OutputFile.c_str(),"w");
+ FILE *fout = cmsys::SystemTools::Fopen(this->OutputFile.c_str(),"w");
if(!fout)
{
std::string err = "Can not open output file: ";
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index abf20cb..bd7e75a 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -23,6 +23,7 @@
#include <cmsys/Terminal.h>
#include <cmsys/ios/sstream>
+#include <cmsys/FStream.hxx>
#include <assert.h>
#include <string.h>
@@ -396,7 +397,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target)
|| !configIncludes.empty()
|| !configUicOptions.empty())
{
- std::ofstream infoFile(outputFile.c_str(), std::ios::app);
+ cmsys::ofstream infoFile(outputFile.c_str(), std::ios::app);
if ( !infoFile )
{
std::string error = "Internal CMake error when trying to open file: ";
@@ -2111,7 +2112,7 @@ bool cmQtAutoGenerators::EndsWith(const std::string& str,
std::string cmQtAutoGenerators::ReadAll(const std::string& filename)
{
- std::ifstream file(filename.c_str());
+ cmsys::ifstream file(filename.c_str());
cmsys_ios::stringstream stream;
stream << file.rdbuf();
file.close();
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index 3aa8e1b..11a9913 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -13,7 +13,7 @@
#include "cmSystemTools.h"
#include "cmVersion.h"
-
+#include <cmsys/FStream.hxx>
#include <ctype.h>
//----------------------------------------------------------------------------
@@ -52,7 +52,7 @@ cmRST::cmRST(std::ostream& os, std::string const& docroot):
//----------------------------------------------------------------------------
bool cmRST::ProcessFile(std::string const& fname, bool isModule)
{
- std::ifstream fin(fname.c_str());
+ cmsys::ifstream fin(fname.c_str());
if(fin)
{
this->DocDir = cmSystemTools::GetFilenamePath(fname);
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index b8163c8..e8e2007 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -32,6 +32,7 @@
# include <cmsys/Terminal.h>
#endif
#include <cmsys/stl/algorithm>
+#include <cmsys/FStream.hxx>
#if defined(_WIN32)
# include <windows.h>
@@ -1432,7 +1433,7 @@ bool cmSystemTools::CreateTar(const char* outFileName,
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
- std::ofstream fout(outFileName, std::ios::out | cmsys_ios_binary);
+ cmsys::ofstream fout(outFileName, std::ios::out | cmsys_ios_binary);
if(!fout)
{
std::string e = "Cannot open output file \"";
@@ -2037,7 +2038,7 @@ unsigned int cmSystemTools::RandomSeed()
} seed;
// Try using a real random source.
- std::ifstream fin("/dev/urandom");
+ cmsys::ifstream fin("/dev/urandom");
if(fin && fin.read(seed.bytes, sizeof(seed)) &&
fin.gcount() == sizeof(seed))
{
@@ -2160,7 +2161,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
// Build tree has "<build>/bin[/<config>]/cmake" and
// "<build>/CMakeFiles/CMakeSourceDir.txt".
std::string src_dir_txt = dir + "/CMakeFiles/CMakeSourceDir.txt";
- std::ifstream fin(src_dir_txt.c_str());
+ cmsys::ifstream fin(src_dir_txt.c_str());
std::string src_dir;
if(fin && cmSystemTools::GetLineFromStream(fin, src_dir) &&
cmSystemTools::FileIsDirectory(src_dir.c_str()))
@@ -2171,7 +2172,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
{
dir = cmSystemTools::GetFilenamePath(dir);
src_dir_txt = dir + "/CMakeFiles/CMakeSourceDir.txt";
- std::ifstream fin2(src_dir_txt.c_str());
+ cmsys::ifstream fin2(src_dir_txt.c_str());
if(fin2 && cmSystemTools::GetLineFromStream(fin2, src_dir) &&
cmSystemTools::FileIsDirectory(src_dir.c_str()))
{
@@ -2506,7 +2507,7 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
{
// Open the file for update.
- std::ofstream f(file.c_str(),
+ cmsys::ofstream f(file.c_str(),
std::ios::in | std::ios::out | std::ios::binary);
if(!f)
{
@@ -2704,7 +2705,7 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
}
// Open the file for update.
- std::ofstream f(file.c_str(),
+ cmsys::ofstream f(file.c_str(),
std::ios::in | std::ios::out | std::ios::binary);
if(!f)
{
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 879d4fd..cfedaa5 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -12,6 +12,7 @@
#include "cmTryRunCommand.h"
#include "cmCacheManager.h"
#include "cmTryCompileCommand.h"
+#include <cmsys/FStream.hxx>
// cmTryRunCommand
bool cmTryRunCommand
@@ -302,7 +303,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
if (error)
{
static bool firstTryRun = true;
- std::ofstream file(resultFileName.c_str(),
+ cmsys::ofstream file(resultFileName.c_str(),
firstTryRun ? std::ios::out : std::ios::app);
if ( file )
{
diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx
index 1bd579d..d4ec20f 100644
--- a/Source/cmUseMangledMesaCommand.cxx
+++ b/Source/cmUseMangledMesaCommand.cxx
@@ -13,6 +13,7 @@
#include "cmSystemTools.h"
#include <cmsys/RegularExpression.hxx>
+#include <cmsys/FStream.hxx>
bool cmUseMangledMesaCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
@@ -73,7 +74,7 @@ CopyAndFullPathMesaHeader(const char* source,
outFile += file;
std::string tempOutputFile = outFile;
tempOutputFile += ".tmp";
- std::ofstream fout(tempOutputFile.c_str());
+ cmsys::ofstream fout(tempOutputFile.c_str());
if(!fout)
{
cmSystemTools::Error("Could not open file for write in copy operation: ",
@@ -81,7 +82,7 @@ CopyAndFullPathMesaHeader(const char* source,
cmSystemTools::ReportLastSystemError("");
return;
}
- std::ifstream fin(source);
+ cmsys::ifstream fin(source);
if(!fin)
{
cmSystemTools::Error("Could not open file for read in copy operation",
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index b9ae701..784cadb 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -596,7 +596,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
// Make sure the path exists for the file
std::string path = cmSystemTools::GetFilenamePath(sourcePath);
cmSystemTools::MakeDirectory(path.c_str());
- std::ofstream fout(sourcePath.c_str());
+ cmsys::ofstream fout(sourcePath.c_str());
if(fout)
{
fout << "# generated from CMake\n";
diff --git a/Source/cmVisualStudioSlnParser.cxx b/Source/cmVisualStudioSlnParser.cxx
index bae5974..d182a75 100644
--- a/Source/cmVisualStudioSlnParser.cxx
+++ b/Source/cmVisualStudioSlnParser.cxx
@@ -13,6 +13,7 @@
#include "cmSystemTools.h"
#include "cmVisualStudioSlnData.h"
+#include <cmsys/FStream.hxx>
#include <cassert>
#include <stack>
@@ -472,7 +473,7 @@ bool cmVisualStudioSlnParser::ParseFile(const std::string& file,
this->LastResult.SetError(ResultErrorUnsupportedDataGroup, 0);
return false;
}
- std::ifstream f(file.c_str());
+ cmsys::ifstream f(file.c_str());
if (!f)
{
this->LastResult.SetError(ResultErrorOpeningInput, 0);
diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx
index 3642c6f..aa6b9f8 100644
--- a/Source/cmWriteFileCommand.cxx
+++ b/Source/cmWriteFileCommand.cxx
@@ -10,6 +10,7 @@
See the License for more information.
============================================================================*/
#include "cmWriteFileCommand.h"
+#include <cmsys/FStream.hxx>
#include <sys/types.h>
#include <sys/stat.h>
@@ -71,7 +72,7 @@ bool cmWriteFileCommand
}
// If GetPermissions fails, pretend like it is ok. File open will fail if
// the file is not writable
- std::ofstream file(fileName.c_str(),
+ cmsys::ofstream file(fileName.c_str(),
overwrite?std::ios::out : std::ios::app);
if ( !file )
{
diff --git a/Source/cmXMLParser.cxx b/Source/cmXMLParser.cxx
index 882fc17..0c53440 100644
--- a/Source/cmXMLParser.cxx
+++ b/Source/cmXMLParser.cxx
@@ -10,6 +10,7 @@
See the License for more information.
============================================================================*/
#include "cmXMLParser.h"
+#include <cmsys/FStream.hxx>
#include <cm_expat.h>
#include <ctype.h>
@@ -45,7 +46,7 @@ int cmXMLParser::ParseFile(const char* file)
return 0;
}
- std::ifstream ifs(file);
+ cmsys::ifstream ifs(file);
if ( !ifs )
{
return 0;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 741e263..1dd8a66 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -28,6 +28,7 @@
#include <cmsys/Glob.hxx>
#include <cmsys/RegularExpression.hxx>
+#include <cmsys/FStream.hxx>
// only build kdevelop generator on non-windows platforms
// when not bootstrapping cmake
@@ -1861,7 +1862,7 @@ void cmake::UpdateConversionPathTable()
if(tablepath)
{
- std::ifstream table( tablepath );
+ cmsys::ifstream table( tablepath );
if(!table)
{
cmSystemTools::Error("CMAKE_PATH_TRANSLATION_FILE set to ", tablepath,
@@ -2387,7 +2388,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
// echo results to stdout if needed
if (writeToStdout)
{
- FILE* fin = fopen(resultFile.c_str(), "r");
+ FILE* fin = cmsys::SystemTools::Fopen(resultFile.c_str(), "r");
if(fin)
{
const int bufferSize = 4096;
@@ -2421,9 +2422,9 @@ static bool cmakeCheckStampFile(const char* stampName)
std::string stampDepends = stampName;
stampDepends += ".depend";
#if defined(_WIN32) || defined(__CYGWIN__)
- std::ifstream fin(stampDepends.c_str(), std::ios::in | std::ios::binary);
+ cmsys::ifstream fin(stampDepends.c_str(), std::ios::in | std::ios::binary);
#else
- std::ifstream fin(stampDepends.c_str(), std::ios::in);
+ cmsys::ifstream fin(stampDepends.c_str(), std::ios::in);
#endif
if(!fin)
{
@@ -2464,7 +2465,7 @@ static bool cmakeCheckStampFile(const char* stampName)
{
// TODO: Teach cmGeneratedFileStream to use a random temp file (with
// multiple tries in unlikely case of conflict) and use that here.
- std::ofstream stamp(stampTemp);
+ cmsys::ofstream stamp(stampTemp);
stamp << "# CMake generation timestamp file for this directory.\n";
}
if(cmSystemTools::RenameFile(stampTemp, stampName))
@@ -2494,7 +2495,7 @@ static bool cmakeCheckStampList(const char* stampList)
<< "is missing.\n";
return false;
}
- std::ifstream fin(stampList);
+ cmsys::ifstream fin(stampList);
if(!fin)
{
std::cout << "CMake is re-running because generate.stamp.list "
diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx
index 0675470..faa5fa7 100644
--- a/Source/cmcldeps.cxx
+++ b/Source/cmcldeps.cxx
@@ -139,7 +139,7 @@ static void outputDepFile(const std::string& dfile, const std::string& objfile,
std::sort(incs.begin(), incs.end());
incs.erase(std::unique(incs.begin(), incs.end()), incs.end());
- FILE* out = fopen(dfile.c_str(), "wb");
+ FILE* out = cmsys::SystemTools::Fopen(dfile.c_str(), "wb");
// FIXME should this be fatal or not? delete obj? delete d?
if (!out)
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index d3b7b5f..7891969 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -23,6 +23,7 @@
#include <cmsys/Directory.hxx>
#include <cmsys/Process.h>
+#include <cmsys/FStream.hxx>
#if defined(CMAKE_HAVE_VS_GENERATORS)
#include "cmCallVisualStudioMacro.h"
@@ -376,7 +377,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
cmSystemTools::RemoveADirectory(dirName.c_str());
// is the last argument a filename that exists?
- FILE *countFile = fopen(args[3].c_str(),"r");
+ FILE *countFile = cmsys::SystemTools::Fopen(args[3].c_str(),"r");
int count;
if (countFile)
{
@@ -396,7 +397,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// write the count into the directory
std::string fName = dirName;
fName += "/count.txt";
- FILE *progFile = fopen(fName.c_str(),"w");
+ FILE *progFile = cmsys::SystemTools::Fopen(fName.c_str(),"w");
if (progFile)
{
fprintf(progFile,"%i\n",count);
@@ -417,7 +418,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// read the count
fName = dirName;
fName += "/count.txt";
- progFile = fopen(fName.c_str(),"r");
+ progFile = cmsys::SystemTools::Fopen(fName.c_str(),"r");
int count = 0;
if (!progFile)
{
@@ -437,7 +438,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
fName = dirName;
fName += "/";
fName += args[i];
- progFile = fopen(fName.c_str(),"w");
+ progFile = cmsys::SystemTools::Fopen(fName.c_str(),"w");
if (progFile)
{
fprintf(progFile,"empty");
@@ -946,7 +947,7 @@ int cmcmd::ExecuteLinkScript(std::vector<std::string>& args)
cmsysProcess_SetOption(cp, cmsysProcess_Option_Verbatim, 1);
// Read command lines from the script.
- std::ifstream fin(args[2].c_str());
+ cmsys::ifstream fin(args[2].c_str());
if(!fin)
{
std::cerr << "Error opening link script \""
@@ -1057,7 +1058,7 @@ int cmcmd::VisualStudioLink(std::vector<std::string>& args, int type)
// check for nmake temporary files
if((*i)[0] == '@' && i->find("@CMakeFiles") != 0 )
{
- std::ifstream fin(i->substr(1).c_str());
+ cmsys::ifstream fin(i->substr(1).c_str());
std::string line;
while(cmSystemTools::GetLineFromStream(fin,
line))
@@ -1229,7 +1230,7 @@ int cmcmd::VisualStudioLinkIncremental(std::vector<std::string>& args,
std::cout << "Create " << resourceInputFile.c_str() << "\n";
}
// Create input file for rc command
- std::ofstream fout(resourceInputFile.c_str());
+ cmsys::ofstream fout(resourceInputFile.c_str());
if(!fout)
{
return -1;
@@ -1252,7 +1253,7 @@ int cmcmd::VisualStudioLinkIncremental(std::vector<std::string>& args,
{
std::cout << "Create empty: " << manifestFile.c_str() << "\n";
}
- std::ofstream foutTmp(manifestFile.c_str());
+ cmsys::ofstream foutTmp(manifestFile.c_str());
}
std::string resourceFile = manifestFile;
resourceFile += ".res";