From bd24b8f6d558bafbbb16d9490ebe3478dbf130bd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 9 Sep 2021 13:57:43 -0400 Subject: Use more human-readable status codes --- tools/console.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'tools/console.c') diff --git a/tools/console.c b/tools/console.c index ab36364d..0e41a2a0 100644 --- a/tools/console.c +++ b/tools/console.c @@ -45,7 +45,7 @@ serd_tool_setup(SerdTool* const tool, "%s: failed to open output file (%s)\n", program, strerror(errno)); - return SERD_ERR_UNKNOWN; + return SERD_UNKNOWN_ERROR; } // We have something to write to, so build the writing environment @@ -61,7 +61,7 @@ serd_tool_setup(SerdTool* const tool, &tool->out, options.block_size))) { fprintf(stderr, "%s: failed to set up writing environment\n", program); - return SERD_ERR_INTERNAL; + return SERD_UNKNOWN_ERROR; } return SERD_SUCCESS; @@ -75,7 +75,7 @@ serd_tool_cleanup(SerdTool tool) // Close the output stream explicitly to check if there were any errors if (serd_close_output(&tool.out)) { perror("write error"); - st = SERD_ERR_BAD_WRITE; + st = SERD_BAD_WRITE; } } @@ -120,7 +120,7 @@ serd_get_argument(OptionIter* const iter, const char** const argument) if (iter->argv[iter->a][iter->f] || (iter->a + 1) == iter->argc) { fprintf( stderr, "%s: option requires an argument -- %c\n", iter->argv[0], flag); - return SERD_ERR_BAD_ARG; + return SERD_BAD_ARG; } *argument = iter->argv[++iter->a]; @@ -141,7 +141,7 @@ serd_get_size_argument(OptionIter* const iter, size_t* const argument) char* endptr = NULL; const long size = strtol(string, &endptr, 10); if (size <= 0 || size == LONG_MAX || *endptr != '\0') { - return SERD_ERR_BAD_ARG; + return SERD_BAD_ARG; } *argument = (size_t)size; @@ -181,7 +181,7 @@ serd_set_input_option(const SerdStringView name, } } - return SERD_ERR_BAD_ARG; + return SERD_BAD_ARG; } SerdStatus @@ -238,7 +238,7 @@ serd_set_output_option(const SerdStringView name, } } - return SERD_ERR_BAD_ARG; + return SERD_BAD_ARG; } SerdStatus @@ -384,12 +384,12 @@ serd_set_base_uri_from_path(SerdEnv* const env, const char* const path) { const size_t path_len = path ? strlen(path) : 0u; if (!path_len) { - return SERD_ERR_BAD_ARG; + return SERD_BAD_ARG; } char* const real_path = serd_canonical_path(path); if (!real_path) { - return SERD_ERR_BAD_ARG; + return SERD_BAD_ARG; } const size_t real_path_len = strlen(real_path); @@ -455,7 +455,7 @@ serd_read_inputs(SerdWorld* const world, // Open the input stream SerdInputStream in = serd_open_tool_input(in_path); if (!in.stream) { - return SERD_ERR_BAD_ARG; + return SERD_BAD_ARG; } // Read the entire file -- cgit v1.2.1