summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2017-05-20 15:28:07 +0100
committerFreeArtMan <dos21h@gmail.com>2017-05-20 15:28:07 +0100
commitf5e6f56a82e56cfd72a0e2f1ce9b583398636545 (patch)
treea8705da438f341dc7a329db964747bf3ad379936
parenteca4a1364bc1313fe0c40c07b7776d3fd8a8e6fc (diff)
downloadagni-f5e6f56a82e56cfd72a0e2f1ce9b583398636545.tar.gz
agni-f5e6f56a82e56cfd72a0e2f1ce9b583398636545.zip
Fixed warnings all over the code
-rw-r--r--agni.c23
-rw-r--r--cmd/cmd_botu.c2
-rw-r--r--cmd/cmd_cmd.c6
-rw-r--r--cmd/cmd_cookie.c1
-rw-r--r--cmd/cmd_date.c1
-rw-r--r--cmd/cmd_fir.c18
-rw-r--r--cmd/cmd_fir1p.c2
-rw-r--r--cmd/cmd_loadavg.c1
-rw-r--r--cmd/cmd_ping.c2
-rw-r--r--cmd/cmd_rand.c1
-rw-r--r--cmd/cmd_rand_libc.c3
-rw-r--r--cmd/cmd_sha1.c2
-rw-r--r--cmd/cmd_uptime.c5
-rw-r--r--cmd/cmd_version.c3
-rw-r--r--tbl_qcmd.c6
15 files changed, 20 insertions, 56 deletions
diff --git a/agni.c b/agni.c
index c637a43..c6644f1 100644
--- a/agni.c
+++ b/agni.c
@@ -159,8 +159,6 @@ server thread
#define TH_CONN_BUF_SZ 1024
int th_start_client(void *data)
{
- //int cmd_id = 1;
- int err;
//mq_cmd *qcmd=NULL; //queue command
int run;
int mq_event;
@@ -449,10 +447,6 @@ int th_start_client(void *data)
//something is sended to cbot
if (token_cmp(itok,1,"PRIVMSG") == 1)
{
- int fret,fret2;
- //char send_back[128];
-
- //PNL();
memset(cmd_buf,0,128);
char *uname = token_new_str(itok,0);
@@ -462,8 +456,6 @@ int th_start_client(void *data)
char *sep = strchr(uname,'!');
uname[sep-uname] = 0x0;
- PNL()
- //if (token_cmp(itok,3,":join") == 1)
if (strncmp(":join",msg,5)==0)
{
//lets check if one more argument is there
@@ -496,9 +488,6 @@ int th_start_client(void *data)
} else
{
//just send to test that thos commands works mate
- //fret2=snprintf(cmd_buf,128,":%s PRIVMSG %s PONGER\r\n",cfg->user,uname);
- //printf("FORMATED [%s]",cmd_buf);
- //fret = write(conn,cmd_buf,fret2);
//create cmd table command and add to table
qcmd = tbl_qcmd_cmd_c();
@@ -645,15 +634,6 @@ int th_event_manager(void *data)
//execution and command table generation
//tble_exec *ecmd = NULL;
tbl_exec *etbl = NULL;
- tble_qcmd *qcmd = NULL;
- tbl_qcmd *qtbl = NULL;
-
- //create execution table
- etbl = tbl_exec_list_c(30);
- if (etbl == NULL)
- {
- PERM();
- }
//load predefined/precompiled command list
{
@@ -685,9 +665,6 @@ int th_event_manager(void *data)
tbl_exec_print_tbl(etbl, TBL_PF_EXEC_ALL);
- //create command table
- qtbl = tbl_qcmd_c(30);//well 30 should be ok right?
-
//config mq
printf("Start event thread\n");
mq = cfg->mq_listen;
diff --git a/cmd/cmd_botu.c b/cmd/cmd_botu.c
index f284ba9..d5a9e4e 100644
--- a/cmd/cmd_botu.c
+++ b/cmd/cmd_botu.c
@@ -35,7 +35,7 @@ void *cmd_botu(void *data)
proc_sec = start.tv_sec - file_stat.st_ctim.tv_sec;
- snprintf(buf, buf_size, "%llud %lluh %llum %llus\n",
+ snprintf(buf, buf_size, "%lud %luh %lum %lus\n",
(proc_sec/(3600*24)),
(proc_sec/(3600))%24,
(proc_sec/60)%60,
diff --git a/cmd/cmd_cmd.c b/cmd/cmd_cmd.c
index e893687..0eabfe1 100644
--- a/cmd/cmd_cmd.c
+++ b/cmd/cmd_cmd.c
@@ -2,17 +2,15 @@
void *cmd_cmd(void *data)
{
+ char *param = (char *)data;
char *ret = NULL;
- int fret=-1;
const int buf_size = 128;
char buf[buf_size+1];
printf("CMD\n");
- snprintf(buf, buf_size, "%s\n", data);
-
-
+ snprintf(buf, buf_size, "%s\n", param);
ret = alloc_new_str(buf);
diff --git a/cmd/cmd_cookie.c b/cmd/cmd_cookie.c
index 8071e10..0c9c5dd 100644
--- a/cmd/cmd_cookie.c
+++ b/cmd/cmd_cookie.c
@@ -2,7 +2,6 @@
void *cmd_cookie(void *data)
{
- char *param = (char *)data;
char *ret = NULL;
const int buf_size = 128;
diff --git a/cmd/cmd_date.c b/cmd/cmd_date.c
index ac44bd5..3ccb75a 100644
--- a/cmd/cmd_date.c
+++ b/cmd/cmd_date.c
@@ -2,7 +2,6 @@
void *cmd_date(void *data)
{
- char *param = (char *)data;
char *ret = NULL;
printf("DATE\n");
diff --git a/cmd/cmd_fir.c b/cmd/cmd_fir.c
index 95e0b53..33bb949 100644
--- a/cmd/cmd_fir.c
+++ b/cmd/cmd_fir.c
@@ -415,21 +415,21 @@ void filter_calc(filter_t *filt, double *hc, int hc_sz)
void *cmd_fir(void *data)
{
char *ret = NULL;
- int i=0,j=0;
+ int i=0;
int count;
sds params;
sds out_result;
sds *tokens;
- double arg_fs;
- int arg_ftype;
- double arg_fc1;
- double arg_fc2;
- double arg_beta;
- int arg_wtype;
- int arg_n;
- double *lp_coef;
+ double arg_fs=0.0;
+ int arg_ftype=0;
+ double arg_fc1=0.0;
+ double arg_fc2=0.0;
+ double arg_beta=0.0;
+ int arg_wtype=0;
+ int arg_n=0;
+ double *lp_coef=NULL;
filter_t filt;
printf("FIR\n");
diff --git a/cmd/cmd_fir1p.c b/cmd/cmd_fir1p.c
index b011719..716d432 100644
--- a/cmd/cmd_fir1p.c
+++ b/cmd/cmd_fir1p.c
@@ -46,7 +46,7 @@ int fir1filter(double *coeffs, double *input, double *output,
void *cmd_fir1p(void *data)
{
char *ret = NULL;
- int i=0,j=0;
+ int i=0;
if (data == NULL)
{
diff --git a/cmd/cmd_loadavg.c b/cmd/cmd_loadavg.c
index a9a4b28..330376e 100644
--- a/cmd/cmd_loadavg.c
+++ b/cmd/cmd_loadavg.c
@@ -2,7 +2,6 @@
void *cmd_loadavg(void *data)
{
- char *param = (char *)data;
char *ret = NULL;
int fret=-1;
diff --git a/cmd/cmd_ping.c b/cmd/cmd_ping.c
index a8e3c59..c26c234 100644
--- a/cmd/cmd_ping.c
+++ b/cmd/cmd_ping.c
@@ -2,7 +2,7 @@
void *cmd_ping(void *data)
{
- char *param = (char *)data;
+ //char *param = (char *)data;
char *ret = NULL;
printf("PONG\n");
diff --git a/cmd/cmd_rand.c b/cmd/cmd_rand.c
index 58f2efe..d5f90e1 100644
--- a/cmd/cmd_rand.c
+++ b/cmd/cmd_rand.c
@@ -4,7 +4,6 @@
void *cmd_rand(void *data)
{
char *ret = NULL;
- int fret=-1;
const int buf_size = 128;
char buf[buf_size+1];
diff --git a/cmd/cmd_rand_libc.c b/cmd/cmd_rand_libc.c
index d72bc45..1860a77 100644
--- a/cmd/cmd_rand_libc.c
+++ b/cmd/cmd_rand_libc.c
@@ -4,7 +4,6 @@
void *cmd_rand_libc(void *data)
{
char *ret = NULL;
- int fret=-1;
const int buf_size = 128;
char buf[buf_size+1];
@@ -25,7 +24,7 @@ void *cmd_rand_libc(void *data)
} else {
//cut output to 512
char str_integer[16];
- int rand_state;
+ unsigned int rand_state;
params = sdsnew(data);
out_result = sdsempty();
diff --git a/cmd/cmd_sha1.c b/cmd/cmd_sha1.c
index 4472ed1..d7d06d5 100644
--- a/cmd/cmd_sha1.c
+++ b/cmd/cmd_sha1.c
@@ -4,8 +4,6 @@ void *cmd_sha1(void *data)
{
char *param = (char *)data;
char *ret = NULL;
- int fret=-1;
-
int i;
char hash_result[21];
diff --git a/cmd/cmd_uptime.c b/cmd/cmd_uptime.c
index 6a9c963..4f0a4f3 100644
--- a/cmd/cmd_uptime.c
+++ b/cmd/cmd_uptime.c
@@ -5,7 +5,7 @@
void *cmd_uptime(void *data)
{
- char *param = (char *)data;
+ //char *param = (char *)data;
char *ret = NULL;
const int buf_size = 128;
@@ -15,7 +15,7 @@ void *cmd_uptime(void *data)
FILE *f=NULL;
double d1,d2;
- int i1,i2;
+ int i1;
f = fopen(PROCFS_UPTIME_PATH,"r");
fscanf(f,"%lf %lf", &d1, &d2);
@@ -23,7 +23,6 @@ void *cmd_uptime(void *data)
printf("Readed %lf %lf\n", d1, d2);
i1 = d1;
- i2 = d2;
printf("Days %d Hours %d Minutes %d\n",i1/(3600*24),i1/(3600)%24, (i1/60)%60);
snprintf(buf, buf_size,"%dd %dh %dm\n",i1/(3600*24),i1/(3600)%24, (i1/60)%60);
diff --git a/cmd/cmd_version.c b/cmd/cmd_version.c
index d919c60..e2e74c4 100644
--- a/cmd/cmd_version.c
+++ b/cmd/cmd_version.c
@@ -2,7 +2,6 @@
void *cmd_version(void *data)
{
- char *param = (char *)data;
char *ret = NULL;
const int buf_size = 128;
@@ -13,4 +12,6 @@ void *cmd_version(void *data)
snprintf(buf, buf_size, "VERSION:0.0.3" " DATE:" VERSION_DATE " COMMIT:" VERSION_COMMIT "\n");
ret = alloc_new_str(buf);
+
+ return ret;
} \ No newline at end of file
diff --git a/tbl_qcmd.c b/tbl_qcmd.c
index 874ad10..c41f6ec 100644
--- a/tbl_qcmd.c
+++ b/tbl_qcmd.c
@@ -30,7 +30,6 @@ tbl_exec *tbl_exec_list_c(int size)
//TODO check if command allready excists
int tbl_exec_add(tbl_exec *tbl, tble_exec *cmd)
{
- int i;
if (tbl == NULL || cmd == NULL)
{
@@ -244,8 +243,6 @@ int tbl_exec_tbl_free(tbl_exec *tbl)
int tbl_exec_tel_free(tble_exec *tble)
{
- int i;
-
if (tble == NULL)
{
return -1;
@@ -317,7 +314,6 @@ tbl_qcmd* tbl_qcmd_c(int size)
int tbl_qcmd_exec(tbl_qcmd *tcmd, tbl_exec *texec)
{
- int ret=-1;
int i,j;
if (tcmd == NULL)
@@ -858,5 +854,5 @@ int tbl_qcmd_mng_states(tbl_qcmd *tbl)
//add more complicated state machine execution
//add more logging and more cases to log
-
+ return 0;
} \ No newline at end of file