From 478b53f935264bdfe4efe394f8d804a1361a6770 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 8 Apr 2017 13:57:36 +0200 Subject: Document memory requirements, minor style fixes, more use of BUFSIZ, fix warnings, and fix potential buffer overflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/stream.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/stream.h') diff --git a/src/stream.h b/src/stream.h index f2d88ed..a5cebc6 100644 --- a/src/stream.h +++ b/src/stream.h @@ -36,8 +36,7 @@ #define process_multiple_streams(...) nprocess_multiple_streams(1, __VA_ARGS__) #define process_each_frame_two_streams(...) nprocess_each_frame_two_streams(1, __VA_ARGS__) -struct stream -{ +struct stream { size_t frames; size_t width; size_t height; @@ -45,7 +44,8 @@ struct stream char pixfmt[32]; int fd; size_t ptr; - char buf[4096]; + size_t xptr; + char buf[BUFSIZ]; const char *file; size_t headlen; }; @@ -62,13 +62,13 @@ void encheck_compat(int status, const struct stream *a, const struct stream *b); int enread_frame(int status, struct stream *stream, void *buf, size_t n); void nprocess_each_frame_segmented(int status, struct stream *stream, int output_fd, const char* output_fname, - void (*process)(struct stream *stream, size_t n, size_t frame)); + void (*process)(struct stream *stream, size_t n, size_t frame)); void nprocess_two_streams(int status, struct stream *left, struct stream *right, int output_fd, const char* output_fname, - void (*process)(struct stream *left, struct stream *right, size_t n)); + void (*process)(struct stream *left, struct stream *right, size_t n)); void nprocess_multiple_streams(int status, struct stream *streams, size_t n_streams, int output_fd, const char* output_fname, - void (*process)(struct stream *streams, size_t n_streams, size_t n)); + void (*process)(struct stream *streams, size_t n_streams, size_t n)); void nprocess_each_frame_two_streams(int status, struct stream *left, struct stream *right, int output_fd, const char* output_fname, void (*process)(char *restrict output, char *restrict lbuf, char *restrict rbuf, -- cgit v1.2.3-70-g09d2