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
ef3df0e8
Commit
ef3df0e8
authored
Jul 18, 2019
by
Laszlo Csomor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use C++11 enum class
parent
416872ef
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
15 deletions
+13
-15
io_win32.cc
src/google/protobuf/io/io_win32.cc
+3
-3
io_win32.h
src/google/protobuf/io/io_win32.h
+6
-8
io_win32_unittest.cc
src/google/protobuf/io/io_win32_unittest.cc
+4
-4
No files found.
src/google/protobuf/io/io_win32.cc
View file @
ef3df0e8
...
...
@@ -362,7 +362,7 @@ wstring testonly_utf8_to_winpath(const char* path) {
return
as_windows_path
(
path
,
&
wpath
)
?
wpath
:
wstring
();
}
in
t
ExpandWildcards
(
ExpandWildcardsResul
t
ExpandWildcards
(
const
string
&
path
,
std
::
function
<
void
(
const
string
&
)
>
consume
)
{
if
(
path
.
find_first_of
(
"*?"
)
==
string
::
npos
)
{
// There are no wildcards in the path, we don't need to expand it.
...
...
@@ -392,7 +392,7 @@ int ExpandWildcards(
dirname
=
path
.
substr
(
0
,
pos
+
1
);
}
in
t
matched
=
ExpandWildcardsResult
::
kErrorNoMatchingFile
;
ExpandWildcardsResul
t
matched
=
ExpandWildcardsResult
::
kErrorNoMatchingFile
;
do
{
// Ignore ".", "..", and directories.
if
((
metadata
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
==
0
...
...
@@ -430,7 +430,7 @@ int ExpandWildcards(
dirname
=
path
.
substr
(
0
,
pos
+
1
);
}
in
t
matched
=
ExpandWildcardsResult
::
kErrorNoMatchingFile
;
ExpandWildcardsResul
t
matched
=
ExpandWildcardsResult
::
kErrorNoMatchingFile
;
do
{
// Ignore ".", "..", and directories.
if
((
metadata
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
==
0
...
...
src/google/protobuf/io/io_win32.h
View file @
ef3df0e8
...
...
@@ -76,13 +76,11 @@ PROTOBUF_EXPORT int stat(const char* path, struct _stat* buffer);
PROTOBUF_EXPORT
int
write
(
int
fd
,
const
void
*
buffer
,
size_t
size
);
PROTOBUF_EXPORT
std
::
wstring
testonly_utf8_to_winpath
(
const
char
*
path
);
struct
ExpandWildcardsResult
{
enum
{
kSuccess
=
0
,
kErrorNoMatchingFile
=
1
,
kErrorInputPathConversion
=
2
,
kErrorOutputPathConversion
=
3
,
};
enum
ExpandWildcardsResult
{
kSuccess
=
0
,
kErrorNoMatchingFile
=
1
,
kErrorInputPathConversion
=
2
,
kErrorOutputPathConversion
=
3
,
};
// Expand wildcards in a path pattern, feed the result to a consumer function.
...
...
@@ -93,7 +91,7 @@ struct ExpandWildcardsResult {
// `consume`. The resulting paths may not be absolute nor normalized.
//
// The function returns a value from `ExpandWildcardsResult`.
LIBPROTOBUF_EXPORT
in
t
ExpandWildcards
(
LIBPROTOBUF_EXPORT
ExpandWildcardsResul
t
ExpandWildcards
(
const
std
::
string
&
path
,
std
::
function
<
void
(
const
std
::
string
&
)
>
consume
);
namespace
strings
{
...
...
src/google/protobuf/io/io_win32_unittest.cc
View file @
ef3df0e8
...
...
@@ -429,7 +429,7 @@ TEST_F(IoWin32Test, ExpandWildcardsInRelativePathTest) {
int
found_b
=
0
;
vector
<
string
>
found_bad
;
// Assert matching a relative path pattern. Results should also be relative.
in
t
result
=
ExpandWildcardsResul
t
result
=
ExpandWildcards
(
string
(
kUtf8Text
)
+
"
\\
foo*.proto"
,
[
&
found_a
,
&
found_b
,
&
found_bad
](
const
string
&
p
)
{
...
...
@@ -481,7 +481,7 @@ TEST_F(IoWin32Test, ExpandWildcardsInAbsolutePathTest) {
vector
<
string
>
found_bad
;
// Assert matching an absolute path. The results should also use absolute
// path.
in
t
result
=
ExpandWildcardsResul
t
result
=
ExpandWildcards
(
string
(
test_tmpdir
)
+
"
\\
"
+
kUtf8Text
+
"
\\
foo*.proto"
,
[
this
,
&
found_a
,
&
found_b
,
&
found_bad
](
const
string
&
p
)
{
...
...
@@ -544,7 +544,7 @@ TEST_F(IoWin32Test, ExpandWildcardsIgnoresDirectoriesTest) {
vector
<
string
>
found_bad
;
// Assert that the pattern matches exactly the expected files, and using the
// absolute path as did the input pattern.
in
t
result
=
ExpandWildcardsResul
t
result
=
ExpandWildcards
(
string
(
kUtf8Text
)
+
"
\\
foo*.proto"
,
[
&
found_a
,
&
found_c
,
&
found_bad
](
const
string
&
p
)
{
...
...
@@ -573,7 +573,7 @@ TEST_F(IoWin32Test, ExpandWildcardsFailsIfNoFileMatchesTest) {
EXPECT_TRUE
(
SetCurrentDirectoryW
(
wtest_tmpdir
.
c_str
()));
// Control test: should match foo*.proto
in
t
result
=
ExpandWildcards
(
ExpandWildcardsResul
t
result
=
ExpandWildcards
(
string
(
kUtf8Text
)
+
"
\\
foo*.proto"
,
[](
const
string
&
)
{});
EXPECT_EQ
(
result
,
ExpandWildcardsResult
::
kSuccess
);
...
...
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