diff options
| author | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-03-01 17:07:28 +1100 |
|---|---|---|
| committer | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-03-01 17:07:28 +1100 |
| commit | e776edfe54ef384535f940c51c8a2798b0322481 (patch) | |
| tree | ff5f480fdcc42870a18a0c98a76aba6521a446da /src/format/image | |
| parent | 52c27fb38fb8a5d989e758eaec8529f8b7acf121 (diff) | |
refactor(bmp): Cancel bmp validation checker if require_valid is off
Diffstat (limited to 'src/format/image')
| -rw-r--r-- | src/format/image/bmp.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/format/image/bmp.c b/src/format/image/bmp.c index ed358df..7dfaa76 100644 --- a/src/format/image/bmp.c +++ b/src/format/image/bmp.c @@ -25,7 +25,7 @@ ff_result ff_bmp_isvalid(ff_stream* stream) return FF_RESULT_OK; } -ff_result ff_open_bmp(ff_stream *stream, ff_bmp_ctx **out_ctx) +ff_result ff_open_bmp(ff_stream *stream, ff_bmp_ctx **out_ctx, ff_flag require_valid) { ff_bmp_ctx *ctx = malloc(sizeof(ff_bmp_ctx)); @@ -45,11 +45,13 @@ ff_result ff_open_bmp(ff_stream *stream, ff_bmp_ctx **out_ctx) ff_dprintf("bmp: stream read successfully\n"); - ff_result res = ff_bmp_isvalid(ctx->raw); - if (res != FF_RESULT_OK) { - ff_dprintf("bmp: validation failed (%d)\n", res); - free(ctx); - return res; + if (require_valid) { + ff_result res = ff_bmp_isvalid(ctx->raw); + if (res != FF_RESULT_OK) { + ff_dprintf("bmp: validation failed (%d)\n", res); + free(ctx); + return res; + } } ff_dprintf("bmp: validation passed\n"); |
