mirror of
https://github.com/mappu/miqt.git
synced 2024-12-23 01:18:37 +00:00
genbindings: more const correctness
This commit is contained in:
parent
421c229771
commit
a4baeabbcb
@ -45,6 +45,13 @@ func (p CppParameter) RenderTypeCabi() string {
|
|||||||
ret = "ptrdiff_t"
|
ret = "ptrdiff_t"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if p.Const {
|
||||||
|
// This is needed for const-correctness for calling some overloads
|
||||||
|
// e.g. QShortcut ctor taking (QWidget* parent, const char* member) signal -
|
||||||
|
// the signal/slot requires that member is const, not just plain char*
|
||||||
|
ret = "const " + ret
|
||||||
|
}
|
||||||
|
|
||||||
if p.IsFlagType() {
|
if p.IsFlagType() {
|
||||||
ret = "int"
|
ret = "int"
|
||||||
|
|
||||||
|
@ -106,6 +106,9 @@ func (p CppParameter) parameterTypeCgo() string {
|
|||||||
return "C.char"
|
return "C.char"
|
||||||
}
|
}
|
||||||
tmp := strings.Replace(p.RenderTypeCabi(), `*`, "", -1)
|
tmp := strings.Replace(p.RenderTypeCabi(), `*`, "", -1)
|
||||||
|
if strings.HasPrefix(tmp, "const ") {
|
||||||
|
tmp = tmp[6:] // Constness doesn't survive the CABI boundary
|
||||||
|
}
|
||||||
if strings.HasPrefix(tmp, "unsigned ") {
|
if strings.HasPrefix(tmp, "unsigned ") {
|
||||||
tmp = "u" + tmp[9:] // Cgo uses uchar, uint instead of full name
|
tmp = "u" + tmp[9:] // Cgo uses uchar, uint instead of full name
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user