From d36c39ccf36a29f995a57669f31e7980cac25e1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Rombauts?= Date: Mon, 1 Jun 2015 22:05:24 +0200 Subject: [PATCH] Fix CppDepends most useful warnings: - Convert last old-style cast to reinterpret_cast<> - Statement::Ptr is now private, with a friend declaration for Column - noexcept should not be defined as the depreacted throw() --- include/SQLiteCpp/Exception.h | 8 ++++++-- include/SQLiteCpp/Statement.h | 6 +++--- src/Column.cpp | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/SQLiteCpp/Exception.h b/include/SQLiteCpp/Exception.h index 337807c5..ae7a8ed9 100644 --- a/include/SQLiteCpp/Exception.h +++ b/include/SQLiteCpp/Exception.h @@ -45,10 +45,14 @@ class Exception : public std::runtime_error #endif // Detect whether the compiler supports C++11 noexcept exception specifications. -#if (defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || (__GNUC__ > 4)) && defined(__GXX_EXPERIMENTAL_CXX0X__)) +#if ( defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || (__GNUC__ > 4)) \ + && defined(__GXX_EXPERIMENTAL_CXX0X__)) // GCC 4.7 and following have noexcept #elif defined(__clang__) && __has_feature(cxx_noexcept) // Clang 3.0 and above have noexcept +#elif defined(_MSC_VER) && _MSC_VER > 1800 +// Visual Studio 2015 and above have noexcept #else - #define noexcept throw() + // Visual Studio 2013 does not support noexcept, and "throw()" is deprecated by C++11 + #define noexcept #endif diff --git a/include/SQLiteCpp/Statement.h b/include/SQLiteCpp/Statement.h index 231c8e04..fd081376 100644 --- a/include/SQLiteCpp/Statement.h +++ b/include/SQLiteCpp/Statement.h @@ -44,9 +44,9 @@ class Column; */ class Statement { -public: - class Ptr; + friend class Column; // For access to Statement::Ptr inner class +public: /** * @brief Compile and register the SQL query for the provided SQLite Database Connection * @@ -400,7 +400,7 @@ class Statement return sqlite3_errmsg(mStmtPtr); } -public: +private: /** * @brief Shared pointer to the sqlite3_stmt SQLite Statement Object. * diff --git a/src/Column.cpp b/src/Column.cpp index eb68e969..dae0f7ea 100644 --- a/src/Column.cpp +++ b/src/Column.cpp @@ -65,7 +65,7 @@ double Column::getDouble() const noexcept // nothrow // Return a pointer to the text value (NULL terminated string) of the column specified by its index starting at 0 const char* Column::getText(const char* apDefaultValue /* = "" */) const noexcept // nothrow { - const char* pText = (const char*)sqlite3_column_text(mStmtPtr, mIndex); + const char* pText = reinterpret_cast(sqlite3_column_text(mStmtPtr, mIndex)); return (pText?pText:apDefaultValue); }