static void
ConvertBundleToMap(const char *pKey, const int type, const bundle_keyval_t *pVal, void *pData)
{
- SysLog(NID_IO, "CB key = %s", pKey);
+ //SysLog(NID_IO, "CB key = %s", pKey);
HashMap* pMap = static_cast<HashMap*>(pData);
case BUNDLE_TYPE_BYTE:
bundle_keyval_get_basic_val(const_cast<bundle_keyval_t*>(pVal), reinterpret_cast<void**>(&pStr), &size);
- SysLog(NID_IO, "Bundle byte value = %s, size = %d", pStr, size);
+ //SysLog(NID_IO, "Bundle byte value = %s, size = %d", pStr, size);
if (pStr)
{
ByteBuffer* pBuffer = new (std::nothrow) ByteBuffer();
- SysTryReturn(NID_IO, pMap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ SysTryReturnVoidResult(NID_IO, pMap != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
result r = pBuffer->Construct(size);
- SysTryReturn(NID_IO, r == E_SUCCESS, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ SysTryCatch(NID_IO, r == E_SUCCESS, delete pBuffer, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+ r = pBuffer->SetArray((const byte*)pStr, 0, size);
+ SysTryCatch(NID_IO, r == E_SUCCESS, delete pBuffer, E_INVALID_ARG, "[E_INVALID_ARG] The buffer argument is invalid.");
- pBuffer->SetArray((const byte*)pStr, 0, size);
pBuffer->Flip();
pMap->Add(new (std::nothrow) String(pKey), pBuffer);
break;
}
}
+
+CATCH:
+ return;
}
static void
return;
}
- SysLog(NID_IO, "local port name: %s", pLocalPort);
+ //SysLog(NID_IO, "local port name: %s", pLocalPort);
_IMessagePortListener* pListener = null;
p->__listeners.GetValue(pLocalPort, pListener);
result r = pMap->Construct();
SysTryCatch(NID_IO, r == E_SUCCESS, delete pMap, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
- SysLog(NID_IO, "bundle to map");
-
bundle_foreach(data, ConvertBundleToMap, pMap);
if (remote_app_id == null) // Uni-directional
else // Bi-directional
{
SysLog(NID_IO, "Trusted message received from [%s:%s], trusted: %d", remote_app_id, remote_port, trusted_port);
+
pListener->OnMessageReceivedN(remote_app_id, remote_port, trusted_port, pMap);
}
}