mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-30 11:09:23 +00:00
(main): Sort scores before trimming them,
reported by Jason Feng <jfeng@ozbert.com> (bug#4397).
This commit is contained in:
parent
2efb64a86a
commit
24e9e99693
@ -1,3 +1,8 @@
|
||||
2009-09-11 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* update-game-score.c (main): Sort scores before trimming them,
|
||||
reported by Jason Feng <jfeng@ozbert.com> (bug#4397).
|
||||
|
||||
2009-09-09 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* Makefile.in ($(DESTDIR)${archlibdir}): Set umask to world-readable
|
||||
|
@ -254,15 +254,15 @@ main (argc, argv)
|
||||
lose_syserr ("Failed to read scores file");
|
||||
}
|
||||
push_score (&scores, &scorecount, newscore, user_id, newdata);
|
||||
sort_scores (scores, scorecount, reverse);
|
||||
/* Limit the number of scores. If we're using reverse sorting, then
|
||||
we should increment the beginning of the array, to skip over the
|
||||
*smallest* scores. Otherwise, we just decrement the number of
|
||||
scores, since the smallest will be at the end. */
|
||||
if (scorecount > MAX_SCORES)
|
||||
scorecount -= (scorecount - MAX_SCORES);
|
||||
if (reverse)
|
||||
scores += (scorecount - MAX_SCORES);
|
||||
sort_scores (scores, scorecount, reverse);
|
||||
if (reverse)
|
||||
scores += (scorecount - MAX_SCORES);
|
||||
if (write_scores (scorefile, scores, scorecount) < 0)
|
||||
{
|
||||
unlock_file (scorefile, lockstate);
|
||||
|
Loading…
Reference in New Issue
Block a user