summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2016-10-21 15:28:24 +0200
committerdimitri staessens <[email protected]>2016-10-21 15:28:24 +0200
commitd5a52f3951fff7ee272bd0d4cd95cd122d07fa64 (patch)
treed32f6d89550a7b8606c78c241b73b23a39ae8bed /src/lib
parent482c44232d4deda3f89a7d85fbad99c1c64e80ec (diff)
downloadouroboros-d5a52f3951fff7ee272bd0d4cd95cd122d07fa64.tar.gz
ouroboros-d5a52f3951fff7ee272bd0d4cd95cd122d07fa64.zip
build: Comply with -Wextra compiler flag
This reduces the risk for some bugs, for instance due to signed/unsigned mismatches and unused variables.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/bitmap.c4
-rw-r--r--src/lib/dev.c7
-rw-r--r--src/lib/nsm.c10
-rw-r--r--src/lib/shm_rdrbuff.c2
-rw-r--r--src/lib/tests/bitmap_test.c3
5 files changed, 21 insertions, 5 deletions
diff --git a/src/lib/bitmap.c b/src/lib/bitmap.c
index e84145b2..916ab2ee 100644
--- a/src/lib/bitmap.c
+++ b/src/lib/bitmap.c
@@ -158,7 +158,7 @@ ssize_t bmp_allocate(struct bmp * b)
id = (ssize_t) find_next_zero_bit(b->bitmap,
b->size);
- if (id >= b->size)
+ if (id >= (ssize_t) b->size)
return bad_id(b);
bitmap_set(b->bitmap, id);
@@ -171,7 +171,7 @@ static bool is_id_valid(struct bmp * b,
{
assert(b);
- if ((id < b->offset) || (id > (b->offset + b->size)))
+ if ((id < b->offset) || (id > (ssize_t) (b->offset + b->size)))
return false;
return true;
diff --git a/src/lib/dev.c b/src/lib/dev.c
index 146070b7..c349846f 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -467,6 +467,9 @@ int flow_alloc(char * dst_name, char * src_ae_name, struct qos_spec * qos)
irm_msg_t * recv_msg = NULL;
int fd = -1;
+ /* FIXME: add qos support */
+ (void) qos;
+
if (dst_name == NULL)
return -EINVAL;
@@ -756,7 +759,7 @@ ssize_t flow_write(int fd, void * buf, size_t count)
ssize_t flow_read(int fd, void * buf, size_t count)
{
int idx = -1;
- int n;
+ ssize_t n;
uint8_t * sdu;
if (fd < 0 || fd >= AP_MAX_FLOWS)
@@ -794,7 +797,7 @@ ssize_t flow_read(int fd, void * buf, size_t count)
return -1;
}
- memcpy(buf, sdu, MIN(n, count));
+ memcpy(buf, sdu, MIN(n, (ssize_t) count));
shm_rdrbuff_remove(ai.rdrb, idx);
diff --git a/src/lib/nsm.c b/src/lib/nsm.c
index 069db139..654b526b 100644
--- a/src/lib/nsm.c
+++ b/src/lib/nsm.c
@@ -26,6 +26,9 @@ int nsm_reg(char * name,
char ** dafs,
size_t dafs_size)
{
+ (void) name;
+ (void) dafs;
+ (void) dafs_size;
return -1;
}
@@ -34,6 +37,10 @@ int nsm_unreg(char * name,
char ** dafs,
size_t dafs_size)
{
+ (void) name;
+ (void) dafs;
+ (void) dafs_size;
+
return -1;
}
@@ -41,5 +48,8 @@ int nsm_unreg(char * name,
ssize_t nsm_resolve(char * name,
char ** dafs)
{
+ (void) name;
+ (void) dafs;
+
return -1;
}
diff --git a/src/lib/shm_rdrbuff.c b/src/lib/shm_rdrbuff.c
index e5a37577..1f93f1c7 100644
--- a/src/lib/shm_rdrbuff.c
+++ b/src/lib/shm_rdrbuff.c
@@ -689,7 +689,7 @@ int shm_rdrbuff_remove(struct shm_rdrbuff * rdrb, ssize_t idx)
idx_to_du_buff_ptr(rdrb, idx)->dst_api = -1;
- if (idx != *rdrb->ptr_tail) {
+ if (idx != (ssize_t) *rdrb->ptr_tail) {
pthread_mutex_unlock(rdrb->lock);
return 0;
}
diff --git a/src/lib/tests/bitmap_test.c b/src/lib/tests/bitmap_test.c
index 4d2d0c73..7eb72fe7 100644
--- a/src/lib/tests/bitmap_test.c
+++ b/src/lib/tests/bitmap_test.c
@@ -35,6 +35,9 @@ int bitmap_test(int argc, char ** argv)
ssize_t r;
ssize_t offset = 100;
+ (void) argc;
+ (void) argv;
+
srand(time(NULL));
bmp = bmp_create(bits, offset);