Bug 879 - Description/Annotation ending with Slash Causes Problems

- Backslashes actually.  The escaping mechanism in the low-level parser
  was eating leading \ characters when it should not.  Very hard bug to
  find, trivial to fix.
- Added unit tests to several components while narrowing this down.
This commit is contained in:
Paul Beckingham
2012-01-29 15:36:05 -05:00
parent 7a2bf28005
commit ec96d929a0
10 changed files with 135 additions and 41 deletions

View File

@@ -25,7 +25,6 @@
//
////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete.
#include <fstream>

View File

@@ -25,7 +25,6 @@
//
////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete.
#include <text.h>
@@ -410,10 +409,10 @@ std::string json::encode (const std::string& input)
}
////////////////////////////////////////////////////////////////////////////////
// TODO Pointers might speed this up.
std::string json::decode (const std::string& input)
{
std::string output;
for (unsigned int i = 0; i < input.length (); ++i)
{
if (input[i] == '\\')
@@ -437,7 +436,7 @@ std::string json::decode (const std::string& input)
i += 3;
break;
// If it is an unrecognized seqeence, do nothing.
// If it is an unrecognized sequence, do nothing.
default:
output += '\\';
output += input[i];

View File

@@ -234,6 +234,7 @@ bool Nibbler::getQuoted (
{
bool inquote = false;
bool inescape = false;
char previous = 0;
char current = 0;
result = "";
@@ -250,6 +251,7 @@ bool Nibbler::getQuoted (
if (current == '\\' && !inescape)
{
inescape = true;
previous = current;
continue;
}
@@ -270,6 +272,12 @@ bool Nibbler::getQuoted (
}
else
{
if (previous)
{
result += previous;
previous = 0;
}
result += current;
inescape = false;
}

View File

@@ -309,7 +309,7 @@ void Task::parse (const std::string& input)
nl.skip (':') &&
nl.getQuoted ('"', value))
{
// Experimental legacy value translation.
// Experimental legacy value translation of 'recur:m' --> 'recur:mo'.
if (name == "recur" &&
digitsOnly (value.substr (0, value.length () - 1)) &&
value[value.length () - 1] == 'm')

View File

@@ -492,11 +492,9 @@ unsigned burndown_size (unsigned ntasks)
////////////////////////////////////////////////////////////////////////////////
// Encode values prior to serialization.
// \t -> &tab;
// " -> &dquot;
// [ -> &open;
// ] -> &close;
// \ -> \\ (extra chars to disambiguate multi-line comment)
const std::string encode (const std::string& value)
{
std::string modified = value;
@@ -510,9 +508,8 @@ const std::string encode (const std::string& value)
////////////////////////////////////////////////////////////////////////////////
// Decode values after parse.
// \t <- &tab;
// " <- &quot; or &dquot;
// ' <- &squot;
// " <- &dquot;
// ' <- &squot; or &quot;
// , <- &comma;
// [ <- &open;
// ] <- &close;