Merge pull request #119 from timrae/fix-warnings

Fix some warnings and increase safety checking on gcc
This commit is contained in:
Sébastien Rombauts 2017-03-31 07:27:29 +02:00 committed by GitHub
commit c6dc1c7cdf
3 changed files with 4 additions and 3 deletions

View File

@ -32,7 +32,7 @@ else (MSVC)
set(CPPLINT_ARG_OUTPUT "--output=eclipse")
set(CPPCHECK_ARG_TEMPLATE "--template=gcc")
# Useful compile flags and extra warnings
add_compile_options(-fstack-protector -Wall -Winit-self -Wswitch-enum -Wshadow -Winline)
add_compile_options(-fstack-protector -Wall -Wextra -Wpedantic -Wno-long-long -Wswitch-enum -Wshadow -Winline)
if (CMAKE_COMPILER_IS_GNUCXX)
# GCC flags
if (SQLITECPP_USE_GCOV AND CMAKE_COMPILER_IS_GNUCXX)

View File

@ -412,7 +412,7 @@ public:
*
* @throw SQLite::Exception in case of error
*/
static const bool isUnencrypted(const std::string& aFilename);
static bool isUnencrypted(const std::string& aFilename);
private:
/// @{ Database must be non-copyable

View File

@ -259,13 +259,14 @@ void Database::rekey(const std::string& aNewKey) const
check(ret);
}
#else // SQLITE_HAS_CODEC
static_cast<void>(aNewKey); // silence unused parameter warning
const SQLite::Exception exception("No encryption support, recompile with SQLITE_HAS_CODEC to enable.");
throw exception;
#endif // SQLITE_HAS_CODEC
}
// Test if a file contains an unencrypted database.
const bool Database::isUnencrypted(const std::string& aFilename)
bool Database::isUnencrypted(const std::string& aFilename)
{
if (aFilename.length() > 0) {
std::ifstream fileBuffer(aFilename.c_str(), std::ios::in | std::ios::binary);