You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2016/01/13 02:45:19 UTC

[1/2] mesos git commit: Removed constructors which use restricted integral width.

Repository: mesos
Updated Branches:
  refs/heads/master d7daf708f -> 885bc5b8b


Removed constructors which use restricted integral width.

These constructors are not needed as we already provide constructors which
can construct from a (value, unit) pair. This makes `Duration`
constructors more uniform.

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


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

Branch: refs/heads/master
Commit: 885bc5b8be2929f796dd52f5ff5f99c8b5f730e6
Parents: e24d24d
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Tue Jan 12 16:59:25 2016 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Tue Jan 12 17:38:51 2016 -0800

----------------------------------------------------------------------
 .../3rdparty/stout/include/stout/duration.hpp         | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/885bc5b8/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp
index ec65b8f..ecec706 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp
@@ -176,11 +176,7 @@ protected:
   static const int64_t DAYS         = 24 * HOURS;
   static const int64_t WEEKS        = 7 * DAYS;
 
-  // For the Seconds, Minutes, Hours, Days & Weeks constructor.
-  constexpr Duration(int32_t value, int64_t unit)
-    : nanos(value * unit) {}
-
-  // For the Nanoseconds, Microseconds, Milliseconds constructor.
+  // Construct from a (value, unit) pair.
   constexpr Duration(int64_t value, int64_t unit)
     : nanos(value * unit) {}
 
@@ -256,7 +252,7 @@ public:
 class Minutes : public Duration
 {
 public:
-  explicit constexpr Minutes(int32_t minutes)
+  explicit constexpr Minutes(int64_t minutes)
     : Duration(minutes, MINUTES) {}
 
   constexpr Minutes(const Duration& d) : Duration(d) {}
@@ -270,7 +266,7 @@ public:
 class Hours : public Duration
 {
 public:
-  explicit constexpr Hours(int32_t hours)
+  explicit constexpr Hours(int64_t hours)
     : Duration(hours, HOURS) {}
 
   constexpr Hours(const Duration& d) : Duration(d) {}
@@ -284,7 +280,7 @@ public:
 class Days : public Duration
 {
 public:
-  explicit Days(int32_t days)
+  explicit Days(int64_t days)
     : Duration(days, DAYS) {}
 
   Days(const Duration& d) : Duration(d) {}
@@ -298,7 +294,7 @@ public:
 class Weeks : public Duration
 {
 public:
-  explicit constexpr Weeks(int32_t value) : Duration(value, WEEKS) {}
+  explicit constexpr Weeks(int64_t value) : Duration(value, WEEKS) {}
 
   constexpr Weeks(const Duration& d) : Duration(d) {}
 


[2/2] mesos git commit: Consistently used fixed width integral types.

Posted by mp...@apache.org.
Consistently used fixed width integral types.

The type `long` has different widths under e.g., 32- and 64-bit
architectures. Since we already use fixed width types internally in most
places, these remaining uses have been updated.

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


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

Branch: refs/heads/master
Commit: e24d24d8749470c99dc9ed63c05c8a3192f8c1d6
Parents: d7daf70
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Tue Jan 12 16:59:00 2016 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Tue Jan 12 17:38:51 2016 -0800

----------------------------------------------------------------------
 .../3rdparty/stout/include/stout/duration.hpp        | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e24d24d8/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp
index 40b2260..ec65b8f 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp
@@ -14,7 +14,6 @@
 #define __STOUT_DURATION_HPP__
 
 #include <ctype.h> // For 'isdigit'.
-#include <limits.h> // For 'LLONG_(MAX|MIN)'.
 
 // For 'timeval'.
 #ifndef __WINDOWS__
@@ -399,7 +398,8 @@ inline std::ostream& operator<<(std::ostream& stream, const Duration& duration_)
 
 inline Try<Duration> Duration::create(double seconds)
 {
-  if (seconds * SECONDS > LLONG_MAX || seconds * SECONDS < LLONG_MIN) {
+  if (seconds * SECONDS > std::numeric_limits<int64_t>::max() ||
+      seconds * SECONDS < std::numeric_limits<int64_t>::min()) {
     return Error("Argument out of the range that a Duration can represent due "
                  "to int64_t's size limit");
   }
@@ -407,10 +407,15 @@ inline Try<Duration> Duration::create(double seconds)
   return Nanoseconds(static_cast<int64_t>(seconds * SECONDS));
 }
 
-
-inline constexpr Duration Duration::max() { return Nanoseconds(LLONG_MAX); }
+inline constexpr Duration Duration::max()
+{
+  return Nanoseconds(std::numeric_limits<int64_t>::max());
+}
 
 
-inline constexpr Duration Duration::min() { return Nanoseconds(LLONG_MIN); }
+inline constexpr Duration Duration::min()
+{
+  return Nanoseconds(std::numeric_limits<int64_t>::min());
+}
 
 #endif // __STOUT_DURATION_HPP__