pkg/wuffs: fix builds for 32-bit systems

This commit is contained in:
Mitchell Hashimoto
2024-09-02 20:57:17 -07:00
parent 8ffa7328a9
commit 781a721fc7

View File

@ -80,7 +80,13 @@ pub fn decode(alloc: Allocator, data: []const u8) Error!struct {
// temporary buffer for intermediate processing of image // temporary buffer for intermediate processing of image
const work_buffer = try alloc.alloc( const work_buffer = try alloc.alloc(
u8, u8,
// The type of this is a u64 on all systems but our allocator
// uses a usize which is a u32 on 32-bit systems.
std.math.cast(
usize,
c.wuffs_png__decoder__workbuf_len(decoder).max_incl, c.wuffs_png__decoder__workbuf_len(decoder).max_incl,
) orelse return error.OutOfMemory,
); );
defer alloc.free(work_buffer); defer alloc.free(work_buffer);