From a5756d21715798ac16cd0e87e0b1ad82c25ab769 Mon Sep 17 00:00:00 2001 From: Sunwook Bae Date: Fri, 26 Apr 2013 15:20:55 +0900 Subject: [PATCH] remove message_port_unregister Change-Id: I1c8e60e6ff80c86dc2d5477ad75ce24afa968ae7 Signed-off-by: Sunwook Bae --- include/message-port.h | 12 ------------ src/MessagePortProxy.cpp | 12 +++++++++--- src/message-port.cpp | 6 +++++- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/include/message-port.h b/include/message-port.h index e663ba7..6df7a95 100755 --- a/include/message-port.h +++ b/include/message-port.h @@ -80,18 +80,6 @@ int messageport_register_local_port(const char* local_port, messageport_message_ */ int messageport_register_trusted_local_port(const char* local_port, messageport_message_cb callback); - -/** - * @brief Unregisters the local message port. - * - * @param [in] id The message port id returned by messageport_register_local_port() or messageport_register_trusted_local_port() - * @return 0 on success, otherwise a negative error value. - * @retval #MESSAGEPORT_ERROR_NONE Successful - * @retval #MESSAGEPORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MESSAGEPORT_ERROR_OUT_OF_MEMORY Out of memory - */ -int messageport_unregister_local_port(int id); - /** * @brief Checks if the message port of a remote application is registered. * diff --git a/src/MessagePortProxy.cpp b/src/MessagePortProxy.cpp index 59801fd..1fc0b68 100644 --- a/src/MessagePortProxy.cpp +++ b/src/MessagePortProxy.cpp @@ -67,6 +67,7 @@ MessagePortProxy::Construct(void) IpcClient* pIpcClient = new (std::nothrow) IpcClient(); if (pIpcClient == NULL) { + _LOGE("Out of memory"); return MESSAGEPORT_ERROR_OUT_OF_MEMORY; } @@ -76,13 +77,13 @@ MessagePortProxy::Construct(void) delete pIpcClient; _LOGE("Failed to create ipc client: %d.", ret); - return MESSAGEPORT_ERROR_IO_ERROR; } pthread_mutex_t* pMutex = (pthread_mutex_t*) malloc(sizeof(pthread_mutex_t)); if (pMutex == NULL) { + _LOGE("Out of memory"); return MESSAGEPORT_ERROR_OUT_OF_MEMORY; } @@ -164,6 +165,8 @@ MessagePortProxy::RegisterMessagePort(const string& localPort, bool isTrusted, if (pMsg == NULL) { bundle_free(b); + + _LOGE("Out of memory"); return MESSAGEPORT_ERROR_OUT_OF_MEMORY; } @@ -233,6 +236,7 @@ MessagePortProxy::CheckRemotePort(const string& remoteAppId, const string& remot { bundle_free(b); + _LOGE("Out of memory"); return MESSAGEPORT_ERROR_OUT_OF_MEMORY; } @@ -245,7 +249,6 @@ MessagePortProxy::CheckRemotePort(const string& remoteAppId, const string& remot if (ret < 0) { _LOGE("Failed to send a request: %d.", ret); - return MESSAGEPORT_ERROR_IO_ERROR; } @@ -367,6 +370,7 @@ MessagePortProxy::SendMessageInternal(const BundleBuffer& metadata, const Bundle IPC::Message* pMsg = new MessagePort_sendMessage(metadata, buffer, &return_value); if (pMsg == NULL) { + _LOGE("Out of memory"); return MESSAGEPORT_ERROR_OUT_OF_MEMORY; } @@ -389,7 +393,6 @@ MessagePortProxy::SendMessageInternal(const BundleBuffer& metadata, const Bundle if (ret < 0) { _LOGE("Failed to send a request: %d.", ret); - return MESSAGEPORT_ERROR_IO_ERROR; } @@ -431,6 +434,7 @@ MessagePortProxy::GetLocalPortNameN(int id) it = __trustedIds.find(id); if (it == __ids.end()) { + _LOGE("Invalid value %d", id); return NULL; } else @@ -459,6 +463,7 @@ MessagePortProxy::CheckTrustedLocalPort(int id, bool* trusted) it = __trustedIds.find(id); if (it == __ids.end()) { + _LOGE("Invalid value %d", id); return MESSAGEPORT_ERROR_INVALID_PARAMETER; } else @@ -486,6 +491,7 @@ MessagePortProxy::GetProxy(void) MessagePortProxy* p = new MessagePortProxy(); if (p == NULL) { + _LOGE("Out of memory"); return NULL; } diff --git a/src/message-port.cpp b/src/message-port.cpp index f6f53cc..e8ece33 100644 --- a/src/message-port.cpp +++ b/src/message-port.cpp @@ -108,7 +108,11 @@ messageport_send_bidirectional_message(int id, const char* remote_app_id, const { char* pName = pProxy->GetLocalPortNameN(id); bool trusted = false; - pProxy->CheckTrustedLocalPort(id, &trusted); + ret = pProxy->CheckTrustedLocalPort(id, &trusted); + if (ret < 0) + { + return MESSAGEPORT_ERROR_INVALID_PARAMETER; + } ret = pProxy->SendMessage(pName, trusted, remote_app_id, remote_port, false, message); -- 2.7.4