Added more warnings for debug builds, removed superfluous consts

develop
tastytea 2019-01-12 17:39:20 +01:00
parent f29e180092
commit 165e9039a7
No known key found for this signature in database
GPG Key ID: CFC39497F1B26E07
7 changed files with 34 additions and 33 deletions

View File

@ -22,7 +22,8 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -g -Og") set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} -Wpedantic -Wall -Wextra -g -Og -fno-omit-frame-pointer")
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)

View File

@ -1,5 +1,5 @@
/* This file is part of whyblocked. /* This file is part of whyblocked.
* Copyright © 2018 tastytea <tastytea@tastytea.de> * Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -447,7 +447,7 @@ const Dialogdata DialogAdd::get_data() const
return data; return data;
} }
const void DialogAdd::set_data(const Dialogdata &data) void DialogAdd::set_data(const Dialogdata &data)
{ {
text_user->setText(QString::fromStdString(data.user)); text_user->setText(QString::fromStdString(data.user));
radio_blocked->setChecked(data.blocked); radio_blocked->setChecked(data.blocked);

View File

@ -1,5 +1,5 @@
/* This file is part of whyblocked. /* This file is part of whyblocked.
* Copyright © 2018 tastytea <tastytea@tastytea.de> * Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -79,7 +79,7 @@ class DialogAdd : public QDialog, private Ui::DialogAdd
public: public:
explicit DialogAdd(QMainWindow *parent = nullptr); explicit DialogAdd(QMainWindow *parent = nullptr);
const void set_data(const Dialogdata &data); void set_data(const Dialogdata &data);
private: private:
const Dialogdata get_data() const; const Dialogdata get_data() const;

View File

@ -44,7 +44,7 @@ const string Text::get_answer(const QString &question)
return answer; return answer;
} }
const bool Text::askblocked() bool Text::askblocked()
{ {
while (true) while (true)
{ {
@ -61,7 +61,7 @@ const bool Text::askblocked()
} }
} }
const void Text::askrecipes(const string &user) void Text::askrecipes(const string &user)
{ {
while (true) while (true)
{ {
@ -86,7 +86,7 @@ const void Text::askrecipes(const string &user)
} }
} }
const void Text::add() void Text::add()
{ {
const string user = get_answer(tr("User or instance")); const string user = get_answer(tr("User or instance"));
int blocked; int blocked;
@ -109,7 +109,7 @@ const void Text::add()
askrecipes(user); askrecipes(user);
} }
const void Text::edit() void Text::edit()
{ {
result_details olddata; result_details olddata;
const string olduser = get_answer(tr("User or instance")); const string olduser = get_answer(tr("User or instance"));
@ -170,7 +170,7 @@ const void Text::edit()
} }
} }
const void Text::remove() void Text::remove()
{ {
const string user = get_answer(tr("User or instance")); const string user = get_answer(tr("User or instance"));
@ -180,7 +180,7 @@ const void Text::remove()
} }
} }
const void Text::view() void Text::view()
{ {
result_view result; result_view result;
if (database::view(result)) if (database::view(result))
@ -201,7 +201,7 @@ const void Text::view()
} }
} }
const void Text::details() void Text::details()
{ {
const string user = get_answer(tr("User or instance")); const string user = get_answer(tr("User or instance"));
{ {
@ -231,7 +231,7 @@ const void Text::details()
} }
} }
const void Text::help() void Text::help()
{ {
cout << tr( cout << tr(
"Type add, edit, remove, view or details. Or just the first letter.") "Type add, edit, remove, view or details. Or just the first letter.")

View File

@ -31,14 +31,14 @@ public:
private: private:
const string get_answer(const QString &question); const string get_answer(const QString &question);
const bool askblocked(); bool askblocked();
const void askrecipes(const string &user); void askrecipes(const string &user);
const void add(); void add();
const void edit(); void edit();
const void remove(); void remove();
const void view(); void view();
const void details(); void details();
const void help(); void help();
}; };
#endif // INTERFACE_TEXT_HPP #endif // INTERFACE_TEXT_HPP

View File

@ -1,5 +1,5 @@
/* This file is part of whyblocked. /* This file is part of whyblocked.
* Copyright © 2018 tastytea <tastytea@tastytea.de> * Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -53,7 +53,7 @@ const string get_filepath()
return filepath; return filepath;
} }
const bool database::add_block(const string &user, const int blocked, bool database::add_block(const string &user, const int blocked,
const string &reason) const string &reason)
{ {
try try
@ -72,7 +72,7 @@ const bool database::add_block(const string &user, const int blocked,
return true; return true;
} }
const bool database::add_receipt(const string &user, const string &receipt) bool database::add_receipt(const string &user, const string &receipt)
{ {
try try
{ {
@ -90,7 +90,7 @@ const bool database::add_receipt(const string &user, const string &receipt)
return true; return true;
} }
const bool database::remove(const string &user) bool database::remove(const string &user)
{ {
try try
{ {
@ -111,7 +111,7 @@ const bool database::remove(const string &user)
return true; return true;
} }
const bool database::view(result_view &result, const string &sql_query) bool database::view(result_view &result, const string &sql_query)
{ {
try try
{ {
@ -146,7 +146,7 @@ const bool database::view(result_view &result, const string &sql_query)
return true; return true;
} }
const bool database::details(const string &user, result_details &result) bool database::details(const string &user, result_details &result)
{ {
try try
{ {

View File

@ -1,5 +1,5 @@
/* This file is part of whyblocked. /* This file is part of whyblocked.
* Copyright © 2018 tastytea <tastytea@tastytea.de> * Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -28,12 +28,12 @@ using result_details = std::tuple<int, string, std::vector<string>>;
const string get_filepath(); const string get_filepath();
namespace database namespace database
{ {
const bool add_block(const string &user, const int blocked, bool add_block(const string &user, const int blocked,
const string &reason); const string &reason);
const bool add_receipt(const string &user, const string &receipt); bool add_receipt(const string &user, const string &receipt);
const bool remove(const string &user); bool remove(const string &user);
const bool view(result_view &result, const string &sql_query = ""); bool view(result_view &result, const string &sql_query = "");
const bool details(const string &user, result_details &result); bool details(const string &user, result_details &result);
} }
#endif // WHYBLOCKED_HPP #endif // WHYBLOCKED_HPP