From 1436e5023c42ac6f54574d2df785dc0555b4d4f9 Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Mon, 25 Nov 2013 14:37:36 +0400 Subject: [PATCH] [FIX] Fix warnings Fixed missing headers, consts and unused variable. Fixed checkpatch warnings Change-Id: Ica91fc8f50ece997a1752265a5a3e07bf919ac0a Signed-off-by: Dmitry Bogatov --- daemon/da_protocol.c | 11 +++++------ daemon/da_protocol.h | 2 +- daemon/da_protocol_check.c | 19 ++++++++++--------- daemon/da_protocol_check.h | 1 + daemon/daemon.h | 1 + daemon/elf.c | 3 ++- daemon/main.c | 1 + daemon/sys_stat.c | 1 - daemon/utils.c | 2 ++ 9 files changed, 23 insertions(+), 18 deletions(-) diff --git a/daemon/da_protocol.c b/daemon/da_protocol.c index 780414c..8c89222 100644 --- a/daemon/da_protocol.c +++ b/daemon/da_protocol.c @@ -47,6 +47,7 @@ #include "ioctl_commands.h" #include "debug.h" #include "md5.h" +#include "da_data.h" #include #include @@ -540,7 +541,7 @@ static void running_status_off(struct prof_session_t *prof_session) prof_session->running_status = 0; } -int check_running_status(struct prof_session_t *prof_session) +int check_running_status(const struct prof_session_t *prof_session) { return prof_session->running_status; } @@ -883,7 +884,7 @@ static size_t binary_ack_pack(char *s, const struct binary_ack *ba) static void get_file_md5sum(md5_byte_t digest[16], const char *filename) { - char buffer[1024]; + md5_byte_t buffer[1024]; ssize_t size; md5_state_t md5_state; int fd = open(filename, O_RDONLY); @@ -981,7 +982,7 @@ static int process_msg_start(struct msg_buf_t *msg_control) struct msg_t *msg_reply; uint32_t serialized_time[2]; - if (check_running_status(&prof_session.conf) == 1) { + if (check_running_status(&prof_session) == 1) { LOGW("Profiling has already been started\n"); goto send_ack; } @@ -1025,7 +1026,7 @@ static int process_msg_start(struct msg_buf_t *msg_control) err_code = ERR_NO; send_ack: - get_serialized_time(&serialized_time); + get_serialized_time(serialized_time); sendACKToHost(NMSG_START, err_code, (void *)&serialized_time, sizeof(serialized_time)); @@ -1063,7 +1064,6 @@ int process_msg_get_screenshot(struct msg_buf_t *msg_control) int host_message_handler(struct msg_t *msg) { - struct app_info_t app_info; struct target_info_t target_info; struct msg_t *msg_reply = NULL; struct msg_buf_t msg_control; @@ -1071,7 +1071,6 @@ int host_message_handler(struct msg_t *msg) enum ErrorCode error_code = ERR_NO; int target_index; - ssize_t sendlen; msg_target_t sendlog; LOGI("MY HANDLE %s (%X)\n", msg_ID_str(msg->id), msg->id); diff --git a/daemon/da_protocol.h b/daemon/da_protocol.h index 9974244..1bb3e89 100644 --- a/daemon/da_protocol.h +++ b/daemon/da_protocol.h @@ -385,7 +385,7 @@ void stop_all_done(void); void reset_msg(struct msg_t *msg); void reset_replay_event_seq(struct replay_event_seq_t *res); void reset_system_info(struct system_info_t *sys); -int check_running_status(struct prof_session_t *prof_session); +int check_running_status(const struct prof_session_t *prof_session); extern struct prof_session_t prof_session; diff --git a/daemon/da_protocol_check.c b/daemon/da_protocol_check.c index e1f73ac..34ff3d3 100644 --- a/daemon/da_protocol_check.c +++ b/daemon/da_protocol_check.c @@ -110,8 +110,8 @@ int check_conf_systrace_period(uint32_t system_trace_period) if ((system_trace_period < CONF_SYSTRACE_PERIOD_MIN) || (system_trace_period > CONF_SYSTRACE_PERIOD_MAX)) { - LOGE("wrong system trace period value %lu (0x%08X)\n", - system_trace_period, system_trace_period); + LOGE("wrong system trace period value %u (0x%08X)\n", + (unsigned int) system_trace_period, system_trace_period); res = 0; } @@ -124,8 +124,8 @@ int check_conf_datamsg_period(uint32_t data_message_period) if ((data_message_period < CONF_DATA_MSG_PERIOD_MIN) || (data_message_period > CONF_DATA_MSG_PERIOD_MAX)) { - LOGE("wrong data message period value %lu (0x%08X)\n", - data_message_period, data_message_period); + LOGE("wrong data message period value %u (0x%08X)\n", + (unsigned int) data_message_period, data_message_period); res = 0; } @@ -139,7 +139,8 @@ int check_us_app_count(uint32_t app_count) if ((app_count < US_APP_COUNT_MIN) || (app_count > US_APP_COUNT_MAX)) { - LOGE("wrong user space app count %lu (0x%08X)\n", app_count, app_count); + LOGE("wrong user space app count %u (0x%08X)\n", + (unsigned int)app_count, app_count); res = 0; } @@ -152,8 +153,8 @@ int check_us_app_inst_func_count(uint32_t func_count) if ((func_count < US_APP_INST_FUNC_MIN) || (func_count > US_APP_INST_FUNC_MAX)) { - LOGE("wrong US app inst func count %lu (0x%08X)\n", - func_count, func_count); + LOGE("wrong US app inst func count %u (0x%08X)\n", + (unsigned int)func_count, func_count); res = 0; } @@ -188,8 +189,8 @@ int check_lib_inst_count(uint32_t lib_count) if ((lib_count < US_APP_INST_LIB_MIN) || (lib_count > US_APP_INST_LIB_MAX)) { - LOGE("wrong US app inst lib count %lu (0x%08X)\n", - lib_count, lib_count); + LOGE("wrong US app inst lib count %u (0x%08X)\n", + (unsigned int)lib_count, lib_count); res = 0; } diff --git a/daemon/da_protocol_check.h b/daemon/da_protocol_check.h index 5e2dc30..896d70e 100644 --- a/daemon/da_protocol_check.h +++ b/daemon/da_protocol_check.h @@ -61,3 +61,4 @@ int check_us_app_inst_func_count(uint32_t func_count); int check_us_inst_func_args(char *args); int check_lib_inst_count(uint32_t lib_count); int check_conf(struct conf_t *conf); +int check_us_inst_func_ret_type(char ret_type); diff --git a/daemon/daemon.h b/daemon/daemon.h index 8c3f323..a1cae0a 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -224,6 +224,7 @@ int samplingStop(); // TODO maybe need move to other file +int prepare_profiling(); int start_profiling(); void stop_profiling(); int reconfigure(); diff --git a/daemon/elf.c b/daemon/elf.c index b86fe5d..d6e22e9 100644 --- a/daemon/elf.c +++ b/daemon/elf.c @@ -135,7 +135,8 @@ void suffix_filename(char buf[PATH_MAX], const char *filename) { char adj_filename[PATH_MAX]; sprintf(adj_filename, "%s.exe", filename); - char *use_filename = exist(adj_filename) ? adj_filename : filename; + const char *use_filename = exist(adj_filename) ? adj_filename + : filename; strcpy(buf, use_filename); } diff --git a/daemon/main.c b/daemon/main.c index 0f0d1d3..6a8ef2a 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -48,6 +48,7 @@ #include "sys_stat.h" #include "buffer.h" #include "debug.h" +#include "utils.h" #define SINGLETON_LOCKFILE "/tmp/da_manager.lock" #define PORTFILE "/tmp/port.da" diff --git a/daemon/sys_stat.c b/daemon/sys_stat.c index 35d8975..8fd29c2 100644 --- a/daemon/sys_stat.c +++ b/daemon/sys_stat.c @@ -2007,7 +2007,6 @@ static int get_partition_sector_size(const char * partition_name) static void get_disk_stat(uint32_t *reads, uint32_t *sec_reads, uint32_t *writes, uint32_t *sec_writes) { - int sec_size = 0; enum { partition_name_maxlength = 128 }; FILE *fp = manager.fd.diskstats; char master_partition[partition_name_maxlength] = { 0 }; diff --git a/daemon/utils.c b/daemon/utils.c index dee5927..6c7fd9a 100644 --- a/daemon/utils.c +++ b/daemon/utils.c @@ -43,6 +43,8 @@ #include // for open #include // for setgroups #include +#include + #include "daemon.h" #include "utils.h" #include "debug.h" -- 2.7.4