diff options
| author | gingerBill <bill@gingerbill.org> | 2023-05-22 11:47:36 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-05-22 11:47:36 +0100 |
| commit | 1e17f44991e6a9d068acf37f3516e08d32e3b04d (patch) | |
| tree | 82b7b55f014ade15240921f3196a7a02bf094d45 /core/image/qoi/qoi.odin | |
| parent | 600c97cc0f2a9c4c5e1ccf098c95f892c35ff78a (diff) | |
Improve error handling for `resize` and `reserve` procedures
Diffstat (limited to 'core/image/qoi/qoi.odin')
| -rw-r--r-- | core/image/qoi/qoi.odin | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/image/qoi/qoi.odin b/core/image/qoi/qoi.odin index 27903c00f..c764178dc 100644 --- a/core/image/qoi/qoi.odin +++ b/core/image/qoi/qoi.odin @@ -53,7 +53,7 @@ save_to_buffer :: proc(output: ^bytes.Buffer, img: ^Image, options := Options{} // Calculate and allocate maximum size. We'll reclaim space to actually written output at the end.
max_size := pixels * (img.channels + 1) + size_of(image.QOI_Header) + size_of(u64be)
- if !resize(&output.buf, max_size) {
+ if resize(&output.buf, max_size) != nil {
return .Unable_To_Allocate_Or_Resize
}
@@ -233,7 +233,7 @@ load_from_context :: proc(ctx: ^$C, options := Options{}, allocator := context.a bytes_needed := image.compute_buffer_size(int(header.width), int(header.height), img.channels, 8)
- if !resize(&img.pixels.buf, bytes_needed) {
+ if resize(&img.pixels.buf, bytes_needed) != nil {
return img, .Unable_To_Allocate_Or_Resize
}
|