Here you go...attached is an example that fails quite reliably (for me).
Compile like so:

mkdir build
cd build
cmake ../
make
./test-pb

On Wed, Oct 7, 2009 at 4:49 PM, Kenton Varda <ken...@google.com> wrote:

> ByteSize() definitely returns the right value -- if it didn't, tons of
> stuff would be broken.  Can you provide a complete example program that
> demonstrates your problem?
> On Wed, Oct 7, 2009 at 4:01 PM, Brenden Matthews <bren...@diddyinc.com>wrote:
>
>>
>> The value returned by Message::ByteSize() does not match the actually
>> number of bytes that are consumed after writing a message to a
>> stream.  Example:
>>
>>    some_message m;
>>    /* ... populate m ... */
>>    size_t len = m.ByteSize();
>>    int pos = boost::iostreams::position_to_offset(stream.tellp()); /*
>> save the current position of the stream */
>>    m.SerializeToOstream(&stream);
>>
>>    /* and now this assert will fail */
>>    assert(pos + len == boost::iostreams::position_to_offset
>> (stream.tellp());
>>
>> Maybe I'm missing something here, but shouldn't the value returned by
>> ByteSize() be the same as the actual number of bytes written to the
>> stream?
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@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
-~----------~----~----~----~------~----~------~--~---

Attachment: pbtest.tar.bz2
Description: BZip2 compressed data

Reply via email to