diff options
author | InHong Han <inhong1.han@samsung.com> | 2018-04-02 20:43:51 +0900 |
---|---|---|
committer | InHong Han <inhong1.han@samsung.com> | 2018-04-03 01:07:23 +0000 |
commit | ccdc43c22ff01032ffcfc91cabf55cd5098c0ef0 (patch) | |
tree | 7805141955f1c08f3f58a038fe83efb1e0146494 /ism/modules | |
parent | 3356a9f7871d4bb5c1cb97f7d0f88bb3e6375edc (diff) | |
download | isf-ccdc43c22ff01032ffcfc91cabf55cd5098c0ef0.tar.gz isf-ccdc43c22ff01032ffcfc91cabf55cd5098c0ef0.tar.bz2 isf-ccdc43c22ff01032ffcfc91cabf55cd5098c0ef0.zip |
Fix defect detected by static anlaysis tool
Change-Id: I9ce40294ac796696821016ae459ba59a117aa2a4
Diffstat (limited to 'ism/modules')
-rw-r--r-- | ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp | 18 | ||||
-rw-r--r-- | ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp | 17 |
2 files changed, 17 insertions, 18 deletions
diff --git a/ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp b/ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp index c4e856dc..61a3b0f7 100644 --- a/ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp +++ b/ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp @@ -922,8 +922,8 @@ private: if (trans.write_to_socket(client_socket) && trans.read_from_socket(client_socket) - && trans.get_command(cmd) && cmd == SCIM_TRANS_CMD_REPLY) { - trans.get_data(imdata, len); + && trans.get_command(cmd) && cmd == SCIM_TRANS_CMD_REPLY + && trans.get_data(imdata, len)) { LOGD ("length of imdata is %d", len); } else { LOGW ("read imdata failed"); @@ -3168,22 +3168,14 @@ private: if (m_info_manager->check_privilege_by_sockfd(client_id, IMEMANAGER_PRIVILEGE)) { String strAppid; uint32 nEnabled = 0; - bool ret = true; - //FIXME - //ret need be checked + m_info_manager->is_helper_ise_enabled(client_id, strAppid, nEnabled); Transaction trans; Socket client_socket(client_id); trans.clear(); trans.put_command(SCIM_TRANS_CMD_REPLY); - - if (ret) { - trans.put_command(SCIM_TRANS_CMD_OK); - trans.put_data(static_cast<uint32>(nEnabled)); - } else { - trans.put_command(SCIM_TRANS_CMD_FAIL); - } - + trans.put_command(SCIM_TRANS_CMD_OK); + trans.put_data(static_cast<uint32>(nEnabled)); trans.write_to_socket(client_socket); } else { diff --git a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp index 229a86e6..9d88744d 100644 --- a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp +++ b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp @@ -1281,7 +1281,8 @@ isf_wsc_context_del (WSCContextISF *wsc_ctx) if (context_scim->selection_text_fd_read_handler) { int fd = ecore_main_fd_handler_fd_get (context_scim->selection_text_fd_read_handler); - close (fd); + if (fd >= 0) + close (fd); ecore_main_fd_handler_del (context_scim->selection_text_fd_read_handler); context_scim->selection_text_fd_read_handler = NULL; } @@ -1293,14 +1294,16 @@ isf_wsc_context_del (WSCContextISF *wsc_ctx) if (context_scim->surrounding_text_fd_read_handler) { int fd = ecore_main_fd_handler_fd_get (context_scim->surrounding_text_fd_read_handler); - close (fd); + if (fd >= 0) + close (fd); ecore_main_fd_handler_del (context_scim->surrounding_text_fd_read_handler); context_scim->surrounding_text_fd_read_handler = NULL; } if (context_scim->remote_surrounding_text_fd_read_handler) { int fd = ecore_main_fd_handler_fd_get (context_scim->remote_surrounding_text_fd_read_handler); - close (fd); + if (fd >= 0) + close (fd); ecore_main_fd_handler_del (context_scim->remote_surrounding_text_fd_read_handler); context_scim->remote_surrounding_text_fd_read_handler = NULL; } @@ -1338,7 +1341,7 @@ isf_wsc_context_del (WSCContextISF *wsc_ctx) // we need set the focused_ic to this context temporary. WSCContextISF* old_focused = _focused_ic; _focused_ic = context_scim; - _focused_ic = old_focused; + context_scim = old_focused; if (context_scim == _focused_ic) { g_info_manager->socket_turn_off (); @@ -2012,6 +2015,9 @@ remote_surrounding_text_fd_read_func (void* data, Ecore_Fd_Handler* fd_handler) WSCContextISF* wsc_ctx = (WSCContextISF*)data; int fd = ecore_main_fd_handler_fd_get (fd_handler); + if (fd < 0) + return ECORE_CALLBACK_RENEW; + char buff[512]; int len = read (fd, buff, sizeof (buff) - 1); @@ -3266,7 +3272,8 @@ public: if (ic->surrounding_text_fd_read_handler) { int fd = ecore_main_fd_handler_fd_get (ic->surrounding_text_fd_read_handler); - close (fd); + if (fd >= 0) + close (fd); ecore_main_fd_handler_del (ic->surrounding_text_fd_read_handler); ic->surrounding_text_fd_read_handler = NULL; } |