Quick fix for qsort off-by-one error. SDL-1.2
authorSam Lantinga <slouken@libsdl.org>
Fri, 11 Mar 2016 08:30:18 -0800
branchSDL-1.2
changeset 10118 2f1eb5fa26ea
parent 10086 2e3396e62aa6
child 10123 8ab0633c9d43
Quick fix for qsort off-by-one error.
src/stdlib/SDL_qsort.c
--- a/src/stdlib/SDL_qsort.c	Sun Feb 21 13:19:33 2016 -0500
+++ b/src/stdlib/SDL_qsort.c	Fri Mar 11 08:30:18 2016 -0800
@@ -411,7 +411,7 @@
       Recurse(trunc)
     }
   }
-  PreInsertion(SWAP_nonaligned,TRUNC_nonaligned-1,size);
+  PreInsertion(SWAP_nonaligned,TRUNC_nonaligned,size);
   Insertion(SWAP_nonaligned);
   free(pivot);
 }
@@ -442,7 +442,7 @@
       Recurse(trunc)
     }
   }
-  PreInsertion(SWAP_aligned,TRUNC_aligned-1,size);
+  PreInsertion(SWAP_aligned,TRUNC_aligned,size);
   Insertion(SWAP_aligned);
   free(pivot);
 }
@@ -483,7 +483,7 @@
       Recurse(TRUNC_words)
     }
   }
-  PreInsertion(SWAP_words,(TRUNC_words/WORD_BYTES)-1,WORD_BYTES);
+  PreInsertion(SWAP_words,(TRUNC_words/WORD_BYTES),WORD_BYTES);
   /* Now do insertion sort. */
   last=((char*)base)+nmemb*WORD_BYTES;
   for (first=((char*)base)+WORD_BYTES;first!=last;first+=WORD_BYTES) {