stream: add STREAM_READ_FILE_FLAGS_DEFAULT

This is the default set of flags used by stream_read_file().
Useful for doing flag customization for stream_read_file2().
This commit is contained in:
nanahi 2024-10-21 09:38:53 -04:00 committed by Avi Halachmi
parent c2e71ceb07
commit dc0d99eaff
2 changed files with 6 additions and 3 deletions

View File

@ -856,9 +856,8 @@ struct bstr stream_read_complete(struct stream *s, void *talloc_ctx,
struct bstr stream_read_file(const char *filename, void *talloc_ctx,
struct mpv_global *global, int max_size)
{
int flags = STREAM_ORIGIN_DIRECT | STREAM_READ | STREAM_LOCAL_FS_ONLY |
STREAM_LESS_NOISE;
return stream_read_file2(filename, talloc_ctx, flags, global, max_size);
return stream_read_file2(filename, talloc_ctx, STREAM_READ_FILE_FLAGS_DEFAULT,
global, max_size);
}
struct bstr stream_read_file2(const char *filename, void *talloc_ctx,

View File

@ -55,6 +55,10 @@
#define STREAM_LESS_NOISE (1 << 6) // try to log errors only
#define STREAM_ALLOW_PARTIAL_READ (1 << 7) // allows partial read with stream_read_file()
// Default flags used by stream_read_file().
#define STREAM_READ_FILE_FLAGS_DEFAULT \
(STREAM_ORIGIN_DIRECT | STREAM_READ | STREAM_LOCAL_FS_ONLY | STREAM_LESS_NOISE)
// end flags for stream_open_ext (the naming convention sucks)
#define STREAM_UNSAFE -3