Merge branch '2.4.3' of ssh://git.tasktools.org/tm/task into 2.4.3
This commit is contained in:
@@ -68,6 +68,8 @@ endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|||||||
|
|
||||||
set (CMAKE_CXX_FLAGS "${_CXX11_FLAGS} ${CMAKE_CXX_FLAGS}")
|
set (CMAKE_CXX_FLAGS "${_CXX11_FLAGS} ${CMAKE_CXX_FLAGS}")
|
||||||
|
|
||||||
|
set (CMAKE_CXX_FLAGS "-Wall -Wsign-compare -Wreturn-type ${CMAKE_CXX_FLAGS}")
|
||||||
|
|
||||||
if (NETBSD)
|
if (NETBSD)
|
||||||
# Since readline, etc likely to be in /usr/pkg/lib, not standard library
|
# Since readline, etc likely to be in /usr/pkg/lib, not standard library
|
||||||
# Otherwise will remove links during install
|
# Otherwise will remove links during install
|
||||||
|
|||||||
@@ -443,7 +443,7 @@ void CLI::analyze (bool parse /* = true */, bool strict /* = false */)
|
|||||||
// For propagation.
|
// For propagation.
|
||||||
_strict = strict;
|
_strict = strict;
|
||||||
|
|
||||||
for (int i = 0; i < _original_args.size (); ++i)
|
for (unsigned int i = 0; i < _original_args.size (); ++i)
|
||||||
{
|
{
|
||||||
std::string raw = _original_args[i];
|
std::string raw = _original_args[i];
|
||||||
A a ("arg", raw);
|
A a ("arg", raw);
|
||||||
@@ -2362,7 +2362,7 @@ bool CLI::isName (const std::string& raw) const
|
|||||||
{
|
{
|
||||||
if (raw != "")
|
if (raw != "")
|
||||||
{
|
{
|
||||||
for (int i = 0; i < raw.length (); ++i)
|
for (unsigned int i = 0; i < raw.length (); ++i)
|
||||||
{
|
{
|
||||||
if (i == 0 && ! Lexer::isIdentifierStart (raw[i]))
|
if (i == 0 && ! Lexer::isIdentifierStart (raw[i]))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -319,6 +319,7 @@ bool Duration::parse (const std::string& input, std::string::size_type& start)
|
|||||||
start = original_start + n.cursor ();
|
start = original_start + n.cursor ();
|
||||||
|
|
||||||
// Linear lookup - should be logarithmic.
|
// Linear lookup - should be logarithmic.
|
||||||
|
double seconds = 1;
|
||||||
for (unsigned int i = 0; i < NUM_DURATIONS; i++)
|
for (unsigned int i = 0; i < NUM_DURATIONS; i++)
|
||||||
{
|
{
|
||||||
if (durations[i].unit == unit &&
|
if (durations[i].unit == unit &&
|
||||||
|
|||||||
28
src/Eval.cpp
28
src/Eval.cpp
@@ -446,7 +446,7 @@ void Eval::evaluatePostfixStack (
|
|||||||
void Eval::infixParse (
|
void Eval::infixParse (
|
||||||
std::vector <std::pair <std::string, Lexer::Type> >& infix) const
|
std::vector <std::pair <std::string, Lexer::Type> >& infix) const
|
||||||
{
|
{
|
||||||
int i = 0;
|
unsigned int i = 0;
|
||||||
parseLogical (infix, i);
|
parseLogical (infix, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,7 +454,7 @@ void Eval::infixParse (
|
|||||||
// Logical --> Regex {( "and" | "or" | "xor" ) Regex}
|
// Logical --> Regex {( "and" | "or" | "xor" ) Regex}
|
||||||
bool Eval::parseLogical (
|
bool Eval::parseLogical (
|
||||||
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
||||||
int &i) const
|
unsigned int &i) const
|
||||||
{
|
{
|
||||||
if (i < infix.size () &&
|
if (i < infix.size () &&
|
||||||
parseRegex (infix, i))
|
parseRegex (infix, i))
|
||||||
@@ -480,7 +480,7 @@ bool Eval::parseLogical (
|
|||||||
// Regex --> Equality {( "~" | "!~" ) Equality}
|
// Regex --> Equality {( "~" | "!~" ) Equality}
|
||||||
bool Eval::parseRegex (
|
bool Eval::parseRegex (
|
||||||
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
||||||
int &i) const
|
unsigned int &i) const
|
||||||
{
|
{
|
||||||
if (i < infix.size () &&
|
if (i < infix.size () &&
|
||||||
parseEquality (infix, i))
|
parseEquality (infix, i))
|
||||||
@@ -505,7 +505,7 @@ bool Eval::parseRegex (
|
|||||||
// Equality --> Comparative {( "==" | "=" | "!==" | "!=" ) Comparative}
|
// Equality --> Comparative {( "==" | "=" | "!==" | "!=" ) Comparative}
|
||||||
bool Eval::parseEquality (
|
bool Eval::parseEquality (
|
||||||
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
||||||
int &i) const
|
unsigned int &i) const
|
||||||
{
|
{
|
||||||
if (i < infix.size () &&
|
if (i < infix.size () &&
|
||||||
parseComparative (infix, i))
|
parseComparative (infix, i))
|
||||||
@@ -532,7 +532,7 @@ bool Eval::parseEquality (
|
|||||||
// Comparative --> Arithmetic {( "<=" | "<" | ">=" | ">" ) Arithmetic}
|
// Comparative --> Arithmetic {( "<=" | "<" | ">=" | ">" ) Arithmetic}
|
||||||
bool Eval::parseComparative (
|
bool Eval::parseComparative (
|
||||||
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
||||||
int &i) const
|
unsigned int &i) const
|
||||||
{
|
{
|
||||||
if (i < infix.size () &&
|
if (i < infix.size () &&
|
||||||
parseArithmetic (infix, i))
|
parseArithmetic (infix, i))
|
||||||
@@ -559,7 +559,7 @@ bool Eval::parseComparative (
|
|||||||
// Arithmetic --> Geometric {( "+" | "-" ) Geometric}
|
// Arithmetic --> Geometric {( "+" | "-" ) Geometric}
|
||||||
bool Eval::parseArithmetic (
|
bool Eval::parseArithmetic (
|
||||||
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
||||||
int &i) const
|
unsigned int &i) const
|
||||||
{
|
{
|
||||||
if (i < infix.size () &&
|
if (i < infix.size () &&
|
||||||
parseGeometric (infix, i))
|
parseGeometric (infix, i))
|
||||||
@@ -584,7 +584,7 @@ bool Eval::parseArithmetic (
|
|||||||
// Geometric --> Tag {( "*" | "/" | "%" ) Tag}
|
// Geometric --> Tag {( "*" | "/" | "%" ) Tag}
|
||||||
bool Eval::parseGeometric (
|
bool Eval::parseGeometric (
|
||||||
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
||||||
int &i) const
|
unsigned int &i) const
|
||||||
{
|
{
|
||||||
if (i < infix.size () &&
|
if (i < infix.size () &&
|
||||||
parseTag (infix, i))
|
parseTag (infix, i))
|
||||||
@@ -610,7 +610,7 @@ bool Eval::parseGeometric (
|
|||||||
// Tag --> Unary {( "_hastag_" | "_notag_" ) Unary}
|
// Tag --> Unary {( "_hastag_" | "_notag_" ) Unary}
|
||||||
bool Eval::parseTag (
|
bool Eval::parseTag (
|
||||||
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
||||||
int &i) const
|
unsigned int &i) const
|
||||||
{
|
{
|
||||||
if (i < infix.size () &&
|
if (i < infix.size () &&
|
||||||
parseUnary (infix, i))
|
parseUnary (infix, i))
|
||||||
@@ -635,7 +635,7 @@ bool Eval::parseTag (
|
|||||||
// Unary --> [( "-" | "+" | "!" )] Exponent
|
// Unary --> [( "-" | "+" | "!" )] Exponent
|
||||||
bool Eval::parseUnary (
|
bool Eval::parseUnary (
|
||||||
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
||||||
int &i) const
|
unsigned int &i) const
|
||||||
{
|
{
|
||||||
if (i < infix.size ())
|
if (i < infix.size ())
|
||||||
{
|
{
|
||||||
@@ -662,7 +662,7 @@ bool Eval::parseUnary (
|
|||||||
// Exponent --> Primitive ["^" Primitive]
|
// Exponent --> Primitive ["^" Primitive]
|
||||||
bool Eval::parseExponent (
|
bool Eval::parseExponent (
|
||||||
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
||||||
int &i) const
|
unsigned int& i) const
|
||||||
{
|
{
|
||||||
if (i < infix.size () &&
|
if (i < infix.size () &&
|
||||||
parsePrimitive (infix, i))
|
parsePrimitive (infix, i))
|
||||||
@@ -686,7 +686,7 @@ bool Eval::parseExponent (
|
|||||||
// Primitive --> "(" Logical ")" | Variant
|
// Primitive --> "(" Logical ")" | Variant
|
||||||
bool Eval::parsePrimitive (
|
bool Eval::parsePrimitive (
|
||||||
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
std::vector <std::pair <std::string, Lexer::Type> >& infix,
|
||||||
int &i) const
|
unsigned int &i) const
|
||||||
{
|
{
|
||||||
if (i < infix.size ())
|
if (i < infix.size ())
|
||||||
{
|
{
|
||||||
@@ -781,7 +781,7 @@ void Eval::infixToPostfix (
|
|||||||
|
|
||||||
// Operator characteristics.
|
// Operator characteristics.
|
||||||
char type;
|
char type;
|
||||||
int precedence;
|
unsigned int precedence;
|
||||||
char associativity;
|
char associativity;
|
||||||
|
|
||||||
std::vector <std::pair <std::string, Lexer::Type> >::iterator token;
|
std::vector <std::pair <std::string, Lexer::Type> >::iterator token;
|
||||||
@@ -811,7 +811,7 @@ void Eval::infixToPostfix (
|
|||||||
identifyOperator (token->first, type, precedence, associativity))
|
identifyOperator (token->first, type, precedence, associativity))
|
||||||
{
|
{
|
||||||
char type2;
|
char type2;
|
||||||
int precedence2;
|
unsigned int precedence2;
|
||||||
char associativity2;
|
char associativity2;
|
||||||
while (op_stack.size () > 0 &&
|
while (op_stack.size () > 0 &&
|
||||||
identifyOperator (op_stack.back ().first, type2, precedence2, associativity2) &&
|
identifyOperator (op_stack.back ().first, type2, precedence2, associativity2) &&
|
||||||
@@ -847,7 +847,7 @@ void Eval::infixToPostfix (
|
|||||||
bool Eval::identifyOperator (
|
bool Eval::identifyOperator (
|
||||||
const std::string& op,
|
const std::string& op,
|
||||||
char& type,
|
char& type,
|
||||||
int& precedence,
|
unsigned int& precedence,
|
||||||
char& associativity) const
|
char& associativity) const
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < NUM_OPERATORS; ++i)
|
for (unsigned int i = 0; i < NUM_OPERATORS; ++i)
|
||||||
|
|||||||
22
src/Eval.h
22
src/Eval.h
@@ -56,17 +56,17 @@ private:
|
|||||||
void evaluatePostfixStack (const std::vector <std::pair <std::string, Lexer::Type> >&, Variant&) const;
|
void evaluatePostfixStack (const std::vector <std::pair <std::string, Lexer::Type> >&, Variant&) const;
|
||||||
void infixToPostfix (std::vector <std::pair <std::string, Lexer::Type> >&) const;
|
void infixToPostfix (std::vector <std::pair <std::string, Lexer::Type> >&) const;
|
||||||
void infixParse (std::vector <std::pair <std::string, Lexer::Type> >&) const;
|
void infixParse (std::vector <std::pair <std::string, Lexer::Type> >&) const;
|
||||||
bool parseLogical (std::vector <std::pair <std::string, Lexer::Type> >&, int &) const;
|
bool parseLogical (std::vector <std::pair <std::string, Lexer::Type> >&, unsigned int &) const;
|
||||||
bool parseRegex (std::vector <std::pair <std::string, Lexer::Type> >&, int &) const;
|
bool parseRegex (std::vector <std::pair <std::string, Lexer::Type> >&, unsigned int &) const;
|
||||||
bool parseEquality (std::vector <std::pair <std::string, Lexer::Type> >&, int &) const;
|
bool parseEquality (std::vector <std::pair <std::string, Lexer::Type> >&, unsigned int &) const;
|
||||||
bool parseComparative (std::vector <std::pair <std::string, Lexer::Type> >&, int &) const;
|
bool parseComparative (std::vector <std::pair <std::string, Lexer::Type> >&, unsigned int &) const;
|
||||||
bool parseArithmetic (std::vector <std::pair <std::string, Lexer::Type> >&, int &) const;
|
bool parseArithmetic (std::vector <std::pair <std::string, Lexer::Type> >&, unsigned int &) const;
|
||||||
bool parseGeometric (std::vector <std::pair <std::string, Lexer::Type> >&, int &) const;
|
bool parseGeometric (std::vector <std::pair <std::string, Lexer::Type> >&, unsigned int &) const;
|
||||||
bool parseTag (std::vector <std::pair <std::string, Lexer::Type> >&, int &) const;
|
bool parseTag (std::vector <std::pair <std::string, Lexer::Type> >&, unsigned int &) const;
|
||||||
bool parseUnary (std::vector <std::pair <std::string, Lexer::Type> >&, int &) const;
|
bool parseUnary (std::vector <std::pair <std::string, Lexer::Type> >&, unsigned int &) const;
|
||||||
bool parseExponent (std::vector <std::pair <std::string, Lexer::Type> >&, int &) const;
|
bool parseExponent (std::vector <std::pair <std::string, Lexer::Type> >&, unsigned int &) const;
|
||||||
bool parsePrimitive (std::vector <std::pair <std::string, Lexer::Type> >&, int &) const;
|
bool parsePrimitive (std::vector <std::pair <std::string, Lexer::Type> >&, unsigned int &) const;
|
||||||
bool identifyOperator (const std::string&, char&, int&, char&) const;
|
bool identifyOperator (const std::string&, char&, unsigned int&, char&) const;
|
||||||
|
|
||||||
std::string dump (std::vector <std::pair <std::string, Lexer::Type> >&) const;
|
std::string dump (std::vector <std::pair <std::string, Lexer::Type> >&) const;
|
||||||
|
|
||||||
|
|||||||
@@ -466,7 +466,7 @@ void Hooks::assertValidJSON (const std::vector <std::string>& input) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void Hooks::assertNTasks (const std::vector <std::string>& input, int n) const
|
void Hooks::assertNTasks (const std::vector <std::string>& input, unsigned int n) const
|
||||||
{
|
{
|
||||||
if (input.size () != n)
|
if (input.size () != n)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ private:
|
|||||||
void separateOutput (const std::vector <std::string>&, std::vector <std::string>&, std::vector <std::string>&) const;
|
void separateOutput (const std::vector <std::string>&, std::vector <std::string>&, std::vector <std::string>&) const;
|
||||||
bool isJSON (const std::string&) const;
|
bool isJSON (const std::string&) const;
|
||||||
void assertValidJSON (const std::vector <std::string>&) const;
|
void assertValidJSON (const std::vector <std::string>&) const;
|
||||||
void assertNTasks (const std::vector <std::string>&, int) const;
|
void assertNTasks (const std::vector <std::string>&, unsigned int) const;
|
||||||
void assertSameTask (const std::vector <std::string>&, const Task&) const;
|
void assertSameTask (const std::vector <std::string>&, const Task&) const;
|
||||||
void assertFeedback (const std::vector <std::string>&) const;
|
void assertFeedback (const std::vector <std::string>&) const;
|
||||||
int callHookScript (const std::string&, const std::vector <std::string>&, std::vector <std::string>&);
|
int callHookScript (const std::string&, const std::vector <std::string>&, std::vector <std::string>&);
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ bool TF2::get (int id, Task& task)
|
|||||||
// pending.data file, the task in question cannot appear earlier than line
|
// pending.data file, the task in question cannot appear earlier than line
|
||||||
// (id - 1) in the file. It can, however, appear significantly later because
|
// (id - 1) in the file. It can, however, appear significantly later because
|
||||||
// it is not known how recent a GC operation was run.
|
// it is not known how recent a GC operation was run.
|
||||||
for (int i = id - 1; i < _tasks.size (); ++i)
|
for (unsigned int i = id - 1; i < _tasks.size (); ++i)
|
||||||
{
|
{
|
||||||
if (_tasks[i].id == id)
|
if (_tasks[i].id == id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -956,7 +956,7 @@ std::string rightJustify (const int input, const int width)
|
|||||||
std::string rightJustify (const std::string& input, const int width)
|
std::string rightJustify (const std::string& input, const int width)
|
||||||
{
|
{
|
||||||
unsigned int len = utf8_text_width (input);
|
unsigned int len = utf8_text_width (input);
|
||||||
return ((width > len)
|
return (((unsigned int) width > len)
|
||||||
? std::string (width - len, ' ')
|
? std::string (width - len, ' ')
|
||||||
: "")
|
: "")
|
||||||
+ input;
|
+ input;
|
||||||
|
|||||||
Reference in New Issue
Block a user