test: update i/o api usage re: b_error

This commit is contained in:
2025-07-28 22:23:57 +01:00
parent 666b315086
commit c14d0b717e
2 changed files with 8 additions and 8 deletions

View File

@@ -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);

View File

@@ -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");