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:
Jeroen van Rijn
2021-05-03 15:08:34 +02:00
parent 357f66fcee
commit 59b3c472ca
8 changed files with 35 additions and 44 deletions
+2 -2
View File
@@ -23,7 +23,7 @@ main :: proc() {
img, err = png.load(file, options);
defer png.destroy(img);
if !png.is_kind(err, png.E_General.OK) {
if err != png.E_General.OK {
fmt.printf("Trying to read PNG file %v returned %v\n", file, err);
} else {
v: png.Info;
@@ -120,7 +120,7 @@ main :: proc() {
}
}
if is_kind(err, E_General.OK) && .do_not_decompress_image not_in options && .info not_in options {
if err == E_General.OK && .do_not_decompress_image not_in options && .info not_in options {
if ok := write_image_as_ppm("out.ppm", img); ok {
fmt.println("Saved decoded image.");
} else {