From 3fcc44e8597586439ad1cc44afa9313a3f8c3334 Mon Sep 17 00:00:00 2001 From: hj kim Date: Tue, 6 Oct 2020 15:43:46 +0900 Subject: [PATCH] Use proper variable name Change-Id: I8554da73108c1b37afd2ce4b72c3124479e4ecc0 --- svc/media_controller_svc.c | 56 ++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/svc/media_controller_svc.c b/svc/media_controller_svc.c index e606bdc..ad2dd17 100644 --- a/svc/media_controller_svc.c +++ b/svc/media_controller_svc.c @@ -513,7 +513,7 @@ static int __mc_service_app_dead_handler(int pid, void *data) static gboolean __mc_service_process(gpointer data) { int length_of_queue = 0; - int send_msg = MEDIA_CONTROLLER_ERROR_NONE; + int msg = MEDIA_CONTROLLER_ERROR_NONE; mc_service_t *_service_data = (mc_service_t*)data; mc_retvm_if(!_service_data, FALSE, "invalid data"); @@ -546,13 +546,13 @@ static gboolean __mc_service_process(gpointer data) if (!MC_STRING_VALID(request_msg->msg) || request_msg->msg_size == 0) { mc_error("Invalid message [msg:%s size:%zu]", request_msg->msg, request_msg->msg_size); - send_msg = MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; + msg = MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; goto ERROR; } if (!__mc_service_is_valid_connection(_service_data->connected_apps, request_msg)) { mc_error("Wrong message"); - send_msg = MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; + msg = MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; goto ERROR; } @@ -560,36 +560,36 @@ static gboolean __mc_service_process(gpointer data) switch (request_msg->msg_type) { case MC_MSG_DB_UPDATE: - send_msg = mc_db_request(request_msg->uid, request_msg->msg, request_msg->msg_size); + msg = mc_db_request(request_msg->uid, request_msg->msg, request_msg->msg_size); break; case MC_MSG_CLIENT_SET: - send_msg = __mc_service_add_cmd_to_send(&(_service_data->connected_apps), request_msg); + msg = __mc_service_add_cmd_to_send(&(_service_data->connected_apps), request_msg); break; case MC_MSG_CLIENT_GET: - send_msg = __mc_service_remove_cmd_to_send(&(_service_data->connected_apps), request_msg); + msg = __mc_service_remove_cmd_to_send(&(_service_data->connected_apps), request_msg); break; case MC_MSG_SERVER_CONNECTION: - send_msg = __mc_service_add_connection(&(_service_data->connected_apps), request_msg); - if (send_msg == MEDIA_CONTROLLER_ERROR_NONE) - send_msg = mc_db_add_application(request_msg->uid, request_msg->msg, request_msg->priv_type); + msg = __mc_service_add_connection(&(_service_data->connected_apps), request_msg); + if (msg == MEDIA_CONTROLLER_ERROR_NONE) + msg = mc_db_add_application(request_msg->uid, request_msg->msg, request_msg->priv_type); break; case MC_MSG_SERVER_DISCONNECTION: __mc_service_remove_connection(&(_service_data->connected_apps), request_msg); - send_msg = mc_db_remove_application(request_msg->uid, request_msg->msg, request_msg->priv_type); + msg = mc_db_remove_application(request_msg->uid, request_msg->msg, request_msg->priv_type); break; default: mc_error("Invalid message type!"); - send_msg = MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; + msg = MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; break; } ERROR: - if (write(req->client_sock, &send_msg, sizeof(send_msg)) != sizeof(send_msg)) + if (write(req->client_sock, &msg, sizeof(msg)) != sizeof(msg)) mc_stderror("send failed"); else mc_debug("Sent successfully"); @@ -606,8 +606,7 @@ static gboolean __mc_read_service_request_tcp_socket(GIOChannel *src, GIOConditi { int sock = -1; int client_sock = -1; - int ret = MEDIA_CONTROLLER_ERROR_NONE; - int send_msg = MEDIA_CONTROLLER_ERROR_NONE; + int msg = MEDIA_CONTROLLER_ERROR_NONE; mc_service_request *req = NULL; mc_service_t *_service_data = (mc_service_t*)data; GQueue *request_queue = _service_data->request->queue; @@ -621,8 +620,8 @@ static gboolean __mc_read_service_request_tcp_socket(GIOChannel *src, GIOConditi } /* get client socket fd */ - ret = mc_ipc_accept_client_tcp(sock, &(client_sock)); - if (ret != MEDIA_CONTROLLER_ERROR_NONE) + msg = mc_ipc_accept_client_tcp(sock, &(client_sock)); + if (msg != MEDIA_CONTROLLER_ERROR_NONE) return TRUE; mc_peer_creds creds; @@ -632,38 +631,37 @@ static gboolean __mc_read_service_request_tcp_socket(GIOChannel *src, GIOConditi req->req_msg = g_new0(mc_comm_msg_s, 1); req->client_sock = client_sock; - ret = mc_cynara_receive_untrusted_message(req->client_sock, req->req_msg, &creds); - if (ret != MEDIA_CONTROLLER_ERROR_NONE) { - mc_error("mc_ipc_receive_message_tcp failed [%d]", ret); - send_msg = ret; + msg = mc_cynara_receive_untrusted_message(req->client_sock, req->req_msg, &creds); + if (msg != MEDIA_CONTROLLER_ERROR_NONE) { + mc_error("mc_ipc_receive_message_tcp failed [%d]", msg); goto ERROR; } if (req->req_msg->priv_type == MC_PRIV_TYPE_SERVER) { - ret = mc_cynara_check(&creds, MC_SERVER_PRIVILEGE); + msg = mc_cynara_check(&creds, MC_SERVER_PRIVILEGE); } else if (req->req_msg->priv_type == MC_PRIV_TYPE_CLIENT) { - ret = mc_cynara_check(&creds, MC_CLIENT_PRIVILEGE); + msg = mc_cynara_check(&creds, MC_CLIENT_PRIVILEGE); } else { mc_error("invalid priv_type[%d]", req->req_msg->priv_type); - send_msg = MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; + msg = MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; goto ERROR; } - if (ret != MEDIA_CONTROLLER_ERROR_NONE) { - mc_error("permission is denied![%d]", ret); - send_msg = MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED; + if (msg != MEDIA_CONTROLLER_ERROR_NONE) { + mc_error("permission is denied![%d]", msg); + msg = MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED; goto ERROR; } if (req->req_msg->msg_type < 0 || req->req_msg->msg_type >= MC_MSG_MAX) { mc_error("invalid msg_type[%d]", req->req_msg->msg_type); - send_msg = MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; + msg = MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; goto ERROR; } if (g_queue_get_length(request_queue) >= MAX_MC_REQUEST) { mc_error("request_queue is limited until %d", MAX_MC_REQUEST); - send_msg = MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; + msg = MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; goto ERROR; } @@ -683,7 +681,7 @@ static gboolean __mc_read_service_request_tcp_socket(GIOChannel *src, GIOConditi return TRUE; ERROR: - if (write(client_sock, &send_msg, sizeof(send_msg)) != sizeof(send_msg)) + if (write(client_sock, &msg, sizeof(msg)) != sizeof(msg)) mc_stderror("send failed"); else mc_debug("Sent successfully"); -- 2.7.4