You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by an...@apache.org on 2018/03/08 00:26:33 UTC
[5/5] mesos git commit: Fixed implicit conversion warnings.
Fixed implicit conversion warnings.
This patch fixes three new "possible loss of data" implicit conversion
warnings by using `static_cast` to the LHS type.
Review: https://reviews.apache.org/r/65955
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0a4a900e
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0a4a900e
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0a4a900e
Branch: refs/heads/master
Commit: 0a4a900e5707a76269b18f3062fff070f69ff911
Parents: 9036951
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Wed Mar 7 10:28:09 2018 -0800
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Wed Mar 7 16:25:20 2018 -0800
----------------------------------------------------------------------
src/docker/docker.cpp | 7 ++++---
src/slave/containerizer/fetcher.cpp | 4 ++--
src/slave/containerizer/mesos/containerizer.cpp | 2 +-
3 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/0a4a900e/src/docker/docker.cpp
----------------------------------------------------------------------
diff --git a/src/docker/docker.cpp b/src/docker/docker.cpp
index bb81c4d..d000a90 100644
--- a/src/docker/docker.cpp
+++ b/src/docker/docker.cpp
@@ -621,14 +621,15 @@ Try<Docker::RunOptions> Docker::RunOptions::create(
// TODO(yifan): Support other resources (e.g. disk).
Option<double> cpus = resources->cpus();
if (cpus.isSome()) {
- options.cpuShares =
- std::max((uint64_t) (CPU_SHARES_PER_CPU * cpus.get()), MIN_CPU_SHARES);
+ options.cpuShares = std::max(
+ static_cast<uint64_t>(CPU_SHARES_PER_CPU * cpus.get()),
+ MIN_CPU_SHARES);
if (enableCfsQuota) {
const Duration quota =
std::max(CPU_CFS_PERIOD * cpus.get(), MIN_CPU_CFS_QUOTA);
- options.cpuQuota = quota.us();
+ options.cpuQuota = static_cast<uint64_t>(quota.us());
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/0a4a900e/src/slave/containerizer/fetcher.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/fetcher.cpp b/src/slave/containerizer/fetcher.cpp
index a49411b..f9ab554 100644
--- a/src/slave/containerizer/fetcher.cpp
+++ b/src/slave/containerizer/fetcher.cpp
@@ -258,13 +258,13 @@ FetcherProcess::Metrics::Metrics(FetcherProcess *fetcher)
"containerizer/fetcher/cache_size_total_bytes",
[=]() {
// This value is safe to read while it is concurrently updated.
- return fetcher->cache.totalSpace().bytes();
+ return static_cast<double>(fetcher->cache.totalSpace().bytes());
}),
cache_size_used_bytes(
"containerizer/fetcher/cache_size_used_bytes",
[=]() {
// This value is safe to read while it is concurrently updated.
- return fetcher->cache.usedSpace().bytes();
+ return static_cast<double>(fetcher->cache.usedSpace().bytes());
})
{
process::metrics::add(task_fetches_succeeded);
http://git-wip-us.apache.org/repos/asf/mesos/blob/0a4a900e/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index a61ed5b..7473a87 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -769,7 +769,7 @@ Future<Nothing> MesosContainerizerProcess::recover(
// successfully launched, therefore we can assume checkpointed
// containers should be running after recover.
container->state = RUNNING;
- container->pid = state.pid();
+ container->pid = static_cast<pid_t>(state.pid());
container->directory = state.directory();
// Attempt to read the launch config of the container.