]> granicus.if.org Git - graphviz/commitdiff
suppress -Wconversion warnings from int promotion due to ~ of flags
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 9 Aug 2020 02:39:48 +0000 (19:39 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 14 Aug 2020 14:46:30 +0000 (07:46 -0700)
Squashes 11 warnings.

lib/sfio/sfclrlock.c
lib/sfio/sfexcept.c
lib/sfio/sfnew.c
lib/sfio/sfopen.c
lib/sfio/sfrd.c
lib/sfio/sfseek.c
lib/sfio/sfset.c
lib/sfio/sfsetbuf.c
lib/sfio/sfswap.c
lib/sfio/sfwr.c

index ca98fe9f94ad9a40e4a4eb12994f0e1c815bf489..ad25ee4863b2e1d08743a28533ab4eaf5617d3ad 100644 (file)
@@ -30,7 +30,7 @@ int sfclrlock(reg Sfio_t * f)
     SFMTXSTART(f, 0);
 
     /* clear error bits */
-    f->flags &= ~(SF_ERROR | SF_EOF);
+    f->flags &= (unsigned short)~(SF_ERROR | SF_EOF);
 
     /* clear peek locks */
     if (f->mode & SF_PKRD) {
index 57d0206c4f0cfeaaacad8224669c550bdf4fa179..5964393ed0dac5abe5fdcba9f70a56d00c75deea 100644 (file)
@@ -91,7 +91,7 @@ int _sfexcept(Sfio_t * f, int type, ssize_t io, Sfdisc_t * disc)
 
        /* a normal interrupt, we can continue */
        errno = 0;
-       f->flags &= ~(SF_EOF | SF_ERROR);
+       f->flags &= (unsigned short)~(SF_EOF | SF_ERROR);
        SFMTXRETURN(f, SF_ECONT);
     }
 
index f73c93b0598fbfae9c9c373e71b349c0a263f474..6b2628b7f672cfde3ef33f8beb4bcdf297accc31 100644 (file)
@@ -64,7 +64,7 @@ Sfio_t *sfnew(Sfio_t * oldf, void * buf, size_t size, int file,
                f->data = NIL(uchar *);
            }
            if (!f->data)
-               sflags &= ~SF_MALLOC;
+               sflags &= (unsigned short)~SF_MALLOC;
        }
     }
 
index ee22c7aa7549d400e1b19762efaca08894053da9..70b2f9db6832b1d51c550b1eec570b35294cb985 100644 (file)
@@ -170,7 +170,7 @@ int _sftype(reg const char *mode, int *oflagsp, int *uflagp)
            uflag = 0;
            continue;
        case 'u':
-           sflags &= ~SF_MTSAFE;
+           sflags &= (unsigned short)~SF_MTSAFE;
            uflag = 1;
            continue;
        default:
index 2079c1660468c861f6190768375da73c0e1d0e39..c68be86d21d643713a04a1d94c84c70884f8c069 100644 (file)
@@ -78,7 +78,7 @@ ssize_t sfrd(reg Sfio_t * f, reg void * buf, reg size_t n,
        if (!(f->flags & SF_STRING) && f->file < 0)
            SFMTXRETURN(f, 0);
 
-       f->flags &= ~(SF_EOF | SF_ERROR);
+       f->flags &= (unsigned short)~(SF_EOF | SF_ERROR);
 
        dc = disc;
        if (f->flags & SF_STRING) {
@@ -127,7 +127,7 @@ ssize_t sfrd(reg Sfio_t * f, reg void * buf, reg size_t n,
                f->mode |= rcrv;
            /* tell readf that no peeking necessary */
            else
-               f->flags &= ~SF_SHARE;
+               f->flags &= (unsigned short)~SF_SHARE;
 
            SFDCRD(f, buf, n, dc, r);
 
index 6cbbef96cbb561be835d5d9ee3b5fe020ff30e92..dceb990fc570daaa8d358b2b74ad5969523107c6 100644 (file)
@@ -87,7 +87,7 @@ Sfoff_t sfseek(Sfio_t * f, Sfoff_t p, int type)
     SFLOCK(f, local);
 
     /* clear error and eof bits */
-    f->flags &= ~(SF_EOF | SF_ERROR);
+    f->flags &= (unsigned short)~(SF_EOF | SF_ERROR);
 
     while (f->flags & SF_STRING) {
        SFSTRSIZE(f);
index 91e75efc3ac1f216c79636195b9b85279fc3b324..c954696d06e1959b3845c8c26b3afdb05d9cd463 100644 (file)
@@ -45,7 +45,7 @@ int sfset(reg Sfio_t * f, reg int flags, reg int set)
     if (set)
        f->flags |= (flags & SF_SETS);
     else
-       f->flags &= ~(flags & SF_SETS);
+       f->flags &= (unsigned short)~(flags & SF_SETS);
 
     /* must have at least one of read/write */
     if (!(f->flags & SF_RDWR))
@@ -69,7 +69,7 @@ int sfset(reg Sfio_t * f, reg int flags, reg int set)
 
     /* if not shared or unseekable, public means nothing */
     if (!(f->flags & SF_SHARE) || f->extent < 0)
-       f->flags &= ~SF_PUBLIC;
+       f->flags &= (unsigned short)~SF_PUBLIC;
 
     SFOPEN(f, 0);
     SFMTXRETURN(f, (oflags & SF_FLAGS));
index 602792a6cec4817fb7586df8f70fd525f05768cc..2d25ee95cec0489dec11fa8591261750a96e0a93 100644 (file)
@@ -121,7 +121,7 @@ void *sfsetbuf(reg Sfio_t * f, reg void * buf, reg size_t size)
     obuf = f->data;
     osize = f->size;
 
-    f->flags &= ~SF_MALLOC;
+    f->flags &= (unsigned short)~SF_MALLOC;
     f->bits &= ~SF_MMAP;
 
     /* pure read/string streams must have a valid string */
index 16ffc8caf61afa13ddef36cb9eb4331230179067..dcdd25311cde5c7ffff84070ffa4004e87a23d9d 100644 (file)
@@ -88,12 +88,12 @@ Sfio_t *sfswap(reg Sfio_t * f1, reg Sfio_t * f2)
     if (f2flags & SF_STATIC)
        f2->flags |= SF_STATIC;
     else
-       f2->flags &= ~SF_STATIC;
+       f2->flags &= (unsigned short)~SF_STATIC;
 
     if (f1flags & SF_STATIC)
        f1->flags |= SF_STATIC;
     else
-       f1->flags &= ~SF_STATIC;
+       f1->flags &= (unsigned short)~SF_STATIC;
 
     if (f2mode & SF_AVAIL) {   /* swapping to a closed stream */
        if (!(f1->flags & SF_STATIC))
index d7f0ef33b43314d2105780176c2d5e2bcb876e30..41738348c2db43407903b5ae079feb6452d2a351 100644 (file)
@@ -126,7 +126,7 @@ ssize_t sfwr(reg Sfio_t * f, reg const void * buf, reg size_t n,
            SFMTXRETURN(f, (ssize_t) 0);
 
        /* clear current error states */
-       f->flags &= ~(SF_EOF | SF_ERROR);
+       f->flags &= (unsigned short)~(SF_EOF | SF_ERROR);
 
        dc = disc;
        if (f->flags & SF_STRING)       /* total required buffer */