Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
d1dc5af4
Commit
d1dc5af4
authored
Sep 22, 2017
by
Ronan
Browse files
fix(c-wrapper): return correctly cObject in getCBackPtr
parent
bd11c098
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/c-wrapper/internal/c-tools.h
View file @
d1dc5af4
...
...
@@ -153,22 +153,22 @@ public:
// Macro helpers.
template
<
typename
T
>
static
T
*
getCppPtr
(
const
std
::
shared_ptr
<
T
>
&
cppObject
)
{
static
inline
T
*
getCppPtr
(
const
std
::
shared_ptr
<
T
>
&
cppObject
)
{
return
cppObject
.
get
();
}
template
<
typename
T
>
static
T
*
getCppPtr
(
T
*
cppObject
)
{
static
inline
T
*
getCppPtr
(
T
*
cppObject
)
{
return
cppObject
;
}
template
<
typename
T
>
static
const
T
*
getCppPtr
(
const
std
::
shared_ptr
<
const
T
>
&
cppObject
)
{
static
inline
const
T
*
getCppPtr
(
const
std
::
shared_ptr
<
const
T
>
&
cppObject
)
{
return
cppObject
.
get
();
}
template
<
typename
T
>
static
const
T
*
getCppPtr
(
const
T
*
cppObject
)
{
static
inline
const
T
*
getCppPtr
(
const
T
*
cppObject
)
{
return
cppObject
;
}
...
...
@@ -183,14 +183,14 @@ public:
static
inline
typename
CppTypeToCType
<
CppType
>::
type
*
getCBackPtr
(
const
std
::
shared_ptr
<
CppType
>
&
cppObject
)
{
typedef
typename
CppTypeToCType
<
CppType
>::
type
RetType
;
Variant
v
=
cppObject
->
getProperty
(
"LinphonePrivate::Wrapper::cBackPtr"
);
void
*
value
=
v
.
getValue
<
void
*>
();
if
(
!
value
)
{
RetType
*
cObject
=
CObjectInitializer
<
CppType
>::
init
();
setCppPtrFromC
(
cObject
,
cppObject
);
}
Variant
variant
=
cppObject
->
getProperty
(
"LinphonePrivate::Wrapper::cBackPtr"
);
void
*
value
=
variant
.
getValue
<
void
*>
();
if
(
value
)
return
reinterpret_cast
<
RetType
*>
(
value
);
return
reinterpret_cast
<
RetType
*>
(
value
);
RetType
*
cObject
=
CObjectInitializer
<
CppType
>::
init
();
setCppPtrFromC
(
cObject
,
cppObject
);
return
cObject
;
}
template
<
...
...
@@ -202,12 +202,12 @@ public:
Variant
v
=
cppObject
->
getProperty
(
"LinphonePrivate::Wrapper::cBackPtr"
);
void
*
value
=
v
.
getValue
<
void
*>
();
if
(
!
value
)
{
RetType
*
cObject
=
CObjectInitializer
<
CppType
>::
init
();
setCppPtrFromC
(
cObject
,
cppObject
);
}
if
(
value
)
return
reinterpret_cast
<
RetType
*>
(
value
);
return
reinterpret_cast
<
RetType
*>
(
value
);
RetType
*
cObject
=
CObjectInitializer
<
CppType
>::
init
();
setCppPtrFromC
(
cObject
,
cppObject
);
return
cObject
;
}
// ---------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment