Code Cleanup

- Constify some catches.
This commit is contained in:
Scott Kostyshak 2012-09-02 00:39:20 -04:00 committed by Paul Beckingham
parent 589d8fab5c
commit 7a6cdde571
14 changed files with 19 additions and 19 deletions

View file

@ -319,7 +319,7 @@ void TF2::load_tasks ()
_loaded_tasks = true;
}
catch (std::string& e)
catch (const std::string& e)
{
throw e + format (STRING_TDB2_PARSE_ERROR, _file._data, line_number);
}

View file

@ -811,7 +811,7 @@ ARE_THESE_REALLY_HARMFUL:
parseTask (task, after, dateformat);
}
catch (std::string& e)
catch (const std::string& e)
{
problem = e;
oops = true;

View file

@ -97,7 +97,7 @@ int CmdMerge::execute (std::string& output)
{
context.tdb2.merge (file);
}
catch (std::string& e) {
catch (const std::string& e) {
if (e == STRING_TDB2_UP_TO_DATE)
{
output += e + "\n";

View file

@ -111,7 +111,7 @@ int CmdShell::execute (std::string&)
context.run ();
}
catch (std::string& error)
catch (const std::string& error)
{
std::cerr << error << "\n";
}

View file

@ -74,7 +74,7 @@ int main (int argc, const char** argv)
status = context.run ();
}
catch (std::string& error)
catch (const std::string& error)
{
std::cerr << error << "\n";
status = -1;

View file

@ -402,7 +402,7 @@ int main (int argc, char** argv)
t.is (r26.toString ("YMDHNS"), "20100314235959", "increment across spring DST boundary");
}
catch (std::string& e)
catch (const std::string& e)
{
t.fail ("Exception thrown.");
t.diag (e);

View file

@ -69,7 +69,7 @@ int main (int argc, char** argv)
// TODO dom.set rc.name
}
catch (std::string& error)
catch (const std::string& error)
{
t.diag (error);
return -1;

View file

@ -58,7 +58,7 @@ int main (int argc, char** argv)
t.is (format ("pre {3}{1}{2} post", "one", "two", "three"), "pre threeonetwo post", "format 3b");
}
catch (std::string& error)
catch (const std::string& error)
{
t.diag (error);
return -1;

View file

@ -175,7 +175,7 @@ int main (int argc, char** argv)
t.is (json::decode (encoded), "one\\", "json::decode one\\\\\\\\ -> one\\\\");
}
catch (std::string& e) {t.diag (e);}
catch (const std::string& e) {t.diag (e);}
return 0;
}

View file

@ -747,7 +747,7 @@ int main (int argc, char** argv)
t.is (n.next (1), "b", " 'bcde' : skip () -> 'b'");
}
catch (std::string& e) {t.diag (e);}
catch (const std::string& e) {t.diag (e);}
return 0;
}

View file

@ -42,33 +42,33 @@ int main (int argc, char** argv)
Task task;
try {task = Task ("");}
catch (std::string& e){t.diag (e); good = false;}
catch (const std::string& e){t.diag (e); good = false;}
t.notok (good, "Task::Task ('')");
// []
good = true;
try {task = Task ("[]");}
catch (std::string& e){t.diag (e); good = false;}
catch (const std::string& e){t.diag (e); good = false;}
t.notok (good, "Task::Task ('[]')");
// [name:"value"]
good = true;
try {task = Task ("[name:\"value\"]");}
catch (std::string& e){t.diag (e); good = false;}
catch (const std::string& e){t.diag (e); good = false;}
t.ok (good, "Task::Task ('[name:\"value\"]')");
t.is (task.get ("name"), "value", "name=value");
// [name:"one two"]
good = true;
try {task = Task ("[name:\"one two\"]");}
catch (std::string& e){t.diag (e); good = false;}
catch (const std::string& e){t.diag (e); good = false;}
t.ok (good, "Task::Task ('[name:\"one two\"]')");
t.is (task.get ("name"), "one two", "name=one two");
// [one:two three:four]
good = true;
try {task = Task ("[one:\"two\" three:\"four\"]");}
catch (std::string& e){t.diag (e); good = false;}
catch (const std::string& e){t.diag (e); good = false;}
t.ok (good, "Task::Task ('[one:\"two\" three:\"four\"]')");
t.is (task.get ("one"), "two", "one=two");
t.is (task.get ("three"), "four", "three=four");

View file

@ -75,7 +75,7 @@ int main (int argc, char** argv)
good = true;
try {
empty.getUuid();
} catch (std::string& e) { t.diag(e); good = false; }
} catch (const std::string& e) { t.diag(e); good = false; }
t.notok (good, "Taskmod::getUuid() not");
// issetAfter() not
@ -87,7 +87,7 @@ int main (int argc, char** argv)
try {
std::string uuid = newMod.getUuid();
t.is(uuid, "df95dac3-5f2b-af88-5416-03a3163d00fd", "Taskmod::getUuid()");
} catch (std::string& e) {
} catch (const std::string& e) {
t.diag(e);
t.fail("Taskmod::getUuid()");
}

View file

@ -126,7 +126,7 @@ int main (int argc, char** argv)
// TODO gc
}
catch (std::string& error)
catch (const std::string& error)
{
t.diag (error);
return -1;

View file

@ -175,7 +175,7 @@ int main (int argc, char** argv)
t.ok (string_view.lines () > 4, "View::lines > 4");
}
catch (std::string& e)
catch (const std::string& e)
{
t.fail ("Exception thrown.");
t.diag (e);