[FFmpeg-devel] [PATCH 4/5] avformat/jpegxl_probe: inline various ret < 0 checks
Leo Izen
leo.izen at gmail.com
Thu Jun 8 17:26:36 EEST 2023
Inlines some ret < 0 checks to look like:
if ((ret = func()) < 0)
return ret;
which clarifies code slightly.
Signed-off-by: Leo Izen <leo.izen at gmail.com>
---
libavformat/jpegxl_probe.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/libavformat/jpegxl_probe.c b/libavformat/jpegxl_probe.c
index 88492cb772..b4ab45518a 100644
--- a/libavformat/jpegxl_probe.c
+++ b/libavformat/jpegxl_probe.c
@@ -254,8 +254,7 @@ int ff_jpegxl_verify_codestream_header(const uint8_t *buf, int buflen, int valid
uint64_t extensions;
int ret;
- ret = init_get_bits8(gb, buf, buflen);
- if (ret < 0)
+ if ((ret = init_get_bits8(gb, buf, buflen)) < 0)
return ret;
if (get_bits_long(gb, 16) != FF_JPEGXL_CODESTREAM_SIGNATURE_LE)
@@ -281,8 +280,7 @@ int ff_jpegxl_verify_codestream_header(const uint8_t *buf, int buflen, int valid
/* preview header */
if (get_bits1(gb)) {
- ret = jpegxl_read_preview_header(gb);
- if (ret < 0)
+ if ((ret = jpegxl_read_preview_header(gb)) < 0)
return ret;
}
@@ -309,8 +307,7 @@ int ff_jpegxl_verify_codestream_header(const uint8_t *buf, int buflen, int valid
if (num_extra_channels > 4 && validate_level)
return -1;
for (uint32_t i = 0; i < num_extra_channels; i++) {
- ret = jpegxl_read_extra_channel_info(gb, validate_level);
- if (ret < 0)
+ if ((ret = jpegxl_read_extra_channel_info(gb, validate_level)) < 0)
return ret;
if (get_bits_left(gb) < 1)
return AVERROR_INVALIDDATA;
--
2.40.1
More information about the ffmpeg-devel
mailing list