mirror of https://github.com/mpv-player/mpv
stream: allow max_size of 0 for stream_read_complete
In this case, it returns a bstr of a length of 0 rather than error.
This commit is contained in:
parent
2af0b0b34b
commit
bd5e3c0261
|
@ -802,7 +802,7 @@ int stream_skip_bom(struct stream *s)
|
||||||
|
|
||||||
// Read the rest of the stream into memory (current pos to EOF), and return it.
|
// Read the rest of the stream into memory (current pos to EOF), and return it.
|
||||||
// talloc_ctx: used as talloc parent for the returned allocation
|
// talloc_ctx: used as talloc parent for the returned allocation
|
||||||
// max_size: must be set to >0. If the file is larger than that, it is treated
|
// max_size: must be set to >=0. If the file is larger than that, it is treated
|
||||||
// as error. This is a minor robustness measure. If the stream is
|
// as error. This is a minor robustness measure. If the stream is
|
||||||
// created with STREAM_ALLOW_PARTIAL_READ flag, partial result up to
|
// created with STREAM_ALLOW_PARTIAL_READ flag, partial result up to
|
||||||
// max_size is returned instead.
|
// max_size is returned instead.
|
||||||
|
@ -814,7 +814,7 @@ int stream_skip_bom(struct stream *s)
|
||||||
struct bstr stream_read_complete(struct stream *s, void *talloc_ctx,
|
struct bstr stream_read_complete(struct stream *s, void *talloc_ctx,
|
||||||
int max_size)
|
int max_size)
|
||||||
{
|
{
|
||||||
if (max_size <= 0 || max_size > STREAM_MAX_READ_SIZE)
|
if (max_size < 0 || max_size > STREAM_MAX_READ_SIZE)
|
||||||
abort();
|
abort();
|
||||||
if (s->is_directory)
|
if (s->is_directory)
|
||||||
return (struct bstr){NULL, 0};
|
return (struct bstr){NULL, 0};
|
||||||
|
|
Loading…
Reference in New Issue