Browse Source

adding asserts

COM-121
Volker Birk 6 years ago
parent
commit
bfb7765928
2 changed files with 38 additions and 8 deletions
  1. +20
    -2
      CpEpEngine.cpp
  2. +18
    -6
      _IpEpEngineEvents_CP.h

+ 20
- 2
CpEpEngine.cpp View File

@ -967,22 +967,40 @@ int CpEpEngine::examine_identity(pEp_identity *ident, void *management)
PEP_STATUS CpEpEngine::messageToSend(void * obj, const message *msg)
{
assert(msg);
if (msg == NULL)
return PEP_ILLEGAL_VALUE;
text_message _msg;
text_message_from_C(&_msg, msg);
CpEpEngine *me = (CpEpEngine *) obj;
me->Fire_MessageToSend(&_msg);
HRESULT r = me->Fire_MessageToSend(&_msg);
assert(r == S_OK);
if (r == E_OUTOFMEMORY)
return PEP_OUT_OF_MEMORY;
if (r != S_OK)
return PEP_UNKNOWN_ERROR;
return PEP_STATUS_OK;
}
sync_handshake_result_s CpEpEngine::showHandshake(void * obj, const pEp_identity *self, const pEp_identity *partner)
{
assert(self && partner);
if (!(self && partner))
return SYNC_HANDSHAKE_CANCEL_S;
pEp_identity_s _self;
copy_identity(&_self, self);
pEp_identity_s _partner;
copy_identity(&_partner, partner);
CpEpEngine *me = (CpEpEngine *) obj;
sync_handshake_result_s result;
me->Fire_ShowHandshake(&_self, &_partner, &result);
HRESULT r = me->Fire_ShowHandshake(&_self, &_partner, &result);
assert(r == S_OK);
if (r != S_OK)
return SYNC_HANDSHAKE_CANCEL_S;
return result;
}


+ 18
- 6
_IpEpEngineEvents_CP.h View File

@ -5,7 +5,7 @@ class CProxy_IpEpEngineEvents :
public ATL::IConnectionPointImpl<T, &__uuidof(_IpEpEngineEvents)>
{
public:
HRESULT Fire_messageToSend(text_message * msg)
HRESULT Fire_MessageToSend(text_message * msg)
{
HRESULT hr = S_OK;
T * pThis = static_cast<T *>(this);
@ -17,16 +17,21 @@ public:
CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection);
pThis->Unlock();
_IpEpEngineEvents * pConnection = static_cast<_IpEpEngineEvents *>(punkConnection.p);
IDispatch * pConnection = static_cast<IDispatch *>(punkConnection.p);
if (pConnection)
{
hr = pConnection->messageToSend(msg);
CComVariant avarParams[1];
avarParams[0] = msg;
CComVariant varResult;
DISPPARAMS params = { avarParams, NULL, 1, 0 };
hr = pConnection->Invoke(1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, &varResult, NULL, NULL);
}
}
return hr;
}
HRESULT Fire_showHandshake(pEp_identity_s * self, pEp_identity_s * partner, sync_handshake_result * result)
HRESULT Fire_ShowHandshake(pEp_identity_s * self, pEp_identity_s * partner, sync_handshake_result_s * result)
{
HRESULT hr = S_OK;
T * pThis = static_cast<T *>(this);
@ -38,11 +43,18 @@ public:
CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection);
pThis->Unlock();
_IpEpEngineEvents * pConnection = static_cast<_IpEpEngineEvents *>(punkConnection.p);
IDispatch * pConnection = static_cast<IDispatch *>(punkConnection.p);
if (pConnection)
{
hr = pConnection->showHandshake(self, partner, result);
CComVariant avarParams[3];
avarParams[2] = self;
avarParams[1] = partner;
avarParams[0] = result;
CComVariant varResult;
DISPPARAMS params = { avarParams, NULL, 3, 0 };
hr = pConnection->Invoke(2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, &varResult, NULL, NULL);
}
}
return hr;


Loading…
Cancel
Save