From ea139fadc1e714b2493d46ede57d3d52c36770db Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 1 Mar 2010 20:20:13 +0000 Subject: Ensure that cue_current_pos.track is not set to an invalid value after attempting to seek to e.g. track 0. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30810 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream_cue.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'stream') diff --git a/stream/stream_cue.c b/stream/stream_cue.c index c356827782..0300e7c78e 100644 --- a/stream/stream_cue.c +++ b/stream/stream_cue.c @@ -439,15 +439,14 @@ static int cue_read_cue (char *in_cue_filename) -static int cue_read_toc_entry(void) { - - int track = cue_current_pos.track - 1; - +static int cue_read_toc_entry(int track) { /* check if its a valid track, if not return -1 */ - if (track < 0 || track >= nTracks) + if (track <= 0 || track > nTracks) return -1; + cue_current_pos.track = track; + track--; switch (tracks[track].mode) { case AUDIO: @@ -470,9 +469,7 @@ static int cue_read_toc_entry(void) { } static int cue_vcd_seek_to_track (int track){ - cue_current_pos.track = track; - - if (cue_read_toc_entry ()) + if (cue_read_toc_entry (track)) return -1; return VCD_SECTOR_DATA * cue_get_msf(); -- cgit v1.2.3