diff --git a/plugins/xmlsave/src/xml_visitor.cc b/plugins/xmlsave/src/xml_visitor.cc index 86f3a80..fda6438 100644 --- a/plugins/xmlsave/src/xml_visitor.cc +++ b/plugins/xmlsave/src/xml_visitor.cc @@ -228,8 +228,8 @@ void XMLVisitor::from_thread(xmlNodePtr parent, const Thread& obj) throw(Seriali Glib::ustring strLastsTime; to_string(obj.get_base_priority(), strPriority); to_string(obj.get_arrival_time(), strArrivalTime); - to_string(obj.get_elapsed_time(), strLastsTime); - // get_elapsed_time() or get_total_cpu_time() ??? + to_string(obj.get_total_cpu_time(), strLastsTime); + xmlNodePtr thread_node = xmlNewChild(parent, NULL, (const xmlChar *) "thread", NULL); xmlNewProp(thread_node, (const xmlChar *) "name", (const xmlChar *) obj.get_name().c_str()); xmlNewProp(thread_node, (const xmlChar *) "priority", (const xmlChar *) strPriority.c_str()); diff --git a/src/backend/string_utils.cc b/src/backend/string_utils.cc index 7d35a21..53b78cb 100644 --- a/src/backend/string_utils.cc +++ b/src/backend/string_utils.cc @@ -51,6 +51,8 @@ namespace sgpem if (tokens.size() != 1) throw domain_error(_("too few or too many tokens")); + // use the token, not the string, so whitespaces at the end of the string are + // not considered errors by the last test istringstream iss(tokens[0]); T result; @@ -65,10 +67,10 @@ namespace sgpem throw domain_error(e.what()); } - // disable exceptions, otherwise peek() will throw them! - // how useless!!! + // disable exceptions, otherwise peek() will throw them on eof! iss.exceptions(ios_base::goodbit); + // check if there is still stuff in the stream, there shouldn't if (iss.peek() != istringstream::traits_type::eof()) throw domain_error(_("incorrect number format")); @@ -85,6 +87,8 @@ namespace sgpem if (tokens.size() != 1) throw domain_error(_("too few or too many tokens")); + // use the token, not the string, so whitespaces at the end of the string are + // not considered errors by the last test istringstream iss(tokens[0]); bool value; @@ -99,10 +103,10 @@ namespace sgpem throw domain_error(e.what()); } - // disable exceptions, otherwise peek() will throw them! - // how useless!!! + // disable exceptions, otherwise peek() will throw them on eof! iss.exceptions(ios_base::goodbit); + // check if there is still stuff in the stream, there shouldn't if (iss.peek() != istringstream::traits_type::eof()) throw domain_error(_("incorrect boolean"));