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.
This commit is contained in:
Clinton Stimpson 2014-01-03 22:47:13 -07:00 committed by Brad King
parent 7fb2b80662
commit 5730710c86
75 changed files with 292 additions and 228 deletions

View File

@ -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;

View File

@ -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))

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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())
{

View File

@ -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,

View File

@ -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

View File

@ -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) )
{

View File

@ -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;

View File

@ -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;

View File

@ -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')
{

View File

@ -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);

View File

@ -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;

View File

@ -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";

View File

@ -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))
{

View File

@ -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;

View File

@ -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))

View File

@ -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: "

View File

@ -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);

View File

@ -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
*/

View File

@ -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,

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
};

View File

@ -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,

View File

@ -11,7 +11,7 @@
============================================================================*/
#include "cmCursesForm.h"
std::ofstream cmCursesForm::DebugFile;
cmsys::ofstream cmCursesForm::DebugFile;
bool cmCursesForm::Debug = false;
cmCursesForm::cmCursesForm()

View File

@ -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);

View File

@ -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 \"";

View File

@ -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

View File

@ -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

View File

@ -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. ",

View File

@ -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;

View File

@ -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 "";

View File

@ -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.

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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] == '<'))

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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 '";

View File

@ -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.

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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)
{

View File

@ -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,

View File

@ -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;

View File

@ -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: ",

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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());

View File

@ -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 ",

View File

@ -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);

View File

@ -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());

View File

@ -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 ",

View File

@ -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

View File

@ -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: ";

View File

@ -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();

View File

@ -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);

View File

@ -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)
{

View File

@ -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 )
{

View File

@ -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",

View File

@ -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";

View File

@ -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);

View File

@ -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 )
{

View File

@ -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;

View File

@ -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 "

View File

@ -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)

View File

@ -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";