]> granicus.if.org Git - curl/commitdiff
schannel: fix -Wsign-compare warning
authorMarcel Raad <Marcel.Raad@teamviewer.com>
Sun, 8 Jul 2018 15:16:34 +0000 (17:16 +0200)
committerMarcel Raad <Marcel.Raad@teamviewer.com>
Mon, 9 Jul 2018 16:09:05 +0000 (18:09 +0200)
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 https://github.com/curl/curl/pull/2721

lib/vtls/schannel.c

index b72542225bb0cbe887bcb1a35337a9d096f42ce7..382efb5250540901a8da9d5d634408f45c6853bd 100644 (file)
@@ -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;