From fe1d3573a32e73600473caf53ebb58a838a738b0 Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Wed, 18 May 2016 16:35:19 +0900 Subject: [PATCH] sensord: put a space after "if" - fixed all code in sensord Change-Id: Ia56bcb22e7ada3f559c9a650a31bbd5ed067b317 Signed-off-by: kibak.yoon --- src/client/client.cpp | 6 +++--- src/client/command_channel.cpp | 4 ++-- src/client/sensor_event_listener.cpp | 2 +- src/sensor/fusion_util.cpp | 2 +- src/server/client_info_manager.cpp | 20 ++++++++++---------- src/server/sensor_event_dispatcher.cpp | 2 +- src/server/virtual_sensor_config.cpp | 4 ++-- src/server/worker_thread.cpp | 2 +- src/shared/csocket.cpp | 2 +- src/shared/sensor_log.h | 20 ++++++++++---------- 10 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/client/client.cpp b/src/client/client.cpp index 73f4180..ae79346 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -602,7 +602,7 @@ API int sensord_connect(sensor_t sensor) if (!sensor_client_info::get_instance().has_client_id()) { first_connection = true; - if(!cmd_channel->cmd_get_id(client_id)) { + if (!cmd_channel->cmd_get_id(client_id)) { _E("Sending cmd_get_id() failed for %s", get_sensor_name(sensor_id)); sensor_client_info::get_instance().close_command_channel(sensor_id); sensor_client_info::get_instance().delete_handle(handle); @@ -623,7 +623,7 @@ API int sensord_connect(sensor_t sensor) sensor_client_info::get_instance().set_sensor_params(handle, SENSOR_STATE_STOPPED, SENSOR_OPTION_DEFAULT); if (!sensor_registered) { - if(!cmd_channel->cmd_hello(sensor_id)) { + if (!cmd_channel->cmd_hello(sensor_id)) { _E("Sending cmd_hello(%s, %d) failed for %s", get_sensor_name(sensor_id), client_id, get_client_name()); sensor_client_info::get_instance().close_command_channel(sensor_id); sensor_client_info::get_instance().delete_handle(handle); @@ -677,7 +677,7 @@ API bool sensord_disconnect(int handle) sensor_client_info::get_instance().set_client_id(CLIENT_ID_INVALID); if (!sensor_client_info::get_instance().is_sensor_registered(sensor_id)) { - if(!cmd_channel->cmd_byebye()) { + if (!cmd_channel->cmd_byebye()) { _E("Sending cmd_byebye(%d, %s) failed for %s", client_id, get_sensor_name(sensor_id), get_client_name()); return false; } diff --git a/src/client/command_channel.cpp b/src/client/command_channel.cpp index e4486b2..274552f 100644 --- a/src/client/command_channel.cpp +++ b/src/client/command_channel.cpp @@ -416,7 +416,7 @@ bool command_channel::cmd_register_events(event_type_vector &event_vec) auto it_event = event_vec.begin(); while (it_event != event_vec.end()) { - if(!cmd_register_event(*it_event)) + if (!cmd_register_event(*it_event)) return false; ++it_event; @@ -469,7 +469,7 @@ bool command_channel::cmd_unregister_events(event_type_vector &event_vec) auto it_event = event_vec.begin(); while (it_event != event_vec.end()) { - if(!cmd_unregister_event(*it_event)) + if (!cmd_unregister_event(*it_event)) return false; ++it_event; diff --git a/src/client/sensor_event_listener.cpp b/src/client/sensor_event_listener.cpp index 56cbfef..cb629af 100644 --- a/src/client/sensor_event_listener.cpp +++ b/src/client/sensor_event_listener.cpp @@ -270,7 +270,7 @@ ssize_t sensor_event_listener::sensor_event_poll(void* buffer, int buffer_len, s len = m_event_socket.recv(buffer, buffer_len); if (!len) { - if(!m_poller->poll(event)) + if (!m_poller->poll(event)) return -1; len = m_event_socket.recv(buffer, buffer_len); diff --git a/src/sensor/fusion_util.cpp b/src/sensor/fusion_util.cpp index e14c223..7314fb9 100644 --- a/src/sensor/fusion_util.cpp +++ b/src/sensor/fusion_util.cpp @@ -34,7 +34,7 @@ static float clamp(float v) int quat_to_matrix(const float *quat, float *R) { - if(quat == NULL || R == NULL) + if (quat == NULL || R == NULL) return -EINVAL; float q0 = quat[3]; diff --git a/src/server/client_info_manager.cpp b/src/server/client_info_manager.cpp index b61bdf1..b42c9f5 100644 --- a/src/server/client_info_manager.cpp +++ b/src/server/client_info_manager.cpp @@ -51,7 +51,7 @@ bool client_info_manager::get_registered_events(int client_id, sensor_id_t senso return false; } - if(!it_record->second.get_registered_events(sensor_id, event_vec)) + if (!it_record->second.get_registered_events(sensor_id, event_vec)) return false; return true; @@ -68,7 +68,7 @@ bool client_info_manager::register_event(int client_id, sensor_id_t sensor_id, u return false; } - if(!it_record->second.register_event(sensor_id, event_type)) + if (!it_record->second.register_event(sensor_id, event_type)) return false; return true; @@ -85,7 +85,7 @@ bool client_info_manager::unregister_event(int client_id, sensor_id_t sensor_id, return false; } - if(!it_record->second.unregister_event(sensor_id, event_type)) + if (!it_record->second.unregister_event(sensor_id, event_type)) return false; return true; @@ -130,7 +130,7 @@ bool client_info_manager::set_option(int client_id, sensor_id_t sensor_id, int o return false; } - if(!it_record->second.set_option(sensor_id, option)) + if (!it_record->second.set_option(sensor_id, option)) return false; return true; @@ -147,7 +147,7 @@ bool client_info_manager::set_start(int client_id, sensor_id_t sensor_id, bool s return false; } - if(!it_record->second.set_start(sensor_id, start)) + if (!it_record->second.set_start(sensor_id, start)) return false; return true; @@ -304,10 +304,10 @@ bool client_info_manager::remove_sensor_record(int client_id, sensor_id_t sensor return false; } - if(!it_record->second.remove_sensor_usage(sensor_id)) + if (!it_record->second.remove_sensor_usage(sensor_id)) return false; - if(!it_record->second.has_sensor_usage()) + if (!it_record->second.has_sensor_usage()) remove_client_record(client_id); return true; @@ -324,7 +324,7 @@ bool client_info_manager::has_sensor_record(int client_id, sensor_id_t sensor_id return false; } - if(!it_record->second.has_sensor_usage(sensor_id)) + if (!it_record->second.has_sensor_usage(sensor_id)) return false; return true; @@ -341,7 +341,7 @@ bool client_info_manager::has_sensor_record(int client_id) return false; } - if(!it_record->second.has_sensor_usage()) + if (!it_record->second.has_sensor_usage()) return false; return true; @@ -354,7 +354,7 @@ bool client_info_manager::get_listener_ids(sensor_id_t sensor_id, unsigned int e auto it_record = m_clients.begin(); while (it_record != m_clients.end()) { - if(it_record->second.is_listening_event(sensor_id, event_type)) + if (it_record->second.is_listening_event(sensor_id, event_type)) id_vec.push_back(it_record->first); ++it_record; diff --git a/src/server/sensor_event_dispatcher.cpp b/src/server/sensor_event_dispatcher.cpp index a8247fc..200cc95 100644 --- a/src/server/sensor_event_dispatcher.cpp +++ b/src/server/sensor_event_dispatcher.cpp @@ -66,7 +66,7 @@ void sensor_event_dispatcher::accept_event_channel(csocket client_socket) client_socket.set_transfer_mode(); - if(!get_client_info_manager().set_event_socket(client_id, client_socket)) { + if (!get_client_info_manager().set_event_socket(client_id, client_socket)) { _E("Failed to store event socket[%d] for %s", client_socket.get_socket_fd(), client_info_manager.get_client_info(client_id)); return; diff --git a/src/server/virtual_sensor_config.cpp b/src/server/virtual_sensor_config.cpp index 46562a5..fc57bd8 100644 --- a/src/server/virtual_sensor_config.cpp +++ b/src/server/virtual_sensor_config.cpp @@ -74,13 +74,13 @@ bool virtual_sensor_config::load_config(const string& config_path) } cur = xmlDocGetRootElement(doc); - if(cur == NULL) { + if (cur == NULL) { _E("There is no root element in %s\n", config_path.c_str()); xmlFreeDoc(doc); return false; } - if(xmlStrcmp(cur->name, (const xmlChar *)ROOT_ELEMENT)) { + if (xmlStrcmp(cur->name, (const xmlChar *)ROOT_ELEMENT)) { _E("Wrong type document: there is no [%s] root element in %s\n", ROOT_ELEMENT, config_path.c_str()); xmlFreeDoc(doc); return false; diff --git a/src/server/worker_thread.cpp b/src/server/worker_thread.cpp index 23cd6ff..9f88a24 100644 --- a/src/server/worker_thread.cpp +++ b/src/server/worker_thread.cpp @@ -40,7 +40,7 @@ worker_thread::~worker_thread() bool worker_thread::transition_function(trans_func_index index) { if (m_trans_func[index] != NULL) { - if(!m_trans_func[index](m_context)) { + if (!m_trans_func[index](m_context)) { _E("Transition[%d] function returning false", index); return false; } diff --git a/src/shared/csocket.cpp b/src/shared/csocket.cpp index 0dc07ce..8481333 100644 --- a/src/shared/csocket.cpp +++ b/src/shared/csocket.cpp @@ -441,7 +441,7 @@ bool csocket::set_connection_mode(void) return false; } - if(setsockopt(m_sock_fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0) { + if (setsockopt(m_sock_fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0) { _ERRNO(errno, _E, "Set SO_RCVTIMEO failed for %s, m_sock_fd : %d", get_client_name(), m_sock_fd); close(); return false; diff --git a/src/shared/sensor_log.h b/src/shared/sensor_log.h index 236eb1d..d478e07 100644 --- a/src/shared/sensor_log.h +++ b/src/shared/sensor_log.h @@ -61,31 +61,31 @@ #if defined(_DEBUG) # define warn_if(expr, fmt, arg...) do { \ - if(expr) { \ + if (expr) { \ _D("(%s) -> " fmt, #expr, ##arg); \ } \ } while (0) # define ret_if(expr) do { \ - if(expr) { \ + if (expr) { \ _D("(%s) -> %s() return", #expr, __FUNCTION__); \ return; \ } \ } while (0) # define retv_if(expr, val) do { \ - if(expr) { \ + if (expr) { \ _D("(%s) -> %s() return", #expr, __FUNCTION__); \ return (val); \ } \ } while (0) # define retm_if(expr, fmt, arg...) do { \ - if(expr) { \ + if (expr) { \ _E(fmt, ##arg); \ _D("(%s) -> %s() return", #expr, __FUNCTION__); \ return; \ } \ } while (0) # define retvm_if(expr, val, fmt, arg...) do { \ - if(expr) { \ + if (expr) { \ _E(fmt, ##arg); \ _D("(%s) -> %s() return", #expr, __FUNCTION__); \ return (val); \ @@ -94,28 +94,28 @@ #else # define warn_if(expr, fmt, arg...) do { \ - if(expr) { \ + if (expr) { \ _E(fmt, ##arg); \ } \ } while (0) # define ret_if(expr) do { \ - if(expr) { \ + if (expr) { \ return; \ } \ } while (0) # define retv_if(expr, val) do { \ - if(expr) { \ + if (expr) { \ return (val); \ } \ } while (0) # define retm_if(expr, fmt, arg...) do { \ - if(expr) { \ + if (expr) { \ _E(fmt, ##arg); \ return; \ } \ } while (0) # define retvm_if(expr, val, fmt, arg...) do { \ - if(expr) { \ + if (expr) { \ _E(fmt, ##arg); \ return (val); \ } \ -- 2.7.4