You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2016/04/09 03:17:05 UTC

mesos git commit: Replaced reinterpret_cast with static_cast in libprocess.

Repository: mesos
Updated Branches:
  refs/heads/master ed93745e1 -> d7e6a1413


Replaced reinterpret_cast with static_cast in libprocess.

Casting from a virtual base class to a child class should not be
done with reinterpret_cast. In this case, we know exactly which
child class the pointer points to, so we can just use static_cast.

Review: https://reviews.apache.org/r/45489/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d7e6a141
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d7e6a141
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d7e6a141

Branch: refs/heads/master
Commit: d7e6a14130829fe7202886001269748b4a8a6595
Parents: ed93745
Author: Neil Conway <ne...@gmail.com>
Authored: Fri Apr 8 18:16:18 2016 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Fri Apr 8 18:16:18 2016 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/process.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d7e6a141/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index e4eb517..5e9dcfd 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -1526,7 +1526,7 @@ void send(Encoder* encoder, Socket* socket)
   switch (encoder->kind()) {
     case Encoder::DATA: {
       size_t size;
-      const char* data = reinterpret_cast<DataEncoder*>(encoder)->next(&size);
+      const char* data = static_cast<DataEncoder*>(encoder)->next(&size);
       socket->send(data, size)
         .onAny(lambda::bind(
             &internal::_send,
@@ -1539,7 +1539,7 @@ void send(Encoder* encoder, Socket* socket)
     case Encoder::FILE: {
       off_t offset;
       size_t size;
-      int fd = reinterpret_cast<FileEncoder*>(encoder)->next(&offset, &size);
+      int fd = static_cast<FileEncoder*>(encoder)->next(&offset, &size);
       socket->sendfile(fd, offset, size)
         .onAny(lambda::bind(
             &internal::_send,