summaryrefslogtreecommitdiff
path: root/src/tools/cbr/cbr_client.c
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/cbr/cbr_client.c
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/cbr/cbr_client.c')
-rw-r--r--src/tools/cbr/cbr_client.c15
1 files changed, 7 insertions, 8 deletions
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);