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.
This commit is contained in:
Miroslav Lichvar 2023-09-11 15:58:17 +02:00
parent 7ff74d9efe
commit 37deee7140

6
conf.c
View file

@ -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));
}