From 63cc083fbb09a9643dd65d015b5d64164930b052 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 3 Jun 2024 14:50:27 -0700 Subject: [PATCH 1/3] test againt clang3 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eff75483f..9e2f3c2f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,9 +6,9 @@ on: - 'main' env: - BUILDER_VERSION: v0.9.55 + BUILDER_VERSION: clang_path BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net - BUILDER_SOURCE: releases + BUILDER_SOURCE: channels PACKAGE_NAME: aws-c-common LINUX_BASE_IMAGE: ubuntu-18-x64 RUN: ${{ github.run_id }}-${{ github.run_number }} From c8167bf4abfe6fda93aa483a64b001c6be90f9e9 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 3 Jun 2024 15:34:33 -0700 Subject: [PATCH 2/3] avoid offsetof --- source/string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/string.c b/source/string.c index 2fd791230..8d20ce21c 100644 --- a/source/string.c +++ b/source/string.c @@ -190,7 +190,7 @@ struct aws_string *aws_string_new_from_array(struct aws_allocator *allocator, co AWS_PRECONDITION(allocator); AWS_PRECONDITION(AWS_MEM_IS_READABLE(bytes, len)); - struct aws_string *str = aws_mem_acquire(allocator, offsetof(struct aws_string, bytes[len + 1])); + struct aws_string *str = aws_mem_acquire(allocator, offsetof(struct aws_string, bytes) + (len + 1) * sizeof(uint8_t) ); if (!str) { return NULL; } From 80b0dc1287014bcfc1aefe6e218bb7694bbc76bd Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 3 Jun 2024 15:42:28 -0700 Subject: [PATCH 3/3] clang-format --- source/string.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/string.c b/source/string.c index 8d20ce21c..8e1c8a259 100644 --- a/source/string.c +++ b/source/string.c @@ -190,7 +190,8 @@ struct aws_string *aws_string_new_from_array(struct aws_allocator *allocator, co AWS_PRECONDITION(allocator); AWS_PRECONDITION(AWS_MEM_IS_READABLE(bytes, len)); - struct aws_string *str = aws_mem_acquire(allocator, offsetof(struct aws_string, bytes) + (len + 1) * sizeof(uint8_t) ); + struct aws_string *str = + aws_mem_acquire(allocator, offsetof(struct aws_string, bytes) + (len + 1) * sizeof(uint8_t)); if (!str) { return NULL; }