From c803ba9baf2570286085ce68a139c64d89fd8e52 Mon Sep 17 00:00:00 2001 From: nicodvb Date: Mon, 27 Aug 2007 21:10:41 +0000 Subject: in open_s() unified failure code in fail: git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24248 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream_dvd.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'stream') diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c index 03cd0ac21d..1625fdbf97 100644 --- a/stream/stream_dvd.c +++ b/stream/stream_dvd.c @@ -866,18 +866,12 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { mp_msg(MSGT_OPEN,MSGL_STATUS, MSGTR_DVDnumChapters, tt_srpt->title[dvd_title].nr_of_ptts); if(dvd_chapter<1 || dvd_chapter>tt_srpt->title[dvd_title].nr_of_ptts) { mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDinvalidChapter, dvd_chapter); - ifoClose( vmg_file ); - DVDClose( dvd ); - m_struct_free(&stream_opts,opts); - return STREAM_UNSUPORTED; + goto fail; } if(dvd_last_chapter>0) { if(dvd_last_chaptertt_srpt->title[dvd_title].nr_of_ptts) { mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDinvalidLastChapter, dvd_last_chapter); - ifoClose( vmg_file ); - DVDClose( dvd ); - m_struct_free(&stream_opts,opts); - return STREAM_UNSUPORTED; + goto fail; } } --dvd_chapter; // remap 1.. -> 0.. @@ -888,10 +882,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { mp_msg(MSGT_OPEN,MSGL_STATUS, MSGTR_DVDnumAngles, tt_srpt->title[dvd_title].nr_of_angles); if(dvd_angle<1 || dvd_angle>tt_srpt->title[dvd_title].nr_of_angles) { mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDinvalidAngle, dvd_angle); - ifoClose( vmg_file ); - DVDClose( dvd ); - m_struct_free(&stream_opts,opts); - return STREAM_UNSUPORTED; + goto fail; } --dvd_angle; // remap 1.. -> 0.. @@ -902,10 +893,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { vts_file = ifoOpen( dvd, tt_srpt->title[dvd_title].title_set_nr ); if(!vts_file) { mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDnoIFO, tt_srpt->title[dvd_title].title_set_nr ); - ifoClose( vmg_file ); - DVDClose( dvd ); - m_struct_free(&stream_opts,opts); - return STREAM_UNSUPORTED; + goto fail; } /** * We've got enough info, time to open the title set data. @@ -914,10 +902,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { if(!title) { mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDnoVOBs, tt_srpt->title[dvd_title].title_set_nr); ifoClose( vts_file ); - ifoClose( vmg_file ); - DVDClose( dvd ); - m_struct_free(&stream_opts,opts); - return STREAM_UNSUPORTED; + goto fail; } mp_msg(MSGT_OPEN,MSGL_V, "DVD successfully opened.\n"); @@ -1097,6 +1082,12 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { mp_msg(MSGT_DVD,MSGL_V,"DVD start=%d end=%d \n",d->cur_pack,d->cur_pgc->cell_playback[d->last_cell-1].last_sector); stream->priv = (void*)d; return STREAM_OK; + +fail: + ifoClose(vmg_file); + DVDClose(dvd); + m_struct_free(&stream_opts, opts); + return STREAM_UNSUPORTED; } mp_msg(MSGT_DVD,MSGL_ERR,MSGTR_NoDVDSupport); m_struct_free(&stream_opts,opts); -- cgit v1.2.3