On Mar 6, 2011, at 18:45 , ksamdev wrote:
I think I found the source of the problem. The problem is that
CodedInputStream has internal counter of how many bytes are read so
far with the same object.
Ah, right. With the C++ API, the intention is that you will not reuse
the CodedInputStream, and instead it will be created and destroyed for
each message. It is very cheap to allocate / destroy if it is a local
variable.
In your case, you should do something like change your ::write method
to do:
CodedOutputStream out(_raw_out.get());
out.WriteVarint32(event.ByteSize());
event.SerializeWithCachedSizes(&out);
This will also save the extra copy that your code currently has. Hope
this helps,
Evan
--
http://evanjones.ca/
--
You received this message because you are subscribed to the Google Groups "Protocol
Buffers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/protobuf?hl=en.