mirror of https://github.com/mpv-player/mpv
stream: remove NULL checks for open calls
open_stream() and open_output_stream() checked for filename==NULL, and if true, printed an error message asking to report this as bug. Internal logic errors should just crash. Use assert() instead.
This commit is contained in:
parent
a19f197cb1
commit
7d3efa8940
|
@ -205,6 +205,8 @@ stream_t *open_stream_full(const char *filename, int mode,
|
||||||
stream_t* s;
|
stream_t* s;
|
||||||
char *redirected_url = NULL;
|
char *redirected_url = NULL;
|
||||||
|
|
||||||
|
assert(filename);
|
||||||
|
|
||||||
int dummy;
|
int dummy;
|
||||||
if (!file_format)
|
if (!file_format)
|
||||||
file_format = &dummy;
|
file_format = &dummy;
|
||||||
|
@ -250,24 +252,12 @@ stream_t *open_stream_full(const char *filename, int mode,
|
||||||
stream_t* open_stream(const char *filename, struct MPOpts *options,
|
stream_t* open_stream(const char *filename, struct MPOpts *options,
|
||||||
int *file_format)
|
int *file_format)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!filename) {
|
|
||||||
mp_msg(MSGT_OPEN,MSGL_ERR,"NULL filename, report this bug\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return open_stream_full(filename,STREAM_READ,options,file_format);
|
return open_stream_full(filename,STREAM_READ,options,file_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
stream_t *open_output_stream(const char *filename, struct MPOpts *options)
|
stream_t *open_output_stream(const char *filename, struct MPOpts *options)
|
||||||
{
|
{
|
||||||
int file_format; //unused
|
return open_stream_full(filename,STREAM_WRITE,options,NULL);
|
||||||
if(!filename) {
|
|
||||||
mp_msg(MSGT_OPEN,MSGL_ERR,"open_output_stream(), NULL filename, report this bug\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return open_stream_full(filename,STREAM_WRITE,options,&file_format);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================== STREAMER =========================
|
//=================== STREAMER =========================
|
||||||
|
|
Loading…
Reference in New Issue