From 539e7a68736a18f025e14ef43eeb3e2993830916 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 8 Aug 2020 17:44:22 -0700 Subject: [PATCH] universally treat SFIO mode flags as unsigned This squashes 119 -Wsign-conversion compiler warnings. --- lib/sfio/sfhdr.h | 24 ++++++++++++------------ lib/sfio/sfio_t.h | 2 +- lib/sfio/sfrd.c | 3 ++- lib/sfio/sfswap.c | 3 ++- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/lib/sfio/sfhdr.h b/lib/sfio/sfhdr.h index 3c13877c8..13389d9c7 100644 --- a/lib/sfio/sfhdr.h +++ b/lib/sfio/sfhdr.h @@ -187,18 +187,18 @@ extern "C" { #define SFCLRBITS(f) (SFMVUNSET(f), ((f)->bits &= ~(SF_DCDOWN|SF_MVSIZE)) ) /* bits for the mode field, SF_INIT defined in sfio_t.h */ -#define SF_RC 00000010 /* peeking for a record */ -#define SF_RV 00000020 /* reserve without read or most write */ -#define SF_LOCK 00000040 /* stream is locked for io op */ -#define SF_PUSH 00000100 /* stream has been pushed */ -#define SF_POOL 00000200 /* stream is in a pool but not current */ -#define SF_PEEK 00000400 /* there is a pending peek */ -#define SF_PKRD 00001000 /* did a peek read */ -#define SF_GETR 00002000 /* did a getr on this stream */ -#define SF_SYNCED 00004000 /* stream was synced */ -#define SF_STDIO 00010000 /* given up the buffer to stdio */ -#define SF_AVAIL 00020000 /* was closed, available for reuse */ -#define SF_LOCAL 00100000 /* sentinel for a local call */ +#define SF_RC 00000010u /* peeking for a record */ +#define SF_RV 00000020u /* reserve without read or most write */ +#define SF_LOCK 00000040u /* stream is locked for io op */ +#define SF_PUSH 00000100u /* stream has been pushed */ +#define SF_POOL 00000200u /* stream is in a pool but not current */ +#define SF_PEEK 00000400u /* there is a pending peek */ +#define SF_PKRD 00001000u /* did a peek read */ +#define SF_GETR 00002000u /* did a getr on this stream */ +#define SF_SYNCED 00004000u /* stream was synced */ +#define SF_STDIO 00010000u /* given up the buffer to stdio */ +#define SF_AVAIL 00020000u /* was closed, available for reuse */ +#define SF_LOCAL 00100000u /* sentinel for a local call */ #ifdef DEBUG #define ASSERT(p) ((p) ? 0 : (abort(),0) ) diff --git a/lib/sfio/sfio_t.h b/lib/sfio/sfio_t.h index efa4855fc..8643d4072 100644 --- a/lib/sfio/sfio_t.h +++ b/lib/sfio/sfio_t.h @@ -46,7 +46,7 @@ extern "C" { #include "sfio.h" /* mode bit to indicate that the structure hasn't been initialized */ -#define SF_INIT 0000004 +#define SF_INIT 0000004u /* short-hand for common stream types */ #define SF_RDWR (SF_READ|SF_WRITE) diff --git a/lib/sfio/sfrd.c b/lib/sfio/sfrd.c index 5f567e901..2079c1660 100644 --- a/lib/sfio/sfrd.c +++ b/lib/sfio/sfrd.c @@ -51,7 +51,8 @@ ssize_t sfrd(reg Sfio_t * f, reg void * buf, reg size_t n, { Sfoff_t r; reg Sfdisc_t *dc; - reg int local, rcrv, dosync, oerrno; + reg int local, dosync, oerrno; + unsigned rcrv; SFMTXSTART(f, -1); diff --git a/lib/sfio/sfswap.c b/lib/sfio/sfswap.c index 21d400546..16ffc8caf 100644 --- a/lib/sfio/sfswap.c +++ b/lib/sfio/sfswap.c @@ -24,7 +24,8 @@ Sfio_t *sfswap(reg Sfio_t * f1, reg Sfio_t * f2) { Sfio_t tmp; - int f1pool, f2pool, f1mode, f2mode, f1flags, f2flags; + int f1pool, f2pool, f1mode, f1flags, f2flags; + unsigned f2mode; if (!f1 || (f1->mode & SF_AVAIL) || (SFFROZEN(f1) && (f1->mode & SF_PUSH))) -- 2.40.0