summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2016-10-21 20:13:41 +0200
committerdimitri staessens <[email protected]>2016-10-22 13:27:02 +0200
commit3cafbf3cfe5c58a6988dbfc4c29148ebb804f5c2 (patch)
tree881da180b8d801c38ba0fbad2fc9f387a70ec016 /src/tools
parentd5a52f3951fff7ee272bd0d4cd95cd122d07fa64 (diff)
downloadouroboros-3cafbf3cfe5c58a6988dbfc4c29148ebb804f5c2.tar.gz
ouroboros-3cafbf3cfe5c58a6988dbfc4c29148ebb804f5c2.zip
build: Compile with strict conversion
This has the code checked with -Wcast-qual and -Wconversion flags. These flags were removed because SWIG generated code fails.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/cbr/cbr.c2
-rw-r--r--src/tools/cbr/cbr_client.c15
-rw-r--r--src/tools/cbr/cbr_server.c8
-rw-r--r--src/tools/echo/echo.c2
-rw-r--r--src/tools/echo/echo_client.c2
-rw-r--r--src/tools/echo/echo_server.c2
-rw-r--r--src/tools/irm/irm.c2
-rw-r--r--src/tools/irm/irm_bind.c2
-rw-r--r--src/tools/irm/irm_bind_ap.c2
-rw-r--r--src/tools/irm/irm_bind_api.c2
-rw-r--r--src/tools/irm/irm_bind_ipcp.c2
-rw-r--r--src/tools/irm/irm_ipcp.c2
-rw-r--r--src/tools/irm/irm_ipcp_bootstrap.c2
-rw-r--r--src/tools/irm/irm_ipcp_create.c2
-rw-r--r--src/tools/irm/irm_ipcp_destroy.c2
-rw-r--r--src/tools/irm/irm_ipcp_enroll.c2
-rw-r--r--src/tools/irm/irm_register.c2
-rw-r--r--src/tools/irm/irm_unbind.c2
-rw-r--r--src/tools/irm/irm_unbind_ap.c2
-rw-r--r--src/tools/irm/irm_unbind_api.c2
-rw-r--r--src/tools/irm/irm_unbind_ipcp.c2
-rw-r--r--src/tools/irm/irm_unregister.c2
-rw-r--r--src/tools/oping/oping.c10
-rw-r--r--src/tools/oping/oping_client.c10
-rw-r--r--src/tools/oping/oping_server.c4
25 files changed, 43 insertions, 44 deletions
diff --git a/src/tools/cbr/cbr.c b/src/tools/cbr/cbr.c
index 27c51586..efcb2847 100644
--- a/src/tools/cbr/cbr.c
+++ b/src/tools/cbr/cbr.c
@@ -64,7 +64,7 @@ static void usage(void)
int main(int argc, char ** argv)
{
- int duration = 60; /* One minute test */
+ int duration = 60; /* One minute test */
int size = 1000; /* 1000 byte SDUs */
long rate = 1000000; /* 1 Mb/s */
bool flood = false;
diff --git a/src/tools/cbr/cbr_client.c b/src/tools/cbr/cbr_client.c
index af766599..b2cf7d7f 100644
--- a/src/tools/cbr/cbr_client.c
+++ b/src/tools/cbr/cbr_client.c
@@ -46,8 +46,8 @@ int client_main(char * server,
int result = 0;
bool stop = false;
char buf[size];
- long seqnr = 0;
- unsigned long gap = size * 8.0 * (BILLION / (double) rate);
+ int seqnr = 0;
+ long gap = size * 8.0 * (BILLION / (double) rate);
struct timespec start;
struct timespec end;
@@ -55,7 +55,7 @@ int client_main(char * server,
int ms;
printf("Client started, duration %d, rate %lu b/s, size %d B.\n",
- duration, rate, size);
+ duration, rate, size);
fd = flow_alloc(server, NULL, NULL);
if (fd < 0) {
@@ -85,18 +85,17 @@ int client_main(char * server,
if (sleep)
nanosleep(&intv, NULL);
else
- busy_wait_until(&end);
+ busy_wait_until(&end);
++seqnr;
- if (ts_diff_us(&start, &end) / MILLION
- >= (long) duration)
+ if (ts_diff_us(&start, &end) / MILLION >= duration)
stop = true;
}
} else { /* flood */
while (!stop) {
clock_gettime(CLOCK_REALTIME, &end);
- if (flow_write(fd, buf, size) == -1) {
+ if (flow_write(fd, buf, (size_t) size) == -1) {
stop = true;
continue;
}
@@ -115,7 +114,7 @@ int client_main(char * server,
ms = ts_diff_ms(&start, &end);
printf("sent statistics: "
- "%9ld SDUs, %12ld bytes in %9d ms, %4.4f Mb/s\n",
+ "%9d SDUs, %12d bytes in %9d ms, %4.4f Mb/s\n",
seqnr, seqnr * size, ms, (seqnr * size * 8.0)/(ms * 1000));
flow_dealloc(fd);
diff --git a/src/tools/cbr/cbr_server.c b/src/tools/cbr/cbr_server.c
index d40ae2cb..f1c342d1 100644
--- a/src/tools/cbr/cbr_server.c
+++ b/src/tools/cbr/cbr_server.c
@@ -63,7 +63,7 @@ void shutdown_server(int signo, siginfo_t * info, void * c)
void handle_flow(int fd)
{
- ssize_t count = 0;
+ int count = 0;
char buf[BUF_SIZE];
struct timespec now;
@@ -112,9 +112,9 @@ void handle_flow(int fd)
sdus - sdus_intv,
bytes_read - bytes_read_intv,
us / 1000,
- ((sdus - sdus_intv) / (float) us) * MILLION,
+ ((sdus - sdus_intv) / (double) us) * MILLION,
8 * (bytes_read - bytes_read_intv)
- / (float)(us));
+ / (double)(us));
iv_start = iv_end;
sdus_intv = sdus;
bytes_read_intv = bytes_read;
@@ -197,7 +197,7 @@ void * listener(void * o)
return 0;
}
-int server_main()
+int server_main(void)
{
struct sigaction sig_act;
int i;
diff --git a/src/tools/echo/echo.c b/src/tools/echo/echo.c
index 28ae4c1a..82d280f9 100644
--- a/src/tools/echo/echo.c
+++ b/src/tools/echo/echo.c
@@ -30,7 +30,7 @@
#include "echo_client.c"
#include "echo_server.c"
-static void usage()
+static void usage(void)
{
printf("Usage: echo-app [OPTION]...\n"
"Sends an echo between a server and a client\n\n"
diff --git a/src/tools/echo/echo_client.c b/src/tools/echo/echo_client.c
index f006273c..3507364a 100644
--- a/src/tools/echo/echo_client.c
+++ b/src/tools/echo/echo_client.c
@@ -23,7 +23,7 @@
#include <ouroboros/dev.h>
#include <stdlib.h>
-int client_main()
+int client_main(void)
{
int fd = 0;
int result = 0;
diff --git a/src/tools/echo/echo_server.c b/src/tools/echo/echo_server.c
index acf691b3..070f0ce3 100644
--- a/src/tools/echo/echo_server.c
+++ b/src/tools/echo/echo_server.c
@@ -35,7 +35,7 @@ void shutdown_server(int signo)
exit(EXIT_SUCCESS);
}
-int server_main()
+int server_main(void)
{
int client_fd = 0;
char buf[BUF_SIZE];
diff --git a/src/tools/irm/irm.c b/src/tools/irm/irm.c
index 1c75a7a5..be758098 100644
--- a/src/tools/irm/irm.c
+++ b/src/tools/irm/irm.c
@@ -27,7 +27,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm [OPERATION]\n\n"
"where OPERATION = {ipcp bind unbind\n"
diff --git a/src/tools/irm/irm_bind.c b/src/tools/irm/irm_bind.c
index a12a812b..bb441573 100644
--- a/src/tools/irm/irm_bind.c
+++ b/src/tools/irm/irm_bind.c
@@ -28,7 +28,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm bind [OPERATION]\n"
"where OPERATION = {ap api ipcp help}\n");
diff --git a/src/tools/irm/irm_bind_ap.c b/src/tools/irm/irm_bind_ap.c
index 189b197e..b558f072 100644
--- a/src/tools/irm/irm_bind_ap.c
+++ b/src/tools/irm/irm_bind_ap.c
@@ -30,7 +30,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm bind ap <ap>\n"
" name <name>\n"
diff --git a/src/tools/irm/irm_bind_api.c b/src/tools/irm/irm_bind_api.c
index abc21b3d..54ecf51d 100644
--- a/src/tools/irm/irm_bind_api.c
+++ b/src/tools/irm/irm_bind_api.c
@@ -30,7 +30,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm bind api <pid> name <name>\n");
}
diff --git a/src/tools/irm/irm_bind_ipcp.c b/src/tools/irm/irm_bind_ipcp.c
index 2d517994..f30c6ef8 100644
--- a/src/tools/irm/irm_bind_ipcp.c
+++ b/src/tools/irm/irm_bind_ipcp.c
@@ -30,7 +30,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm bind ipcp <name> name <name>\n");
}
diff --git a/src/tools/irm/irm_ipcp.c b/src/tools/irm/irm_ipcp.c
index 9d7d9532..795281bb 100644
--- a/src/tools/irm/irm_ipcp.c
+++ b/src/tools/irm/irm_ipcp.c
@@ -25,7 +25,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm ipcp [OPERATION]\n\n"
"where OPERATION = {create destroy\n"
diff --git a/src/tools/irm/irm_ipcp_bootstrap.c b/src/tools/irm/irm_ipcp_bootstrap.c
index ba9b7e2e..cc1bf6f9 100644
--- a/src/tools/irm/irm_ipcp_bootstrap.c
+++ b/src/tools/irm/irm_ipcp_bootstrap.c
@@ -46,7 +46,7 @@
#define DEFAULT_MAX_PDU_SIZE 9000
#define DEFAULT_DDNS 0
-static void usage()
+static void usage(void)
{
/* FIXME: Add dif_config stuff */
printf("Usage: irm ipcp bootstrap\n"
diff --git a/src/tools/irm/irm_ipcp_create.c b/src/tools/irm/irm_ipcp_create.c
index b43a544e..e9921112 100644
--- a/src/tools/irm/irm_ipcp_create.c
+++ b/src/tools/irm/irm_ipcp_create.c
@@ -33,7 +33,7 @@
#define SHIM_ETH_LLC "shim-eth-llc"
#define LOCAL "local"
-static void usage()
+static void usage(void)
{
printf("Usage: irm ipcp create\n"
" name <ipcp name>\n"
diff --git a/src/tools/irm/irm_ipcp_destroy.c b/src/tools/irm/irm_ipcp_destroy.c
index 9768b5e1..d3bc0cf3 100644
--- a/src/tools/irm/irm_ipcp_destroy.c
+++ b/src/tools/irm/irm_ipcp_destroy.c
@@ -28,7 +28,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm ipcp destroy\n"
" name <ipcp name>\n");
diff --git a/src/tools/irm/irm_ipcp_enroll.c b/src/tools/irm/irm_ipcp_enroll.c
index 32d8be54..b5517bcd 100644
--- a/src/tools/irm/irm_ipcp_enroll.c
+++ b/src/tools/irm/irm_ipcp_enroll.c
@@ -28,7 +28,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm ipcp enroll\n"
" name <ipcp name>\n"
diff --git a/src/tools/irm/irm_register.c b/src/tools/irm/irm_register.c
index 62470d1d..22de402f 100644
--- a/src/tools/irm/irm_register.c
+++ b/src/tools/irm/irm_register.c
@@ -30,7 +30,7 @@
#define MAX_DIFS 128
-static void usage()
+static void usage(void)
{
printf("Usage: irm register\n"
" name <name>\n"
diff --git a/src/tools/irm/irm_unbind.c b/src/tools/irm/irm_unbind.c
index 7f2d0d7d..5d167e1c 100644
--- a/src/tools/irm/irm_unbind.c
+++ b/src/tools/irm/irm_unbind.c
@@ -28,7 +28,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm unbind [OPERATION]\n"
"where OPERATION = {ap api ipcp help}\n");
diff --git a/src/tools/irm/irm_unbind_ap.c b/src/tools/irm/irm_unbind_ap.c
index bdfcbaad..8ad3d670 100644
--- a/src/tools/irm/irm_unbind_ap.c
+++ b/src/tools/irm/irm_unbind_ap.c
@@ -29,7 +29,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm unbind ap <ap>\n"
" [name <name>, omit: remove all AP info]\n");
diff --git a/src/tools/irm/irm_unbind_api.c b/src/tools/irm/irm_unbind_api.c
index b69a4579..d332f438 100644
--- a/src/tools/irm/irm_unbind_api.c
+++ b/src/tools/irm/irm_unbind_api.c
@@ -30,7 +30,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm unbind api <pid>\n"
" [name <name>, omit: remove all AP-I info]\n");
diff --git a/src/tools/irm/irm_unbind_ipcp.c b/src/tools/irm/irm_unbind_ipcp.c
index db310e05..33d7a818 100644
--- a/src/tools/irm/irm_unbind_ipcp.c
+++ b/src/tools/irm/irm_unbind_ipcp.c
@@ -30,7 +30,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm unbind ipcp <name>\n"
" [name <name>, omit: remove all information.\n");
diff --git a/src/tools/irm/irm_unregister.c b/src/tools/irm/irm_unregister.c
index edcd42bb..12c1eb22 100644
--- a/src/tools/irm/irm_unregister.c
+++ b/src/tools/irm/irm_unregister.c
@@ -31,7 +31,7 @@
#define MAX_DIFS 128
-static void usage()
+static void usage(void)
{
printf("Usage: irm unregister\n"
" name <name>\n"
diff --git a/src/tools/oping/oping.c b/src/tools/oping/oping.c
index 0ca40326..b476b33a 100644
--- a/src/tools/oping/oping.c
+++ b/src/tools/oping/oping.c
@@ -48,10 +48,10 @@ struct c {
/* stats */
int sent;
int rcvd;
- float rtt_min;
- float rtt_max;
- float rtt_avg;
- float rtt_m2;
+ double rtt_min;
+ double rtt_max;
+ double rtt_avg;
+ double rtt_m2;
flow_set_t * flows;
@@ -82,7 +82,7 @@ struct oping_msg {
#include "oping_client.c"
#include "oping_server.c"
-static void usage()
+static void usage(void)
{
printf("Usage: oping [OPTION]...\n"
"Checks liveness between a client and a server\n"
diff --git a/src/tools/oping/oping_client.c b/src/tools/oping/oping_client.c
index c2471b46..9f49a1df 100644
--- a/src/tools/oping/oping_client.c
+++ b/src/tools/oping/oping_client.c
@@ -62,8 +62,8 @@ void * reader(void * o)
struct oping_msg * msg = (struct oping_msg *) buf;
int fd = 0;
int msg_len = 0;
- float ms = 0;
- float d = 0;
+ double ms = 0;
+ double d = 0;
fqueue_t * fq = fqueue_create();
if (fq == NULL)
return (void *) 1;
@@ -83,7 +83,7 @@ void * reader(void * o)
continue;
}
- if ((int) ntohl(msg->id) >= client.count) {
+ if (ntohl(msg->id) >= (ssize_t) client.count) {
printf("Invalid id.\n");
continue;
}
@@ -94,7 +94,7 @@ void * reader(void * o)
pthread_mutex_lock(&client.lock);
ms = ts_diff_us(&client.times[ntohl(msg->id)], &now)
- /1000.0;
+ / 1000.0;
pthread_mutex_unlock(&client.lock);
printf("%d bytes from %s: seq=%d time=%.3f ms\n",
@@ -164,7 +164,7 @@ void * writer(void * o)
return (void *) 0;
}
-int client_main()
+int client_main(void)
{
struct sigaction sig_act;
diff --git a/src/tools/oping/oping_server.c b/src/tools/oping/oping_server.c
index 8680b11b..193b76d1 100644
--- a/src/tools/oping/oping_server.c
+++ b/src/tools/oping/oping_server.c
@@ -107,7 +107,7 @@ void * server_thread(void *o)
server.times[fd] = now;
pthread_mutex_unlock(&server.lock);
- msg->type = htonl((uint32_t) ECHO_REPLY);
+ msg->type = htonl(ECHO_REPLY);
if (flow_write(fd, buf, msg_len) < 0) {
printf("Error writing to flow (fd %d).\n", fd);
@@ -156,7 +156,7 @@ void * accept_thread(void * o)
return (void *) 0;
}
-int server_main()
+int server_main(void)
{
struct sigaction sig_act;