mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 13:37:20 +02:00
Duration: Addressed problem of UUID/Duration overlap
- The "d" unit is a special case, because it is the only one that can legitimately occur at the beginning of a UUID, and be followed by an operator: 1111111d-0000-0000-0000-000000000000 Because Lexer::isDuration is higher precedence than Lexer::isUUID, the above UUID looks like: <1111111d> <-> ... duration op ... So as a special case, durations, with units of "d" are rejected if the quantity exceeds 10000.
This commit is contained in:
parent
77ae4a3613
commit
02173be81a
1 changed files with 19 additions and 0 deletions
|
@ -341,6 +341,25 @@ bool Duration::parse (const std::string& input, std::string::size_type& start)
|
|||
n.skipWS ();
|
||||
if (n.getOneOf (units, unit))
|
||||
{
|
||||
// The "d" unit is a special case, because it is the only one that can
|
||||
// legitimately occur at the beginning of a UUID, and be followed by an
|
||||
// operator:
|
||||
//
|
||||
// 1111111d-0000-0000-0000-000000000000
|
||||
//
|
||||
// Because Lexer::isDuration is higher precedence than Lexer::isUUID,
|
||||
// the above UUID looks like:
|
||||
//
|
||||
// <1111111d> <-> ...
|
||||
// duration op ...
|
||||
//
|
||||
// So as a special case, durations, with units of "d" are rejected if the
|
||||
// quantity exceeds 10000.
|
||||
//
|
||||
if (unit == "d" &&
|
||||
strtol (number.c_str (), NULL, 10) > 10000)
|
||||
return false;
|
||||
|
||||
if (n.depleted () ||
|
||||
Lexer::isWhitespace (n.next ()) ||
|
||||
Lexer::isSingleCharOperator (n.next ()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue