[Commits] SDL: Quick fix for qsort off-by-one error.

libsdl.org revision control commits-owner at libsdl.org
Fri Mar 11 16:34:23 PST 2016


details:   https://hg.libsdl.org/SDL/rev/418691d83f6a
changeset: 10116:418691d83f6a
user:      Sam Lantinga <slouken at libsdl.org>
date:      Fri Mar 11 08:30:18 2016 -0800
description:
Quick fix for qsort off-by-one error.

diffstat:

 src/stdlib/SDL_qsort.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 4f54ed649bf7 -r 418691d83f6a src/stdlib/SDL_qsort.c
--- a/src/stdlib/SDL_qsort.c	Fri Mar 11 22:10:35 2016 +0100
+++ b/src/stdlib/SDL_qsort.c	Fri Mar 11 08:30:18 2016 -0800
@@ -427,7 +427,7 @@
       Recurse(trunc)
     }
   }
-  PreInsertion(SWAP_nonaligned,TRUNC_nonaligned-1,size);
+  PreInsertion(SWAP_nonaligned,TRUNC_nonaligned,size);
   Insertion(SWAP_nonaligned);
   free(pivot);
 }
@@ -458,7 +458,7 @@
       Recurse(trunc)
     }
   }
-  PreInsertion(SWAP_aligned,TRUNC_aligned-1,size);
+  PreInsertion(SWAP_aligned,TRUNC_aligned,size);
   Insertion(SWAP_aligned);
   free(pivot);
 }
@@ -499,7 +499,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) {


More information about the commits mailing list