mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From josep...@apache.org
Subject [1/4] mesos git commit: Windows: Disambiguated `os::write` by adding another overload.
Date Thu, 15 Dec 2016 23:30:35 GMT
Repository: mesos
Updated Branches:
  refs/heads/master 961e80107 -> c1578bb74


Windows: Disambiguated `os::write` by adding another overload.

This commit will address test failures on Windows in `files_tests.cpp`.
On Windows, calling `os::write` with a `char *` literal (e.g.,
`os::write("your_file", ...)` will erroneously dispatch to the overload
of `os::write(HANDLE)` instead of `os::write(const string&)`, because
`HANDLE` is a typedef'd `void *`.

In this commit, we simply add an overload for `char *`, which resolves
the ambiguity and causes most tests in `files_tests.cpp` to pass.

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


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

Branch: refs/heads/master
Commit: c1578bb74929440c37bd9f393af5e55efee3c67d
Parents: 75feb89
Author: Alex Clemmer <clemmer.alexander@gmail.com>
Authored: Thu Dec 15 15:08:14 2016 -0800
Committer: Joseph Wu <josephwu@apache.org>
Committed: Thu Dec 15 15:13:05 2016 -0800

----------------------------------------------------------------------
 3rdparty/stout/include/stout/os/write.hpp | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c1578bb7/3rdparty/stout/include/stout/os/write.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/write.hpp b/3rdparty/stout/include/stout/os/write.hpp
index 24a69d8..9bb9fbd 100644
--- a/3rdparty/stout/include/stout/os/write.hpp
+++ b/3rdparty/stout/include/stout/os/write.hpp
@@ -82,6 +82,14 @@ inline Try<Nothing> write(const std::string& path, const std::string&
message)
   return result;
 }
 
+
+// NOTE: This overload is necessary to disambiguate between arguments
+// of type `HANDLE` (`typedef void*`) and `char*` on Windows.
+inline Try<Nothing> write(const char* path, const std::string& message)
+{
+  return write(std::string(path), message);
+}
+
 } // namespace os {
 
 


Mime
View raw message