From 7431f0cdd376e29e6413c54cf91d566f537ee0b9 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 12 Apr 2009 22:53:20 -0400 Subject: [PATCH] Bug Fix - use " not ' for annotation quoting - Annotations were using ' to quote text, sanitizing ' -> " inside the text. It would be better to quote with " and sanitize " -> ' because ' is more common in the text (e.g. "Doesn't work") than ". --- src/T.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/T.cpp b/src/T.cpp index 3ec41edc1..43495f542 100644 --- a/src/T.cpp +++ b/src/T.cpp @@ -280,7 +280,7 @@ void T::setAnnotations (const std::map & all) void T::addAnnotation (const std::string& description) { std::string sanitized = description; - std::replace (sanitized.begin (), sanitized.end (), '\'', '"'); + std::replace (sanitized.begin (), sanitized.end (), '"', '\''); std::replace (sanitized.begin (), sanitized.end (), '[', '('); std::replace (sanitized.begin (), sanitized.end (), ']', ')'); mAnnotations[time (NULL)] = sanitized; @@ -337,7 +337,7 @@ const std::string T::compose () const else annotation << " "; - annotation << note->first << ":'" << note->second << "'"; + annotation << note->first << ":\"" << note->second << "\""; } line += annotation.str () + "] "; @@ -584,7 +584,7 @@ void T::parse (const std::string& line) } // Extract and split the annotations, which are of the form: - // 1234:'...' 5678:'...' + // 1234:"..." 5678:"..." std::string annotations = line.substr ( openAnnoBracket + 1, closeAnnoBracket - openAnnoBracket - 1); pairs.clear (); @@ -593,10 +593,10 @@ void T::parse (const std::string& line) std::string::size_type end = 0; do { - end = annotations.find ('\'', start); + end = annotations.find ('"', start); if (end != std::string::npos) { - end = annotations.find ('\'', end + 1); + end = annotations.find ('"', end + 1); if (start != std::string::npos && end != std::string::npos)