From fb0901b10f39f552f5ea94b3b7f1d6bf4a0194e6 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Wed, 15 Jun 2022 20:56:28 +0300 Subject: [PATCH] silence a -Wint-in-bool-context warning: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In file included from /home/runner/work/physfs/physfs/src/physfs.c:12: /home/runner/work/physfs/physfs/src/physfs.c: In function ‘openDirectory’: /home/runner/work/physfs/physfs/src/physfs.c:929:40: warning: ?: using integer constants in boolean context [-Wint-in-bool-context] 929 | BAIL_IF(!retval, claimed ? errcode : PHYSFS_ERR_UNSUPPORTED, NULL); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ /home/runner/work/physfs/physfs/src/physfs_internal.h:273:44: note: in definition of macro ‘BAIL_IF’ 273 | #define BAIL_IF(c, e, r) do { if (c) { if (e) PHYSFS_setErrorCode(e); return r; } } while (0) | ^ Closes https://github.com/icculus/physfs/issues/44 --- src/physfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/physfs.c b/src/physfs.c index e7ceddd..568f1fc 100644 --- a/src/physfs.c +++ b/src/physfs.c @@ -921,12 +921,12 @@ static DirHandle *openDirectory(PHYSFS_Io *io, const char *d, int forWriting) retval = tryOpenDir(io, *i, d, forWriting, &claimed); } /* else */ - errcode = currentErrorCode(); + errcode = claimed ? currentErrorCode() : PHYSFS_ERR_UNSUPPORTED; if ((!retval) && (created_io)) io->destroy(io); - BAIL_IF(!retval, claimed ? errcode : PHYSFS_ERR_UNSUPPORTED, NULL); + BAIL_IF(!retval, errcode, NULL); return retval; } /* openDirectory */