Use size_t to avoid overflow when sorting arrays larger than 2 GB.

PR:		111085
MFC after:	2 weeks
This commit is contained in:
David Schultz 2008-01-13 02:11:10 +00:00
parent c6eabb5ec1
commit badf97cd55
2 changed files with 3 additions and 2 deletions

View File

@ -141,7 +141,7 @@ heapsort(vbase, nmemb, size, compar)
size_t nmemb, size;
int (*compar)(const void *, const void *);
{
int cnt, i, j, l;
size_t cnt, i, j, l;
char tmp, *tmp1, *tmp2;
char *base, *k, *p, *t;

View File

@ -111,7 +111,8 @@ qsort(void *a, size_t n, size_t es, cmp_t *cmp)
#endif
{
char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
int d, r, swaptype, swap_cnt;
size_t d, r;
int swaptype, swap_cnt;
loop: SWAPINIT(a, es);
swap_cnt = 0;