Skip to content

Commit b752760

Browse files
committed
Merge pull request #5 from neclepsio/SjB-go1.6-port
Go 1.6 (final)
2 parents 25510fc + 9e7fbdc commit b752760

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

cpp/capi.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -599,17 +599,17 @@ int objectIsView(QObject_ *object)
599599
return qobject->inherits("QQuickView") ? 1 : 0;
600600
}
601601

602-
error *objectGoAddr(QObject_ *object, GoAddr **addr)
602+
error *objectGoRef(QObject_ *object, GoRef *ref)
603603
{
604604
QObject *qobject = static_cast<QObject *>(object);
605605
if (qobject->inherits("GoValue")) {
606606
GoValue *goValue = static_cast<GoValue *>(qobject);
607-
*addr = goValue->addr;
607+
*ref = goValue->ref;
608608
return 0;
609609
}
610610
if (qobject->inherits("GoPaintedValue")) {
611611
GoPaintedValue *goPaintedValue = static_cast<GoPaintedValue *>(qobject);
612-
*addr = goPaintedValue->addr;
612+
*ref = goPaintedValue->ref;
613613
return 0;
614614
}
615615
return errorf("QML object is not backed by a Go value");
@@ -627,13 +627,13 @@ void delString(QString_ *s)
627627
delete reinterpret_cast<QString *>(s);
628628
}
629629

630-
GoValue_ *newGoValue(GoAddr *addr, GoTypeInfo *typeInfo, QObject_ *parent)
630+
GoValue_ *newGoValue(GoRef ref, GoTypeInfo *typeInfo, QObject_ *parent)
631631
{
632632
QObject *qparent = reinterpret_cast<QObject *>(parent);
633633
if (typeInfo->paint) {
634-
return new GoPaintedValue(addr, typeInfo, qparent);
634+
return new GoPaintedValue(ref, typeInfo, qparent);
635635
}
636-
return new GoValue(addr, typeInfo, qparent);
636+
return new GoValue(ref, typeInfo, qparent);
637637
}
638638

639639
void goValueActivate(GoValue_ *value, GoTypeInfo *typeInfo, int addrOffset)
@@ -813,12 +813,12 @@ void packDataValue(QVariant_ *var, DataValue *value)
813813
QObject *qobject = qvar->value<QObject *>();
814814
if (qobject->inherits("GoValue")) {
815815
value->dataType = DTGoAddr;
816-
*(void **)(value->data) = (static_cast<GoValue*>(qobject))->addr;
816+
*(uintptr_t*)(value->data) = (static_cast<GoValue*>(qobject))->ref;
817817
break;
818818
}
819819
if (qobject->inherits("GoPaintedValue")) {
820820
value->dataType = DTGoAddr;
821-
*(void **)(value->data) = (static_cast<GoPaintedValue*>(qobject))->addr;
821+
*(uintptr_t*)(value->data) = (static_cast<GoPaintedValue*>(qobject))->ref;
822822
break;
823823
}
824824
value->dataType = DTObject;
@@ -876,28 +876,28 @@ QVariantList_ *newVariantList(DataValue *list, int len)
876876

877877
QObject *listPropertyAt(QQmlListProperty<QObject> *list, int i)
878878
{
879-
return reinterpret_cast<QObject *>(hookListPropertyAt(list->data, (intptr_t)list->dummy1, (intptr_t)list->dummy2, i));
879+
return reinterpret_cast<QObject *>(hookListPropertyAt((uintptr_t)list->data, (intptr_t)list->dummy1, (intptr_t)list->dummy2, i));
880880
}
881881

882882
int listPropertyCount(QQmlListProperty<QObject> *list)
883883
{
884-
return hookListPropertyCount(list->data, (intptr_t)list->dummy1, (intptr_t)list->dummy2);
884+
return hookListPropertyCount((uintptr_t)list->data, (intptr_t)list->dummy1, (intptr_t)list->dummy2);
885885
}
886886

887887
void listPropertyAppend(QQmlListProperty<QObject> *list, QObject *obj)
888888
{
889-
hookListPropertyAppend(list->data, (intptr_t)list->dummy1, (intptr_t)list->dummy2, obj);
889+
hookListPropertyAppend((uintptr_t)list->data, (intptr_t)list->dummy1, (intptr_t)list->dummy2, obj);
890890
}
891891

892892
void listPropertyClear(QQmlListProperty<QObject> *list)
893893
{
894-
hookListPropertyClear(list->data, (intptr_t)list->dummy1, (intptr_t)list->dummy2);
894+
hookListPropertyClear((uintptr_t)list->data, (intptr_t)list->dummy1, (intptr_t)list->dummy2);
895895
}
896896

897-
QQmlListProperty_ *newListProperty(GoAddr *addr, intptr_t reflectIndex, intptr_t setIndex)
897+
QQmlListProperty_ *newListProperty(GoRef ref, intptr_t reflectIndex, intptr_t setIndex)
898898
{
899899
QQmlListProperty<QObject> *list = new QQmlListProperty<QObject>();
900-
list->data = addr;
900+
list->data = (void*)ref;
901901
list->dummy1 = (void*)reflectIndex;
902902
list->dummy2 = (void*)setIndex;
903903
list->at = listPropertyAt;

0 commit comments

Comments
 (0)