summaryrefslogtreecommitdiff
path: root/src/lib/job.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-08-10 16:38:33 +0100
committerCarl Hetherington <cth@carlh.net>2016-08-12 09:13:51 +0100
commitb1dc9c3a2f7e55c9afc5bf2d5b465371b048e14f (patch)
tree9968238c6c0511f044e6fcdb4abcc08b5eb28f27 /src/lib/job.cc
parent4a0ae92e28d7d1f0dd648d1b620efc324fdef161 (diff)
Remove all use of stringstream in an attempt to fix
the suspected thread-unsafe crash bugs on OS X.
Diffstat (limited to 'src/lib/job.cc')
-rw-r--r--src/lib/job.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/lib/job.cc b/src/lib/job.cc
index 585e8fb0d..6e2bc9f53 100644
--- a/src/lib/job.cc
+++ b/src/lib/job.cc
@@ -376,7 +376,7 @@ Job::status () const
int const t = elapsed_sub_time ();
int const r = remaining_time ();
- locked_stringstream s;
+ string s;
if (!finished () && p) {
int pc = lrintf (p.get() * 100);
if (pc == 100) {
@@ -384,22 +384,24 @@ Job::status () const
pc = 99;
}
- s << pc << N_("%");
+ char buffer[64];
+ snprintf (buffer, sizeof(buffer), "%d%%", pc);
+ s += buffer;
if (t > 10 && r > 0) {
/// TRANSLATORS: remaining here follows an amount of time that is remaining
/// on an operation.
- s << "; " << seconds_to_approximate_hms (r) << " " << _("remaining");
+ s += "; " + seconds_to_approximate_hms (r) + " " + _("remaining");
}
} else if (finished_ok ()) {
- s << String::compose (_("OK (ran for %1)"), seconds_to_hms (_ran_for));
+ s = String::compose (_("OK (ran for %1)"), seconds_to_hms (_ran_for));
} else if (finished_in_error ()) {
- s << String::compose (_("Error: %1"), error_summary ());
+ s = String::compose (_("Error: %1"), error_summary ());
} else if (finished_cancelled ()) {
- s << _("Cancelled");
+ s = _("Cancelled");
}
- return s.str ();
+ return s;
}
string