diff options
author | Jisi Liu <jisi.liu@gmail.com> | 2017-07-25 11:52:33 -0700 |
---|---|---|
committer | Jisi Liu <jisi.liu@gmail.com> | 2017-07-25 11:52:33 -0700 |
commit | 759245a49a00315a41b28da8fe52a2894d4f57ea (patch) | |
tree | 5a0032a1a3619a448d5301da131907ca8449730f /src/google/protobuf/io | |
parent | 4bff88e0fb2338657a781eeee0c5362a57b57bf3 (diff) |
Merge from master
Diffstat (limited to 'src/google/protobuf/io')
-rw-r--r-- | src/google/protobuf/io/zero_copy_stream_impl.cc | 13 | ||||
-rw-r--r-- | src/google/protobuf/io/zero_copy_stream_unittest.cc | 11 |
2 files changed, 17 insertions, 7 deletions
diff --git a/src/google/protobuf/io/zero_copy_stream_impl.cc b/src/google/protobuf/io/zero_copy_stream_impl.cc index d638ec05..f72add41 100644 --- a/src/google/protobuf/io/zero_copy_stream_impl.cc +++ b/src/google/protobuf/io/zero_copy_stream_impl.cc @@ -32,9 +32,7 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. -#ifdef _MSC_VER -#include <io.h> -#else +#ifndef _MSC_VER #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> @@ -43,9 +41,9 @@ #include <errno.h> #include <iostream> #include <algorithm> - #include <google/protobuf/io/zero_copy_stream_impl.h> #include <google/protobuf/stubs/common.h> +#include <google/protobuf/stubs/io_win32.h> #include <google/protobuf/stubs/logging.h> #include <google/protobuf/stubs/stl_util.h> @@ -58,6 +56,13 @@ namespace io { // Win32 lseek is broken: If invoked on a non-seekable file descriptor, its // return value is undefined. We re-define it to always produce an error. #define lseek(fd, offset, origin) ((off_t)-1) +// DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import +// them like we do below. +using google::protobuf::internal::win32::access; +using google::protobuf::internal::win32::close; +using google::protobuf::internal::win32::open; +using google::protobuf::internal::win32::read; +using google::protobuf::internal::win32::write; #endif namespace { diff --git a/src/google/protobuf/io/zero_copy_stream_unittest.cc b/src/google/protobuf/io/zero_copy_stream_unittest.cc index 235cbca4..f3754087 100644 --- a/src/google/protobuf/io/zero_copy_stream_unittest.cc +++ b/src/google/protobuf/io/zero_copy_stream_unittest.cc @@ -47,9 +47,7 @@ // implementations. -#ifdef _MSC_VER -#include <io.h> -#else +#ifndef _MSC_VER #include <unistd.h> #endif #include <stdlib.h> @@ -72,6 +70,7 @@ #endif #include <google/protobuf/stubs/common.h> +#include <google/protobuf/stubs/io_win32.h> #include <google/protobuf/stubs/logging.h> #include <google/protobuf/testing/googletest.h> #include <google/protobuf/testing/file.h> @@ -84,6 +83,12 @@ namespace { #ifdef _WIN32 #define pipe(fds) _pipe(fds, 4096, O_BINARY) +// DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import +// them like we do below. +using google::protobuf::internal::win32::access; +using google::protobuf::internal::win32::mkdir; +using google::protobuf::internal::win32::open; +using google::protobuf::internal::win32::close; #endif #ifndef O_BINARY |