Code Cleanup
- When compiling the 2.0.0 branch of Taskwarrior with GCC 4.6.1, the compiler generates a number of warnings. This patch eliminates these warnings. Signed-off-by: Paul Beckingham <paul@beckingham.net>
This commit is contained in:
committed by
Paul Beckingham
parent
b9ea9ca2db
commit
0e2da7f1d4
16
src/A3.cpp
16
src/A3.cpp
@@ -625,7 +625,6 @@ const A3 A3::tokenize (const A3& input) const
|
|||||||
// For identifying sequence versus non-sequence.
|
// For identifying sequence versus non-sequence.
|
||||||
bool found_sequence = false;
|
bool found_sequence = false;
|
||||||
bool found_something_after_sequence = false;
|
bool found_something_after_sequence = false;
|
||||||
bool found_non_sequence = false;
|
|
||||||
|
|
||||||
std::string s;
|
std::string s;
|
||||||
int i;
|
int i;
|
||||||
@@ -637,7 +636,6 @@ const A3 A3::tokenize (const A3& input) const
|
|||||||
n.getQuoted ('\'', s, true))
|
n.getQuoted ('\'', s, true))
|
||||||
{
|
{
|
||||||
output.push_back (Arg (s, "string"));
|
output.push_back (Arg (s, "string"));
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
@@ -645,7 +643,6 @@ const A3 A3::tokenize (const A3& input) const
|
|||||||
else if (is_subst (n, s))
|
else if (is_subst (n, s))
|
||||||
{
|
{
|
||||||
output.push_back (Arg (s, "subst"));
|
output.push_back (Arg (s, "subst"));
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
@@ -653,7 +650,6 @@ const A3 A3::tokenize (const A3& input) const
|
|||||||
else if (is_pattern (n, s))
|
else if (is_pattern (n, s))
|
||||||
{
|
{
|
||||||
output.push_back (Arg (s, "pattern"));
|
output.push_back (Arg (s, "pattern"));
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
@@ -661,7 +657,6 @@ const A3 A3::tokenize (const A3& input) const
|
|||||||
else if (is_tag (n, s))
|
else if (is_tag (n, s))
|
||||||
{
|
{
|
||||||
output.push_back (Arg (s, "tag"));
|
output.push_back (Arg (s, "tag"));
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
@@ -669,7 +664,6 @@ const A3 A3::tokenize (const A3& input) const
|
|||||||
else if (n.getOneOf (operators, s))
|
else if (n.getOneOf (operators, s))
|
||||||
{
|
{
|
||||||
output.push_back (Arg (s, "op"));
|
output.push_back (Arg (s, "op"));
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
@@ -677,7 +671,6 @@ const A3 A3::tokenize (const A3& input) const
|
|||||||
else if (is_attr (n, s))
|
else if (is_attr (n, s))
|
||||||
{
|
{
|
||||||
output.push_back (Arg (s, "attr"));
|
output.push_back (Arg (s, "attr"));
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
@@ -685,7 +678,6 @@ const A3 A3::tokenize (const A3& input) const
|
|||||||
else if (is_attmod (n, s))
|
else if (is_attmod (n, s))
|
||||||
{
|
{
|
||||||
output.push_back (Arg (s, "attmod"));
|
output.push_back (Arg (s, "attmod"));
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
@@ -693,7 +685,6 @@ const A3 A3::tokenize (const A3& input) const
|
|||||||
else if (is_dom (n, s))
|
else if (is_dom (n, s))
|
||||||
{
|
{
|
||||||
output.push_back (Arg (s, "dom"));
|
output.push_back (Arg (s, "dom"));
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
@@ -701,7 +692,6 @@ const A3 A3::tokenize (const A3& input) const
|
|||||||
else if (n.getDateISO (t))
|
else if (n.getDateISO (t))
|
||||||
{
|
{
|
||||||
output.push_back (Arg (Date (t).toISO (), "date"));
|
output.push_back (Arg (Date (t).toISO (), "date"));
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
@@ -709,7 +699,6 @@ const A3 A3::tokenize (const A3& input) const
|
|||||||
else if (n.getDate (date_format, t))
|
else if (n.getDate (date_format, t))
|
||||||
{
|
{
|
||||||
output.push_back (Arg (Date (t).toString (date_format), "date"));
|
output.push_back (Arg (Date (t).toString (date_format), "date"));
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
@@ -717,7 +706,6 @@ const A3 A3::tokenize (const A3& input) const
|
|||||||
else if (is_duration (n, s))
|
else if (is_duration (n, s))
|
||||||
{
|
{
|
||||||
output.push_back (Arg (s, "duration"));
|
output.push_back (Arg (s, "duration"));
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
@@ -752,7 +740,6 @@ const A3 A3::tokenize (const A3& input) const
|
|||||||
else if (n.getNumber (d))
|
else if (n.getNumber (d))
|
||||||
{
|
{
|
||||||
output.push_back (Arg (format (d), "num"));
|
output.push_back (Arg (format (d), "num"));
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
@@ -760,7 +747,6 @@ const A3 A3::tokenize (const A3& input) const
|
|||||||
else if (n.getInt (i))
|
else if (n.getInt (i))
|
||||||
{
|
{
|
||||||
output.push_back (Arg (format (i), "int"));
|
output.push_back (Arg (format (i), "int"));
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
@@ -773,7 +759,6 @@ const A3 A3::tokenize (const A3& input) const
|
|||||||
else
|
else
|
||||||
output.push_back (Arg (s, "word"));
|
output.push_back (Arg (s, "word"));
|
||||||
|
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
@@ -784,7 +769,6 @@ const A3 A3::tokenize (const A3& input) const
|
|||||||
n.getUntilEOS (s);
|
n.getUntilEOS (s);
|
||||||
|
|
||||||
output.push_back (Arg (s, "word"));
|
output.push_back (Arg (s, "word"));
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,10 +284,9 @@ void Arguments::categorize ()
|
|||||||
bool found_command = false;
|
bool found_command = false;
|
||||||
bool found_sequence = false;
|
bool found_sequence = false;
|
||||||
bool found_something_after_sequence = false;
|
bool found_something_after_sequence = false;
|
||||||
bool found_non_sequence = false;
|
|
||||||
|
|
||||||
// Track where the command is, if possible.
|
// Track where the command is, if possible.
|
||||||
int command_pos = -1;
|
// int command_pos = -1;
|
||||||
// int distance_from_command = 0;
|
// int distance_from_command = 0;
|
||||||
|
|
||||||
// Configurable support.
|
// Configurable support.
|
||||||
@@ -312,7 +311,6 @@ void Arguments::categorize ()
|
|||||||
if (arg->_first == "--")
|
if (arg->_first == "--")
|
||||||
{
|
{
|
||||||
terminated = true;
|
terminated = true;
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
|
|
||||||
@@ -333,7 +331,6 @@ void Arguments::categorize ()
|
|||||||
arg->_first = "calendar";
|
arg->_first = "calendar";
|
||||||
arg->_third = "command";
|
arg->_third = "command";
|
||||||
found_command = true;
|
found_command = true;
|
||||||
found_non_sequence = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,11 +339,10 @@ void Arguments::categorize ()
|
|||||||
is_command (keywords, arg->_first))
|
is_command (keywords, arg->_first))
|
||||||
{
|
{
|
||||||
found_command = true;
|
found_command = true;
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
|
|
||||||
command_pos = counter;
|
// command_pos = counter;
|
||||||
|
|
||||||
arg->_third = "command";
|
arg->_third = "command";
|
||||||
}
|
}
|
||||||
@@ -398,7 +394,6 @@ void Arguments::categorize ()
|
|||||||
// [+-]tag
|
// [+-]tag
|
||||||
else if (is_tag (arg->_first))
|
else if (is_tag (arg->_first))
|
||||||
{
|
{
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
|
|
||||||
@@ -411,7 +406,6 @@ void Arguments::categorize ()
|
|||||||
// <name>.<modifier>:<value>
|
// <name>.<modifier>:<value>
|
||||||
else if (is_attmod (arg->_first))
|
else if (is_attmod (arg->_first))
|
||||||
{
|
{
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
|
|
||||||
@@ -424,7 +418,6 @@ void Arguments::categorize ()
|
|||||||
// <name>:<value>
|
// <name>:<value>
|
||||||
else if (is_attr (arg->_first))
|
else if (is_attr (arg->_first))
|
||||||
{
|
{
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
|
|
||||||
@@ -437,7 +430,6 @@ void Arguments::categorize ()
|
|||||||
// /<from>/<to>/[g]
|
// /<from>/<to>/[g]
|
||||||
else if (is_subst (arg->_first))
|
else if (is_subst (arg->_first))
|
||||||
{
|
{
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
|
|
||||||
@@ -450,7 +442,6 @@ void Arguments::categorize ()
|
|||||||
// /pattern/
|
// /pattern/
|
||||||
else if (enable_patterns && is_pattern (arg->_first))
|
else if (enable_patterns && is_pattern (arg->_first))
|
||||||
{
|
{
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
|
|
||||||
@@ -463,7 +454,6 @@ void Arguments::categorize ()
|
|||||||
// <operator>
|
// <operator>
|
||||||
else if (is_operator (arg->_first))
|
else if (is_operator (arg->_first))
|
||||||
{
|
{
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
|
|
||||||
@@ -476,7 +466,6 @@ void Arguments::categorize ()
|
|||||||
// <expression>
|
// <expression>
|
||||||
else if (enable_expressions && is_expression (arg->_first))
|
else if (enable_expressions && is_expression (arg->_first))
|
||||||
{
|
{
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
|
|
||||||
@@ -490,7 +479,6 @@ void Arguments::categorize ()
|
|||||||
// If the type is not known, it is treated as a generic word.
|
// If the type is not known, it is treated as a generic word.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
|
|
||||||
@@ -504,7 +492,6 @@ void Arguments::categorize ()
|
|||||||
// All post-termination arguments are simply words.
|
// All post-termination arguments are simply words.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
found_non_sequence = true;
|
|
||||||
if (found_sequence)
|
if (found_sequence)
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
|
|
||||||
|
|||||||
@@ -238,7 +238,6 @@ bool Nibbler::getQuoted (
|
|||||||
bool inquote = false;
|
bool inquote = false;
|
||||||
bool inescape = false;
|
bool inescape = false;
|
||||||
char current = 0;
|
char current = 0;
|
||||||
char previous = 0;
|
|
||||||
result = "";
|
result = "";
|
||||||
|
|
||||||
if (mCursor >= mLength ||
|
if (mCursor >= mLength ||
|
||||||
@@ -249,7 +248,6 @@ bool Nibbler::getQuoted (
|
|||||||
|
|
||||||
for (std::string::size_type i = mCursor; i < mLength; ++i)
|
for (std::string::size_type i = mCursor; i < mLength; ++i)
|
||||||
{
|
{
|
||||||
previous = current;
|
|
||||||
current = mInput[i];
|
current = mInput[i];
|
||||||
|
|
||||||
if (current == '\\' && !inescape)
|
if (current == '\\' && !inescape)
|
||||||
|
|||||||
@@ -133,10 +133,11 @@ std::string onProjectChange (Task& task, bool scope /* = true */)
|
|||||||
int count_done = 0;
|
int count_done = 0;
|
||||||
|
|
||||||
std::vector <Task> all;
|
std::vector <Task> all;
|
||||||
|
std::vector <Task> none;
|
||||||
context.tdb.load (all);
|
context.tdb.load (all);
|
||||||
|
|
||||||
countTasks (all, project, context.tdb.getAllModified (), count_pending, count_done);
|
countTasks (all, project, context.tdb.getAllModified (), count_pending, count_done);
|
||||||
countTasks (context.tdb.getAllModified (), project, (std::vector <Task>) NULL, count_pending, count_done);
|
countTasks (context.tdb.getAllModified (), project, none, count_pending, count_done);
|
||||||
|
|
||||||
// count_done count_pending percentage
|
// count_done count_pending percentage
|
||||||
// ---------- ------------- ----------
|
// ---------- ------------- ----------
|
||||||
|
|||||||
24
src/utf8.cpp
24
src/utf8.cpp
@@ -80,31 +80,33 @@ unsigned int utf8_next_char (const std::string& input, std::string::size_type& i
|
|||||||
// How many bytes in the sequence?
|
// How many bytes in the sequence?
|
||||||
int length = utf8_sequence (input[i]);
|
int length = utf8_sequence (input[i]);
|
||||||
|
|
||||||
|
i += length;
|
||||||
|
|
||||||
// 0xxxxxxx -> 0xxxxxxx
|
// 0xxxxxxx -> 0xxxxxxx
|
||||||
if (length == 1)
|
if (length == 1)
|
||||||
return input[i++];
|
return input[i - 1];
|
||||||
|
|
||||||
// 110yyyyy 10xxxxxx -> 00000yyy yyxxxxxx
|
// 110yyyyy 10xxxxxx -> 00000yyy yyxxxxxx
|
||||||
if (length == 2)
|
if (length == 2)
|
||||||
return ((input[i++] & 0x1F) << 6) +
|
return ((input[i - 2] & 0x1F) << 6) +
|
||||||
(input[i++] & 0x3F);
|
(input[i - 1] & 0x3F);
|
||||||
|
|
||||||
// 1110zzzz 10yyyyyy 10xxxxxx -> zzzzyyyy yyxxxxxx
|
// 1110zzzz 10yyyyyy 10xxxxxx -> zzzzyyyy yyxxxxxx
|
||||||
if (length == 3)
|
if (length == 3)
|
||||||
return ((input[i++] & 0xF) << 12) +
|
return ((input[i - 3] & 0xF) << 12) +
|
||||||
((input[i++] & 0x3F) << 6) +
|
((input[i - 2] & 0x3F) << 6) +
|
||||||
(input[i++] & 0x3F);
|
(input[i - 1] & 0x3F);
|
||||||
|
|
||||||
// 11110www 10zzzzzz 10yyyyyy 10xxxxxx -> 000wwwzz zzzzyyyy yyxxxxxx
|
// 11110www 10zzzzzz 10yyyyyy 10xxxxxx -> 000wwwzz zzzzyyyy yyxxxxxx
|
||||||
if (length == 4)
|
if (length == 4)
|
||||||
return ((input[i++] & 0x7) << 18) +
|
return ((input[i - 4] & 0x7) << 18) +
|
||||||
((input[i++] & 0x3F) << 12) +
|
((input[i - 3] & 0x3F) << 12) +
|
||||||
((input[i++] & 0x3F) << 6) +
|
((input[i - 2] & 0x3F) << 6) +
|
||||||
(input[i++] & 0x3F);
|
(input[i - 1] & 0x3F);
|
||||||
|
|
||||||
// Default: pretend as though it's a single character.
|
// Default: pretend as though it's a single character.
|
||||||
// TODO Or should this throw?
|
// TODO Or should this throw?
|
||||||
return input[i++];
|
return input[i - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user