[Supertux-Commit] [tinygettext commit] r151 - branches/tinygettext-portable/src

codesite-noreply at google.com codesite-noreply at google.com
Tue Feb 10 02:42:42 PST 2009


Author: grumbel
Date: Tue Feb 10 02:04:57 2009
New Revision: 151

Modified:
    branches/tinygettext-portable/src/dictionary_manager.cpp

Log:
Use auto_ptr instead of delete

Modified: branches/tinygettext-portable/src/dictionary_manager.cpp
==============================================================================
--- branches/tinygettext-portable/src/dictionary_manager.cpp	(original)
+++ branches/tinygettext-portable/src/dictionary_manager.cpp	Tue Feb 10  
02:04:57 2009
@@ -17,6 +17,7 @@
  //  along with this program; if not, write to the Free Software
  //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,  
USA.

+#include <memory>
  #include <assert.h>
  #include <stdlib.h>
  #include <string.h>
@@ -148,8 +149,8 @@
                    std::string pofile = *p + "/" + best_filename;
                    try
                      {
-                      std::istream* in = dir_op.open_file(pofile.c_str());
-                      if (!*in)
+                      std::auto_ptr<std::istream>  
in(dir_op.open_file(pofile.c_str()));
+                      if (!in.get())
                          {
                            log_error << "error: failure opening: " <<  
pofile << std::endl;
                          }
@@ -157,7 +158,6 @@
                          {
                            POParser::parse(pofile, *in, *dict);
                          }
-                      delete in;
                      }
                    catch(std::exception& e)
                      {


More information about the Supertux-Commit mailing list