diff --git a/src/c-wrapper/internal/c-tools.h b/src/c-wrapper/internal/c-tools.h index 6f886310e..736187980 100644 --- a/src/c-wrapper/internal/c-tools.h +++ b/src/c-wrapper/internal/c-tools.h @@ -152,20 +152,22 @@ public: // --------------------------------------------------------------------------- template< - typename CppType, + typename CType, + typename CppType = typename CTypeMetaInfo::cppType, typename = typename std::enable_if::value, CppType>::type > - static inline void setCppPtrFromC (void *cObject, const std::shared_ptr &cppObject) { - static_cast *>(cObject)->cppPtr = cppObject; + static inline void setCppPtrFromC (CType *cObject, const std::shared_ptr &cppObject) { + reinterpret_cast *>(cObject)->cppPtr = cppObject; cppObject->setProperty("LinphonePrivate::Wrapper::cBackPtr", cObject); } template< - typename CppType, + typename CType, + typename CppType = typename CTypeMetaInfo::cppType, typename = typename std::enable_if::value, CppType>::type > - static inline void setCppPtrFromC (void *cObject, const CppType *cppObject) { - CppType **cppObjectAddr = &static_cast *>(cObject)->cppPtr; + static inline void setCppPtrFromC (CType *cObject, const CppType *cppObject) { + CppType **cppObjectAddr = &reinterpret_cast *>(cObject)->cppPtr; if (*cppObjectAddr == cppObject) return; delete *cppObjectAddr;