summaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-10-21 17:22:36 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2011-12-09 20:28:07 -0300
commit3522a207cc2307e331cb85c25afabc355fe50a78 (patch)
tree2c2c2a7638b4d0443c854b0e5b19d31ed93142bb /libshiboken
parent333703fd5adf573808a81ab190b393ff121de0bc (diff)
downloadshiboken-3522a207cc2307e331cb85c25afabc355fe50a78.tar.gz
shiboken-3522a207cc2307e331cb85c25afabc355fe50a78.tar.xz
shiboken-3522a207cc2307e331cb85c25afabc355fe50a78.zip
Fixes SBK_CONVERTER macro and SbkEnumType structure.
Fixes provided by Hugo Parente Lima. Unit test added.
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/sbkconverter.h4
-rw-r--r--libshiboken/sbkenum.cpp5
2 files changed, 6 insertions, 3 deletions
diff --git a/libshiboken/sbkconverter.h b/libshiboken/sbkconverter.h
index 0edd5abb..463014fd 100644
--- a/libshiboken/sbkconverter.h
+++ b/libshiboken/sbkconverter.h
@@ -282,7 +282,7 @@ template<> inline SbkConverter* PrimitiveTypeConverter<void*>() { return primiti
} } // namespace Shiboken::Conversions
-struct _SbkGenericType { PyHeapTypeObject super; SbkConverter* converter; };
-#define SBK_CONVERTER(objType) (reinterpret_cast<_SbkGenericType*>(objType)->converter)
+struct _SbkGenericType { PyHeapTypeObject super; SbkConverter** converter; };
+#define SBK_CONVERTER(pyType) (*reinterpret_cast<_SbkGenericType*>(pyType)->converter)
#endif // SBK_CONVERTER_H
diff --git a/libshiboken/sbkenum.cpp b/libshiboken/sbkenum.cpp
index c2f6ce0c..306ffc8d 100644
--- a/libshiboken/sbkenum.cpp
+++ b/libshiboken/sbkenum.cpp
@@ -41,6 +41,7 @@ extern "C"
struct SbkEnumType
{
PyHeapTypeObject super;
+ SbkConverter** converterPtr;
SbkConverter* converter;
const char* cppName;
};
@@ -533,7 +534,9 @@ PyTypeObject* newTypeWithName(const char* name, const char* cppName)
type->tp_richcompare = &enum_richcompare;
type->tp_hash = &enum_hash;
- reinterpret_cast<SbkEnumType*>(type)->cppName = cppName;
+ SbkEnumType* enumType = reinterpret_cast<SbkEnumType*>(type);
+ enumType->cppName = cppName;
+ enumType->converterPtr = &enumType->converter;
DeclaredEnumTypes::instance().addEnumType(type);
return type;
}