Closed bloche closed 8 years ago
import dproto.dproto; mixin ProtocolBufferFromString!q{ message Test { repeated sint32 id = 1 [packed = true]; } }; unittest { Test t; t.id = [123]; std.stdio.writeln(t); auto s = t.serialize(); t = Test(s); std.stdio.writeln(t); assert(t.id == [123]); }
Deserializing a packed array of signed numbers appears to append a zero.
Test([123]) Test([123, 0]) core.exception.AssertError@src/test.d(22): unittest failure
If id were a double I get:
id
Test([123]) core.exception.RangeError@std/bitmanip.d(2987): Range violation
The other number types run though fine. e.g. int32, uint64, etc.
int32
uint64
I have confirmed that the in both cases, it's an issue with deserialization, by serializing it via Python and comparing the serialized data. I'm looking at actually fixing the issue now.
Deserializing a packed array of signed numbers appears to append a zero.
If
id
were a double I get:The other number types run though fine. e.g.
int32
,uint64
, etc.