genbindings/integers: properly treat char as signed int8, not byte

This commit is contained in:
mappu 2024-10-11 18:37:38 +13:00
parent c783029317
commit bcfdb4ea15
2 changed files with 9 additions and 6 deletions

View File

@ -45,11 +45,14 @@ func (p CppParameter) RenderTypeGo() string {
} }
switch p.ParameterType { switch p.ParameterType {
case "char", "qint8", "signed char", "unsigned char", "uchar", "quint8": case "unsigned char", "uchar", "quint8":
ret += "byte" // Strictly speaking, Go byte is unsigned and char may be signed // Go byte is unsigned
case "short", "qint16": ret += "byte"
case "char", "qint8", "signed char":
ret += "int8" // Signed
case "short", "qint16", "int16_t":
ret += "int16" ret += "int16"
case "ushort", "quint16", "unsigned short": case "ushort", "quint16", "unsigned short", "uint16_t":
ret += "uint16" ret += "uint16"
case "long": case "long":
// Windows ILP32 - 32-bits // Windows ILP32 - 32-bits

View File

@ -151,10 +151,10 @@ func (p CppParameter) IntType() bool {
switch p.ParameterType { switch p.ParameterType {
case "int", "unsigned int", "uint", case "int", "unsigned int", "uint",
"short", "unsigned short", "ushort", "qint16", "quint16", "short", "unsigned short", "ushort", "qint16", "quint16", "uint16_t", "int16_t",
"qint8", "quint8", "qint8", "quint8",
"unsigned char", "signed char", "uchar", "unsigned char", "signed char", "uchar",
"long", "unsigned long", "ulong", "qint32", "quint32", "long", "unsigned long", "ulong", "qint32", "quint32", "int32_t", "uint32_t",
"longlong", "ulonglong", "qlonglong", "qulonglong", "qint64", "quint64", "int64_t", "uint64_t", "long long", "unsigned long long", "longlong", "ulonglong", "qlonglong", "qulonglong", "qint64", "quint64", "int64_t", "uint64_t", "long long", "unsigned long long",
"qintptr", "quintptr", "uintptr_t", "intptr_t", "qintptr", "quintptr", "uintptr_t", "intptr_t",
"qsizetype", "size_t", "qsizetype", "size_t",