genbindings: more integer type handling

This commit is contained in:
mappu 2024-08-17 14:10:17 +12:00
parent 58eee48a5d
commit 0dce1b4fe2

View File

@ -41,10 +41,8 @@ func (p CppParameter) RenderTypeGo() string {
} }
switch p.ParameterType { switch p.ParameterType {
case "char", "qint8": case "char", "qint8", "unsigned char", "uchar", "quint8":
ret += "byte" ret += "byte" // Strictly speaking, Go byte is unsigned and char may be signed
case "unsigned char", "quint8":
ret += "byte"
case "short", "qint16": case "short", "qint16":
ret += "int16" ret += "int16"
case "ushort", "quint16": case "ushort", "quint16":
@ -82,6 +80,12 @@ func (p CppParameter) RenderTypeGo() string {
ret += "float32" ret += "float32"
case "double": case "double":
ret += "float64" ret += "float64"
case "qsizetype":
if C.sizeof_size_t == 4 {
ret += "uint32"
} else {
ret += "uint64"
}
default: default:
// Do not transform this type // Do not transform this type
ret += p.ParameterType ret += p.ParameterType