From 07678423fb737e7c12f1b513d68ab1c99b44d853 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 20 Apr 2015 23:02:20 +0200 Subject: image_writer: minor cleanup Instead of using int like bool, use bool directly. --- video/image_writer.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'video/image_writer.c') diff --git a/video/image_writer.c b/video/image_writer.c index 491828aa22..88ffb7964c 100644 --- a/video/image_writer.c +++ b/video/image_writer.c @@ -78,14 +78,14 @@ struct image_writer_ctx { struct img_writer { const char *file_ext; - int (*write)(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp); + bool (*write)(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp); const int *pixfmts; int lavc_codec; }; -static int write_lavc(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp) +static bool write_lavc(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp) { - int success = 0; + bool success = 0; AVFrame *pic = NULL; AVPacket pkt = {0}; int got_output = 0; @@ -161,7 +161,7 @@ static void write_jpeg_error_exit(j_common_ptr cinfo) longjmp(*(jmp_buf*)cinfo->client_data, 1); } -static int write_jpeg(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp) +static bool write_jpeg(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp) { struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; @@ -173,7 +173,7 @@ static int write_jpeg(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp) cinfo.client_data = &error_return_jmpbuf; if (setjmp(cinfo.client_data)) { jpeg_destroy_compress(&cinfo); - return 0; + return false; } jpeg_create_compress(&cinfo); @@ -209,7 +209,7 @@ static int write_jpeg(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp) jpeg_destroy_compress(&cinfo); - return 1; + return true; } #endif @@ -279,8 +279,8 @@ const char *image_writer_file_ext(const struct image_writer_opts *opts) return get_writer(opts)->file_ext; } -int write_image(struct mp_image *image, const struct image_writer_opts *opts, - const char *filename, struct mp_log *log) +bool write_image(struct mp_image *image, const struct image_writer_opts *opts, + const char *filename, struct mp_log *log) { struct mp_image *allocated_image = NULL; struct image_writer_opts defs = image_writer_opts_defaults; @@ -316,7 +316,7 @@ int write_image(struct mp_image *image, const struct image_writer_opts *opts, } FILE *fp = fopen(filename, "wb"); - int success = 0; + bool success = false; if (fp == NULL) { mp_err(log, "Error opening '%s' for writing!\n", filename); } else { -- cgit v1.2.3