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

Fix JS array types #369

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

gaillarddamien
Copy link
Contributor

Support for array types was requested in issue #317 and its implementation recently merged into develop (PR #340).
However, there were a few issues with it.
I will try and summarize what this PR addresses.

  • int and float array types:
    it fails to decode int and float arrays (other than Int8Array and Uint8Array): an array of the right size is returned, but it is filled with the first value from the original array.

    #input:
    {"value": [-1,-2,47897,-3.4,-4,-5,-6,47879,1,9,-7,7877444],"type":"Int16Array","name":"test"}
    #output:
    {"value":[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"type":"Int16Array","name":"test"}

    This is because the decoding function always returns the first byte (index 0) regardless of how it is invoked (i has no effect on these calls).

  • boolean array type:

    #input:
    {"value": [false,false,true,true,false,true,false,false,true,true,false,true,true,true,false],"type":"booleanArray","name":"Hello"}

    It fails here with the following error byte length of Uint32Array should be a multiple of 4.
    And I believe the bytes would then be built with bits reversed.

Signed-off-by: Damien Gaillard <damien.gaillard@vossloh.com>
Signed-off-by: Damien Gaillard <damien.gaillard@vossloh.com>
Signed-off-by: Damien Gaillard <damien.gaillard@vossloh.com>
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

Successfully merging this pull request may close these issues.

1 participant