mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-24 14:48:07 +00:00
feat(c-wrapper): setCppPtrFromC is more secure, check types
This commit is contained in:
parent
38a9ac162a
commit
f3b3015dbc
2 changed files with 3 additions and 2 deletions
|
|
@ -41,6 +41,7 @@
|
|||
F(Participant, Participant)
|
||||
|
||||
#define L_REGISTER_SUBTYPES(F) \
|
||||
F(ChatRoom, BasicChatRoom) \
|
||||
F(ChatRoom, ClientGroupChatRoom) \
|
||||
F(ChatRoom, RealTimeTextChatRoom)
|
||||
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ public:
|
|||
|
||||
template<
|
||||
typename CppType,
|
||||
typename = typename std::enable_if<std::is_base_of<Object, CppType>::value, CppType>::type
|
||||
typename = typename std::enable_if<IsDefinedNotClonableCppObject<CppType>::value, CppType>::type
|
||||
>
|
||||
static inline void setCppPtrFromC (void *cObject, const std::shared_ptr<CppType> &cppObject) {
|
||||
static_cast<WrappedObject<CppType> *>(cObject)->cppPtr = cppObject;
|
||||
|
|
@ -152,7 +152,7 @@ public:
|
|||
|
||||
template<
|
||||
typename CppType,
|
||||
typename = typename std::enable_if<std::is_base_of<ClonableObject, CppType>::value, CppType>::type
|
||||
typename = typename std::enable_if<IsDefinedClonableCppObject<CppType>::value, CppType>::type
|
||||
>
|
||||
static inline void setCppPtrFromC (void *cObject, const CppType *cppObject) {
|
||||
CppType **cppObjectAddr = &static_cast<WrappedClonableObject<CppType> *>(cObject)->cppPtr;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue