From 6326452f41e74675009120c7b9251bb2d7f8be0b Mon Sep 17 00:00:00 2001 From: arpi Date: Wed, 22 Aug 2001 19:40:46 +0000 Subject: [PATCH] exit() -> return NULL git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1632 b3059339-0415-0410-9bf9-f77b7e298cf2 --- asfheader.c | 2 +- dec_video.c | 20 +++++--------------- demux_avi.c | 2 -- demuxer.c | 2 -- dll_init.c | 3 --- network.c | 2 +- url.c | 10 +++++----- 7 files changed, 12 insertions(+), 29 deletions(-) diff --git a/asfheader.c b/asfheader.c index 8d22109352..5c17bab80e 100644 --- a/asfheader.c +++ b/asfheader.c @@ -160,7 +160,7 @@ while(!stream_eof(demuxer->stream)){ if(streamh.type_size>1024 || streamh.stream_size>1024){ mp_msg(MSGT_HEADER,MSGL_FATAL,"FATAL: header size bigger than 1024 bytes!\n" "Please contact mplayer authors, and upload/send this file.\n"); - exit(1); + return 0; } // type-specific data: stream_read(demuxer->stream,(char*) buffer,streamh.type_size); diff --git a/dec_video.c b/dec_video.c index 1888ef146c..f22235990b 100644 --- a/dec_video.c +++ b/dec_video.c @@ -150,7 +150,6 @@ switch(sh_video->codec->driver){ case VFM_VFW: { if(!init_video_codec(sh_video,0)) { // GUI_MSG( mplUnknowError ) -// exit(1); return 0; } mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32 video codec init OK!\n"); @@ -159,7 +158,6 @@ switch(sh_video->codec->driver){ case VFM_VFWEX: { if(!init_video_codec(sh_video,1)) { // GUI_MSG( mplUnknowError ) -// exit(1); return 0; } mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32Ex video codec init OK!\n"); @@ -170,7 +168,6 @@ switch(sh_video->codec->driver){ mp_msg(MSGT_DECVIDEO,MSGL_ERR,"MPlayer was compiled WITHOUT directshow support!\n"); return 0; // GUI_MSG( mplCompileWithoutDSSupport ) -// exit(1); #else int bpp; if(DS_VideoDecoder_Open(sh_video->codec->dll,&sh_video->codec->guid, sh_video->bih, 0, &sh_video->our_out_buffer)){ @@ -188,7 +185,6 @@ switch(sh_video->codec->driver){ // usec_sleep( 10000 ); // } // #endif -// exit(1); } switch(out_fmt){ @@ -247,7 +243,7 @@ switch(sh_video->codec->driver){ case VFM_DIVX4: { // DivX4Linux #ifndef NEW_DECORE mp_msg(MSGT_DECVIDEO,MSGL_ERR,"MPlayer was compiled WITHOUT DivX4Linux (libdivxdecore.so) support!\n"); - return 0; //exit(1); + return 0; #else mp_msg(MSGT_DECVIDEO,MSGL_V,"DivX4Linux video codec\n"); { DEC_PARAM dec_param; @@ -282,7 +278,7 @@ switch(sh_video->codec->driver){ case VFM_FFMPEG: { // FFmpeg's libavcodec #ifndef USE_LIBAVCODEC mp_msg(MSGT_DECVIDEO,MSGL_ERR,"MPlayer was compiled WITHOUT libavcodec support!\n"); - return 0; //exit(1); + return 0; #else mp_msg(MSGT_DECVIDEO,MSGL_V,"FFmpeg's libavcodec video codec\n"); avcodec_init(); @@ -290,7 +286,7 @@ switch(sh_video->codec->driver){ lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh_video->codec->dll); if(!lavc_codec){ mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Can't find codec '%s' in libavcodec...\n",sh_video->codec->dll); - return 0; //exit(1); + return 0; } memset(&lavc_context, 0, sizeof(lavc_context)); // sh_video->disp_h/=2; // !! @@ -300,7 +296,7 @@ switch(sh_video->codec->driver){ /* open it */ if (avcodec_open(&lavc_context, lavc_codec) < 0) { mp_msg(MSGT_DECVIDEO,MSGL_ERR, "could not open codec\n"); - return 0; //exit(1); + return 0; } mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: libavcodec init OK!\n"); @@ -580,7 +576,6 @@ switch(d_video->demuxer->file_format){ mp_msg(MSGT_DECVIDEO,MSGL_ERR,"MPEG: FATAL: EOF while searching for sequence header\n"); return 0; // GUI_MSG( mplMPEGErrorSeqHeaderSearch ) -// exit(1); } } mp_msg(MSGT_DECVIDEO,MSGL_V,"OK!\n"); @@ -592,20 +587,17 @@ switch(d_video->demuxer->file_format){ mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Cannot allocate shared memory\n"); return 0; // GUI_MSG( mplErrorShMemAlloc ) -// exit(0); } videobuf_len=0; if(!read_video_packet(d_video)){ mp_msg(MSGT_DECVIDEO,MSGL_ERR,"FATAL: Cannot read sequence header!\n"); return 0; // GUI_MSG( mplMPEGErrorCannotReadSeqHeader ) -// exit(1); } if(header_process_sequence_header (picture, &videobuffer[4])) { mp_msg(MSGT_DECVIDEO,MSGL_ERR,"bad sequence header!\n"); return 0; // GUI_MSG( mplMPEGErrorBadSeqHeader ) -// exit(1); } if(sync_video_packet(d_video)==0x1B5){ // next packet is seq. ext. // videobuf_len=0; @@ -614,13 +606,11 @@ switch(d_video->demuxer->file_format){ mp_msg(MSGT_DECVIDEO,MSGL_ERR,"FATAL: Cannot read sequence header extension!\n"); return 0; // GUI_MSG( mplMPEGErrorCannotReadSeqHeaderExt ) -// exit(1); } if(header_process_extension (picture, &videobuffer[pos+4])) { mp_msg(MSGT_DECVIDEO,MSGL_ERR,"bad sequence header extension!\n"); return 0; // GUI_MSG( mplMPEGErrorBadSeqHeaderExt ) -// exit(1); } } // display info: @@ -629,7 +619,7 @@ switch(d_video->demuxer->file_format){ if(!sh_video->fps){ // if(!force_fps){ // fprintf(stderr,"FPS not specified (or invalid) in the header! Use the -fps option!\n"); -// return 0; //exit(1); +// return 0; // } sh_video->frametime=0; } else { diff --git a/demux_avi.c b/demux_avi.c index 7b968ea157..0111dbf86f 100644 --- a/demux_avi.c +++ b/demux_avi.c @@ -412,7 +412,6 @@ demuxer_t* demux_open_avi(demuxer_t* demuxer){ mp_msg(MSGT_DEMUX,MSGL_ERR,"AVI_NI: missing video stream!? contact the author, it may be a bug :(\n"); return NULL; // GUI_MSG( mplErrorAVINI ) -// exit(1); } if(a_pos==-1){ mp_msg(MSGT_DEMUX,MSGL_INFO,"AVI_NI: No audio stream found -> nosound\n"); @@ -439,7 +438,6 @@ demuxer_t* demux_open_avi(demuxer_t* demuxer){ mp_msg(MSGT_DEMUX,MSGL_ERR,"AVI: missing video stream!? contact the author, it may be a bug :(\n"); return NULL; // GUI_MSG( mplAVIErrorMissingVideoStream ) -// exit(1); } sh_video=d_video->sh;sh_video->ds=d_video; if(d_audio->id!=-2){ diff --git a/demuxer.c b/demuxer.c index 62d8ecda95..d8588d4cca 100644 --- a/demuxer.c +++ b/demuxer.c @@ -399,7 +399,6 @@ if(file_format==DEMUXER_TYPE_UNKNOWN){ mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_FormatNotRecognized); return NULL; // GUI_MSG( mplUnknowFileType ) -// exit(1); } //====== File format recognized, set up these for compatibility: ========= d_audio=demuxer->audio; @@ -429,7 +428,6 @@ switch(file_format){ sh_video=NULL; //printf("ASF: missing video stream!? contact the author, it may be a bug :(\n"); //GUI_MSG( mplASFErrorMissingVideoStream ) - //exit(1); } else { sh_video=d_video->sh;sh_video->ds=d_video; sh_video->fps=1000.0f; sh_video->frametime=0.001f; // 1ms diff --git a/dll_init.c b/dll_init.c index 1b0e930d2a..7d24d24877 100644 --- a/dll_init.c +++ b/dll_init.c @@ -34,9 +34,6 @@ int init_acm_audio_codec(sh_audio_t *sh_audio){ sh_audio->srcstream=NULL; -// if(in_fmt->nSamplesPerSec==0){ printf("Bad WAVE header!\n");exit(1); } -// MSACM_RegisterAllDrivers(); - sh_audio->o_wf.nChannels=in_fmt->nChannels; sh_audio->o_wf.nSamplesPerSec=in_fmt->nSamplesPerSec; sh_audio->o_wf.nAvgBytesPerSec=2*sh_audio->o_wf.nSamplesPerSec*sh_audio->o_wf.nChannels; diff --git a/network.c b/network.c index e3fbd7a861..45299b8e4d 100644 --- a/network.c +++ b/network.c @@ -474,7 +474,7 @@ network_streaming(void *arg) { ret = select( streaming_ctrl->fd_net+1, &fd_net_in, NULL, NULL, NULL ); if( ret<0 ) { perror("select"); - exit(1); + return; //exit(1); // FIXME! } if( FD_ISSET( streaming_ctrl->fd_net, &fd_net_in ) ) { ret = readFromServer( streaming_ctrl->fd_net, buffer, BUFFER_SIZE ); diff --git a/url.c b/url.c index febf09a1b4..f4a506ec72 100644 --- a/url.c +++ b/url.c @@ -23,7 +23,7 @@ url_new(char* url) { Curl = (URL_t*)malloc(sizeof(URL_t)); if( Curl==NULL ) { printf("Memory allocation failed!\n"); - exit(1); + return NULL; } // Initialisation of the URL container members memset( Curl, 0, sizeof(URL_t) ); @@ -32,7 +32,7 @@ url_new(char* url) { Curl->url = (char*)malloc(strlen(url)+1); if( Curl->url==NULL ) { printf("Memory allocation failed!\n"); - exit(1); + return NULL; } strcpy(Curl->url, url); @@ -71,7 +71,7 @@ url_new(char* url) { Curl->hostname = (char*)malloc(pos2-pos1-3+1); if( Curl->hostname==NULL ) { printf("Memory allocation failed!\n"); - exit(1); + return NULL; } strncpy(Curl->hostname, ptr1+3, pos2-pos1-3); Curl->hostname[pos2-pos1-3] = '\0'; @@ -86,7 +86,7 @@ url_new(char* url) { Curl->file = (char*)malloc(strlen(ptr2)+1); if( Curl->file==NULL ) { printf("Memory allocation failed!\n"); - exit(1); + return NULL; } strcpy(Curl->file, ptr2); } @@ -96,7 +96,7 @@ url_new(char* url) { Curl->file = (char*)malloc(2); if( Curl->file==NULL ) { printf("Memory allocation failed!\n"); - exit(1); + return NULL; } strcpy(Curl->file, "/"); }