Skip to content

Commit

Permalink
Fix CppDepends most useful warnings:
Browse files Browse the repository at this point in the history
 - 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()
  • Loading branch information
SRombauts committed Jun 1, 2015
1 parent 8c7aced commit d36c39c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions include/SQLiteCpp/Exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions include/SQLiteCpp/Statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -400,7 +400,7 @@ class Statement
return sqlite3_errmsg(mStmtPtr);
}

public:
private:
/**
* @brief Shared pointer to the sqlite3_stmt SQLite Statement Object.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Column.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const char*>(sqlite3_column_text(mStmtPtr, mIndex));
return (pText?pText:apDefaultValue);
}

Expand Down

0 comments on commit d36c39c

Please sign in to comment.