From dc0d99eaff3a4e0c2c41daada56803f8a98be3d4 Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Mon, 21 Oct 2024 09:38:53 -0400 Subject: [PATCH] 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(). --- stream/stream.c | 5 ++--- stream/stream.h | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/stream/stream.c b/stream/stream.c index 5cca42e2a4..2e0ac39ecc 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -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, diff --git a/stream/stream.h b/stream/stream.h index eb44e23a1f..d4c5d0fded 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -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