mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Task: Removed unnecessary chomp in ::parse
This commit is contained in:
parent
2aa3163451
commit
ee9d303b10
1 changed files with 6 additions and 13 deletions
19
src/Task.cpp
19
src/Task.cpp
|
@ -579,27 +579,20 @@ bool Task::is_overdue () const
|
|||
//
|
||||
void Task::parse (const std::string& input)
|
||||
{
|
||||
// TODO Is this simply a 'chomp'?
|
||||
std::string copy;
|
||||
if (input[input.length () - 1] == '\n')
|
||||
copy = input.substr (0, input.length () - 1);
|
||||
else
|
||||
copy = input;
|
||||
|
||||
try
|
||||
{
|
||||
// File format version 4, from 2009-5-16 - now, v1.7.1+
|
||||
// This is the parse format tried first, because it is most used.
|
||||
clear ();
|
||||
|
||||
if (copy[0] == '[')
|
||||
if (input[0] == '[')
|
||||
{
|
||||
Nibbler n (copy);
|
||||
Nibbler n (input);
|
||||
std::string line;
|
||||
if (n.skip ('[') &&
|
||||
n.getUntil (']', line) &&
|
||||
n.skip (']') &&
|
||||
n.depleted ())
|
||||
(n.skip ('\n') || n.depleted ()))
|
||||
{
|
||||
if (line.length () == 0)
|
||||
throw std::string (STRING_RECORD_EMPTY);
|
||||
|
@ -630,15 +623,15 @@ void Task::parse (const std::string& input)
|
|||
throw std::string (STRING_RECORD_JUNK_AT_EOL);
|
||||
}
|
||||
}
|
||||
else if (copy[0] == '{')
|
||||
parseJSON (copy);
|
||||
else if (input[0] == '{')
|
||||
parseJSON (input);
|
||||
else
|
||||
throw std::string (STRING_RECORD_NOT_FF4);
|
||||
}
|
||||
|
||||
catch (const std::string&)
|
||||
{
|
||||
parseLegacy (copy);
|
||||
parseLegacy (input);
|
||||
}
|
||||
|
||||
recalc_urgency = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue