Remove redundant arguments from fstream constructors

Don't pass the default value of the openmode parameter explicitly.
This commit is contained in:
Daniel Pfeifer 2016-06-13 22:56:48 +02:00
parent eb79fa7260
commit ab8b77dd33
8 changed files with 10 additions and 12 deletions

View File

@ -633,8 +633,8 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
cmsys::ifstream finModFile(modFile, 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); cmsys::ifstream finStampFile(stampFile, std::ios::in | std::ios::binary);
#else #else
cmsys::ifstream finModFile(modFile, std::ios::in); cmsys::ifstream finModFile(modFile);
cmsys::ifstream finStampFile(stampFile, std::ios::in); cmsys::ifstream finStampFile(stampFile);
#endif #endif
if (!finModFile || !finStampFile) { if (!finModFile || !finStampFile) {
// At least one of the files does not exist. The modules differ. // At least one of the files does not exist. The modules differ.

View File

@ -140,7 +140,7 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os)
cmsys::ofstream* fout = 0; cmsys::ofstream* fout = 0;
std::ostream* s = &os; std::ostream* s = &os;
if (!i->Filename.empty()) { if (!i->Filename.empty()) {
fout = new cmsys::ofstream(i->Filename.c_str(), std::ios::out); fout = new cmsys::ofstream(i->Filename.c_str());
if (fout) { if (fout) {
s = fout; s = fout;
} else { } else {

View File

@ -257,7 +257,7 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args)
fileName.c_str(), std::ios::in | fileName.c_str(), std::ios::in |
(hexOutputArg.IsEnabled() ? std::ios::binary : std::ios::in)); (hexOutputArg.IsEnabled() ? std::ios::binary : std::ios::in));
#else #else
cmsys::ifstream file(fileName.c_str(), std::ios::in); cmsys::ifstream file(fileName.c_str());
#endif #endif
if (!file) { if (!file) {
@ -526,7 +526,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
#if defined(_WIN32) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__CYGWIN__)
cmsys::ifstream fin(fileName.c_str(), std::ios::in | std::ios::binary); cmsys::ifstream fin(fileName.c_str(), std::ios::in | std::ios::binary);
#else #else
cmsys::ifstream fin(fileName.c_str(), std::ios::in); cmsys::ifstream fin(fileName.c_str());
#endif #endif
if (!fin) { if (!fin) {
std::ostringstream e; std::ostringstream e;

View File

@ -56,7 +56,7 @@ cmGeneratedFileStream& cmGeneratedFileStream::Open(const char* name,
this->Stream::open(this->TempName.c_str(), this->Stream::open(this->TempName.c_str(),
std::ios::out | std::ios::binary); std::ios::out | std::ios::binary);
} else { } else {
this->Stream::open(this->TempName.c_str(), std::ios::out); this->Stream::open(this->TempName.c_str());
} }
// Check if the file opened. // Check if the file opened.

View File

@ -2571,7 +2571,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile,
#if defined(_WIN32) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__CYGWIN__)
cmsys::ifstream fin(pfile.c_str(), std::ios::in | std::ios::binary); cmsys::ifstream fin(pfile.c_str(), std::ios::in | std::ios::binary);
#else #else
cmsys::ifstream fin(pfile.c_str(), std::ios::in); cmsys::ifstream fin(pfile.c_str());
#endif #endif
if (!fin) { if (!fin) {
return; return;

View File

@ -2094,7 +2094,7 @@ static bool cmakeCheckStampFile(const char* stampName)
#if defined(_WIN32) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__CYGWIN__)
cmsys::ifstream fin(stampDepends.c_str(), std::ios::in | std::ios::binary); cmsys::ifstream fin(stampDepends.c_str(), std::ios::in | std::ios::binary);
#else #else
cmsys::ifstream fin(stampDepends.c_str(), std::ios::in); cmsys::ifstream fin(stampDepends.c_str());
#endif #endif
if (!fin) { if (!fin) {
// The stamp dependencies file cannot be read. Just assume the // The stamp dependencies file cannot be read. Just assume the

View File

@ -5,8 +5,7 @@
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
std::fstream fout; std::ofstream fout("commandoutput.h");
fout.open("commandoutput.h", std::ios::out);
if (!fout) if (!fout)
return 1; return 1;
fout << "#define COMMANDOUTPUT_DEFINE\n"; fout << "#define COMMANDOUTPUT_DEFINE\n";

View File

@ -3,8 +3,7 @@
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
std::fstream fout; std::ofstream fout("targetoutput.h");
fout.open("targetoutput.h", std::ios::out);
if (!fout) if (!fout)
return 1; return 1;
fout << "#define TARGETOUTPUT_DEFINE\n"; fout << "#define TARGETOUTPUT_DEFINE\n";