Fixed signed/unsigned comparison warnings in Visual Studio
authorSam Lantinga <slouken@libsdl.org>
Fri, 11 Nov 2016 03:18:16 -0800
changeset 10599ade40eb390dc
parent 10598 85f444d7a73d
child 10600 ae286e502a00
Fixed signed/unsigned comparison warnings in Visual Studio
src/stdlib/SDL_qsort.c
     1.1 --- a/src/stdlib/SDL_qsort.c	Fri Nov 11 04:06:00 2016 -0700
     1.2 +++ b/src/stdlib/SDL_qsort.c	Fri Nov 11 03:18:16 2016 -0800
     1.3 @@ -275,7 +275,7 @@
     1.4  
     1.5  /* and so is the pivoting logic (note: last is inclusive): */
     1.6  #define Pivot(swapper,sz)			\
     1.7 -  if (last-first>PIVOT_THRESHOLD*sz) mid=pivot_big(first,mid,last,sz,compare);\
     1.8 +  if ((size_t)(last-first)>PIVOT_THRESHOLD*sz) mid=pivot_big(first,mid,last,sz,compare);\
     1.9    else {	\
    1.10      if (compare(first,mid)<0) {			\
    1.11        if (compare(mid,last)>0) {		\
    1.12 @@ -413,7 +413,7 @@
    1.13  
    1.14    first=(char*)base; last=first+(nmemb-1)*size;
    1.15  
    1.16 -  if (last-first>=trunc) {
    1.17 +  if ((size_t)(last-first)>=trunc) {
    1.18      char *ffirst=first, *llast=last;
    1.19      while (1) {
    1.20        /* Select pivot */
    1.21 @@ -444,7 +444,7 @@
    1.22  
    1.23    first=(char*)base; last=first+(nmemb-1)*size;
    1.24  
    1.25 -  if (last-first>=trunc) {
    1.26 +  if ((size_t)(last-first)>=trunc) {
    1.27      char *ffirst=first,*llast=last;
    1.28      while (1) {
    1.29        /* Select pivot */