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
c4dce018
Commit
c4dce018
authored
Oct 03, 2017
by
Thomas Van Lenten
Committed by
GitHub
Oct 03, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3709 from thomasvl/unknown_field_merge_issue
ObjC: Fix merging of length delimited unknown fields.
parents
210be267
3f2dcaeb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
11 deletions
+21
-11
GPBUnknownField.m
objectivec/GPBUnknownField.m
+1
-1
GPBUnknownFieldSetTest.m
objectivec/Tests/GPBUnknownFieldSetTest.m
+20
-10
No files found.
objectivec/GPBUnknownField.m
View file @
c4dce018
...
...
@@ -79,7 +79,7 @@
result
->
mutableFixed32List_
=
[
mutableFixed32List_
copyWithZone
:
zone
];
result
->
mutableFixed64List_
=
[
mutableFixed64List_
copyWithZone
:
zone
];
result
->
mutableLengthDelimitedList_
=
[
mutableLengthDelimitedList_
c
opyWithZone
:
zone
];
[
mutableLengthDelimitedList_
mutableC
opyWithZone
:
zone
];
result
->
mutableVarintList_
=
[
mutableVarintList_
copyWithZone
:
zone
];
if
(
mutableGroupList_
.
count
)
{
result
->
mutableGroupList_
=
[[
NSMutableArray
allocWithZone
:
zone
]
...
...
objectivec/Tests/GPBUnknownFieldSetTest.m
View file @
c4dce018
...
...
@@ -34,6 +34,10 @@
#import "GPBUnknownFieldSet_PackagePrivate.h"
#import "google/protobuf/Unittest.pbobjc.h"
static
NSData
*
DataFromCStr
(
const
char
*
str
)
{
return
[
NSData
dataWithBytes
:
str
length
:
strlen
(
str
)];
}
@interface
GPBUnknownFieldSet
(
GPBUnknownFieldSetTest
)
-
(
void
)
getTags
:(
int32_t
*
)
tags
;
@end
...
...
@@ -112,6 +116,9 @@
field
=
[[[
GPBUnknownField
alloc
]
initWithNumber
:
3
]
autorelease
];
[
field
addVarint
:
4
];
[
set1
addField
:
field
];
field
=
[[[
GPBUnknownField
alloc
]
initWithNumber
:
10
]
autorelease
];
[
field
addLengthDelimited
:
DataFromCStr
(
"data1"
)];
[
set1
addField
:
field
];
GPBUnknownFieldSet
*
set2
=
[[[
GPBUnknownFieldSet
alloc
]
init
]
autorelease
];
field
=
[[[
GPBUnknownField
alloc
]
initWithNumber
:
1
]
autorelease
];
...
...
@@ -120,22 +127,26 @@
field
=
[[[
GPBUnknownField
alloc
]
initWithNumber
:
3
]
autorelease
];
[
field
addVarint
:
3
];
[
set2
addField
:
field
];
field
=
[[[
GPBUnknownField
alloc
]
initWithNumber
:
10
]
autorelease
];
[
field
addLengthDelimited
:
DataFromCStr
(
"data2"
)];
[
set2
addField
:
field
];
GPBUnknownFieldSet
*
set3
=
[[[
GPBUnknownFieldSet
alloc
]
init
]
autorelease
];
field
=
[[[
GPBUnknownField
alloc
]
initWithNumber
:
1
]
autorelease
];
[
field
addVarint
:
1
];
[
set3
addField
:
field
];
field
=
[[[
GPBUnknownField
alloc
]
initWithNumber
:
3
]
autorelease
];
[
field
addVarint
:
4
];
[
set3
addField
:
field
];
GPBUnknownFieldSet
*
set4
=
[[[
GPBUnknownFieldSet
alloc
]
init
]
autorelease
];
field
=
[[[
GPBUnknownField
alloc
]
initWithNumber
:
2
]
autorelease
];
[
field
addVarint
:
2
];
[
set
4
addField
:
field
];
[
set
3
addField
:
field
];
field
=
[[[
GPBUnknownField
alloc
]
initWithNumber
:
3
]
autorelease
];
[
field
addVarint
:
4
];
[
set3
addField
:
field
];
[
field
addVarint
:
3
];
[
set4
addField
:
field
];
[
set3
addField
:
field
];
field
=
[[[
GPBUnknownField
alloc
]
initWithNumber
:
10
]
autorelease
];
[
field
addLengthDelimited
:
DataFromCStr
(
"data1"
)];
[
field
addLengthDelimited
:
DataFromCStr
(
"data2"
)];
[
set3
addField
:
field
];
TestEmptyMessage
*
source1
=
[
TestEmptyMessage
message
];
[
source1
setUnknownFields
:
set1
];
...
...
@@ -143,8 +154,6 @@
[
source2
setUnknownFields
:
set2
];
TestEmptyMessage
*
source3
=
[
TestEmptyMessage
message
];
[
source3
setUnknownFields
:
set3
];
TestEmptyMessage
*
source4
=
[
TestEmptyMessage
message
];
[
source4
setUnknownFields
:
set4
];
TestEmptyMessage
*
destination1
=
[
TestEmptyMessage
message
];
[
destination1
mergeFrom
:
source1
];
...
...
@@ -152,9 +161,10 @@
TestEmptyMessage
*
destination2
=
[
TestEmptyMessage
message
];
[
destination2
mergeFrom
:
source3
];
[
destination2
mergeFrom
:
source4
];
XCTAssertEqualObjects
(
destination1
.
data
,
destination2
.
data
);
XCTAssertEqualObjects
(
destination1
.
data
,
source3
.
data
);
XCTAssertEqualObjects
(
destination2
.
data
,
source3
.
data
);
}
-
(
void
)
testClearMessage
{
...
...
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