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
a6fc5da0
Commit
a6fc5da0
authored
Feb 20, 2015
by
Jisi Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix review comments.
Change-Id: Iafd4a3aa9d55e31478bf070311eeadfe95ece4d7
parent
f2cf6cdc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
11 deletions
+12
-11
NanoTest.java
...nano/src/test/java/com/google/protobuf/nano/NanoTest.java
+1
-1
javanano_field.cc
src/google/protobuf/compiler/javanano/javanano_field.cc
+1
-10
javanano_message.cc
src/google/protobuf/compiler/javanano/javanano_message.cc
+10
-0
No files found.
javanano/src/test/java/com/google/protobuf/nano/NanoTest.java
View file @
a6fc5da0
...
...
@@ -3741,7 +3741,7 @@ public class NanoTest extends TestCase {
checkOneofCase
(
m
,
0
);
}
public
void
testOneofMarshling
()
throws
Exception
{
public
void
testOneofMarsh
a
ling
()
throws
Exception
{
TestAllTypesNano
m
=
new
TestAllTypesNano
();
TestAllTypesNano
parsed
=
new
TestAllTypesNano
();
{
...
...
src/google/protobuf/compiler/javanano/javanano_field.cc
View file @
a6fc5da0
...
...
@@ -174,15 +174,10 @@ void GenerateOneofFieldEquals(const FieldDescriptor* descriptor,
if
(
GetJavaType
(
descriptor
)
==
JAVATYPE_BYTES
)
{
printer
->
Print
(
variables
,
"if (this.has$capitalized_name$()) {
\n
"
" if (!other.has$capitalized_name$() ||
\n
"
" !java.util.Arrays.equals((byte[]) this.$oneof_name$_,
\n
"
" if (!java.util.Arrays.equals((byte[]) this.$oneof_name$_,
\n
"
" (byte[]) other.$oneof_name$_)) {
\n
"
" return false;
\n
"
" }
\n
"
"} else {
\n
"
" if (other.has$capitalized_name$()) {
\n
"
" return false;
\n
"
" }
\n
"
"}
\n
"
);
}
else
{
printer
->
Print
(
variables
,
...
...
@@ -190,10 +185,6 @@ void GenerateOneofFieldEquals(const FieldDescriptor* descriptor,
" if (!this.$oneof_name$_.equals(other.$oneof_name$_)) {
\n
"
" return false;
\n
"
" }
\n
"
"} else {
\n
"
" if (other.has$capitalized_name$()) {
\n
"
" return false;
\n
"
" }
\n
"
"}
\n
"
);
}
}
...
...
src/google/protobuf/compiler/javanano/javanano_message.cc
View file @
a6fc5da0
...
...
@@ -551,6 +551,16 @@ void MessageGenerator::GenerateEquals(io::Printer* printer) {
"$classname$ other = ($classname$) o;
\n
"
,
"classname"
,
descriptor_
->
name
());
// Checking oneof case before checking each oneof field.
for
(
int
i
=
0
;
i
<
descriptor_
->
oneof_decl_count
();
i
++
)
{
const
OneofDescriptor
*
oneof_desc
=
descriptor_
->
oneof_decl
(
i
);
printer
->
Print
(
"if (this.$oneof_name$Case_ != other.$oneof_name$Case_) {
\n
"
" return false;
\n
"
"}
\n
"
,
"oneof_name"
,
UnderscoresToCamelCase
(
oneof_desc
));
}
for
(
int
i
=
0
;
i
<
descriptor_
->
field_count
();
i
++
)
{
const
FieldDescriptor
*
field
=
descriptor_
->
field
(
i
);
field_generators_
.
get
(
field
).
GenerateEqualsCode
(
printer
);
...
...
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