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
82a4e4e3
Commit
82a4e4e3
authored
Jul 31, 2018
by
Yilun Chong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix js reader.js's skipGroup
parent
8705adc2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
reader.js
js/binary/reader.js
+5
-7
reader_test.js
js/binary/reader_test.js
+2
-0
package.json
js/package.json
+1
-1
No files found.
js/binary/reader.js
View file @
82a4e4e3
...
...
@@ -389,7 +389,7 @@ jspb.BinaryReader.prototype.skipFixed64Field = function() {
*/
jspb
.
BinaryReader
.
prototype
.
skipGroup
=
function
()
{
// Keep a stack of start-group tags that must be matched by end-group tags.
var
nestedGroups
=
[
this
.
nextField_
]
;
var
previousField
=
this
.
nextField_
;
do
{
if
(
!
this
.
nextField
())
{
goog
.
asserts
.
fail
(
'Unmatched start-group tag: stream EOF'
);
...
...
@@ -397,19 +397,17 @@ jspb.BinaryReader.prototype.skipGroup = function() {
return
;
}
if
(
this
.
nextWireType_
==
jspb
.
BinaryConstants
.
WireType
.
START_GROUP
)
{
// Nested group start.
nestedGroups
.
push
(
this
.
nextField_
);
}
else
if
(
this
.
nextWireType_
==
jspb
.
BinaryConstants
.
WireType
.
END_GROUP
)
{
// Group end: check that it matches top-of-stack.
if
(
this
.
nextField_
!=
nestedGroups
.
pop
()
)
{
if
(
this
.
nextField_
!=
previousField
)
{
goog
.
asserts
.
fail
(
'Unmatched end-group tag'
);
this
.
error_
=
true
;
return
;
}
return
;
}
}
while
(
nestedGroups
.
length
>
0
);
this
.
skipField
();
}
while
(
true
);
};
...
...
js/binary/reader_test.js
View file @
82a4e4e3
...
...
@@ -680,8 +680,10 @@ describe('binaryReaderTest', function() {
var
dummyMessage
=
/** @type {!jspb.BinaryMessage} */
({});
writer
.
writeGroup
(
5
,
dummyMessage
,
function
()
{
writer
.
writeInt64
(
42
,
42
);
writer
.
writeString
(
43
,
'The quick brown fox jumps over the lazy dog'
);
writer
.
writeGroup
(
6
,
dummyMessage
,
function
()
{
writer
.
writeInt64
(
84
,
42
);
writer
.
writeString
(
85
,
'The quick brown fox jumps over the lazy dog'
);
});
});
...
...
js/package.json
View file @
82a4e4e3
...
...
@@ -22,5 +22,5 @@
"url"
:
"https://github.com/google/protobuf/tree/master/js"
},
"author"
:
"Google Protocol Buffers Team"
,
"license"
:
"BSD-3-Clause"
"license"
:
"BSD-3-Clause"
}
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