From: Szymon Jastrzebski Date: Tue, 20 Feb 2018 09:58:55 +0000 (+0100) Subject: [MessagePort] Removing unreachable and optimizing code X-Git-Tag: submit/tizen/20180228.082430~6^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a80ee81eba28036d0737400b48d0d43d93b54eb0;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [MessagePort] Removing unreachable and optimizing code SVACE ids: #312935, #312936. [Verification] MessagePort TCT 100% pass rate. Change-Id: I1e17e53cef6fa7a5557485e01375c787b8f8c6d7 Signed-off-by: Szymon Jastrzebski --- diff --git a/src/messageport/messageport_instance.cc b/src/messageport/messageport_instance.cc index 2614fdaa..27fd90d1 100644 --- a/src/messageport/messageport_instance.cc +++ b/src/messageport/messageport_instance.cc @@ -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)));