From 37deee71405dae7cba1126bf75777332cb5d4048 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 11 Sep 2023 15:58:17 +0200 Subject: [PATCH] conf: cast subtraction operands in source comparison Cast the values to int to not break the sorting in case they are changed to unsigned types. --- conf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf.c b/conf.c index 4c1d2e9..5d2ba15 100644 --- a/conf.c +++ b/conf.c @@ -1660,11 +1660,11 @@ compare_sources(const void *a, const void *b) return 1; if ((d = strcmp(sa->params.name, sb->params.name)) != 0) return d; - if ((d = (int)(sa->type) - (int)(sb->type)) != 0) + if ((d = (int)sa->type - (int)sb->type) != 0) return d; - if ((d = sa->pool - sb->pool) != 0) + if ((d = (int)sa->pool - (int)sb->pool) != 0) return d; - if ((d = sa->params.port - sb->params.port) != 0) + if ((d = (int)sa->params.port - (int)sb->params.port) != 0) return d; return memcmp(&sa->params.params, &sb->params.params, sizeof (sa->params.params)); }