-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
int64 serialization/deserialization not working properly #534
Comments
var enc = test.encode({int_64: 314159265358979}).finish(); // not a string Still wondering where the other number comes from. |
Yeah maybe, but these guys at |
Will see what I can do, need to setup this test first! |
Alright, most of this should be working now. Without a long-lib, parseInt is used for strings now. However, I doubt that the following line if (dec.int_64 === '314159265358979') { would actually work with v5, because v5 always returns a Long instance when fixed64 is supported. Hence, I assume that grpc is using long actually (if it has protobufjs in its dependencies, it even must because it is a non-optional dep on node prior to v6). What actually works with a long lib is this: if (dec.int_64 == '314159265358979') { because there is Long#toString, which is called implicitly here (at the cost of some usually unnecessary overhead btw - converting hence and forth between longs and strings is suboptimal). Let me know if this is sufficient! |
I'm testing it still and it doesn't seem to want to work properly, I have |
Okay, two of the test cases are fixed, see #536 for the next issue :) |
Output:
Extracted from a failing test case in grpc.
long
is not installed. Nodev6.9.1
The text was updated successfully, but these errors were encountered: