From e8d04bdce6d9b0f422d05c5487e3cbf16d4f3b44 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 24 May 2015 13:36:26 -0400 Subject: [PATCH] C++11: N1984 auto --- src/CLI.cpp | 14 ++++++------ src/Config.cpp | 8 +++---- src/Directory.cpp | 2 +- src/Duration.cpp | 2 +- src/ISO8601.cpp | 4 ++-- src/Msg.cpp | 2 +- src/Nibbler.cpp | 38 ++++++++++++++++----------------- src/Path.cpp | 8 +++---- src/TDB2.cpp | 4 ++-- src/Task.cpp | 14 ++++++------ src/columns/ColProject.cpp | 4 ++-- src/columns/Column.cpp | 2 +- src/commands/CmdBurndown.cpp | 2 +- src/commands/CmdCalendar.cpp | 2 +- src/commands/CmdConfig.cpp | 8 +++---- src/commands/CmdDenotate.cpp | 2 +- src/commands/CmdDiagnostics.cpp | 2 +- src/commands/CmdEdit.cpp | 16 +++++++------- src/commands/CmdInfo.cpp | 6 +++--- src/commands/CmdReports.cpp | 2 +- src/commands/CmdSync.cpp | 2 +- src/commands/CmdUDAs.cpp | 4 ++-- src/commands/Command.cpp | 2 +- test/test.cpp | 4 ++-- 24 files changed, 77 insertions(+), 77 deletions(-) diff --git a/src/CLI.cpp b/src/CLI.cpp index 3b278d1d0..dfda2ac68 100644 --- a/src/CLI.cpp +++ b/src/CLI.cpp @@ -230,7 +230,7 @@ void CLI::getOverride (int argc, const char** argv, std::string& home, File& rc) rc = raw.substr (3); home = "."; - std::string::size_type last_slash = rc._data.rfind ("/"); + auto last_slash = rc._data.rfind ("/"); if (last_slash != std::string::npos) home = rc.parent (); @@ -286,7 +286,7 @@ void CLI::applyOverrides (int argc, const char** argv) raw.length () > 3 && raw.substr (0, 3) == "rc.") { - std::string::size_type sep = raw.find ('=', 3); + auto sep = raw.find ('=', 3); if (sep == std::string::npos) sep = raw.find (':', 3); if (sep != std::string::npos) @@ -445,7 +445,7 @@ void CLI::analyze (bool parse /* = true */, bool strict /* = false */) a.tag ("BINARY"); std::string basename = "task"; - std::string::size_type slash = raw.rfind ('/'); + auto slash = raw.rfind ('/'); if (slash != std::string::npos) basename = raw.substr (slash + 1); @@ -808,7 +808,7 @@ void CLI::findOverrides () } else if (isConfigOverride (raw)) { - std::string::size_type sep = raw.find ('=', 3); + auto sep = raw.find ('=', 3); if (sep == std::string::npos) sep = raw.find (':', 3); if (sep != std::string::npos) @@ -2236,8 +2236,8 @@ bool CLI::isSubstitution (const std::string& raw) const // .[~][:=]... bool CLI::isAttribute (const std::string& raw) const { - std::string::size_type colon = raw.find (":"); - std::string::size_type equal = raw.find ("="); + auto colon = raw.find (":"); + auto equal = raw.find ("="); std::string attr = ""; if (colon != std::string::npos) @@ -2251,7 +2251,7 @@ bool CLI::isAttribute (const std::string& raw) const if (! isName (attr)) return false; - std::string::size_type dot = attr.find ("."); + auto dot = attr.find ("."); std::string mod = ""; if (dot != std::string::npos) { diff --git a/src/Config.cpp b/src/Config.cpp index 592583beb..fc60e9d72 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -531,7 +531,7 @@ void Config::parse (const std::string& input, int nest /* = 1 */) for (auto& line : lines) { // Remove comments. - std::string::size_type pound = line.find ("#"); // no i18n + auto pound = line.find ("#"); // no i18n if (pound != std::string::npos) line = line.substr (0, pound); @@ -540,7 +540,7 @@ void Config::parse (const std::string& input, int nest /* = 1 */) // Skip empty lines. if (line.length () > 0) { - std::string::size_type equal = line.find ("="); // no i18n + auto equal = line.find ("="); // no i18n if (equal != std::string::npos) { std::string key = trim (line.substr (0, equal), " \t"); // no i18n @@ -550,7 +550,7 @@ void Config::parse (const std::string& input, int nest /* = 1 */) } else { - std::string::size_type include = line.find ("include"); // no i18n. + auto include = line.find ("include"); // no i18n. if (include != std::string::npos) { Path included (trim (line.substr (include + 7), " \t")); @@ -575,7 +575,7 @@ void Config::parse (const std::string& input, int nest /* = 1 */) void Config::createDefaultRC (const std::string& rc, const std::string& data) { // Override data.location in the defaults. - std::string::size_type loc = _defaults.find ("data.location=~/.task"); + auto loc = _defaults.find ("data.location=~/.task"); // loc+0^ +14^ +21^ Date now; diff --git a/src/Directory.cpp b/src/Directory.cpp index f0e7efe5f..6390cc45d 100644 --- a/src/Directory.cpp +++ b/src/Directory.cpp @@ -175,7 +175,7 @@ bool Directory::up () if (_data == "/") return false; - std::string::size_type slash = _data.rfind ('/'); + auto slash = _data.rfind ('/'); if (slash == 0) { _data = "/"; // Root dir should retain the slash. diff --git a/src/Duration.cpp b/src/Duration.cpp index a61d2fdaf..c94391e04 100644 --- a/src/Duration.cpp +++ b/src/Duration.cpp @@ -299,7 +299,7 @@ std::string Duration::formatISO () const //////////////////////////////////////////////////////////////////////////////// bool Duration::parse (const std::string& input, std::string::size_type& start) { - std::string::size_type original_start = start; + auto original_start = start; Nibbler n (input.substr (start)); // Static and so preserved between calls. diff --git a/src/ISO8601.cpp b/src/ISO8601.cpp index 6f31abaae..dfc4ee896 100644 --- a/src/ISO8601.cpp +++ b/src/ISO8601.cpp @@ -129,7 +129,7 @@ void ISO8601d::ambiguity (bool value) // bool ISO8601d::parse (const std::string& input, std::string::size_type& start) { - std::string::size_type i = start; + auto i = start; Nibbler n (input.substr (i)); if (parse_date_time_ext (n) || // Most complex first. @@ -749,7 +749,7 @@ ISO8601p::operator time_t () const // bool ISO8601p::parse (const std::string& input, std::string::size_type& start) { - std::string::size_type i = start; + auto i = start; Nibbler n (input.substr (i)); if (parse_designated (n)) diff --git a/src/Msg.cpp b/src/Msg.cpp index 2999516ef..3d36bdfb2 100644 --- a/src/Msg.cpp +++ b/src/Msg.cpp @@ -150,7 +150,7 @@ bool Msg::parse (const std::string& input) split (lines, input.substr (0, separator), '\n'); for (auto& i : lines) { - std::string::size_type delimiter = i.find (':'); + auto delimiter = i.find (':'); if (delimiter == std::string::npos) throw std::string ("ERROR: Malformed message header '") + i + "'"; diff --git a/src/Nibbler.cpp b/src/Nibbler.cpp index 7a7f25889..738cf79fd 100644 --- a/src/Nibbler.cpp +++ b/src/Nibbler.cpp @@ -91,7 +91,7 @@ bool Nibbler::getUntil (char c, std::string& result) { if (_cursor < _length) { - std::string::size_type i = _input.find (c, _cursor); + auto i = _input.find (c, _cursor); if (i != std::string::npos) { result = _input.substr (_cursor, i - _cursor); @@ -114,7 +114,7 @@ bool Nibbler::getUntil (const std::string& terminator, std::string& result) { if (_cursor < _length) { - std::string::size_type i = _input.find (terminator, _cursor); + auto i = _input.find (terminator, _cursor); if (i != std::string::npos) { result = _input.substr (_cursor, i - _cursor); @@ -164,7 +164,7 @@ bool Nibbler::getUntilOneOf (const std::string& chars, std::string& result) { if (_cursor < _length) { - std::string::size_type i = _input.find_first_of (chars, _cursor); + auto i = _input.find_first_of (chars, _cursor); if (i != std::string::npos) { result = _input.substr (_cursor, i - _cursor); @@ -238,7 +238,7 @@ bool Nibbler::getQuoted ( return false; } - for (std::string::size_type i = _cursor; i < _length; ++i) + for (auto i = _cursor; i < _length; ++i) { current = _input[i]; @@ -296,7 +296,7 @@ bool Nibbler::getDigit (int& result) //////////////////////////////////////////////////////////////////////////////// bool Nibbler::getDigit6 (int& result) { - std::string::size_type i = _cursor; + auto i = _cursor; if (i < _length && _length - i >= 6) { @@ -319,7 +319,7 @@ bool Nibbler::getDigit6 (int& result) //////////////////////////////////////////////////////////////////////////////// bool Nibbler::getDigit4 (int& result) { - std::string::size_type i = _cursor; + auto i = _cursor; if (i < _length && _length - i >= 4) { @@ -340,7 +340,7 @@ bool Nibbler::getDigit4 (int& result) //////////////////////////////////////////////////////////////////////////////// bool Nibbler::getDigit3 (int& result) { - std::string::size_type i = _cursor; + auto i = _cursor; if (i < _length && _length - i >= 3) { @@ -360,7 +360,7 @@ bool Nibbler::getDigit3 (int& result) //////////////////////////////////////////////////////////////////////////////// bool Nibbler::getDigit2 (int& result) { - std::string::size_type i = _cursor; + auto i = _cursor; if (i < _length && _length - i >= 2) { @@ -379,7 +379,7 @@ bool Nibbler::getDigit2 (int& result) //////////////////////////////////////////////////////////////////////////////// bool Nibbler::getInt (int& result) { - std::string::size_type i = _cursor; + auto i = _cursor; if (i < _length) { @@ -406,7 +406,7 @@ bool Nibbler::getInt (int& result) //////////////////////////////////////////////////////////////////////////////// bool Nibbler::getUnsignedInt (int& result) { - std::string::size_type i = _cursor; + auto i = _cursor; // TODO Potential for use of find_first_not_of while (i < _length && Lexer::isDigit (_input[i])) ++i; @@ -439,7 +439,7 @@ bool Nibbler::getUnsignedInt (int& result) // bool Nibbler::getNumber (std::string& result) { - std::string::size_type i = _cursor; + auto i = _cursor; // [+-]? if (i < _length && (_input[i] == '-' || _input[i] == '+')) @@ -525,7 +525,7 @@ bool Nibbler::getNumber (double &result) // bool Nibbler::getUnsignedNumber (double& result) { - std::string::size_type i = _cursor; + auto i = _cursor; // digit+ if (i < _length && Lexer::isDigit (_input[i])) @@ -619,7 +619,7 @@ bool Nibbler::getRx (const std::string& regex, std::string& result) //////////////////////////////////////////////////////////////////////////////// bool Nibbler::getUUID (std::string& result) { - std::string::size_type i = _cursor; + auto i = _cursor; if (i < _length && _length - i >= 36) @@ -705,7 +705,7 @@ bool Nibbler::getPartialUUID (std::string& result) // 19980119T070000Z = YYYYMMDDThhmmssZ bool Nibbler::getDateISO (time_t& t) { - std::string::size_type i = _cursor; + auto i = _cursor; if (i < _length && _length - i >= 16) @@ -815,7 +815,7 @@ bool Nibbler::parseDigits(std::string::size_type& i, #ifdef NIBBLER_FEATURE_DATE bool Nibbler::getDate (const std::string& format, time_t& t) { - std::string::size_type i = _cursor; + auto i = _cursor; int month = -1; // So we can check later. int day = -1; @@ -998,7 +998,7 @@ bool Nibbler::getOneOf ( // A name is a string of alpha-numeric characters. bool Nibbler::getName (std::string& result) { - std::string::size_type i = _cursor; + auto i = _cursor; if (i < _length) { @@ -1030,7 +1030,7 @@ bool Nibbler::getName (std::string& result) // A word is a contiguous string of non-space, non-digit, non-punct characters. bool Nibbler::getWord (std::string& result) { - std::string::size_type i = _cursor; + auto i = _cursor; if (i < _length) { @@ -1083,7 +1083,7 @@ bool Nibbler::skipAll (char c) { if (_cursor < _length) { - std::string::size_type i = _input.find_first_not_of (c, _cursor); + auto i = _input.find_first_not_of (c, _cursor); if (i == _cursor) return false; @@ -1156,7 +1156,7 @@ bool Nibbler::skipAllOneOf (const std::string& chars) { if (_cursor < _length) { - std::string::size_type i = _input.find_first_not_of (chars, _cursor); + auto i = _input.find_first_not_of (chars, _cursor); if (i == _cursor) return false; diff --git a/src/Path.cpp b/src/Path.cpp index 8c1ecde23..908e5d08a 100644 --- a/src/Path.cpp +++ b/src/Path.cpp @@ -116,7 +116,7 @@ std::string Path::name () const { if (_data.length ()) { - std::string::size_type slash = _data.rfind ('/'); + auto slash = _data.rfind ('/'); if (slash != std::string::npos) return _data.substr (slash + 1, std::string::npos); } @@ -129,7 +129,7 @@ std::string Path::parent () const { if (_data.length ()) { - std::string::size_type slash = _data.rfind ('/'); + auto slash = _data.rfind ('/'); if (slash != std::string::npos) return _data.substr (0, slash); } @@ -142,7 +142,7 @@ std::string Path::extension () const { if (_data.length ()) { - std::string::size_type dot = _data.rfind ('.'); + auto dot = _data.rfind ('.'); if (dot != std::string::npos) return _data.substr (dot + 1, std::string::npos); } @@ -231,7 +231,7 @@ std::string Path::expand (const std::string& in) { std::string copy = in; - std::string::size_type tilde = copy.find ("~"); + auto tilde = copy.find ("~"); std::string::size_type slash; if (tilde != std::string::npos) diff --git a/src/TDB2.cpp b/src/TDB2.cpp index 196a789a4..405934b53 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -464,7 +464,7 @@ const std::string TF2::dump () // File label. std::string label; - std::string::size_type slash = _file._data.rfind ('/'); + auto slash = _file._data.rfind ('/'); if (slash != std::string::npos) label = rightJustify (_file._data.substr (slash + 1), 14); @@ -791,7 +791,7 @@ void TDB2::revert_undo ( } // Extract identifying uuid. - std::string::size_type uuidAtt = current.find ("uuid:\""); + auto uuidAtt = current.find ("uuid:\""); if (uuidAtt != std::string::npos) uuid = current.substr (uuidAtt + 6, 36); // "uuid:"" --> else diff --git a/src/Task.cpp b/src/Task.cpp index 32e9eec14..f316e7471 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -1393,7 +1393,7 @@ void Task::validate (bool applyDefault /* = true */) if (var.first.substr (0, 4) == "uda." && var.first.find (".default") != std::string::npos) { - std::string::size_type period = var.first.find ('.', 4); + auto period = var.first.find ('.', 4); if (period != std::string::npos) udas.push_back (var.first.substr (4, period - 4)); } @@ -1543,9 +1543,9 @@ int Task::determineVersion (const std::string& line) // uuid status [tags] [attributes] [annotations] description\n // // Scan for the number of [] pairs. - std::string::size_type tagAtts = line.find ("] [", 0); - std::string::size_type attsAnno = line.find ("] [", tagAtts + 1); - std::string::size_type annoDesc = line.find ("] ", attsAnno + 1); + auto tagAtts = line.find ("] [", 0); + auto attsAnno = line.find ("] [", tagAtts + 1); + auto annoDesc = line.find ("] ", attsAnno + 1); if (tagAtts != std::string::npos && attsAnno != std::string::npos && annoDesc != std::string::npos) @@ -1630,7 +1630,7 @@ float Task::urgency_c () const if (var.first.substr (0, 13) == "urgency.user.") { // urgency.user.project..coefficient - std::string::size_type end = std::string::npos; + auto end = std::string::npos; if (var.first.substr (13, 8) == "project." && (end = var.first.find (".coefficient")) != std::string::npos) { @@ -1664,11 +1664,11 @@ float Task::urgency_c () const { // urgency.uda..coefficient // urgency.uda...coefficient - std::string::size_type end = var.first.find (".coefficient"); + auto end = var.first.find (".coefficient"); if (end != std::string::npos) { const std::string uda = var.first.substr (12, end - 12); - std::string::size_type dot = uda.find ("."); + auto dot = uda.find ("."); if (dot == std::string::npos) { // urgency.uda..coefficient diff --git a/src/columns/ColProject.cpp b/src/columns/ColProject.cpp index 8cca278f5..f71b60b39 100644 --- a/src/columns/ColProject.cpp +++ b/src/columns/ColProject.cpp @@ -71,7 +71,7 @@ void ColumnProject::measure (Task& task, unsigned int& minimum, unsigned int& ma if (_style == "parent") { - std::string::size_type period = project.find ('.'); + auto period = project.find ('.'); if (period != std::string::npos) project = project.substr (0, period); } @@ -101,7 +101,7 @@ void ColumnProject::render ( std::string project = task.get (_name); if (_style == "parent") { - std::string::size_type period = project.find ('.'); + auto period = project.find ('.'); if (period != std::string::npos) project = project.substr (0, period); } diff --git a/src/columns/Column.cpp b/src/columns/Column.cpp index a6f57dcbf..1cfbbfb85 100644 --- a/src/columns/Column.cpp +++ b/src/columns/Column.cpp @@ -62,7 +62,7 @@ extern Context context; Column* Column::factory (const std::string& name, const std::string& report) { // Decompose name into type and style. - std::string::size_type dot = name.find ('.'); + auto dot = name.find ('.'); std::string column_name; std::string column_style; if (dot != std::string::npos) diff --git a/src/commands/CmdBurndown.cpp b/src/commands/CmdBurndown.cpp index fef714f60..760b894cb 100644 --- a/src/commands/CmdBurndown.cpp +++ b/src/commands/CmdBurndown.cpp @@ -593,7 +593,7 @@ void Chart::optimizeGrid () std::string::size_type ws; while ((ws = _grid.find (" \n")) != std::string::npos) { - std::string::size_type non_ws = ws; + auto non_ws = ws; while (_grid[non_ws] == ' ') --non_ws; diff --git a/src/commands/CmdCalendar.cpp b/src/commands/CmdCalendar.cpp index 59bf41a75..41dba8410 100644 --- a/src/commands/CmdCalendar.cpp +++ b/src/commands/CmdCalendar.cpp @@ -336,7 +336,7 @@ int CmdCalendar::execute (std::string& output) // If the executable was "cal" or equivalent, replace it with "task". std::string executable = context.cli._args[0].attribute ("raw"); - std::string::size_type cal = executable.find ("cal"); + auto cal = executable.find ("cal"); if (cal != std::string::npos) executable = executable.substr (0, cal) + PACKAGE; diff --git a/src/commands/CmdConfig.cpp b/src/commands/CmdConfig.cpp index 711535996..ec7627e72 100644 --- a/src/commands/CmdConfig.cpp +++ b/src/commands/CmdConfig.cpp @@ -59,8 +59,8 @@ bool CmdConfig::setConfigVariable (std::string name, std::string value, bool con for (auto& line : contents) { // If there is a comment on the line, it must follow the pattern. - std::string::size_type comment = line.find ("#"); - std::string::size_type pos = line.find (name + "="); + auto comment = line.find ("#"); + auto pos = line.find (name + "="); if (pos != std::string::npos && (comment == std::string::npos || @@ -110,8 +110,8 @@ int CmdConfig::unsetConfigVariable (std::string name, bool confirmation /* = fal bool lineDeleted = false; // If there is a comment on the line, it must follow the pattern. - std::string::size_type comment = line->find ("#"); - std::string::size_type pos = line->find (name + "="); + auto comment = line->find ("#"); + auto pos = line->find (name + "="); if (pos != std::string::npos && (comment == std::string::npos || diff --git a/src/commands/CmdDenotate.cpp b/src/commands/CmdDenotate.cpp index a02fa235e..0b2c5d205 100644 --- a/src/commands/CmdDenotate.cpp +++ b/src/commands/CmdDenotate.cpp @@ -108,7 +108,7 @@ int CmdDenotate::execute (std::string& output) { for (auto i = annotations.begin (); i != annotations.end (); ++i) { - std::string::size_type loc = find (i->second, pattern, sensitive); + auto loc = find (i->second, pattern, sensitive); if (loc != std::string::npos) { anno = i->second; diff --git a/src/commands/CmdDiagnostics.cpp b/src/commands/CmdDiagnostics.cpp index 58b476869..a4c5d93c5 100644 --- a/src/commands/CmdDiagnostics.cpp +++ b/src/commands/CmdDiagnostics.cpp @@ -285,7 +285,7 @@ int CmdDiagnostics::execute (std::string& output) // Get credentials, but mask out the key. std::string credentials = context.config.get ("taskd.credentials"); - std::string::size_type last_slash = credentials.rfind ('/'); + auto last_slash = credentials.rfind ('/'); if (last_slash != std::string::npos) credentials = credentials.substr (0, last_slash) + "/" diff --git a/src/commands/CmdEdit.cpp b/src/commands/CmdEdit.cpp index fbb401f88..574a54bac 100644 --- a/src/commands/CmdEdit.cpp +++ b/src/commands/CmdEdit.cpp @@ -78,10 +78,10 @@ std::string CmdEdit::findValue ( const std::string& text, const std::string& name) { - std::string::size_type found = text.find (name); + auto found = text.find (name); if (found != std::string::npos) { - std::string::size_type eol = text.find ("\n", found + 1); + auto eol = text.find ("\n", found + 1); if (eol != std::string::npos) { std::string value = text.substr ( @@ -101,10 +101,10 @@ std::string CmdEdit::findMultilineValue ( const std::string& startMarker, const std::string& endMarker) { - std::string::size_type start = text.find (startMarker); + auto start = text.find (startMarker); if (start != std::string::npos) { - std::string::size_type end = text.find (endMarker, start); + auto end = text.find (endMarker, start); if (end != std::string::npos) { std::string value = text.substr (start + startMarker.length (), @@ -128,7 +128,7 @@ std::vector CmdEdit::findValues ( found = text.find (name, found + 1); if (found != std::string::npos) { - std::string::size_type eol = text.find ("\n", found + 1); + auto eol = text.find ("\n", found + 1); if (eol != std::string::npos) { std::string value = text.substr ( @@ -612,14 +612,14 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string { found += 14; // Length of "\n Annotation:". - std::string::size_type eol = after.find ("\n", found + 1); + auto eol = after.find ("\n", found + 1); if (eol != std::string::npos) { std::string value = trim (after.substr ( found, eol - found), "\t "); - std::string::size_type gap = value.find (" -- "); + auto gap = value.find (" -- "); if (gap != std::string::npos) { // TODO keeping the initial dates even if dateformat approximates them @@ -714,7 +714,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string std::vector orphanValues = findValues (after, "\n UDA Orphan "); for (auto& orphan : orphanValues) { - std::string::size_type colon = orphan.find (':'); + auto colon = orphan.find (':'); if (colon != std::string::npos) { std::string name = trim (orphan.substr (0, colon), "\t "); diff --git a/src/commands/CmdInfo.cpp b/src/commands/CmdInfo.cpp index 8bb413a14..ccd0ab2a9 100644 --- a/src/commands/CmdInfo.cpp +++ b/src/commands/CmdInfo.cpp @@ -426,7 +426,7 @@ int CmdInfo::execute (std::string& output) if (var.first.substr (0, 13) == "urgency.user.") { // urgency.user.project..coefficient - std::string::size_type end = std::string::npos; + auto end = std::string::npos; if (var.first.substr (13, 8) == "project." && (end = var.first.find (".coefficient")) != std::string::npos) { @@ -459,11 +459,11 @@ int CmdInfo::execute (std::string& output) { // urgency.uda..coefficient // urgency.uda...coefficient - std::string::size_type end = var.first.find (".coefficient"); + auto end = var.first.find (".coefficient"); if (end != std::string::npos) { const std::string uda = var.first.substr (12, end - 12); - std::string::size_type dot = uda.find ("."); + auto dot = uda.find ("."); if (dot == std::string::npos) { // urgency.uda..coefficient diff --git a/src/commands/CmdReports.cpp b/src/commands/CmdReports.cpp index 91a2483f1..002b59143 100644 --- a/src/commands/CmdReports.cpp +++ b/src/commands/CmdReports.cpp @@ -56,7 +56,7 @@ int CmdReports::execute (std::string& output) if (i.first.substr (0, 7) == "report.") { std::string report = i.first.substr (7); - std::string::size_type columns = report.find (".columns"); + auto columns = report.find (".columns"); if (columns != std::string::npos) reports.push_back (report.substr (0, columns)); } diff --git a/src/commands/CmdSync.cpp b/src/commands/CmdSync.cpp index 8c61bcc02..5a2bcd30c 100644 --- a/src/commands/CmdSync.cpp +++ b/src/commands/CmdSync.cpp @@ -337,7 +337,7 @@ bool CmdSync::send ( { // It is important that the ':' be the *last* colon, in order to support // IPv6 addresses. - std::string::size_type colon = to.rfind (':'); + auto colon = to.rfind (':'); if (colon == std::string::npos) throw format (STRING_CMD_SYNC_BAD_SERVER, to); diff --git a/src/commands/CmdUDAs.cpp b/src/commands/CmdUDAs.cpp index d64a3f33b..fa8775c61 100644 --- a/src/commands/CmdUDAs.cpp +++ b/src/commands/CmdUDAs.cpp @@ -60,7 +60,7 @@ int CmdUDAs::execute (std::string& output) if (name.first.substr (0, 4) == "uda." && name.first.find (".type") != std::string::npos) { - std::string::size_type period = name.first.find ('.', 4); + auto period = name.first.find ('.', 4); if (period != std::string::npos) udas.push_back (name.first.substr (4, period - 4)); } @@ -187,7 +187,7 @@ int CmdCompletionUDAs::execute (std::string& output) if (name.first.substr (0, 4) == "uda." && name.first.find (".type") != std::string::npos) { - std::string::size_type period = name.first.find ('.', 4); + auto period = name.first.find ('.', 4); if (period != std::string::npos) udas.push_back (name.first.substr (4, period - 4)); } diff --git a/src/commands/Command.cpp b/src/commands/Command.cpp index 0f2821e11..5299ddd92 100644 --- a/src/commands/Command.cpp +++ b/src/commands/Command.cpp @@ -170,7 +170,7 @@ void Command::factory (std::map & all) if (i.first.substr (0, 7) == "report.") { std::string report = i.first.substr (7); - std::string::size_type columns = report.find (".columns"); + auto columns = report.find (".columns"); if (columns != std::string::npos) reports.push_back (report.substr (0, columns)); } diff --git a/test/test.cpp b/test/test.cpp index 2945bb6dd..d05561a88 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -392,8 +392,8 @@ void UnitTest::is ( /////////////////////////////////////////////////////////////////////////////// void UnitTest::diag (const std::string& text) { - std::string::size_type start = text.find_first_not_of (" \t\n\r\f"); - std::string::size_type end = text.find_last_not_of (" \t\n\r\f"); + auto start = text.find_first_not_of (" \t\n\r\f"); + auto end = text.find_last_not_of (" \t\n\r\f"); std::cout << "# " << text.substr (start, end - start + 1) << "\n"; }