Cleanup: Prep for '-Wextra'

This commit is contained in:
Paul Beckingham 2015-10-16 16:27:05 -04:00
parent 84be60fdca
commit a82558064b
23 changed files with 48 additions and 54 deletions

View file

@ -53,7 +53,7 @@ CmdAnnotate::CmdAnnotate ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdAnnotate::execute (std::string& output)
int CmdAnnotate::execute (std::string&)
{
int rc = 0;
int count = 0;
@ -84,7 +84,7 @@ int CmdAnnotate::execute (std::string& output)
task.modify (Task::modAnnotate, true);
if (permission (task, taskDifferences (before, task) + question, filtered.size ()))
if (permission (taskDifferences (before, task) + question, filtered.size ()))
{
context.tdb2.modify (task);
++count;

View file

@ -53,7 +53,7 @@ CmdAppend::CmdAppend ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdAppend::execute (std::string& output)
int CmdAppend::execute (std::string&)
{
int rc = 0;
int count = 0;
@ -84,7 +84,7 @@ int CmdAppend::execute (std::string& output)
task.modify (Task::modAppend, true);
if (permission (task, taskDifferences (before, task) + question, filtered.size ()))
if (permission (taskDifferences (before, task) + question, filtered.size ()))
{
context.tdb2.modify (task);
++count;

View file

@ -68,9 +68,9 @@ int CmdContext::execute (std::string& output)
if (subcommand == "define") rc = defineContext (words, out);
else if (subcommand == "delete") rc = deleteContext (words, out);
else if (subcommand == "list") rc = listContexts (words, out);
else if (subcommand == "none") rc = unsetContext (words, out);
else if (subcommand == "show") rc = showContext (words, out);
else if (subcommand == "list") rc = listContexts (out);
else if (subcommand == "none") rc = unsetContext (out);
else if (subcommand == "show") rc = showContext (out);
else rc = setContext (words, out);
}
@ -229,7 +229,7 @@ int CmdContext::deleteContext (const std::vector <std::string>& words, std::stri
// Invoked with: task context list
// Example: task context list
//
int CmdContext::listContexts (const std::vector <std::string>& words, std::stringstream& out)
int CmdContext::listContexts (std::stringstream& out)
{
int rc = 0;
std::vector <std::string> contexts = getContexts();
@ -321,7 +321,7 @@ int CmdContext::setContext (const std::vector <std::string>& words, std::strings
// Invoked with: task context show
// Example: task context show
//
int CmdContext::showContext (const std::vector <std::string>& words, std::stringstream& out)
int CmdContext::showContext (std::stringstream& out)
{
std::string currentContext = context.config.get ("context");
@ -346,7 +346,7 @@ int CmdContext::showContext (const std::vector <std::string>& words, std::string
// Invoked with: task context none
// Example: task context none
//
int CmdContext::unsetContext (const std::vector <std::string>& words, std::stringstream& out)
int CmdContext::unsetContext (std::stringstream& out)
{
int rc = 0;
int status = CmdConfig::unsetConfigVariable ("context", false);

View file

@ -35,14 +35,14 @@ class CmdContext : public Command
public:
CmdContext ();
int execute (std::string&);
std::string joinWords (const std::vector <std::string>& words, unsigned int from, unsigned int to = 0);
std::string joinWords (const std::vector <std::string>&, unsigned int, unsigned int = 0);
static std::vector <std::string> getContexts ();
int defineContext (const std::vector <std::string>& words, std::stringstream& out);
int deleteContext (const std::vector <std::string>& words, std::stringstream& out);
int listContexts (const std::vector <std::string>& words, std::stringstream& out);
int setContext (const std::vector <std::string>& words, std::stringstream& out);
int showContext (const std::vector <std::string>& words, std::stringstream& out);
int unsetContext (const std::vector <std::string>& words, std::stringstream& out);
int defineContext (const std::vector <std::string>&, std::stringstream&);
int deleteContext (const std::vector <std::string>&, std::stringstream&);
int listContexts (std::stringstream&);
int setContext (const std::vector <std::string>&, std::stringstream&);
int showContext (std::stringstream&);
int unsetContext (std::stringstream&);
};
class CmdCompletionContext : public Command

View file

@ -54,7 +54,7 @@ CmdDelete::CmdDelete ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdDelete::execute (std::string& output)
int CmdDelete::execute (std::string&)
{
int rc = 0;
int count = 0;
@ -94,7 +94,7 @@ int CmdDelete::execute (std::string& output)
if (! task.has ("end"))
task.setAsNow ("end");
if (permission (task, question, filtered.size ()))
if (permission (question, filtered.size ()))
{
updateRecurrenceMask (task);
++count;

View file

@ -53,7 +53,7 @@ CmdDenotate::CmdDenotate ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdDenotate::execute (std::string& output)
int CmdDenotate::execute (std::string&)
{
int rc = 0;
int count = 0;
@ -130,7 +130,7 @@ int CmdDenotate::execute (std::string& output)
task.id,
task.get ("description"));
if (permission (task, taskDifferences (before, task) + question, filtered.size ()))
if (permission (taskDifferences (before, task) + question, filtered.size ()))
{
++count;
context.tdb2.modify (task);

View file

@ -53,7 +53,7 @@ CmdDone::CmdDone ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdDone::execute (std::string& output)
int CmdDone::execute (std::string&)
{
int rc = 0;
int count = 0;
@ -97,7 +97,7 @@ int CmdDone::execute (std::string& output)
task.addAnnotation (context.config.get ("journal.time.stop.annotation"));
}
if (permission (task, taskDifferences (before, task) + question, filtered.size ()))
if (permission (taskDifferences (before, task) + question, filtered.size ()))
{
updateRecurrenceMask (task);
context.tdb2.modify (task);

View file

@ -53,7 +53,7 @@ CmdDuplicate::CmdDuplicate ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdDuplicate::execute (std::string& output)
int CmdDuplicate::execute (std::string&)
{
int rc = 0;
int count = 0;
@ -105,8 +105,7 @@ int CmdDuplicate::execute (std::string& output)
dup.modify (Task::modAnnotate);
if (permission (dup,
format (STRING_CMD_DUPLICATE_CONFIRM,
if (permission (format (STRING_CMD_DUPLICATE_CONFIRM,
task.id,
task.get ("description")),
filtered.size ()))

View file

@ -65,7 +65,7 @@ CmdEdit::CmdEdit ()
// Introducing the Silver Bullet. This feature is the catch-all fixative for
// various other ills. This is like opening up the hood and going in with a
// wrench. To be used sparingly.
int CmdEdit::execute (std::string& output)
int CmdEdit::execute (std::string&)
{
// Filter the tasks.
handleRecurrence ();

View file

@ -50,7 +50,7 @@ CmdExec::CmdExec ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdExec::execute (std::string& output)
int CmdExec::execute (std::string&)
{
std::string command_line;
join (command_line, " ", context.cli2.getWords ());

View file

@ -55,7 +55,7 @@ CmdImport::CmdImport ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdImport::execute (std::string& output)
int CmdImport::execute (std::string&)
{
int rc = 0;
int count = 0;

View file

@ -53,7 +53,7 @@ CmdModify::CmdModify ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdModify::execute (std::string& output)
int CmdModify::execute (std::string&)
{
int rc = 0;
int count = 0;
@ -91,7 +91,7 @@ int CmdModify::execute (std::string& output)
task.get ("uuid"),
task.get ("description"));
if (permission (task, taskDifferences (before, task) + question, filtered.size ()))
if (permission (taskDifferences (before, task) + question, filtered.size ()))
{
count += modifyAndUpdate (before, task, &projectChanges);
}

View file

@ -53,7 +53,7 @@ CmdPrepend::CmdPrepend ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdPrepend::execute (std::string& output)
int CmdPrepend::execute (std::string&)
{
int rc = 0;
int count = 0;
@ -84,7 +84,7 @@ int CmdPrepend::execute (std::string& output)
task.modify (Task::modPrepend, true);
if (permission (task, taskDifferences (before, task) + question, filtered.size ()))
if (permission (taskDifferences (before, task) + question, filtered.size ()))
{
context.tdb2.modify (task);
++count;

View file

@ -53,7 +53,7 @@ CmdStart::CmdStart ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdStart::execute (std::string& output)
int CmdStart::execute (std::string&)
{
int rc = 0;
int count = 0;
@ -95,7 +95,7 @@ int CmdStart::execute (std::string& output)
if (context.config.getBoolean ("journal.time"))
task.addAnnotation (context.config.get ("journal.time.start.annotation"));
if (permission (task, taskDifferences (before, task) + question, filtered.size ()))
if (permission (taskDifferences (before, task) + question, filtered.size ()))
{
updateRecurrenceMask (task);
context.tdb2.modify (task);

View file

@ -52,7 +52,7 @@ CmdStop::CmdStop ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdStop::execute (std::string& output)
int CmdStop::execute (std::string&)
{
int rc = 0;
int count = 0;
@ -87,7 +87,7 @@ int CmdStop::execute (std::string& output)
if (context.config.getBoolean ("journal.time"))
task.addAnnotation (context.config.get ("journal.time.stop.annotation"));
if (permission (task, taskDifferences (before, task) + question, filtered.size ()))
if (permission (taskDifferences (before, task) + question, filtered.size ()))
{
updateRecurrenceMask (task);
context.tdb2.modify (task);

View file

@ -49,7 +49,7 @@ CmdUndo::CmdUndo ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdUndo::execute (std::string& output)
int CmdUndo::execute (std::string&)
{
context.tdb2.revert ();
return 0;

View file

@ -25,7 +25,6 @@
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <iostream>
#include <string>
#include <set>
#include <algorithm>
@ -88,7 +87,7 @@ int CmdUnique::execute (std::string& output)
// Generate list of unique values.
for (auto& value : values)
std::cout << value << "\n";
output += value + "\n";
context.headers.clear ();
return 0;

View file

@ -312,7 +312,6 @@ Command::Category Command::category () const
// rc.confirmation
// this->_read_only
bool Command::permission (
const Task& task,
const std::string& question,
unsigned int quantity)
{

View file

@ -71,7 +71,7 @@ public:
virtual int execute (std::string&) = 0;
protected:
bool permission (const Task&, const std::string&, unsigned int);
bool permission (const std::string&, unsigned int);
static const std::map <Command::Category, std::string> categoryNames;
protected: