From fdd0dab1c3138ed5d73ed364f5c7fc8463159ea1 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 1 Aug 2024 09:02:38 +0300 Subject: [PATCH] stbi: change Image.data from voidptr to &u8, to reduce casts (#21977) --- vlib/stbi/stbi.c.v | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/vlib/stbi/stbi.c.v b/vlib/stbi/stbi.c.v index 66ece19dc9..72bf010727 100644 --- a/vlib/stbi/stbi.c.v +++ b/vlib/stbi/stbi.c.v @@ -42,7 +42,7 @@ pub mut: height int nr_channels int ok bool - data voidptr + data &u8 = unsafe { nil } ext string } @@ -124,7 +124,6 @@ pub fn load(path string, params LoadParams) !Image { mut res := Image{ ok: true ext: ext - data: 0 } res.data = C.stbi_load(&char(path.str), &res.width, &res.height, &res.nr_channels, params.desired_channels) @@ -139,7 +138,6 @@ pub fn load(path string, params LoadParams) !Image { pub fn load_from_memory(buf &u8, bufsize int, params LoadParams) !Image { mut res := Image{ ok: true - data: 0 } res.data = C.stbi_load_from_memory(buf, bufsize, &res.width, &res.height, &res.nr_channels, params.desired_channels) @@ -162,7 +160,6 @@ pub fn resize_uint8(img &Image, output_w int, output_h int) !Image { mut res := Image{ ok: true ext: img.ext - data: 0 width: output_w height: output_h nr_channels: img.nr_channels