Skip to content

Commit d36c39c

Browse files
committed
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()
1 parent 8c7aced commit d36c39c

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

include/SQLiteCpp/Exception.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@ class Exception : public std::runtime_error
4545
#endif
4646

4747
// Detect whether the compiler supports C++11 noexcept exception specifications.
48-
#if (defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || (__GNUC__ > 4)) && defined(__GXX_EXPERIMENTAL_CXX0X__))
48+
#if ( defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || (__GNUC__ > 4)) \
49+
&& defined(__GXX_EXPERIMENTAL_CXX0X__))
4950
// GCC 4.7 and following have noexcept
5051
#elif defined(__clang__) && __has_feature(cxx_noexcept)
5152
// Clang 3.0 and above have noexcept
53+
#elif defined(_MSC_VER) && _MSC_VER > 1800
54+
// Visual Studio 2015 and above have noexcept
5255
#else
53-
#define noexcept throw()
56+
// Visual Studio 2013 does not support noexcept, and "throw()" is deprecated by C++11
57+
#define noexcept
5458
#endif

include/SQLiteCpp/Statement.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ class Column;
4444
*/
4545
class Statement
4646
{
47-
public:
48-
class Ptr;
47+
friend class Column; // For access to Statement::Ptr inner class
4948

49+
public:
5050
/**
5151
* @brief Compile and register the SQL query for the provided SQLite Database Connection
5252
*
@@ -400,7 +400,7 @@ class Statement
400400
return sqlite3_errmsg(mStmtPtr);
401401
}
402402

403-
public:
403+
private:
404404
/**
405405
* @brief Shared pointer to the sqlite3_stmt SQLite Statement Object.
406406
*

src/Column.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ double Column::getDouble() const noexcept // nothrow
6565
// Return a pointer to the text value (NULL terminated string) of the column specified by its index starting at 0
6666
const char* Column::getText(const char* apDefaultValue /* = "" */) const noexcept // nothrow
6767
{
68-
const char* pText = (const char*)sqlite3_column_text(mStmtPtr, mIndex);
68+
const char* pText = reinterpret_cast<const char*>(sqlite3_column_text(mStmtPtr, mIndex));
6969
return (pText?pText:apDefaultValue);
7070
}
7171

0 commit comments

Comments
 (0)