git: 8dd8d56d9576 - main - posixshm_test: Fix sign mismatches in ?: results.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 05 Dec 2022 00:32:18 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8dd8d56d95763ffc914bb729eb27d720cd8ab5eb commit 8dd8d56d95763ffc914bb729eb27d720cd8ab5eb Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2022-12-05 00:31:05 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2022-12-05 00:31:05 +0000 posixshm_test: Fix sign mismatches in ?: results. GCC 12's -Wsign-compare complains if the two alternative results of the ?: operator are differently signed. Cast the small, sub-page off_t values to size_t to quiet the warning. Reviewed by: imp, kib Differential Revision: https://reviews.freebsd.org/D37539 --- tests/sys/posixshm/posixshm_test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/sys/posixshm/posixshm_test.c b/tests/sys/posixshm/posixshm_test.c index c84eca319e0e..6398f5f6e085 100644 --- a/tests/sys/posixshm/posixshm_test.c +++ b/tests/sys/posixshm/posixshm_test.c @@ -195,7 +195,7 @@ shm_fill(int fd, off_t offset, off_t len) return (1); while (len > 0) { - blen = len < (off_t)page_size ? len : page_size; + blen = len < (off_t)page_size ? (size_t)len : page_size; memset(buf, byte_to_fill, blen); if (pwrite(fd, buf, blen, offset) != (ssize_t)blen) { error = 1; @@ -236,7 +236,7 @@ check_content_dealloc(int fd, off_t hole_start, off_t hole_len, off_t shm_sz) offset = hole_start; resid = hole_len; while (resid > 0) { - blen = resid < (off_t)page_size ? resid : page_size; + blen = resid < (off_t)page_size ? (size_t)resid : page_size; if (pread(fd, buf, blen, offset) != (ssize_t)blen) { error = 1; break; @@ -257,7 +257,7 @@ check_content_dealloc(int fd, off_t hole_start, off_t hole_len, off_t shm_sz) offset = 0; resid = hole_start; while (resid > 0) { - blen = resid < (off_t)page_size ? resid : page_size; + blen = resid < (off_t)page_size ? (size_t)resid : page_size; if (pread(fd, buf, blen, offset) != (ssize_t)blen) { error = 1; break; @@ -276,7 +276,7 @@ check_content_dealloc(int fd, off_t hole_start, off_t hole_len, off_t shm_sz) offset = hole_start + hole_len; resid = shm_sz - offset; while (resid > 0) { - blen = resid < (off_t)page_size ? resid : page_size; + blen = resid < (off_t)page_size ? (size_t)resid : page_size; if (pread(fd, buf, blen, offset) != (ssize_t)blen) { error = 1; break;