On Tue, Oct 19, 2010 at 6:28 PM, Paul <mjpabl...@gmail.com> wrote:

> int numBytesForDelim = sizeof(int);
>

You seem to be assuming that the delimiter is a simple fixed-width int.


> coded_output->WriteVarint32(snap1.ByteSize());
>

But you are actually writing a varint32, which can be anywhere between 1 and
5 bytes depending on the value.

Use CodedOutputStream::Varint32Size() to compute the number of bytes needed
to encode a particular value.

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to