Skip to content

Commit cedfe2a

Browse files
committed
sort: remove undefined pointer comparisons
Signed-off-by: Phillip Wood <[email protected]>
1 parent a023a9f commit cedfe2a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

builtin/pack-objects.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2093,9 +2093,9 @@ static int pack_offset_sort(const void *_a, const void *_b)
20932093
if (!a_in_pack && !b_in_pack)
20942094
return oidcmp(&a->idx.oid, &b->idx.oid);
20952095

2096-
if (a_in_pack < b_in_pack)
2096+
if ((uintmax_t)a_in_pack < (uintmax_t)b_in_pack)
20972097
return -1;
2098-
if (a_in_pack > b_in_pack)
2098+
if ((uintmax_t)a_in_pack > (uintmax_t)b_in_pack)
20992099
return 1;
21002100
return a->in_pack_offset < b->in_pack_offset ? -1 :
21012101
(a->in_pack_offset > b->in_pack_offset);

server-info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ static int compare_info(const void *a_, const void *b_)
275275
/* then it does not matter but at least keep the comparison stable */
276276
if ((*a)->p == (*b)->p)
277277
return 0;
278-
else if ((*a)->p < (*b)->p)
278+
else if ((uintmax_t)((*a)->p) < (uintmax_t)((*b)->p))
279279
return -1;
280280
else
281281
return 1;

0 commit comments

Comments
 (0)