summaryrefslogtreecommitdiff
path: root/src/format
diff options
context:
space:
mode:
authorWatson Wheeler <git@tazy.dev>2026-06-28 12:50:28 +1000
committerWatson Wheeler <git@tazy.dev>2026-06-28 12:50:28 +1000
commit0d6823e6b29072a64f87519ff5f0c49d8d93f047 (patch)
tree54c37dbbc5e498549e3c5bcff0aececb35578d12 /src/format
parentdbcd54dd7114bd23ddcef149291822c38e523fd2 (diff)
fix(png): fix png chunk writer's writing order
It now prints it in the way the spec intends (length, type, data, crc) Signed-off-by: Watson Wheeler <git@tazy.dev>
Diffstat (limited to 'src/format')
-rw-r--r--src/format/image/png.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/format/image/png.c b/src/format/image/png.c
index 48c073c..dfd3230 100644
--- a/src/format/image/png.c
+++ b/src/format/image/png.c
@@ -482,11 +482,11 @@ ff_result ff_close_png(ff_ctx* ctx, ff_png_ctx *png_ctx)
ff_result ff_write_chunk(ff_stream *stream, const char *type, uint8_t *buf, size_t len)
{
- stream->write(type, 4, stream->user);
-
- uint32_t be_len = (uint32_t)len;
- stream->write(&be_len, 4, stream->user);
+ uint8_t be_len[4];
+ ff_write_be32(be_len, (uint32_t)len);
+ stream->write(be_len, 4, stream->user);
+ stream->write(type, 4, stream->user);
stream->write(buf, len, stream->user);
uint32_t zero_crc = 0;
@@ -594,4 +594,4 @@ ff_result ff_png_normalize(ff_ctx *ctx, ff_png_ctx *png_ctx, ff_image_ctx **out_
(void)png_ctx;
}
return FF_RESULT_OK;
-} \ No newline at end of file
+}