From cf9e8da56ca352b230dda8ba0dafffc7c250c9b8 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 3 Mar 2022 05:27:05 -0800 Subject: [PATCH] fix issue #689 - ?: warning From copperwater: a recently added use of ? : had a ptrdiff_t (signed) expression for and a size_t (unsigned) expression for which triggered a sign-compare warning when the two expressions are implicitly converted into the same type. Use casts to convert both expressions to long rather that convert the size_t half to ptrdiff_t or vice versa. The final result gets cast to int already. Fixes #689 --- sys/unix/unixmain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/unix/unixmain.c b/sys/unix/unixmain.c index 23ac06f8f..9cd7dfede 100644 --- a/sys/unix/unixmain.c +++ b/sys/unix/unixmain.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 unixmain.c $NHDT-Date: 1645223897 2022/02/18 22:38:17 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.97 $ */ +/* NetHack 3.7 unixmain.c $NHDT-Date: 1646313937 2022/03/03 13:25:37 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.99 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -333,7 +333,7 @@ lopt( if (p && opttype == ArgValDisallowed) goto loptnotallowed; - l = (int) (p ? (p - arg) : strlen(arg)); + l = (int) (p ? (long) (p - arg) : (long) strlen(arg)); if (!strncmp(arg, optname, l)) { /* "-windowtype[=foo]" */ if (p)