Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
eaeca0d4
Commit
eaeca0d4
authored
7 years ago
by
Jisi Liu
Committed by
GitHub
7 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3485 from pherl/mingw
Fix build on MinGW32
parents
1bd2d1fc
651429b7
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
44 additions
and
15 deletions
+44
-15
command_line_interface.cc
src/google/protobuf/compiler/command_line_interface.cc
+1
-1
command_line_interface_unittest.cc
...ogle/protobuf/compiler/command_line_interface_unittest.cc
+1
-1
importer.cc
src/google/protobuf/compiler/importer.cc
+3
-0
objectivec_helpers.cc
...google/protobuf/compiler/objectivec/objectivec_helpers.cc
+1
-1
plugin.cc
src/google/protobuf/compiler/plugin.cc
+1
-1
subprocess.cc
src/google/protobuf/compiler/subprocess.cc
+13
-2
zero_copy_stream_impl.cc
src/google/protobuf/io/zero_copy_stream_impl.cc
+3
-0
zero_copy_stream_unittest.cc
src/google/protobuf/io/zero_copy_stream_unittest.cc
+3
-0
message_unittest.cc
src/google/protobuf/message_unittest.cc
+1
-1
io_win32.cc
src/google/protobuf/stubs/io_win32.cc
+7
-7
io_win32.h
src/google/protobuf/stubs/io_win32.h
+6
-0
file.cc
src/google/protobuf/testing/file.cc
+3
-0
googletest.cc
src/google/protobuf/testing/googletest.cc
+1
-1
No files found.
src/google/protobuf/compiler/command_line_interface.cc
View file @
eaeca0d4
...
...
@@ -108,7 +108,7 @@ namespace compiler {
#endif
namespace
{
#if defined(_
WIN32) && !defined(__CYGWIN__
)
#if defined(_
MSC_VER
)
// 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
;
...
...
This diff is collapsed.
Click to expand it.
src/google/protobuf/compiler/command_line_interface_unittest.cc
View file @
eaeca0d4
...
...
@@ -69,7 +69,7 @@ namespace google {
namespace
protobuf
{
namespace
compiler
{
#if defined(_
WIN32
)
#if defined(_
MSC_VER
)
// 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
;
...
...
This diff is collapsed.
Click to expand it.
src/google/protobuf/compiler/importer.cc
View file @
eaeca0d4
...
...
@@ -59,6 +59,9 @@
#ifdef _WIN32
#include <ctype.h>
#endif
#ifdef _MSC_VER
// 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
;
...
...
This diff is collapsed.
Click to expand it.
src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
View file @
eaeca0d4
...
...
@@ -50,7 +50,7 @@
#include <google/protobuf/stubs/io_win32.h>
#include <google/protobuf/stubs/strutil.h>
#if defined(_
WIN32
)
#if defined(_
MSC_VER
)
// 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
::
open
;
...
...
This diff is collapsed.
Click to expand it.
src/google/protobuf/compiler/plugin.cc
View file @
eaeca0d4
...
...
@@ -49,7 +49,7 @@
#include <google/protobuf/descriptor.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#if defined(_
WIN32
)
#if defined(_
MSC_VER
)
// 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
::
setmode
;
...
...
This diff is collapsed.
Click to expand it.
src/google/protobuf/compiler/subprocess.cc
View file @
eaeca0d4
...
...
@@ -33,6 +33,7 @@
#include <google/protobuf/compiler/subprocess.h>
#include <algorithm>
#include <cstring>
#include <iostream>
#ifndef _WIN32
...
...
@@ -51,6 +52,16 @@ namespace google {
namespace
protobuf
{
namespace
compiler
{
namespace
{
char
*
portable_strdup
(
const
char
*
s
)
{
char
*
ns
=
(
char
*
)
malloc
(
strlen
(
s
)
+
1
);
if
(
ns
!=
NULL
)
{
strcpy
(
ns
,
s
);
}
return
ns
;
}
}
// namespace
#ifdef _WIN32
static
void
CloseHandleOrDie
(
HANDLE
handle
)
{
...
...
@@ -114,7 +125,7 @@ void Subprocess::Start(const string& program, SearchMode search_mode) {
}
// CreateProcess() mutates its second parameter. WTF?
char
*
name_copy
=
strdup
(
program
.
c_str
());
char
*
name_copy
=
portable_
strdup
(
program
.
c_str
());
// Create the process.
PROCESS_INFORMATION
process_info
;
...
...
@@ -298,7 +309,7 @@ void Subprocess::Start(const string& program, SearchMode search_mode) {
GOOGLE_CHECK
(
pipe
(
stdin_pipe
)
!=
-
1
);
GOOGLE_CHECK
(
pipe
(
stdout_pipe
)
!=
-
1
);
char
*
argv
[
2
]
=
{
strdup
(
program
.
c_str
()),
NULL
};
char
*
argv
[
2
]
=
{
portable_
strdup
(
program
.
c_str
()),
NULL
};
child_pid_
=
fork
();
if
(
child_pid_
==
-
1
)
{
...
...
This diff is collapsed.
Click to expand it.
src/google/protobuf/io/zero_copy_stream_impl.cc
View file @
eaeca0d4
...
...
@@ -56,6 +56,9 @@ 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)
#endif
#ifdef _MSC_VER
// 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
;
...
...
This diff is collapsed.
Click to expand it.
src/google/protobuf/io/zero_copy_stream_unittest.cc
View file @
eaeca0d4
...
...
@@ -83,6 +83,9 @@ namespace {
#ifdef _WIN32
#define pipe(fds) _pipe(fds, 4096, O_BINARY)
#endif
#ifdef _MSC_VER
// 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
;
...
...
This diff is collapsed.
Click to expand it.
src/google/protobuf/message_unittest.cc
View file @
eaeca0d4
...
...
@@ -63,7 +63,7 @@
namespace
google
{
namespace
protobuf
{
#if defined(_
WIN32
)
#if defined(_
MSC_VER
)
// 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
::
close
;
...
...
This diff is collapsed.
Click to expand it.
src/google/protobuf/stubs/io_win32.cc
View file @
eaeca0d4
...
...
@@ -39,7 +39,7 @@
//
// This file is only used on Windows, it's empty on other platforms.
#if defined(_
WIN32
)
#if defined(_
MSC_VER
)
// Comment this out to fall back to using the ANSI versions (open, mkdir, ...)
// instead of the Unicode ones (_wopen, _wmkdir, ...). Doing so can be useful to
...
...
@@ -105,15 +105,15 @@ bool has_longpath_prefix(const char_type* path) {
path
[
3
]
==
'\\'
;
}
// Returns true if the path starts with a drive specifier (e.g. "c:\").
template
<
typename
char_type
>
bool
is_
path_absolute
(
const
char_type
*
path
)
{
return
has_drive_letter
(
path
)
&&
is_separator
(
path
[
2
])
;
bool
is_
separator
(
char_type
c
)
{
return
c
==
'/'
||
c
==
'\\'
;
}
// Returns true if the path starts with a drive specifier (e.g. "c:\").
template
<
typename
char_type
>
bool
is_
separator
(
char_type
c
)
{
return
c
==
'/'
||
c
==
'\\'
;
bool
is_
path_absolute
(
const
char_type
*
path
)
{
return
has_drive_letter
(
path
)
&&
is_separator
(
path
[
2
])
;
}
template
<
typename
char_type
>
...
...
@@ -358,5 +358,5 @@ wstring testonly_path_to_winpath(const string& path) {
}
// namespace protobuf
}
// namespace google
#endif // defined(_
WIN32
)
#endif // defined(_
MSC_VER
)
This diff is collapsed.
Click to expand it.
src/google/protobuf/stubs/io_win32.h
View file @
eaeca0d4
...
...
@@ -50,6 +50,9 @@
#include <string>
#include <google/protobuf/stubs/port.h>
// Compilers on Windows other than MSVC (e.g. Cygwin, MinGW32) define the
// following functions already, except for mkdir.
#ifdef _MSC_VER
namespace
google
{
namespace
protobuf
{
namespace
internal
{
...
...
@@ -74,6 +77,9 @@ LIBPROTOBUF_EXPORT std::wstring testonly_path_to_winpath(
}
// namespace internal
}
// namespace protobuf
}
// namespace google
#else // _MSC_VER
#define mkdir(name, mode) mkdir(name)
#endif // !_MSC_VER
#ifndef W_OK
#define W_OK 02 // not defined by MSVC for whatever reason
...
...
This diff is collapsed.
Click to expand it.
src/google/protobuf/testing/file.cc
View file @
eaeca0d4
...
...
@@ -55,6 +55,9 @@ namespace protobuf {
#define lstat stat
// DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import
// them like we do below.
#endif
#ifdef _MSC_VER
using
google
::
protobuf
::
internal
::
win32
::
access
;
using
google
::
protobuf
::
internal
::
win32
::
chdir
;
using
google
::
protobuf
::
internal
::
win32
::
fopen
;
...
...
This diff is collapsed.
Click to expand it.
src/google/protobuf/testing/googletest.cc
View file @
eaeca0d4
...
...
@@ -52,7 +52,7 @@
namespace
google
{
namespace
protobuf
{
#ifdef _
WIN32
#ifdef _
MSC_VER
// 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
::
close
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment