aboutsummaryrefslogtreecommitdiffstats
path: root/src/stream.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-04-08 13:57:36 +0200
committerMattias Andrée <maandree@kth.se>2017-04-08 13:57:36 +0200
commit478b53f935264bdfe4efe394f8d804a1361a6770 (patch)
tree31c87de7b67f928ff93b4564e0929d7db2a369f8 /src/stream.h
parentUpdate TODO: blind-from-sent (diff)
downloadblind-478b53f935264bdfe4efe394f8d804a1361a6770.tar.gz
blind-478b53f935264bdfe4efe394f8d804a1361a6770.tar.bz2
blind-478b53f935264bdfe4efe394f8d804a1361a6770.tar.xz
Document memory requirements, minor style fixes, more use of BUFSIZ, fix warnings, and fix potential buffer overflow
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/stream.h')
-rw-r--r--src/stream.h12
1 files changed, 6 insertions, 6 deletions
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,