Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nanopb
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
le
nanopb
Commits
25210ac1
Commit
25210ac1
authored
8 years ago
by
Petteri Aimonen
Browse files
Options
Downloads
Patches
Plain Diff
Fix message length calculation for arrays of size 1 (issue #253)
parent
d56c4cc7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
generator/nanopb_generator.py
+6
-1
6 additions, 1 deletion
generator/nanopb_generator.py
with
6 additions
and
1 deletion
generator/nanopb_generator.py
+
6
−
1
View file @
25210ac1
...
...
@@ -649,9 +649,14 @@ class Field:
if
self
.
rules
==
'
REPEATED
'
:
# Decoders must be always able to handle unpacked arrays.
# Therefore we have to reserve space for it, even though
# we emit packed arrays ourselves.
# we emit packed arrays ourselves. For length of 1, packed
# arrays are larger however so we need to add allowance
# for the length byte.
encsize
*=
self
.
max_count
if
self
.
max_count
==
1
:
encsize
+=
1
return
encsize
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment