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

Issue 4186060: Fix for issue 256: CodedOutputStream computes wrong size for negative enums

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 2 months ago by jasonh
Modified:
9 years, 11 months ago
Reviewers:
Jisi Liu
Base URL:
http://protobuf.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Negative enum values are encoded as sign-extended varints, but CodedOutputStream.computeEnumSizeNoTag just returns computeRawVarint32Size(). Use computeInt32SizeNoTag() instead to match the writing code. Adds a unittest for this in CodedOutputStreamTest.java

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+16 lines, -1 line) Patch
M java/src/main/java/com/google/protobuf/CodedOutputStream.java View 1 chunk +1 line, -1 line 0 comments Download
M java/src/test/java/com/google/protobuf/CodedOutputStreamTest.java View 1 chunk +15 lines, -0 lines 0 comments Download

Messages

Total messages: 2
jasonh
Hi Jisi - This fixes the bug when serializing negative enum values in Java, reported ...
13 years, 2 months ago (2011-02-18 04:14:46 UTC) #1
Jisi Liu
13 years, 2 months ago (2011-02-18 04:29:19 UTC) #2
LGTM

Thanks for the fix!
Sign in to reply to this message.

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