summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-31 18:38:30 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-31 18:38:30 -0500
commit945f0dd29d9d7b188e01ba27419c043bd0357bbb (patch)
tree30ef08811b1d5e368e38304e6e1f1d49344ca9ef
parentf1e509603806b71a282c076e4c6ef2c632761cd9 (diff)
downloadhorizon-945f0dd29d9d7b188e01ba27419c043bd0357bbb.tar.gz
horizon-945f0dd29d9d7b188e01ba27419c043bd0357bbb.tar.bz2
horizon-945f0dd29d9d7b188e01ba27419c043bd0357bbb.tar.xz
horizon-945f0dd29d9d7b188e01ba27419c043bd0357bbb.zip
hscript: Remove unused paramaters and de-const-ify DiskLabel::type
-rw-r--r--hscript/disk.cc6
-rw-r--r--hscript/disk.hh2
-rw-r--r--hscript/meta.cc2
-rw-r--r--hscript/network.cc6
-rw-r--r--hscript/script.cc7
-rw-r--r--hscript/user.cc12
6 files changed, 19 insertions, 16 deletions
diff --git a/hscript/disk.cc b/hscript/disk.cc
index ecd0afa..05fb6d2 100644
--- a/hscript/disk.cc
+++ b/hscript/disk.cc
@@ -60,7 +60,7 @@ bool is_block_device(const std::string &key, long line,
Key *DiskId::parseFromData(const std::string &data, int lineno, int *errors,
- int *warnings) {
+ int *) {
std::string block, ident;
std::string::size_type block_end = data.find_first_of(' ');
if(block_end == std::string::npos) {
@@ -139,7 +139,7 @@ bool DiskId::execute(ScriptOptions options) const {
Key *DiskLabel::parseFromData(const std::string &data, int lineno, int *errors,
- int *warnings) {
+ int *) {
std::string block, label;
std::string::size_type sep = data.find_first_of(' ');
LabelType type;
@@ -660,7 +660,7 @@ bool Filesystem::execute(ScriptOptions) const {
Key *Mount::parseFromData(const std::string &data, int lineno, int *errors,
- int *warnings) {
+ int *) {
std::string dev, where, opt;
std::string::size_type where_pos, opt_pos;
bool any_failure = false;
diff --git a/hscript/disk.hh b/hscript/disk.hh
index 53e2749..f3a8a4c 100644
--- a/hscript/disk.hh
+++ b/hscript/disk.hh
@@ -57,7 +57,7 @@ public:
/*! Retrieve the block device that this key identifies. */
const std::string device() const { return this->_block; }
/*! Retrieve the type of disklabel for the block device. */
- const LabelType type() const { return this->_type; }
+ LabelType type() const { return this->_type; }
static Key *parseFromData(const std::string &, int, int*, int*);
bool validate(ScriptOptions) const override;
diff --git a/hscript/meta.cc b/hscript/meta.cc
index dfd147a..5885c1e 100644
--- a/hscript/meta.cc
+++ b/hscript/meta.cc
@@ -317,7 +317,7 @@ bool Keymap::execute(ScriptOptions) const {
Key *Firmware::parseFromData(const std::string &data, int lineno, int *errors,
- int *warnings) {
+ int *) {
bool value;
if(!BooleanKey::parse(data, "installfile:" + std::to_string(lineno),
"firmware", &value)) {
diff --git a/hscript/network.cc b/hscript/network.cc
index a47e69e..3816415 100644
--- a/hscript/network.cc
+++ b/hscript/network.cc
@@ -29,7 +29,7 @@
using namespace Horizon::Keys;
Key *Network::parseFromData(const std::string &data, int lineno, int *errors,
- int *warnings) {
+ int *) {
bool value;
if(!BooleanKey::parse(data, "installfile:" + std::to_string(lineno),
"network", &value)) {
@@ -46,7 +46,7 @@ bool Network::execute(ScriptOptions) const {
Key *NetAddress::parseFromData(const std::string &data, int lineno, int *errors,
- int *warnings) {
+ int *) {
long elements = std::count(data.cbegin(), data.cend(), ' ') + 1;
std::string::size_type type_pos, addr_pos, prefix_pos, gw_pos, next_end;
std::string iface, type, addr, prefix, gw;
@@ -304,7 +304,7 @@ bool NetAddress::execute(ScriptOptions) const {
Key *NetSSID::parseFromData(const std::string &data, int lineno, int *errors,
- int *warnings) {
+ int *) {
std::string iface, ssid, secstr, passphrase;
SecurityType type;
std::string::size_type start, pos, next;
diff --git a/hscript/script.cc b/hscript/script.cc
index 33e8c6d..5a9dd8e 100644
--- a/hscript/script.cc
+++ b/hscript/script.cc
@@ -244,8 +244,8 @@ struct Script::ScriptPrivate {
return true;
}
- bool store_pkginstall(Keys::Key* obj, int lineno, int *errors,
- int *warnings, ScriptOptions opts) {
+ bool store_pkginstall(Keys::Key* obj, int lineno, int *, int *warnings,
+ ScriptOptions opts) {
PkgInstall *install = dynamic_cast<PkgInstall *>(obj);
for(auto &pkg : install->packages()) {
if(opts.test(StrictMode) && packages.find(pkg) != packages.end()) {
@@ -285,6 +285,9 @@ struct Script::ScriptPrivate {
this->firmware = std::move(f);
return true;
#else
+ /* Shut up -Wunused-parameter. */
+ assert(lineno != 0);
+ assert(errors != nullptr);
assert(!f->test());
return true;
#endif
diff --git a/hscript/user.cc b/hscript/user.cc
index f654db9..f8a46a1 100644
--- a/hscript/user.cc
+++ b/hscript/user.cc
@@ -120,7 +120,7 @@ static bool string_is_crypt(const std::string &pw, const std::string &key,
Key *RootPassphrase::parseFromData(const std::string &data, int lineno,
- int *errors, int *warnings) {
+ int *errors, int *) {
if(!string_is_crypt(data, "rootpw", lineno)) {
if(errors) *errors += 1;
return nullptr;
@@ -189,7 +189,7 @@ bool RootPassphrase::execute(ScriptOptions options) const {
Key *Username::parseFromData(const std::string &data, int lineno, int *errors,
- int *warnings) {
+ int *) {
if(!is_valid_name(data.c_str())) {
if(errors) *errors += 1;
output_error("installfile:" + std::to_string(lineno),
@@ -214,7 +214,7 @@ bool Username::execute(ScriptOptions) const {
Key *UserAlias::parseFromData(const std::string &data, int lineno, int *errors,
- int *warnings) {
+ int *) {
/* REQ: Runner.Validate.useralias.Validity */
const std::string::size_type sep = data.find_first_of(' ');
if(sep == std::string::npos || data.length() == sep + 1) {
@@ -238,7 +238,7 @@ bool UserAlias::execute(ScriptOptions) const {
Key *UserPassphrase::parseFromData(const std::string &data, int lineno,
- int *errors, int *warnings) {
+ int *errors, int *) {
/* REQ: Runner.Validate.userpw.Validity */
const std::string::size_type sep = data.find_first_of(' ');
if(sep == std::string::npos || data.length() == sep + 1) {
@@ -269,7 +269,7 @@ bool UserPassphrase::execute(ScriptOptions) const {
Key *UserIcon::parseFromData(const std::string &data, int lineno, int *errors,
- int *warnings) {
+ int *) {
/* REQ: Runner.Validate.usericon.Validity */
const std::string::size_type sep = data.find_first_of(' ');
if(sep == std::string::npos || data.length() == sep + 1) {
@@ -302,7 +302,7 @@ bool UserIcon::execute(ScriptOptions) const {
Key *UserGroups::parseFromData(const std::string &data, int lineno,
- int *errors, int *warnings) {
+ int *errors, int *) {
/* REQ: Runner.Validate.usergroups.Validity */
const std::string::size_type sep = data.find_first_of(' ');
if(sep == std::string::npos || data.length() == sep + 1) {