From 2ee061e02d39077858db63c37910649e9b7b64a5 Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 13 Dec 2022 19:17:00 -0500 Subject: [PATCH] cast away a new warning role.c: In function 'plnamesuffix': role.c:1615:19: warning: operand of '?:' changes signedness from 'int' to 'unsigned int' due to unsignedness of other operand [-Wsign-compare] 1615 | ? (int) (eptr - gp.plname) ^~~~~~~~~~~~~~~~~~~~~~~~ Since Strlen() (actually hacklib's Strlen_ function) returns 'unsigned' for the second operand of the '?:', the compiler was having to change the signedness of the first operand '(int) (eptr - gp.plname)' to 'unsigned' and issuing the warning. Cast the result of Strlen() to int to make both operands of the '?:' the same ('signed'). --- src/role.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/role.c b/src/role.c index 4301cb97a..c8f96097d 100644 --- a/src/role.c +++ b/src/role.c @@ -1613,7 +1613,7 @@ plnamesuffix(void) contains a username with dash(es) in it and is usually 0 */ i = ((eptr = strchr(gp.plname + gp.plnamelen, '-')) != 0) ? (int) (eptr - gp.plname) - : Strlen(gp.plname); + : (int) Strlen(gp.plname); /* look for plname[] in the 'genericusers' space-separated list */ if (findword(sysopt.genericusers, gp.plname, i, FALSE)) /* it's generic; remove it so that askname() will be called */