]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/database-leveldb.cpp
Fix backwards compatibility issue introduced by close_on_enter
[dragonfireclient.git] / src / database-leveldb.cpp
index e895354a4cac2432617ad2e242982872f1819e12..4a4904c6a0b122f58a5ee217577236b22cf767fb 100644 (file)
@@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #define ENSURE_STATUS_OK(s) \
        if (!(s).ok()) { \
-               throw FileNotGoodException(std::string("LevelDB error: ") + \
+               throw DatabaseException(std::string("LevelDB error: ") + \
                                (s).ToString()); \
        }
 
@@ -57,7 +57,7 @@ bool Database_LevelDB::saveBlock(const v3s16 &pos, const std::string &data)
        leveldb::Status status = m_database->Put(leveldb::WriteOptions(),
                        i64tos(getBlockAsInteger(pos)), data);
        if (!status.ok()) {
-               errorstream << "WARNING: saveBlock: LevelDB error saving block "
+               warningstream << "saveBlock: LevelDB error saving block "
                        << PP(pos) << ": " << status.ToString() << std::endl;
                return false;
        }
@@ -65,16 +65,13 @@ bool Database_LevelDB::saveBlock(const v3s16 &pos, const std::string &data)
        return true;
 }
 
-std::string Database_LevelDB::loadBlock(const v3s16 &pos)
+void Database_LevelDB::loadBlock(const v3s16 &pos, std::string *block)
 {
        std::string datastr;
        leveldb::Status status = m_database->Get(leveldb::ReadOptions(),
                i64tos(getBlockAsInteger(pos)), &datastr);
 
-       if(status.ok())
-               return datastr;
-       else
-               return "";
+       *block = (status.ok()) ? datastr : "";
 }
 
 bool Database_LevelDB::deleteBlock(const v3s16 &pos)
@@ -82,7 +79,7 @@ bool Database_LevelDB::deleteBlock(const v3s16 &pos)
        leveldb::Status status = m_database->Delete(leveldb::WriteOptions(),
                        i64tos(getBlockAsInteger(pos)));
        if (!status.ok()) {
-               errorstream << "WARNING: deleteBlock: LevelDB error deleting block "
+               warningstream << "deleteBlock: LevelDB error deleting block "
                        << PP(pos) << ": " << status.ToString() << std::endl;
                return false;
        }