Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
protobuf-c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
protobuf-c
Commits
a2100d1f
Commit
a2100d1f
authored
Jun 19, 2014
by
Ilya Lipnitskiy
Committed by
Robert Edmonds
Jun 27, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
protobuf-c.c: Fix repeated field concatenation order in merge_messages (fixes #147)
parent
e7dc76c5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
protobuf-c/protobuf-c.c
protobuf-c/protobuf-c.c
+5
-5
t/generated-code2/test-generated-code2.c
t/generated-code2/test-generated-code2.c
+4
-4
No files found.
protobuf-c/protobuf-c.c
View file @
a2100d1f
...
@@ -1933,12 +1933,12 @@ merge_messages(ProtobufCMessage *earlier_msg,
...
@@ -1933,12 +1933,12 @@ merge_messages(ProtobufCMessage *earlier_msg,
if
(
!
new_field
)
if
(
!
new_field
)
return
FALSE
;
return
FALSE
;
memcpy
(
new_field
,
*
p_latter
,
memcpy
(
new_field
,
*
p_earlier
,
*
n_latter
*
el_size
);
memcpy
(
new_field
+
*
n_latter
*
el_size
,
*
p_earlier
,
*
n_earlier
*
el_size
);
*
n_earlier
*
el_size
);
memcpy
(
new_field
+
*
n_earlier
*
el_size
,
*
p_latter
,
*
n_latter
*
el_size
);
do_free
(
allocator
,
*
p_latter
);
do_free
(
allocator
,
*
p_latter
);
do_free
(
allocator
,
*
p_earlier
);
do_free
(
allocator
,
*
p_earlier
);
...
...
t/generated-code2/test-generated-code2.c
View file @
a2100d1f
...
@@ -1469,8 +1469,8 @@ test_field_merge (void)
...
@@ -1469,8 +1469,8 @@ test_field_merge (void)
msg2
.
test_message
=
&
sub2
;
msg2
.
test_message
=
&
sub2
;
sub2
.
has_val2
=
1
;
sub2
.
has_val2
=
1
;
sub2
.
val2
=
666
;
sub2
.
val2
=
666
;
int32_t
arr2
[]
=
{
2
,
3
};
int32_t
arr2
[]
=
{
2
,
3
,
4
};
sub2
.
n_rep
=
2
;
sub2
.
n_rep
=
3
;
sub2
.
rep
=
arr2
;
sub2
.
rep
=
arr2
;
sub2
.
sub1
=
&
subsub2
;
sub2
.
sub1
=
&
subsub2
;
subsub2
.
has_val1
=
1
;
subsub2
.
has_val1
=
1
;
...
@@ -1496,8 +1496,8 @@ test_field_merge (void)
...
@@ -1496,8 +1496,8 @@ test_field_merge (void)
assert
(
merged
->
test_message
->
has_val1
&&
merged
->
test_message
->
val1
==
sub1
.
val1
);
assert
(
merged
->
test_message
->
has_val1
&&
merged
->
test_message
->
val1
==
sub1
.
val1
);
assert
(
merged
->
test_message
->
has_val2
&&
merged
->
test_message
->
val2
==
sub2
.
val2
);
assert
(
merged
->
test_message
->
has_val2
&&
merged
->
test_message
->
val2
==
sub2
.
val2
);
/* Repeated fields should get concatenated */
/* Repeated fields should get concatenated */
int32_t
merged_arr
[]
=
{
2
,
3
,
0
,
1
};
int32_t
merged_arr
[]
=
{
0
,
1
,
2
,
3
,
4
};
assert
(
merged
->
test_message
->
n_rep
==
4
&&
assert
(
merged
->
test_message
->
n_rep
==
5
&&
memcmp
(
merged
->
test_message
->
rep
,
merged_arr
,
sizeof
(
merged_arr
))
==
0
);
memcmp
(
merged
->
test_message
->
rep
,
merged_arr
,
sizeof
(
merged_arr
))
==
0
);
assert
(
merged
->
test_message
->
sub1
->
val1
==
subsub2
.
val1
);
assert
(
merged
->
test_message
->
sub1
->
val1
==
subsub2
.
val1
);
...
...
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