[MessagePort] Removing unreachable and optimizing code 08/170508/3
authorSzymon Jastrzebski <s.jastrzebsk@partner.samsung.com>
Tue, 20 Feb 2018 09:58:55 +0000 (10:58 +0100)
committerSzymon Jastrzebski <s.jastrzebsk@partner.samsung.com>
Tue, 20 Feb 2018 14:52:01 +0000 (14:52 +0000)
SVACE ids: #312935, #312936.

[Verification] MessagePort TCT 100% pass rate.

Change-Id: I1e17e53cef6fa7a5557485e01375c787b8f8c6d7
Signed-off-by: Szymon Jastrzebski <s.jastrzebsk@partner.samsung.com>
src/messageport/messageport_instance.cc

index 2614fda..27fd90d 100644 (file)
@@ -282,29 +282,17 @@ void MessageportInstance::MessagePortManagerRequestremotemessageport(const picoj
           portCheck ? "true" : "false");
   LoggerD("Error code: %d (%s)", ret, get_error_message(ret));
 
-  if (ret == MESSAGE_PORT_ERROR_NONE) {
+  if (MESSAGE_PORT_ERROR_NONE == ret) {
     if (portCheck) {
       ReportSuccess(out);
     } else {
       LogAndReportError(NotFoundException("The port of the target application is not found"), out);
     }
-  } else if (ret == MESSAGE_PORT_ERROR_INVALID_PARAMETER) {
-    LogAndReportError(
-        InvalidValuesException("An input parameter contains an invalid value."), out,
-        ("message_port_check_remote_port error: %d (%s)", ret, get_error_message(ret)));
-  } else if (ret == MESSAGE_PORT_ERROR_OUT_OF_MEMORY) {
-    LogAndReportError(
-        UnknownException("Out of memory."), out,
-        ("message_port_check_remote_port error: %d (%s)", ret, get_error_message(ret)));
-  } else if (ret == MESSAGE_PORT_ERROR_IO_ERROR) {
+  } else if (MESSAGE_PORT_ERROR_IO_ERROR == ret) {
     // IO error means that remote port does not exist
     LogAndReportError(
         NotFoundException("The port of the target application is not found"), out,
         ("message_port_check_remote_port error: %d (%s)", ret, get_error_message(ret)));
-  } else if (ret == MESSAGE_PORT_ERROR_PORT_NOT_FOUND) {
-    LogAndReportError(
-        NotFoundException("The port of the target application is not found"), out,
-        ("message_port_check_remote_port error: %d (%s)", ret, get_error_message(ret)));
   } else {
     LogAndReportError(
         UnknownException("Unknown Error"), out,
@@ -330,30 +318,18 @@ void MessageportInstance::MessagePortManagerRequesttrustedremotemessageport(
           portCheck ? "true" : "false");
   LoggerD("Error code: %d (%s)", ret, get_error_message(ret));
 
-  if (ret == MESSAGE_PORT_ERROR_NONE) {
+  if (MESSAGE_PORT_ERROR_NONE == ret) {
     if (portCheck) {
       ReportSuccess(out);
     } else {
       LogAndReportError(NotFoundException("The port of the target application is not found"), out);
     }
-  } else if (ret == MESSAGE_PORT_ERROR_INVALID_PARAMETER) {
-    LogAndReportError(
-        InvalidValuesException("An input parameter contains an invalid value."), out,
-        ("message_port_check_trusted_remote_port error: %d (%s)", ret, get_error_message(ret)));
-  } else if (ret == MESSAGE_PORT_ERROR_OUT_OF_MEMORY) {
-    LogAndReportError(
-        UnknownException("Out of memory."), out,
-        ("message_port_check_trusted_remote_port error: %d (%s)", ret, get_error_message(ret)));
-  } else if (ret == MESSAGE_PORT_ERROR_IO_ERROR) {
+  } else if (MESSAGE_PORT_ERROR_IO_ERROR == ret) {
     // IO error means that remote port does not exist
     LogAndReportError(
         NotFoundException("The port of the target application is not found"), out,
         ("message_port_check_trusted_remote_port error: %d (%s)", ret, get_error_message(ret)));
-  } else if (ret == MESSAGE_PORT_ERROR_PORT_NOT_FOUND) {
-    LogAndReportError(
-        NotFoundException("The port of the target application is not found"), out,
-        ("message_port_check_trusted_remote_port error: %d (%s)", ret, get_error_message(ret)));
-  } else if (ret == MESSAGE_PORT_ERROR_CERTIFICATE_NOT_MATCH) {
+  } else if (MESSAGE_PORT_ERROR_CERTIFICATE_NOT_MATCH == ret) {
     LogAndReportError(
         UnknownException("The remote application is not signed with the same certificate"), out,
         ("message_port_check_trusted_remote_port error: %d (%s)", ret, get_error_message(ret)));