-
Notifications
You must be signed in to change notification settings - Fork 133
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
Wrong offset in MIDIPacketList struct #374
Comments
MIDIPacket uses non native struct member packing ( |
I see, thanks for the feedback! As a short term solution: Do you know how I could workaround this issue when creating a MIDIPacketList struct? The workaround I mentioned only applies when reading but not when creating this type. |
you can try manually build a structure in allocated memory (with VM.allocateMemory), and then creating java object for needed memory using |
hi @florianf, no it requires packed struct support in compiler. I will deliver fix as another PR |
hi @davidgiga1993 , sadly it took more than month since reported. but there is a support for packed structs in #378 . Could you please test it and report any issues. Thanks |
Issue details
The struct definition for MIDIPacketList is wrong and only seems to work by accident on 32bit platforms.
When calling
getPacket()
on aMIDIPacketList
struct the returned packet is off by 4 byte on a 64bit platform.Example:
On 32bit
6106767000
getPacket().getHandle()
:6106767004
On 64bit
6106767000
getPacket().getHandle()
:6106767008
Therefore all the data of the MIDIPacket is invalid on 64bit platforms.
The issue is that the packet is not referenced by ref in the original header - therefore the offset is always 4 byte (the numPackets field)
Reproduction steps/code
Configuration
Build Tools:
Versions:
Build Targets:
iPhone 8 (64 bit)
Workaround
As of now I'm reading the packet with an hardcoded 4 byte offset but that's pretty ugly..
The text was updated successfully, but these errors were encountered: