1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-19 00:17:56 +02:00

Fix issues reported by Sonar, review fixes

This commit is contained in:
Ivan Savenko
2025-04-21 18:41:01 +03:00
parent f3a57f754c
commit 4e8e85e3e4
26 changed files with 94 additions and 107 deletions

View File

@ -15,12 +15,11 @@ VCMI_LIB_NAMESPACE_BEGIN
CSaveFile::CSaveFile(const boost::filesystem::path &fname)
: serializer(this)
, sfile(fname.c_str(), std::ios::out | std::ios::binary)
, fName(fname)
{
sfile.exceptions(std::ifstream::failbit | std::ifstream::badbit); //we throw a lot anyway
if(!sfile)
throw std::runtime_error("Error: cannot open file '" + fName.string() + "' for writing!");
throw std::runtime_error("Error: cannot open file '" + fname.string() + "' for writing!");
sfile.write("VCMI", 4); //write magic identifier
serializer & ESerializationVersion::CURRENT; //write format version