summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorGuillem Jover <guillem@hadrons.org>2021-09-15 14:50:58 +0200
committerGuillem Jover <guillem@hadrons.org>2021-09-15 14:52:25 +0200
commit055ed4352a159bf4c9ab14296a563f36a0a6b8f2 (patch)
treede9230db03cf80f34ab6596ce02e111eda6d22d7 /examples
parent1274abfc33450dde08a0166acc2beaba6ad0da2b (diff)
downloadliburing-055ed4352a159bf4c9ab14296a563f36a0a6b8f2.tar.gz
liburing-055ed4352a159bf4c9ab14296a563f36a0a6b8f2.tar.bz2
examples: Fix warnings for comparison of integers with different signedness
Warned-by: gcc -Wsign-compare Signed-off-by: Guillem Jover <guillem@hadrons.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/io_uring-cp.c5
-rw-r--r--examples/link-cp.c4
2 files changed, 5 insertions, 4 deletions
diff --git a/examples/io_uring-cp.c b/examples/io_uring-cp.c
index 2a44c30..9322575 100644
--- a/examples/io_uring-cp.c
+++ b/examples/io_uring-cp.c
@@ -127,7 +127,8 @@ static int copy_file(struct io_uring *ring, off_t insize)
writes = reads = offset = 0;
while (insize || write_left) {
- int had_reads, got_comp;
+ unsigned long had_reads;
+ int got_comp;
/*
* Queue up as many reads as we can
@@ -194,7 +195,7 @@ static int copy_file(struct io_uring *ring, off_t insize)
fprintf(stderr, "cqe failed: %s\n",
strerror(-cqe->res));
return 1;
- } else if (cqe->res != data->iov.iov_len) {
+ } else if ((size_t)cqe->res != data->iov.iov_len) {
/* Short read/write, adjust and requeue */
data->iov.iov_base += cqe->res;
data->iov.iov_len -= cqe->res;
diff --git a/examples/link-cp.c b/examples/link-cp.c
index e15dfc3..244d21a 100644
--- a/examples/link-cp.c
+++ b/examples/link-cp.c
@@ -26,7 +26,7 @@ struct io_data {
};
static int infd, outfd;
-static unsigned inflight;
+static int inflight;
static int setup_context(unsigned entries, struct io_uring *ring)
{
@@ -115,7 +115,7 @@ static int handle_cqe(struct io_uring *ring, struct io_uring_cqe *cqe)
static int copy_file(struct io_uring *ring, off_t insize)
{
struct io_uring_cqe *cqe;
- size_t this_size;
+ off_t this_size;
off_t offset;
offset = 0;