Commit 79f6ba5a842b0385dcd6c19f6decedf39c4c0a08

Sam Lantinga 2016-11-11T03:18:16

Fixed signed/unsigned comparison warnings in Visual Studio

diff --git a/src/stdlib/SDL_qsort.c b/src/stdlib/SDL_qsort.c
index 2ef33b1..0f97139 100644
--- a/src/stdlib/SDL_qsort.c
+++ b/src/stdlib/SDL_qsort.c
@@ -275,7 +275,7 @@ typedef struct { char * first; char * last; } stack_entry;
 
 /* and so is the pivoting logic (note: last is inclusive): */
 #define Pivot(swapper,sz)			\
-  if (last-first>PIVOT_THRESHOLD*sz) mid=pivot_big(first,mid,last,sz,compare);\
+  if ((size_t)(last-first)>PIVOT_THRESHOLD*sz) mid=pivot_big(first,mid,last,sz,compare);\
   else {	\
     if (compare(first,mid)<0) {			\
       if (compare(mid,last)>0) {		\
@@ -413,7 +413,7 @@ static void qsort_nonaligned(void *base, size_t nmemb, size_t size,
 
   first=(char*)base; last=first+(nmemb-1)*size;
 
-  if (last-first>=trunc) {
+  if ((size_t)(last-first)>=trunc) {
     char *ffirst=first, *llast=last;
     while (1) {
       /* Select pivot */
@@ -444,7 +444,7 @@ static void qsort_aligned(void *base, size_t nmemb, size_t size,
 
   first=(char*)base; last=first+(nmemb-1)*size;
 
-  if (last-first>=trunc) {
+  if ((size_t)(last-first)>=trunc) {
     char *ffirst=first,*llast=last;
     while (1) {
       /* Select pivot */