Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(241)

Unified Diff: proto/decode.go

Issue 3274043: code review 3274043: Encode and decode empty bytes fields correctly.
Patch Set: code review 3274043: Encode and decode empty bytes fields correctly. Created 14 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « proto/all_test.go ('k') | proto/encode.go » ('j') | proto/encode.go » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: proto/decode.go
===================================================================
--- a/proto/decode.go
+++ b/proto/decode.go
@@ -479,10 +479,7 @@
if err != nil {
return err
}
- lb := len(b)
- if lb == 0 {
- return nil
- }
+
x := (*[]uint8)(unsafe.Pointer(base + p.offset))
y := *x
@@ -494,6 +491,7 @@
}
l := len(y)
+ lb := len(b)
if l+lb > c {
// incremental growth is max(len(slice)*1.5, len(slice)+len(bytes))
g := l * 3 / 2
« no previous file with comments | « proto/all_test.go ('k') | proto/encode.go » ('j') | proto/encode.go » ('J')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b