On Tuesday, June 25, 2013 2:55:44 PM UTC-7, Ilia Mirkin wrote:

> You also need to keep track of how big your header is. Otherwise when 
> reading the header, it will happily just keep on going, accumulating 
> "unknown" tags/etc. 
> When you write the file, keep track of the actual offsets you write 
> the protos at. When reading, compare them to what you had when written 
> out... that should reveal the issue. 
Sorry, I forgot to mention that at the beginning of the file (when I write 
out the file), I write to a coded output stream and write the size of the 
header via WriteLittleEndianInt32 (or whatever that function is). I then 
write out the "header" protocol buffer message (via same coded output 
stream) and then I loop over all "entries" and (via same coded output 
stream) and write those messages out to the file. So I believe I am setting 
the limit's properly for reading the header, but I'll double check.

I'll keep track (via trust ol' pen and paper for now) the offsets and see 
what I come up with. Thanks for the info. 

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to