Skip to content

Commit 99ba446

Browse files
committed
tree: avoid mixed signedness comparison
Promote mode to `uint32_t` before comparing it to an `uint16_t` to avoid mixed signed comparison warnings.
1 parent 5f796f8 commit 99ba446

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libgit2/tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ static int parse_mode(uint16_t *mode_out, const char *buffer, size_t buffer_len,
381381
if ((error = git__strntol32(&mode, buffer, buffer_len, buffer_out, 8)) < 0)
382382
return error;
383383

384-
if (mode < 0 || mode > UINT16_MAX)
384+
if (mode < 0 || (uint32_t)mode > UINT16_MAX)
385385
return -1;
386386

387387
*mode_out = mode;

0 commit comments

Comments
 (0)