Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[de]serialization issue -- [packed = true] sint32, sint64, and double #89

Closed
bloche opened this issue Jul 19, 2016 · 1 comment
Closed
Assignees

Comments

@bloche
Copy link

bloche commented Jul 19, 2016

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:

Test([123])
core.exception.RangeError@std/bitmanip.d(2987): Range violation

The other number types run though fine. e.g. int32, uint64, etc.

@msoucy
Copy link
Owner

msoucy commented Aug 12, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants