mirror of
https://github.com/mappu/miqt.git
synced 2025-01-03 06:08:38 +00:00
genbindings/ints: qint64 handling applies to pointer types too
This commit is contained in:
parent
cf430b6cc5
commit
e629117e54
@ -225,15 +225,18 @@ func emitParametersCABI2CppForwarding(params []CppParameter) (preamble string, f
|
|||||||
if p.ByRef { // e.g. QDataStream::operator>>() overloads
|
if p.ByRef { // e.g. QDataStream::operator>>() overloads
|
||||||
castSrc = "*" + castSrc
|
castSrc = "*" + castSrc
|
||||||
castType += "&" // believe it or not, this is legal
|
castType += "&" // believe it or not, this is legal
|
||||||
|
|
||||||
if p.ParameterType == "qint64" || p.ParameterType == "quint64" {
|
|
||||||
// QDataStream::operator>>()
|
|
||||||
// CABI has these as int64_t* (long int) which fails a static_cast to qint64& (long long int&)
|
|
||||||
// Hack a hard C-style cast
|
|
||||||
castSrc = "(" + castType + ")(" + castSrc + ")"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tmp = append(tmp, "static_cast<"+castType+">("+castSrc+")")
|
|
||||||
|
if p.ParameterType == "qint64" || p.ParameterType == "quint64" {
|
||||||
|
// QDataStream::operator>>() by reference
|
||||||
|
// QLockFile::getLockInfo() by pointer
|
||||||
|
// CABI has these as int64_t* (long int) which fails a static_cast to qint64& (long long int&)
|
||||||
|
// Hack a hard C-style cast
|
||||||
|
tmp = append(tmp, "("+castType+")("+castSrc+")")
|
||||||
|
} else {
|
||||||
|
// Use static_cast<> safely
|
||||||
|
tmp = append(tmp, "static_cast<"+castType+">("+castSrc+")")
|
||||||
|
}
|
||||||
|
|
||||||
} else if p.ByRef {
|
} else if p.ByRef {
|
||||||
// We changed RenderTypeCabi() to render this as a pointer
|
// We changed RenderTypeCabi() to render this as a pointer
|
||||||
|
Loading…
Reference in New Issue
Block a user