From c14d0b717e6fe458f9aa3d03a3ccfbc1596a14e2 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Mon, 28 Jul 2025 22:23:57 +0100 Subject: [PATCH] test: update i/o api usage re: b_error --- test/cat.c | 8 ++++---- test/json-read.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/cat.c b/test/cat.c index 5c876d8..6c8ffd4 100644 --- a/test/cat.c +++ b/test/cat.c @@ -14,9 +14,9 @@ int main(int argc, const char **argv) b_path *path = b_path_create_from_cstr(path_cstr); b_file *file = NULL; - b_status status = b_file_open(NULL, path, B_FILE_READ_ONLY, &file); - if (!B_OK(status)) { - fprintf(stderr, "cannot open file %s\n", path_cstr); + b_result result = b_file_open(NULL, path, B_FILE_READ_ONLY, &file); + if (b_result_is_error(result)) { + b_throw(result); return -1; } b_stream *src_stream, *dest_stream; @@ -25,7 +25,7 @@ int main(int argc, const char **argv) b_string *str = b_string_create(); b_stream_pipeline *pipeline; - status = b_string_open_stream(str, &dest_stream); + b_status status = b_string_open_stream(str, &dest_stream); b_stream_pipeline_create(1024, &pipeline); diff --git a/test/json-read.c b/test/json-read.c index 21d26a5..6c84c91 100644 --- a/test/json-read.c +++ b/test/json-read.c @@ -13,9 +13,9 @@ int main(int argc, const char **argv) b_path *path = b_path_create_from_cstr(path_cstr); b_file *file = NULL; - b_status status = b_file_open(NULL, path, B_FILE_READ_ONLY, &file); - if (!B_OK(status)) { - fprintf(stderr, "cannot open file %s\n", path_cstr); + b_result result = b_file_open(NULL, path, B_FILE_READ_ONLY, &file); + if (b_result_is_error(result)) { + b_throw(result); return -1; } @@ -27,7 +27,7 @@ int main(int argc, const char **argv) b_serial_ctx_create(&ctx); b_object *data; - status = b_serial_ctx_deserialise( + b_status status = b_serial_ctx_deserialise( ctx, B_SERIAL_FORMAT_JSON, src_stream, &data, 0); if (!B_OK(status)) { fprintf(stderr, "cannot read data\n");