aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2016-07-08 06:24:22 +0200
committerest31 <MTest31@outlook.com>2016-07-08 07:08:33 +0200
commit483cca78a1312aa3b9c01049b5ebf6842929ec7a (patch)
tree674e4d143f42d23374af33c571575d4d78528cea /src
parent795f1c75cb6e337984cccd042371cb8b9a3ef6c1 (diff)
downloadminetest-483cca78a1312aa3b9c01049b5ebf6842929ec7a.tar.gz
minetest-483cca78a1312aa3b9c01049b5ebf6842929ec7a.tar.bz2
minetest-483cca78a1312aa3b9c01049b5ebf6842929ec7a.zip
Fix -Wterminate warning on GCC 6
Fixes #4137
Diffstat (limited to 'src')
-rw-r--r--src/database-sqlite3.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/database-sqlite3.cpp b/src/database-sqlite3.cpp
index 07df976d4..095d485c0 100644
--- a/src/database-sqlite3.cpp
+++ b/src/database-sqlite3.cpp
@@ -56,8 +56,14 @@ SQLite format specification:
SQLOK(sqlite3_prepare_v2(m_database, query, -1, &m_stmt_##name, NULL),\
"Failed to prepare query '" query "'")
-#define FINALIZE_STATEMENT(statement) \
- SQLOK(sqlite3_finalize(statement), "Failed to finalize " #statement)
+#define SQLOK_ERRSTREAM(s, m) \
+ if ((s) != SQLITE_OK) { \
+ errorstream << (m) << ": " \
+ << sqlite3_errmsg(m_database) << std::endl; \
+ }
+
+#define FINALIZE_STATEMENT(statement) SQLOK_ERRSTREAM(sqlite3_finalize(statement), \
+ "Failed to finalize " #statement)
int Database_SQLite3::busyHandler(void *data, int count)
{
@@ -289,6 +295,6 @@ Database_SQLite3::~Database_SQLite3()
FINALIZE_STATEMENT(m_stmt_end)
FINALIZE_STATEMENT(m_stmt_delete)
- SQLOK(sqlite3_close(m_database), "Failed to close database");
+ SQLOK_ERRSTREAM(sqlite3_close(m_database), "Failed to close database");
}