Closed GoogleCodeExporter closed 9 years ago
Oups, pressed enter too fast. Description:
if message A contains message B, which contains message C
then message A will have the wrong size for message B, because the calculation
of the
size of message B will forget the byte for the tag and the byte for size of
message C.
Need to be solved by first writing B to a tempStream, then measuring its real
size.
Original comment by b...@philippe.pascalonline.org
on 18 Mar 2009 at 7:45
The change is:
public function writeMessage(fieldNumber:int, value:Message):void {
writeTag(fieldNumber, WireFormat.WIRETYPE_LENGTH_DELIMITED);
var tempStream:ByteArray = new ByteArray();
value.writeToDataOutput(tempStream);
tempStream.position = 0;
writeRawVarint32(tempStream.length);
output.writeBytes(tempStream,0,tempStream.length);
}
instead of
public function writeMessage(fieldNumber:int, value:Message):void {
writeTag(fieldNumber, WireFormat.WIRETYPE_LENGTH_DELIMITED);
writeRawVarint32(value.getSerializedSize());
value.writeToCodedStream(this);
}
Original comment by b...@philippe.pascalonline.org
on 18 Mar 2009 at 7:46
fix in trunk@10 , released in v1.0.3
Original comment by sorrydevil@gmail.com
on 18 Mar 2009 at 7:53
Original issue reported on code.google.com by
b...@philippe.pascalonline.org
on 18 Mar 2009 at 7:42