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

[03/11] mesos git commit: Fixed warnings in message encoders and decoders.

Fixed warnings in message encoders and decoders.

Removes a couple implicit type casts.

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


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

Branch: refs/heads/master
Commit: 187f632f075fe9e6dd50332bf7b2a56ef92af8ba
Parents: e8bbbc5
Author: Daniel Pravat <dp...@outlook.com>
Authored: Mon Sep 26 15:09:48 2016 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon Sep 26 15:19:01 2016 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/decoder.hpp | 10 +++++++---
 3rdparty/libprocess/src/encoder.hpp |  4 ++--
 2 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/187f632f/3rdparty/libprocess/src/decoder.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/decoder.hpp b/3rdparty/libprocess/src/decoder.hpp
index ccf12ac..c79296b 100644
--- a/3rdparty/libprocess/src/decoder.hpp
+++ b/3rdparty/libprocess/src/decoder.hpp
@@ -172,7 +172,7 @@ private:
     decoder->request->method =
       http_method_str((http_method) decoder->parser.method);
 
-    decoder->request->keepAlive = http_should_keep_alive(&decoder->parser);
+    decoder->request->keepAlive = http_should_keep_alive(&decoder->parser) != 0;
 
     return 0;
   }
@@ -239,8 +239,10 @@ private:
         return 1;
       }
       decoder->request->body = decompressed.get();
+
+      CHECK_LE(decoder->request->body.length(), CHAR_MAX);
       decoder->request->headers["Content-Length"] =
-        decoder->request->body.length();
+        static_cast<char>(decoder->request->body.length());
     }
 
     decoder->requests.push_back(decoder->request);
@@ -430,8 +432,10 @@ private:
         return 1;
       }
       decoder->response->body = decompressed.get();
+
+      CHECK_LE(decoder->response->body.length(), CHAR_MAX);
       decoder->response->headers["Content-Length"] =
-        decoder->response->body.length();
+        static_cast<char>(decoder->response->body.length());
     }
 
     decoder->responses.push_back(decoder->response);

http://git-wip-us.apache.org/repos/asf/mesos/blob/187f632f/3rdparty/libprocess/src/encoder.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/encoder.hpp b/3rdparty/libprocess/src/encoder.hpp
index af083d1..005d1cc 100644
--- a/3rdparty/libprocess/src/encoder.hpp
+++ b/3rdparty/libprocess/src/encoder.hpp
@@ -267,7 +267,7 @@ public:
   virtual int next(off_t* offset, size_t* length)
   {
     off_t temp = index;
-    index = size;
+    index = static_cast<off_t>(size);
     *offset = temp;
     *length = size - temp;
     return fd;
@@ -276,7 +276,7 @@ public:
   virtual void backup(size_t length)
   {
     if (index >= length) {
-      index -= length;
+      index -= static_cast<off_t>(length);
     }
   }