Skip to content

Commit

Permalink
schannel: fix -Wsign-compare warning
Browse files Browse the repository at this point in the history
MinGW warns:
/lib/vtls/schannel.c:219:64: warning: signed and unsigned type in
conditional expression [-Wsign-compare]

Fix this by casting the ptrdiff_t to size_t as we know it's positive.

Closes curl#2721
  • Loading branch information
MarcelRaad authored and falconindy committed Sep 10, 2018
1 parent 19ecf44 commit 1c525b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/vtls/schannel.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ get_alg_id_by_name(char *name)
{
char tmp[LONGEST_ALG_ID] = { 0 };
char *nameEnd = strchr(name, ':');
size_t n = nameEnd ? min(nameEnd - name, LONGEST_ALG_ID - 1) : \
size_t n = nameEnd ? min((size_t)(nameEnd - name), LONGEST_ALG_ID - 1) : \
min(strlen(name), LONGEST_ALG_ID - 1);
strncpy(tmp, name, n);
tmp[n] = 0;
Expand Down

0 comments on commit 1c525b6

Please sign in to comment.