From 72d2535a49cca00b37758d6d96426444a1d1ed05 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Mon, 11 Oct 2004 07:55:45 +0000 Subject: Stepping backwards over non-existing files now works. Thanks to Christian Marg for pinpointing the problem. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5249 a1c6a512-1295-4272-9138-f99709370657 --- firmware/mpeg.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 3507d2b2f4..7969d5970b 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c @@ -17,6 +17,7 @@ * ****************************************************************************/ #include +#include #include "config.h" #include "debug.h" #include "panic.h" @@ -855,10 +856,13 @@ static int new_file(int steps) mpeg_file = open(trackname, O_RDONLY); if(mpeg_file < 0) { DEBUGF("Couldn't open file: %s\n",trackname); - steps++; + if(steps < 0) + steps--; + else + steps++; /* Bail out if no file could be opened */ - if(steps > max_steps) + if(abs(steps) > max_steps) return -1; } else -- cgit v1.2.3