samples: uhid: fix warnings in uhid-example
authorSam Ravnborg <sam@ravnborg.org>
Wed, 29 Apr 2020 03:45:18 +0000 (12:45 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Sun, 17 May 2020 09:52:01 +0000 (18:52 +0900)
Fix warnings seen when building for 32-bit architecture.

Use "%xd" for arguments of type size_t to fix the warnings.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
samples/uhid/uhid-example.c

index b72d645..015cb06 100644 (file)
@@ -165,7 +165,7 @@ static int uhid_write(int fd, const struct uhid_event *ev)
                fprintf(stderr, "Cannot write to uhid: %m\n");
                return -errno;
        } else if (ret != sizeof(*ev)) {
-               fprintf(stderr, "Wrong size written to uhid: %ld != %lu\n",
+               fprintf(stderr, "Wrong size written to uhid: %zd != %zu\n",
                        ret, sizeof(ev));
                return -EFAULT;
        } else {
@@ -236,7 +236,7 @@ static int event(int fd)
                fprintf(stderr, "Cannot read uhid-cdev: %m\n");
                return -errno;
        } else if (ret != sizeof(ev)) {
-               fprintf(stderr, "Invalid size read from uhid-dev: %ld != %lu\n",
+               fprintf(stderr, "Invalid size read from uhid-dev: %zd != %zu\n",
                        ret, sizeof(ev));
                return -EFAULT;
        }