[colobot] 90/390: Also fixed the same thing in file writing code

Didier Raboud odyx at moszumanska.debian.org
Fri Jun 12 14:21:32 UTC 2015


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch upstream/latest
in repository colobot.

commit b85a41b42a2f95555ceaa985789ec7608085790c
Author: krzys-h <krzys_h at interia.pl>
Date:   Wed Oct 15 21:31:43 2014 +0200

    Also fixed the same thing in file writing code
---
 src/common/profile.cpp | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/common/profile.cpp b/src/common/profile.cpp
index c43cd75..92fc1d6 100644
--- a/src/common/profile.cpp
+++ b/src/common/profile.cpp
@@ -59,7 +59,7 @@ bool CProfile::Init()
     try
     {
         std::unique_ptr<std::istream> stream;
-        bool good = false;
+        bool good;
         if (m_useCurrentDirectory)
         {
             std::ifstream* inputStream = new std::ifstream("./colobot.ini");
@@ -98,16 +98,21 @@ bool CProfile::Save()
         try
         {
             std::unique_ptr<std::ostream> stream;
+            bool good;
             if (m_useCurrentDirectory)
             {
-                stream = std::unique_ptr<std::ostream>(new std::ofstream("./colobot.ini"));
+                std::ofstream* outputStream = new std::ofstream("./colobot.ini");
+                stream = std::unique_ptr<std::ostream>(outputStream);
+                good = outputStream->good();
             }
             else
             {
-                stream = std::unique_ptr<std::ostream>(new COutputStream("colobot.ini"));
+                COutputStream* outputStream = new COutputStream("colobot.ini");
+                stream = std::unique_ptr<std::ostream>(outputStream);
+                good = outputStream->is_open();
             }
 
-            if (stream->good())
+            if (good)
             {
                 bp::ini_parser::write_ini(*stream, m_propertyTree);
             }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list