Repository: arrow
Updated Branches:
  refs/heads/master d4685f420 -> c4f5a1237


ARROW-1536:[C++] Do not transitively depend on libboost_system

Author: Deepak Majeti <[email protected]>

Closes #1105 from majetideepak/ARROW-1536 and squashes the following commits:

9f4ed610 [Deepak Majeti] Review comments
d49e1aa0 [Deepak Majeti] Fix failure
055dc308 [Deepak Majeti] ARROW-1536:[C++] Do not transitively depend on 
libboost_system


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

Branch: refs/heads/master
Commit: c4f5a1237380d70c21bbf415e39ae0b4f4ca97b1
Parents: d4685f4
Author: Deepak Majeti <[email protected]>
Authored: Tue Sep 19 23:42:33 2017 -0400
Committer: Wes McKinney <[email protected]>
Committed: Tue Sep 19 23:42:33 2017 -0400

----------------------------------------------------------------------
 cpp/src/arrow/io/file.cc | 37 ++++++++++++++++++++++++++++---------
 1 file changed, 28 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/c4f5a123/cpp/src/arrow/io/file.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/io/file.cc b/cpp/src/arrow/io/file.cc
index 0abadbb..843cfe8 100644
--- a/cpp/src/arrow/io/file.cc
+++ b/cpp/src/arrow/io/file.cc
@@ -107,16 +107,35 @@
 #include "arrow/status.h"
 #include "arrow/util/logging.h"
 
+#if defined(_MSC_VER)
 #include <boost/filesystem.hpp>           // NOLINT
 #include <boost/system/system_error.hpp>  // NOLINT
-
 namespace fs = boost::filesystem;
+#define PlatformFilename fs::path
+
+namespace arrow {
+namespace io {
 
+#else
 namespace arrow {
 namespace io {
 
+struct PlatformFilename {
+  PlatformFilename() {}
+  explicit PlatformFilename(const std::string& path) { utf8_path = path; }
+
+  const char* c_str() const { return utf8_path.c_str(); }
+
+  const std::string& string() const { return utf8_path; }
+
+  size_t length() const { return utf8_path.size(); }
+
+  std::string utf8_path;
+};
+#endif
+
 static inline Status CheckOpenResult(int ret, int errno_actual,
-                                     const fs::path& file_name) {
+                                     const PlatformFilename& file_name) {
   if (ret == -1) {
     // TODO: errno codes to strings
     std::stringstream ss;
@@ -137,7 +156,7 @@ static inline int64_t lseek64_compat(int fd, int64_t pos, 
int whence) {
 #endif
 }
 
-static inline Status FileOpenReadable(const fs::path& file_name, int* fd) {
+static inline Status FileOpenReadable(const PlatformFilename& file_name, int* 
fd) {
   int ret;
   errno_t errno_actual = 0;
 #if defined(_MSC_VER)
@@ -152,7 +171,7 @@ static inline Status FileOpenReadable(const fs::path& 
file_name, int* fd) {
   return CheckOpenResult(ret, errno_actual, file_name);
 }
 
-static inline Status FileOpenWriteable(const fs::path& file_name, bool 
write_only,
+static inline Status FileOpenWriteable(const PlatformFilename& file_name, bool 
write_only,
                                        bool truncate, int* fd) {
   int ret;
   errno_t errno_actual = 0;
@@ -366,20 +385,20 @@ class OSFile {
 
  protected:
   Status SetFileName(const std::string& file_name) {
-    try {
 #if defined(_MSC_VER)
+    try {
       std::codecvt_utf8_utf16<wchar_t> utf16_converter;
       file_name_.assign(file_name, utf16_converter);
-#else
-      file_name_ = file_name;
-#endif
     } catch (boost::system::system_error& e) {
       return Status::Invalid(e.what());
     }
+#else
+    file_name_ = PlatformFilename(file_name);
+#endif
     return Status::OK();
   }
 
-  fs::path file_name_;
+  PlatformFilename file_name_;
 
   std::mutex lock_;
 

Reply via email to