Bug Fix - composeF4 -> parse -> composeF4
- Fixed bug that meant Task::composeF4 added a newline, but Task::parse did not expect a newline. This caused Task::determineVersion to detect a format 1 encoding and throw. Changed TDB::load to not remove any \n characters, and Task::parse to accept lines either with or without.
This commit is contained in:
@@ -181,7 +181,6 @@ int TDB::loadPending (std::vector <Task>& tasks, Filter& filter)
|
|||||||
if (length > 1)
|
if (length > 1)
|
||||||
{
|
{
|
||||||
// TODO Add hidden attribute indicating source?
|
// TODO Add hidden attribute indicating source?
|
||||||
line[length - 1] = '\0'; // Kill \n
|
|
||||||
Task task (line);
|
Task task (line);
|
||||||
task.id = mId++;
|
task.id = mId++;
|
||||||
|
|
||||||
|
|||||||
10
src/Task.cpp
10
src/Task.cpp
@@ -125,14 +125,20 @@ void Task::setStatus (Task::status status)
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void Task::parse (const std::string& line)
|
void Task::parse (const std::string& line)
|
||||||
{
|
{
|
||||||
|
std::string copy;
|
||||||
|
if (line[line.length () - 1] == '\n')
|
||||||
|
copy = line.substr (0, line.length () - 1);
|
||||||
|
else
|
||||||
|
copy = line;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Record::parse (line);
|
Record::parse (copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (std::string& e)
|
catch (std::string& e)
|
||||||
{
|
{
|
||||||
legacyParse (line);
|
legacyParse (copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user