mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 08:08:50 +00:00
Convert core:compress and core:image error checks to new union comparison.
No more need for `is_kind(err, Error_Value)`, just test err == Error_Value.
This commit is contained in:
@@ -107,7 +107,7 @@ text :: proc(c: Chunk) -> (res: Text, ok: bool) {
|
||||
buf: bytes.Buffer;
|
||||
zlib_error := zlib.inflate_from_byte_array(fields[2], &buf);
|
||||
defer bytes.buffer_destroy(&buf);
|
||||
if !is_kind(zlib_error, E_General.OK) {
|
||||
if zlib_error != E_General.OK {
|
||||
ok = false; return;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ text :: proc(c: Chunk) -> (res: Text, ok: bool) {
|
||||
buf: bytes.Buffer;
|
||||
zlib_error := zlib.inflate_from_byte_array(rest, &buf);
|
||||
defer bytes.buffer_destroy(&buf);
|
||||
if !is_kind(zlib_error, E_General.OK) {
|
||||
if zlib_error != E_General.OK {
|
||||
|
||||
ok = false; return;
|
||||
}
|
||||
@@ -200,7 +200,7 @@ iccp :: proc(c: Chunk) -> (res: iCCP, ok: bool) {
|
||||
// Set up ZLIB context and decompress iCCP payload
|
||||
buf: bytes.Buffer;
|
||||
zlib_error := zlib.inflate_from_byte_array(fields[2], &buf);
|
||||
if !is_kind(zlib_error, E_General.OK) {
|
||||
if zlib_error != E_General.OK {
|
||||
bytes.buffer_destroy(&buf);
|
||||
ok = false; return;
|
||||
}
|
||||
@@ -498,7 +498,7 @@ when false {
|
||||
err = zlib.write_zlib_stream_from_memory(&ctx);
|
||||
|
||||
b: []u8;
|
||||
if is_kind(err, E_General, E_General.OK) {
|
||||
if err == E_General.OK {
|
||||
b = ctx.out_buf[:];
|
||||
} else {
|
||||
return err;
|
||||
|
||||
Reference in New Issue
Block a user