Repository: mesos Updated Branches: refs/heads/master fb99cd00b -> fac4c5960
Dealt with some type casting warnings in common/values.cpp. This fixes the type of the local variable we use to store an IO stream's original precision while outputing a `Scalar` value. We extraneously cast from a `std::streamsize` (`int`) to `long`. Also, this removes an extranous cast from `size_t` to `int` in a vector iteration loop. Review: https://reviews.apache.org/r/56675/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/fac4c596 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/fac4c596 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/fac4c596 Branch: refs/heads/master Commit: fac4c59600d7c1b45fda128b114ebdff25b91a4c Parents: 039343a Author: Alex Clemmer <[email protected]> Authored: Fri Feb 17 18:10:21 2017 -0800 Committer: Joseph Wu <[email protected]> Committed: Thu Feb 23 14:28:42 2017 -0800 ---------------------------------------------------------------------- src/common/values.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/fac4c596/src/common/values.cpp ---------------------------------------------------------------------- diff --git a/src/common/values.cpp b/src/common/values.cpp index cb26627..1ac327f 100644 --- a/src/common/values.cpp +++ b/src/common/values.cpp @@ -73,7 +73,8 @@ ostream& operator<<(ostream& stream, const Value::Scalar& scalar) { // Output the scalar's full significant digits and save the old // precision. - long precision = stream.precision(std::numeric_limits<double>::digits10); + std::streamsize precision = + stream.precision(std::numeric_limits<double>::digits10); // We discard any additional precision (of the fractional part) // from scalar resources before writing them to an ostream. This @@ -609,12 +610,11 @@ Try<Value> parse(const string& text) for (size_t i = 0; i < tokens.size(); i += 2) { Value::Range* range = ranges->add_range(); - int j = i; - Try<uint64_t> begin = numify<uint64_t>(tokens[j++]); - Try<uint64_t> end = numify<uint64_t>(tokens[j++]); + Try<uint64_t> begin = numify<uint64_t>(tokens[i]); + Try<uint64_t> end = numify<uint64_t>(tokens[i + 1]); if (begin.isError() || end.isError()) { return Error( - "Expecting non-negative integers in '" + tokens[j - 1] + "'"); + "Expecting non-negative integers in '" + tokens[i] + "'"); } range->set_begin(begin.get());
