From 814d7d69fadaf6d5c2e50e2e7bce87f4601cbb04 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 14 Oct 2016 23:11:28 -0400 Subject: [PATCH] Cleanup: Don't use string literals when character literals are needed --- src/Msg.cpp | 6 ++-- src/TDB2.cpp | 60 ++++++++++++++++----------------- src/Task.cpp | 58 +++++++++++++++---------------- src/columns/ColDepends.cpp | 2 +- src/columns/ColDescription.cpp | 4 +-- src/columns/ColProject.cpp | 6 ++-- src/columns/ColRecur.cpp | 2 +- src/columns/ColTags.cpp | 6 ++-- src/columns/ColTypeDate.cpp | 10 +++--- src/columns/ColTypeDuration.cpp | 2 +- src/columns/ColTypeNumeric.cpp | 2 +- src/columns/ColTypeString.cpp | 4 +-- src/commands/CmdAttributes.cpp | 2 +- src/commands/CmdBurndown.cpp | 4 +-- src/commands/CmdCommands.cpp | 4 +-- src/commands/CmdConfig.cpp | 14 ++++---- src/commands/CmdDiagnostics.cpp | 8 ++--- src/commands/CmdEdit.cpp | 2 +- src/commands/CmdExport.cpp | 2 +- src/commands/CmdHistory.cpp | 12 +++---- src/commands/CmdIDs.cpp | 6 ++-- src/commands/CmdInfo.cpp | 8 ++--- src/commands/CmdStats.cpp | 2 +- src/rules.cpp | 2 +- src/text.cpp | 2 +- src/text.h | 2 +- src/util.cpp | 12 +++---- 27 files changed, 122 insertions(+), 122 deletions(-) diff --git a/src/Msg.cpp b/src/Msg.cpp index 7f73858c4..bed357e11 100644 --- a/src/Msg.cpp +++ b/src/Msg.cpp @@ -72,9 +72,9 @@ std::string Msg::serialize () const { std::string output; for (auto& i : _header) - output += i.first + ": " + i.second + "\n"; + output += i.first + ": " + i.second + '\n'; - output += "\n" + _payload + "\n"; + output += '\n' + _payload + '\n'; return output; } @@ -95,7 +95,7 @@ bool Msg::parse (const std::string& input) { auto delimiter = i.find (':'); if (delimiter == std::string::npos) - throw std::string ("ERROR: Malformed message header '") + i + "'"; + throw std::string ("ERROR: Malformed message header '") + i + '\''; _header[Lexer::trim (i.substr (0, delimiter))] = Lexer::trim (i.substr (delimiter + 1)); } diff --git a/src/TDB2.cpp b/src/TDB2.cpp index 0f3e696c3..f53332aed 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -61,7 +61,7 @@ TF2::~TF2 () { if (_dirty && TDB2::debug_mode) std::cout << format (STRING_TDB2_DIRTY_EXIT, std::string (_file)) - << "\n"; + << '\n'; } //////////////////////////////////////////////////////////////////////////////// @@ -301,7 +301,7 @@ void TF2::commit () for (auto& task : _tasks) // Skip over the tasks that are marked to be purged if (_purged_tasks.find (task.get ("uuid")) == _purged_tasks.end ()) - _file.write_raw (task.composeF4 () + "\n"); + _file.write_raw (task.composeF4 () + '\n'); // Write out all the added lines. _file.append (_added_lines); @@ -708,9 +708,9 @@ void TDB2::update ( // old // new // --- - undo.add_line ("time " + ISO8601d ().toEpochString () + "\n"); - undo.add_line ("old " + original.composeF4 () + "\n"); - undo.add_line ("new " + task.composeF4 () + "\n"); + undo.add_line ("time " + ISO8601d ().toEpochString () + '\n'); + undo.add_line ("old " + original.composeF4 () + '\n'); + undo.add_line ("new " + task.composeF4 () + '\n'); undo.add_line ("---\n"); } else @@ -727,14 +727,14 @@ void TDB2::update ( // time