From cc7425e83d6e92f0066bddc3f9c3d0c104228137 Mon Sep 17 00:00:00 2001 From: Michael Graeb Date: Tue, 13 Feb 2024 09:41:55 -0800 Subject: [PATCH] Fix a bunch of places we forget to aws_raise_error() (#1089) --- .github/workflows/ci.yml | 2 +- .github/workflows/codecov.yml | 2 +- include/aws/common/json.h | 2 +- source/json.c | 4 ++-- source/log_formatter.c | 2 +- source/logging.c | 4 ++-- tests/encoding_test.c | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c840938d..b25b05cff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: - 'main' env: - BUILDER_VERSION: v0.9.49 + BUILDER_VERSION: v0.9.55 BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net BUILDER_SOURCE: releases PACKAGE_NAME: aws-c-common diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 7a1adff09..317354e59 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -4,7 +4,7 @@ on: push: env: - BUILDER_VERSION: v0.9.37 + BUILDER_VERSION: v0.9.55 BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net BUILDER_SOURCE: releases PACKAGE_NAME: aws-c-common diff --git a/include/aws/common/json.h b/include/aws/common/json.h index b614387c0..b8c4e6cfe 100644 --- a/include/aws/common/json.h +++ b/include/aws/common/json.h @@ -400,7 +400,7 @@ int aws_byte_buf_append_json_string(const struct aws_json_value *value, struct a * @param value The aws_json_value to format. * @param output The destination for the JSON string * @return AWS_OP_SUCCESS if the JSON string was allocated to output without any errors - * Will return AWS_ERROR_INVALID_ARGUMENT if the value passed is not an aws_json_value or if there + * Will return AWS_OP_ERR if the value passed is not an aws_json_value or if there * aws an error appending the JSON into the byte buffer. */ AWS_COMMON_API diff --git a/source/json.c b/source/json.c index face2914c..326354d62 100644 --- a/source/json.c +++ b/source/json.c @@ -397,7 +397,7 @@ int aws_byte_buf_append_json_string(const struct aws_json_value *value, struct a char *tmp = cJSON_PrintUnformatted(cjson); if (tmp == NULL) { - return AWS_OP_ERR; + return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); } // Append the text to the byte buffer @@ -415,7 +415,7 @@ int aws_byte_buf_append_json_string_formatted(const struct aws_json_value *value char *tmp = cJSON_Print(cjson); if (tmp == NULL) { - return AWS_OP_ERR; + return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); } // Append the text to the byte buffer diff --git a/source/log_formatter.c b/source/log_formatter.c index 321312981..b6e74e407 100644 --- a/source/log_formatter.c +++ b/source/log_formatter.c @@ -205,7 +205,7 @@ static int s_default_aws_log_formatter_format( struct aws_default_log_formatter_impl *impl = formatter->impl; if (formatted_output == NULL) { - return AWS_OP_ERR; + return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); } /* diff --git a/source/logging.c b/source/logging.c index 9033a208c..46f5e7dbe 100644 --- a/source/logging.c +++ b/source/logging.c @@ -337,11 +337,11 @@ int aws_thread_id_t_to_string(aws_thread_id_t thread_id, char *buffer, size_t bu unsigned char c = bytes[i - 1]; int written = snprintf(buffer + current_index, bufsz - current_index, "%02x", c); if (written < 0) { - return AWS_OP_ERR; + return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); } current_index += written; if (bufsz <= current_index) { - return AWS_OP_ERR; + return aws_raise_error(AWS_ERROR_SHORT_BUFFER); } } return AWS_OP_SUCCESS; diff --git a/tests/encoding_test.c b/tests/encoding_test.c index d9863951a..23cd084d0 100644 --- a/tests/encoding_test.c +++ b/tests/encoding_test.c @@ -1298,7 +1298,7 @@ static int s_utf8_validation_callback_always_fails(const uint32_t codepoint, voi static int s_utf8_validation_callback_always_passes(const uint32_t codepoint, void *user_data) { (void)codepoint; (void)user_data; - return AWS_ERROR_SUCCESS; + return AWS_OP_SUCCESS; } static struct utf8_example s_valid_utf8_examples_for_callback[] = {