Closed yalue closed 8 years ago
Good catch! If we rely on C.int
and C.uint
being 4 bytes, then there is a large number of fixes to be made across the project. I think, breaking the API will be warranted, rather than resizing.
Sounds great, thanks for looking into it. I wasn't sure how to handle the problem "properly", so I just submitted the quick hack I used to get my stuff working. I also considered using unsafe.Sizeof
to check if uint
was the same size as C.uint
, and only doing the resizing if the sizes differ, but if you're willing to make the breaking change I agree that's the most foolproof option in terms of performance and maintainability.
I'm going to go ahead and close all PRs that have been open for more than 6 months, including this one. If it needs reopened feel free to do so or open a new PR.
The sendkey function assumes that Go's uint type is the same length as C's uint type. This is not true on many systems, especially x86_64 Linux, where Go's uint is usually 8 bytes, but C's is usually 4.
This change addresses the issue by explicitly converting the slice of Go keycodes to a slice of C keycodes.