Skip to content

Bug: Incorrect mapping of C char to Go rune in gobindings #65

@vszurma

Description

@vszurma

Description

The gobindings currently map C char types to Go rune. This is incorrect.

According to the Go specification:

byte        alias for uint8
rune        alias for int32

C char should be mapped to Go byte (uint8), not rune (int32).

Impact

This mismatch leads to incorrect behavior and can cause crashes when interacting with devices.

Reproduction Example

Using the current mapping:

// This crashes the master brick
func (device *RS232Bricklet) Write(message [60]rune, length uint8) (written uint8, err error) {

Using the correct mapping:

// This works as expected
func (device *RS232Bricklet) Write(message [60]byte, length uint8) (written uint8, err error) {

This issue specifically affects functions like RS232Bricklet.Write() but may impact other bindings where char arrays are used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions