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
2bee6e66
Commit
2bee6e66
authored
Dec 05, 2012
by
liujisi@google.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix build warnings for gcc 4.6
parent
ed95d54e
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
18 deletions
+25
-18
subprocess.cc
src/google/protobuf/compiler/subprocess.cc
+6
-4
descriptor_unittest.cc
src/google/protobuf/descriptor_unittest.cc
+4
-4
repeated_field_unittest.cc
src/google/protobuf/repeated_field_unittest.cc
+2
-4
test_util.cc
src/google/protobuf/test_util.cc
+0
-0
text_format_unittest.cc
src/google/protobuf/text_format_unittest.cc
+13
-6
No files found.
src/google/protobuf/compiler/subprocess.cc
View file @
2bee6e66
...
@@ -295,8 +295,8 @@ void Subprocess::Start(const string& program, SearchMode search_mode) {
...
@@ -295,8 +295,8 @@ void Subprocess::Start(const string& program, SearchMode search_mode) {
int
stdin_pipe
[
2
];
int
stdin_pipe
[
2
];
int
stdout_pipe
[
2
];
int
stdout_pipe
[
2
];
pipe
(
stdin_pipe
);
GOOGLE_CHECK
(
pipe
(
stdin_pipe
)
!=
-
1
);
pipe
(
stdout_pipe
);
GOOGLE_CHECK
(
pipe
(
stdout_pipe
)
!=
-
1
);
char
*
argv
[
2
]
=
{
strdup
(
program
.
c_str
()),
NULL
};
char
*
argv
[
2
]
=
{
strdup
(
program
.
c_str
()),
NULL
};
...
@@ -324,9 +324,11 @@ void Subprocess::Start(const string& program, SearchMode search_mode) {
...
@@ -324,9 +324,11 @@ void Subprocess::Start(const string& program, SearchMode search_mode) {
// Write directly to STDERR_FILENO to avoid stdio code paths that may do
// Write directly to STDERR_FILENO to avoid stdio code paths that may do
// stuff that is unsafe here.
// stuff that is unsafe here.
write
(
STDERR_FILENO
,
argv
[
0
],
strlen
(
argv
[
0
]));
int
ignored
;
ignored
=
write
(
STDERR_FILENO
,
argv
[
0
],
strlen
(
argv
[
0
]));
const
char
*
message
=
": program not found or is not executable
\n
"
;
const
char
*
message
=
": program not found or is not executable
\n
"
;
write
(
STDERR_FILENO
,
message
,
strlen
(
message
));
ignored
=
write
(
STDERR_FILENO
,
message
,
strlen
(
message
));
(
void
)
ignored
;
// Must use _exit() rather than exit() to avoid flushing output buffers
// Must use _exit() rather than exit() to avoid flushing output buffers
// that will also be flushed by the parent.
// that will also be flushed by the parent.
...
...
src/google/protobuf/descriptor_unittest.cc
View file @
2bee6e66
...
@@ -1739,7 +1739,7 @@ TEST_F(MiscTest, DefaultValues) {
...
@@ -1739,7 +1739,7 @@ TEST_F(MiscTest, DefaultValues) {
message
->
field
(
3
)
->
default_value_uint64
());
message
->
field
(
3
)
->
default_value_uint64
());
EXPECT_EQ
(
4.5
,
message
->
field
(
4
)
->
default_value_float
());
EXPECT_EQ
(
4.5
,
message
->
field
(
4
)
->
default_value_float
());
EXPECT_EQ
(
10e100
,
message
->
field
(
5
)
->
default_value_double
());
EXPECT_EQ
(
10e100
,
message
->
field
(
5
)
->
default_value_double
());
EXPECT_
EQ
(
true
,
message
->
field
(
6
)
->
default_value_bool
());
EXPECT_
TRUE
(
message
->
field
(
6
)
->
default_value_bool
());
EXPECT_EQ
(
"hello"
,
message
->
field
(
7
)
->
default_value_string
());
EXPECT_EQ
(
"hello"
,
message
->
field
(
7
)
->
default_value_string
());
EXPECT_EQ
(
"
\001\002\003
"
,
message
->
field
(
8
)
->
default_value_string
());
EXPECT_EQ
(
"
\001\002\003
"
,
message
->
field
(
8
)
->
default_value_string
());
EXPECT_EQ
(
enum_value_b
,
message
->
field
(
9
)
->
default_value_enum
());
EXPECT_EQ
(
enum_value_b
,
message
->
field
(
9
)
->
default_value_enum
());
...
@@ -1762,7 +1762,7 @@ TEST_F(MiscTest, DefaultValues) {
...
@@ -1762,7 +1762,7 @@ TEST_F(MiscTest, DefaultValues) {
EXPECT_EQ
(
0
,
message
->
field
(
14
)
->
default_value_uint64
());
EXPECT_EQ
(
0
,
message
->
field
(
14
)
->
default_value_uint64
());
EXPECT_EQ
(
0.0
f
,
message
->
field
(
15
)
->
default_value_float
());
EXPECT_EQ
(
0.0
f
,
message
->
field
(
15
)
->
default_value_float
());
EXPECT_EQ
(
0.0
,
message
->
field
(
16
)
->
default_value_double
());
EXPECT_EQ
(
0.0
,
message
->
field
(
16
)
->
default_value_double
());
EXPECT_
EQ
(
false
,
message
->
field
(
17
)
->
default_value_bool
());
EXPECT_
FALSE
(
message
->
field
(
17
)
->
default_value_bool
());
EXPECT_EQ
(
""
,
message
->
field
(
18
)
->
default_value_string
());
EXPECT_EQ
(
""
,
message
->
field
(
18
)
->
default_value_string
());
EXPECT_EQ
(
""
,
message
->
field
(
19
)
->
default_value_string
());
EXPECT_EQ
(
""
,
message
->
field
(
19
)
->
default_value_string
());
EXPECT_EQ
(
enum_value_a
,
message
->
field
(
20
)
->
default_value_enum
());
EXPECT_EQ
(
enum_value_a
,
message
->
field
(
20
)
->
default_value_enum
());
...
@@ -2167,7 +2167,7 @@ TEST(CustomOptions, OptionTypes) {
...
@@ -2167,7 +2167,7 @@ TEST(CustomOptions, OptionTypes) {
options
=
options
=
&
protobuf_unittest
::
CustomOptionMinIntegerValues
::
descriptor
()
->
options
();
&
protobuf_unittest
::
CustomOptionMinIntegerValues
::
descriptor
()
->
options
();
EXPECT_
EQ
(
false
,
options
->
GetExtension
(
protobuf_unittest
::
bool_opt
));
EXPECT_
FALSE
(
options
->
GetExtension
(
protobuf_unittest
::
bool_opt
));
EXPECT_EQ
(
kint32min
,
options
->
GetExtension
(
protobuf_unittest
::
int32_opt
));
EXPECT_EQ
(
kint32min
,
options
->
GetExtension
(
protobuf_unittest
::
int32_opt
));
EXPECT_EQ
(
kint64min
,
options
->
GetExtension
(
protobuf_unittest
::
int64_opt
));
EXPECT_EQ
(
kint64min
,
options
->
GetExtension
(
protobuf_unittest
::
int64_opt
));
EXPECT_EQ
(
0
,
options
->
GetExtension
(
protobuf_unittest
::
uint32_opt
));
EXPECT_EQ
(
0
,
options
->
GetExtension
(
protobuf_unittest
::
uint32_opt
));
...
@@ -2181,7 +2181,7 @@ TEST(CustomOptions, OptionTypes) {
...
@@ -2181,7 +2181,7 @@ TEST(CustomOptions, OptionTypes) {
options
=
options
=
&
protobuf_unittest
::
CustomOptionMaxIntegerValues
::
descriptor
()
->
options
();
&
protobuf_unittest
::
CustomOptionMaxIntegerValues
::
descriptor
()
->
options
();
EXPECT_
EQ
(
true
,
options
->
GetExtension
(
protobuf_unittest
::
bool_opt
));
EXPECT_
TRUE
(
options
->
GetExtension
(
protobuf_unittest
::
bool_opt
));
EXPECT_EQ
(
kint32max
,
options
->
GetExtension
(
protobuf_unittest
::
int32_opt
));
EXPECT_EQ
(
kint32max
,
options
->
GetExtension
(
protobuf_unittest
::
int32_opt
));
EXPECT_EQ
(
kint64max
,
options
->
GetExtension
(
protobuf_unittest
::
int64_opt
));
EXPECT_EQ
(
kint64max
,
options
->
GetExtension
(
protobuf_unittest
::
int64_opt
));
EXPECT_EQ
(
kuint32max
,
options
->
GetExtension
(
protobuf_unittest
::
uint32_opt
));
EXPECT_EQ
(
kuint32max
,
options
->
GetExtension
(
protobuf_unittest
::
uint32_opt
));
...
...
src/google/protobuf/repeated_field_unittest.cc
View file @
2bee6e66
...
@@ -1007,11 +1007,13 @@ class RepeatedPtrFieldPtrsIteratorTest : public testing::Test {
...
@@ -1007,11 +1007,13 @@ class RepeatedPtrFieldPtrsIteratorTest : public testing::Test {
TEST_F
(
RepeatedPtrFieldPtrsIteratorTest
,
ConvertiblePtr
)
{
TEST_F
(
RepeatedPtrFieldPtrsIteratorTest
,
ConvertiblePtr
)
{
RepeatedPtrField
<
string
>::
pointer_iterator
iter
=
RepeatedPtrField
<
string
>::
pointer_iterator
iter
=
proto_array_
.
pointer_begin
();
proto_array_
.
pointer_begin
();
(
void
)
iter
;
}
}
TEST_F
(
RepeatedPtrFieldPtrsIteratorTest
,
ConvertibleConstPtr
)
{
TEST_F
(
RepeatedPtrFieldPtrsIteratorTest
,
ConvertibleConstPtr
)
{
RepeatedPtrField
<
string
>::
const_pointer_iterator
iter
=
RepeatedPtrField
<
string
>::
const_pointer_iterator
iter
=
const_proto_array_
->
pointer_begin
();
const_proto_array_
->
pointer_begin
();
(
void
)
iter
;
}
}
TEST_F
(
RepeatedPtrFieldPtrsIteratorTest
,
MutablePtrIteration
)
{
TEST_F
(
RepeatedPtrFieldPtrsIteratorTest
,
MutablePtrIteration
)
{
...
@@ -1136,8 +1138,6 @@ TEST_F(RepeatedPtrFieldPtrsIteratorTest, PtrSTLAlgorithms_lower_bound) {
...
@@ -1136,8 +1138,6 @@ TEST_F(RepeatedPtrFieldPtrsIteratorTest, PtrSTLAlgorithms_lower_bound) {
proto_array_
.
Add
()
->
assign
(
"y"
);
proto_array_
.
Add
()
->
assign
(
"y"
);
{
{
RepeatedPtrField
<
string
>::
pointer_iterator
iter
=
proto_array_
.
pointer_begin
();
string
v
=
"f"
;
string
v
=
"f"
;
RepeatedPtrField
<
string
>::
pointer_iterator
it
=
RepeatedPtrField
<
string
>::
pointer_iterator
it
=
lower_bound
(
proto_array_
.
pointer_begin
(),
proto_array_
.
pointer_end
(),
lower_bound
(
proto_array_
.
pointer_begin
(),
proto_array_
.
pointer_end
(),
...
@@ -1149,8 +1149,6 @@ TEST_F(RepeatedPtrFieldPtrsIteratorTest, PtrSTLAlgorithms_lower_bound) {
...
@@ -1149,8 +1149,6 @@ TEST_F(RepeatedPtrFieldPtrsIteratorTest, PtrSTLAlgorithms_lower_bound) {
EXPECT_TRUE
(
it
==
proto_array_
.
pointer_begin
()
+
3
);
EXPECT_TRUE
(
it
==
proto_array_
.
pointer_begin
()
+
3
);
}
}
{
{
RepeatedPtrField
<
string
>::
const_pointer_iterator
iter
=
const_proto_array_
->
pointer_begin
();
string
v
=
"f"
;
string
v
=
"f"
;
RepeatedPtrField
<
string
>::
const_pointer_iterator
it
=
RepeatedPtrField
<
string
>::
const_pointer_iterator
it
=
lower_bound
(
const_proto_array_
->
pointer_begin
(),
lower_bound
(
const_proto_array_
->
pointer_begin
(),
...
...
src/google/protobuf/test_util.cc
View file @
2bee6e66
This diff is collapsed.
Click to expand it.
src/google/protobuf/text_format_unittest.cc
View file @
2bee6e66
...
@@ -858,6 +858,12 @@ TEST_F(TextFormatParserTest, ParseFieldValueFromString) {
...
@@ -858,6 +858,12 @@ TEST_F(TextFormatParserTest, ParseFieldValueFromString) {
EXPECT_EQ(value, message->optional_##name()); \
EXPECT_EQ(value, message->optional_##name()); \
EXPECT_TRUE(message->has_optional_##name());
EXPECT_TRUE(message->has_optional_##name());
#define EXPECT_BOOL_FIELD(name, value, valuestring) \
EXPECT_TRUE(TextFormat::ParseFieldValueFromString( \
valuestring, d->FindFieldByName("optional_" #name), message.get())); \
EXPECT_TRUE(message->optional_##name() == value); \
EXPECT_TRUE(message->has_optional_##name());
#define EXPECT_FLOAT_FIELD(name, value, valuestring) \
#define EXPECT_FLOAT_FIELD(name, value, valuestring) \
EXPECT_TRUE(TextFormat::ParseFieldValueFromString( \
EXPECT_TRUE(TextFormat::ParseFieldValueFromString( \
valuestring, d->FindFieldByName("optional_" #name), message.get())); \
valuestring, d->FindFieldByName("optional_" #name), message.get())); \
...
@@ -915,12 +921,12 @@ TEST_F(TextFormatParserTest, ParseFieldValueFromString) {
...
@@ -915,12 +921,12 @@ TEST_F(TextFormatParserTest, ParseFieldValueFromString) {
EXPECT_INVALID
(
fixed64
,
"1,2"
);
EXPECT_INVALID
(
fixed64
,
"1,2"
);
// bool
// bool
EXPECT_FIELD
(
bool
,
true
,
"true"
);
EXPECT_
BOOL_
FIELD
(
bool
,
true
,
"true"
);
EXPECT_FIELD
(
bool
,
false
,
"false"
);
EXPECT_
BOOL_
FIELD
(
bool
,
false
,
"false"
);
EXPECT_FIELD
(
bool
,
true
,
"1"
);
EXPECT_
BOOL_
FIELD
(
bool
,
true
,
"1"
);
EXPECT_FIELD
(
bool
,
true
,
"t"
);
EXPECT_
BOOL_
FIELD
(
bool
,
true
,
"t"
);
EXPECT_FIELD
(
bool
,
false
,
"0"
);
EXPECT_
BOOL_
FIELD
(
bool
,
false
,
"0"
);
EXPECT_FIELD
(
bool
,
false
,
"f"
);
EXPECT_
BOOL_
FIELD
(
bool
,
false
,
"f"
);
EXPECT_INVALID
(
bool
,
"2"
);
EXPECT_INVALID
(
bool
,
"2"
);
EXPECT_INVALID
(
bool
,
"-0"
);
EXPECT_INVALID
(
bool
,
"-0"
);
EXPECT_INVALID
(
bool
,
"on"
);
EXPECT_INVALID
(
bool
,
"on"
);
...
@@ -962,6 +968,7 @@ TEST_F(TextFormatParserTest, ParseFieldValueFromString) {
...
@@ -962,6 +968,7 @@ TEST_F(TextFormatParserTest, ParseFieldValueFromString) {
EXPECT_INVALID
(
nested_message
,
"any"
);
EXPECT_INVALID
(
nested_message
,
"any"
);
#undef EXPECT_FIELD
#undef EXPECT_FIELD
#undef EXPECT_BOOL_FIELD
#undef EXPECT_FLOAT_FIELD
#undef EXPECT_FLOAT_FIELD
#undef EXPECT_DOUBLE_FIELD
#undef EXPECT_DOUBLE_FIELD
#undef EXPECT_INVALID
#undef EXPECT_INVALID
...
...
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