diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2021-05-03 15:08:34 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2021-05-03 15:08:34 +0200 |
| commit | 59b3c472ca1ea4e56728eb81c3c8b595a4b1bcdd (patch) | |
| tree | ce9948ba6b2a1dc888006066a11c65c62bb0ebe0 /core/compress/gzip | |
| parent | 357f66fceeb6cbc3b72281300dbe7af4e2b68715 (diff) | |
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.
Diffstat (limited to 'core/compress/gzip')
| -rw-r--r-- | core/compress/gzip/example.odin | 6 | ||||
| -rw-r--r-- | core/compress/gzip/gzip.odin | 3 |
2 files changed, 4 insertions, 5 deletions
diff --git a/core/compress/gzip/example.odin b/core/compress/gzip/example.odin index 8e0f53cf8..344521489 100644 --- a/core/compress/gzip/example.odin +++ b/core/compress/gzip/example.odin @@ -35,7 +35,7 @@ main :: proc() { if len(args) < 2 { stderr("No input file specified.\n"); err := gzip.load(TEST, &buf); - if gzip.is_kind(err, gzip.E_General.OK) { + if err != E_General.OK { stdout("Displaying test vector: "); stdout(bytes.buffer_to_string(&buf)); stdout("\n"); @@ -54,8 +54,8 @@ main :: proc() { } else { err = gzip.load(file, &buf); } - if !gzip.is_kind(err, gzip.E_General.OK) { - if gzip.is_kind(err, gzip.E_General.File_Not_Found) { + if err != gzip.E_General.OK { + if err != E_General.File_Not_Found { stderr("File not found: "); stderr(file); stderr("\n"); diff --git a/core/compress/gzip/gzip.odin b/core/compress/gzip/gzip.odin index f86d3ddce..2284953d1 100644 --- a/core/compress/gzip/gzip.odin +++ b/core/compress/gzip/gzip.odin @@ -94,7 +94,6 @@ E_General :: compress.General_Error; E_GZIP :: compress.GZIP_Error; E_ZLIB :: compress.ZLIB_Error; E_Deflate :: compress.Deflate_Error; -is_kind :: compress.is_kind; load_from_slice :: proc(slice: []u8, buf: ^bytes.Buffer, allocator := context.allocator) -> (err: Error) { @@ -278,7 +277,7 @@ load_from_stream :: proc(stream: io.Stream, buf: ^bytes.Buffer, allocator := con // fmt.printf("ZLIB returned: %v\n", zlib_error); - if !is_kind(zlib_error, E_General.OK) || zlib_error == nil { + if zlib_error != E_General.OK || zlib_error == nil { return zlib_error; } |